Info_Store.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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 $equip;
  24. /**
  25. * 装备信息 装备不跟hero走
  26. * @var type
  27. */
  28. public $equipPosition = null;
  29. public function initialize() {
  30. $this->items = new \stdClass();
  31. $this->equip = new \stdClass();
  32. $this->equipPosition = new \stdClass();
  33. }
  34. public function __construct($arg = null) {
  35. if ($arg == null) {
  36. $this->items = new \stdClass();
  37. $this->equip = new \stdClass();
  38. $this->equipPosition = new \stdClass();
  39. } else {
  40. parent::__construct($arg);
  41. }
  42. }
  43. public function removeItem($itemId, $num) {
  44. if (StlUtil::dictHasProperty($this->items, $itemId)) {
  45. $this->items->$itemId -= $num;
  46. if ($this->items->$itemId <= 0) {
  47. unset($this->items->$itemId);
  48. }
  49. }
  50. }
  51. }