Info_Store.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. public function initialize() {
  25. $this->items = new \stdClass();
  26. $this->equip = new \stdClass();
  27. }
  28. public function __construct($arg = null) {
  29. if ($arg == null) {
  30. $this->items = new \stdClass();
  31. $this->equip = new \stdClass();
  32. } else {
  33. parent::__construct($arg);
  34. }
  35. }
  36. public function removeItem($itemId, $num) {
  37. if (StlUtil::dictHasProperty($this->items, $itemId)) {
  38. $this->items->$itemId -= $num;
  39. if ($this->items->$itemId <= 0) {
  40. unset($this->items->$itemId);
  41. }
  42. }
  43. }
  44. }