Info_Store.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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 type
  17. */
  18. public $items;
  19. /**
  20. * 宝石背包
  21. * @var type
  22. */
  23. public $gemStore;
  24. /**
  25. * 装备界面默认页
  26. * @var type
  27. */
  28. public $equipPag =1;
  29. /**
  30. * 装备
  31. * @var type
  32. */
  33. public $equip;
  34. /**
  35. * 宝石装备的信息
  36. * @var type
  37. */
  38. public $gemEquip;
  39. /**
  40. * 装备信息 装备不跟hero走--废弃
  41. * @var type
  42. */
  43. public $equipPosition = null;
  44. public function initialize() {
  45. $this->items = new \stdClass();
  46. $this->gemStore = new \stdClass();
  47. $this->equip = new \stdClass();
  48. $this->gemEquip = new \stdClass();
  49. }
  50. public function __construct($arg = null) {
  51. if ($arg == null) {
  52. $this->items = new \stdClass();
  53. $this->gemStore = new \stdClass();
  54. $this->equip = new \stdClass();
  55. for ($i = 1; $i <=6; $i++) {
  56. $this->equip->$i = new Ins_Equip();
  57. }
  58. $this->gemEquip = new \stdClass();
  59. for ($k = 1; $k <=3; $k++) {
  60. $item = new \stdClass();
  61. for ($j = 1; $j <= 6; $j++) {
  62. $item->$j = new \stdClass();
  63. }
  64. $this->gemEquip->$k =$item;
  65. }
  66. } else {
  67. parent::__construct($arg);
  68. }
  69. }
  70. public function removeItem($itemId, $num) {
  71. if (StlUtil::dictHasProperty($this->items, $itemId)) {
  72. $this->items->$itemId -= $num;
  73. if ($this->items->$itemId <= 0) {
  74. unset($this->items->$itemId);
  75. }
  76. }
  77. }
  78. }