Info_Store.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <?php
  2. /*
  3. * To change this license header, choose License Headers in Project Properties.
  4. * To change this template file, choose Tools | Templates
  5. * and open the template in the editor.
  6. */
  7. namespace loyalsoft;
  8. /**
  9. * Description of Info_Store
  10. *
  11. * @author c'y'zhao
  12. */
  13. class Info_Store extends Object_ext {
  14. /**
  15. * 道具
  16. * @var \stdClass()
  17. */
  18. public $items;
  19. /**
  20. * 宝石在背包库的唯一id
  21. * @var type
  22. */
  23. public $gemLength = 0;
  24. /**
  25. * 宝石背包
  26. * \stdClass()
  27. */
  28. public $gemStore;
  29. /**
  30. * 装备界面默认页
  31. * @var int
  32. */
  33. public $equipPag =1;
  34. /**
  35. * 装备
  36. * @var \stdClass()
  37. */
  38. public $equip;
  39. /**
  40. * 宝石装备的信息
  41. * @var \stdClass()
  42. */
  43. public $gemEquip;
  44. /**
  45. * 装备信息 装备不跟hero走--废弃
  46. * @var type
  47. */
  48. public $equipPosition = null;
  49. public function initialize() {
  50. $this->items = new \stdClass();
  51. $this->gemStore = new \stdClass();
  52. $this->equip = new \stdClass();
  53. $this->gemEquip = new \stdClass();
  54. }
  55. public function __construct($arg = null) {
  56. if ($arg == null) {
  57. $this->items = new \stdClass();
  58. $this->gemStore = new \stdClass();
  59. $this->equip = new \stdClass();
  60. for ($i = 1; $i <=6; $i++) {
  61. $equip = new Ins_Equip();
  62. $equip->typeId = $i;
  63. $this->equip->$i = $equip;
  64. }
  65. $this->gemEquip = new \stdClass();
  66. for ($k = 1; $k <=3; $k++) {
  67. $item = new \stdClass();
  68. for ($j = 1; $j <= 6; $j++) {
  69. $item->$j = new \stdClass();
  70. }
  71. $this->gemEquip->$k =$item;
  72. }
  73. } else {
  74. parent::__construct($arg);
  75. }
  76. }
  77. public function removeItem($itemId, $num) {
  78. if (StlUtil::dictHasProperty($this->items, $itemId)) {
  79. $this->items->$itemId -= $num;
  80. if ($this->items->$itemId <= 0) {
  81. unset($this->items->$itemId);
  82. }
  83. }
  84. }
  85. }