boxes = GameConfig::primordial_data()->User_Store_boxes; $this->taskcards = ObjectInit(); $this->items = JsonUtil::decode(GameConfig::primordial_data()->User_Store_items); # 初始含有一张黄金通知书 $this->equipment = JsonUtil::decode(GameConfig::primordial_data()->User_Store_equipment); # 装备初始化数据 $this->yanling = JsonUtil::decode(GameConfig::primordial_data()->User_Store_yanling); # 言灵初始化数据 $this->segement = JsonUtil::decode(GameConfig::primordial_data()->User_Store_segment); # 碎片 } /** * 返回指定物品的数量 */ function GetItemCount($typeId) { if (property_exists($this->items, $typeId)) { return $this->items->$typeId; } return 0; } /** * 扣除玩家碎片 * @param int $segmentId 碎片ID * @param int $amt 数量 * @return boolean true 成功, false 失败 */ function Consume_HeroSegment($segmentId, $amt) { if ($amt > 0) { if (CommUtil::isPropertyExists($this->items, $segmentId)) { if ($this->items->$segmentId - $amt >= 0) { $this->items->$segmentId -= $amt; return true; } } } return false; } }