HeroTempPropManager = {} local this = HeroTempPropManager function this.Initialize() this.TempHeroDatas = {} end -- 临时数据的生成规则 function this.GetTempHeroID(dId) return "TEMP_"..dId end -- 判断是否是临时数据 function this.IsTempHeroID(tempId) if startWith(tempId, "TEMP_") then return true end return false end -- 复制一个神将数据,不影响原数据 function this.CreateTempHero(dId) if this.IsTempHeroID(dId) then assert(false, "正在尝试复制一条临时数据") return end local tempId = this.GetTempHeroID(dId) -- 清空缓存 this.ClearTempHero(tempId) -- 复制属性 local tempData = Table_DeepCopy(HeroPropManager.CreateHeroCountData(dId)) -- 保存 tempData.dId = tempId this.TempHeroDatas[tempId] = tempData return tempId, tempData end -- 判断数据是否存在 function this.IsTempHeroExist(tempId) if this.TempHeroDatas[tempId] then return true end return false end -- 获取临时英雄数据 function this.GetTempHero(tempId) return this.TempHeroDatas[tempId] end -- 清空缓存数据 function this.ClearTempHero(tempId) this.TempHeroDatas[tempId] = nil HeroPropManager.ClearHeroData(tempId) end -- 获取临时英雄属性 function this.GetTempHeroProp(tempId, formationId) if this.IsTempHeroExist(tempId) then return HeroPropManager.GetHeroProp(tempId, formationId) end end -- 获取临时英雄属性 function this.GetTempHeroPower(tempId, formationId) if this.IsTempHeroExist(tempId) then return HeroPowerManager.GetHeroPower(tempId, formationId) end end return HeroTempPropManager