require("game.common.ConfigItem") ConfigItemMgr = ConfigItemMgr or BaseClass() local ConfigItemMgr= ConfigItemMgr local ConfigItem= ConfigItem function ConfigItemMgr:__init() ConfigItemMgr.Instance = self self.good_data = nil --物品数据表 self.skill_data = nil --技能数据表 self.gift_data = nil self.talk_data = nil self.scene_data = nil self.npc_data = nil self.skill_good_map_data = nil --技能id对应的物品id表 self.task_data = nil --任务数据 self.pet_aptitude_data = nil --宠物资质配置数据表 self.equip_strength_rule_data = nil --装备精炼数据表 self.aircraft_inf_data = nil --飞行器数据db self.equip_upgrade_star_rule_data = nil --装备升星规则数据表 self.equip_strength_add_data = nil --装备精炼加成配置 self.equip_upgrade_star_att_data = nil --装备升星属性配置 self.fig_fate_sub_type_data = nil --天命配置 self.aircraft_lv_data = nil --飞行器等级配置 self.custom_act_reward_data = nil --活动奖励配置 self.holy_weapon_grow_data = nil --神兵培养配置 self.boss_gift_data = nil --礼盒数据配置 self.monster_data = nil --怪物配置 self:InitData() end function ConfigItemMgr:InitData() local need_to_load_count = 4 local function loadCallback() need_to_load_count = need_to_load_count - 1 if need_to_load_count <= 0 then GlobalEventSystem:Fire(EventName.DB_DATA_LOAD_COMPLETED) end end self.task_data = ConfigItem.New("data_task", 20, loadCallback) self.good_data = ConfigItem.New("data_goods", 150, loadCallback) self.scene_data = ConfigItem.New("data_scene", 20, loadCallback) self.npc_data = ConfigItem.New("data_npc", 20, loadCallback) self.monster_data = ConfigItem.New("data_mon", 50, loadCallback) self.skill_data = ConfigItem.New("data_skill", 50, loadCallback) self.talk_data = ConfigItem.New("data_talk", 20, loadCallback) --[[ -- self.skill_good_map_data = ConfigItem.New("/client/luaconfig/data_goods_type_skill.db", 30) self.gift_data = ConfigItem.New("/client/luaconfig/data_gift.db", 20) self.scene_data = ConfigItem.New("/client/luaconfig/data_scene.db", 20) -- self.monster_ai_data = ConfigItem.New("/client/luaconfig/data_ai.db", 20) self.task_data = ConfigItem.New("/client/luaconfig/data_task.db", 20) self.pet_aptitude_data = ConfigItem.New("/client/luaconfig/data_battle_pet_aptitude_args.db", 20) self.equip_strength_rule_data = ConfigItem.New("/client/luaconfig/data_equip_strength_rule.db", 20) self.aircraft_inf_data = ConfigItem.New("/client/luaconfig/data_aircraft_inf.db", 20) self.equip_upgrade_star_rule_data = ConfigItem.New("/client/luaconfig/data_equip_upgrade_star_rule.db", 20) self.equip_strength_add_data = ConfigItem.New("/client/luaconfig/data_equip_strength_award_data.db", 20) self.equip_upgrade_star_att_data = ConfigItem.New("/client/luaconfig/data_equip_upgrade_star_attribute.db", 20) self.fig_fate_sub_type_data = ConfigItem.New("/client/luaconfig/data_fate_sub_type.db", 20) self.aircraft_lv_data = ConfigItem.New("/client/luaconfig/data_artifact_lv.db", 20) -- self.custom_act_reward_data = ConfigItem.New("/client/luaconfig/data_custom_act_reward.db", 20) self.holy_weapon_grow_data = ConfigItem.New("/client/luaconfig/data_holy_weapon_grow.db", 20) self.boss_gift_data = ConfigItem.New("/client/luaconfig/data_boss_rank.db", 20) ]] end function ConfigItemMgr:__delete() if self.good_data then self.good_data:DeleteMe() self.good_data = nil end if self.skill_data then self.skill_data:DeleteMe() self.skill_data = nil end if self.skill_good_map_data then self.skill_good_map_data:DeleteMe() self.skill_good_map_data = nil end if self.gift_data then self.gift_data:DeleteMe() self.gift_data = nil end if self.talk_data then self.talk_data:DeleteMe() self.talk_data = nil end if self.npc_data then self.npc_data:DeleteMe() self.npc_data = nil end if self.scene_data then self.scene_data:DeleteMe() self.scene_data = nil end if self.task_data then self.task_data:DeleteMe() self.task_data = nil end if self.pet_aptitude_data then self.pet_aptitude_data:DeleteMe() self.pet_aptitude_data = nil end if self.equip_strength_rule_data then self.equip_strength_rule_data:DeleteMe() self.equip_strength_rule_data = nil end if self.aircraft_inf_data then self.aircraft_inf_data:DeleteMe() self.aircraft_inf_data = nil end if self.equip_upgrade_star_rule_data then self.equip_upgrade_star_rule_data:DeleteMe() self.equip_upgrade_star_rule_data = nil end if self.equip_strength_add_data then self.equip_strength_add_data:DeleteMe() self.equip_strength_add_data = nil end if self.equip_upgrade_star_att_data then self.equip_upgrade_star_att_data:DeleteMe() self.equip_upgrade_star_att_data = nil end if self.fig_fate_sub_type_data then self.fig_fate_sub_type_data:DeleteMe() self.fig_fate_sub_type_data = nil end if self.aircraft_lv_data then self.aircraft_lv_data:DeleteMe() self.aircraft_lv_data = nil end if self.custom_act_reward_data then self.custom_act_reward_data:DeleteMe() self.custom_act_reward_data = nil end if self.holy_weapon_grow_data then self.holy_weapon_grow_data:DeleteMe() self.holy_weapon_grow_data = nil end if self.boss_gift_data then self.boss_gift_data:DeleteMe() self.boss_gift_data = nil end end function ConfigItemMgr:GetGoodItem(id) local obj = ConfigItem.GetItem(self.good_data, id) if obj then return obj else return ConfigItem.GetItem(self.good_data, 0) end end function ConfigItemMgr:GetSkillItem(id) return ConfigItem.GetItem(self.skill_data, id) end function ConfigItemMgr:GetGiftItem(id) return ConfigItem.GetItem(self.gift_data, id) end function ConfigItemMgr:GetTalkItem(id) return ConfigItem.GetItem(self.talk_data, id) end function ConfigItemMgr:GetSceneItem(id) return ConfigItem.GetItem(self.scene_data, id) end -- function ConfigItemMgr:GetSkillToGoodsItem(id) -- return self.skill_good_map_data:GetItem(id) -- end function ConfigItemMgr:GetNpcItem(id) return ConfigItem.GetItem(self.npc_data, id) end function ConfigItemMgr:GetMonsterDataItem(id) return ConfigItem.GetItem(self.monster_data, id) end function ConfigItemMgr:GetTaskData(id) return ConfigItem.GetItem(self.task_data, id) end function ConfigItemMgr:GetPetAptitudeItem(id) return ConfigItem.GetItem(self.pet_aptitude_data, id) end --根据位操作来进行封装 function ConfigItemMgr:CreatUniqueId(...) local arg_list = {...} local curr_bit_size = 0 local curr_number = 0 for i = #arg_list, 2, -2 do curr_number = curr_number + bit.lshift(arg_list[i-1],curr_bit_size) curr_bit_size = curr_bit_size + arg_list[i] end if curr_bit_size >= 32 then print("Error:function ConfigItemMgr:CreatUniqueId(...) total arg'bit exceed 32bit。args=",...) return 0 end return curr_number end