SacredTreeManager = {} local this = SacredTreeManager local treeLevelConfig = ConfigManager.GetConfig(ConfigName.GodHoodTreeLevel) local treeSetting = ConfigManager.GetConfig(ConfigName.GodHoodTreeSetting) local jewerLevelUpConfig = ConfigManager.GetConfig(ConfigName.JewelRankupConfig) function this.Initialize() this.treeLevel = 0 this.SacredtreeLevelConfig={} this.getGodHoodTreeLevelConfigData() this.treeSettingData={} this.getGodHoodTreeSettingData() end --当战力变化时 function this.OnPowerChange(oldPower) local newPower = FormationManager.GetFormationPower(FormationTypeDef.FORMATION_NORMAL) if oldPower ~= newPower and oldPower ~= 0 then UIManager.OpenPanel(UIName.WarPowerChangeNotifyPanelV2,{oldValue = oldPower,newValue = newPower}) end end function this.GetTowerLevel() return MonsterCampManager.GetFourElementTotalWave() end --树等级表数据 function this.getGodHoodTreeLevelConfigData() for i, v in ConfigPairs(treeLevelConfig) do this.SacredtreeLevelConfig[v.Id] = v.LvupCost end end --神应属性数据 function this.getGodHoodTreeSettingData() local wave = this.GetTowerLevel() local data = treeSetting[0].PropertyUnlcokLevelForClient for i = 1, #data do local tempTable = {} tempTable.id = data[i][1] tempTable.curNum = data[i][2] >= wave and wave or data[i][2] tempTable.allNum = data[i][2] table.insert(this.treeSettingData,tempTable) end end function this.GetUnLockNewProperty(trailWaves) local data = treeSetting[0].PropertyUnlcokLevelForClient for i = 1, #data do local tempTable = {} if data[i][2] == trailWaves then return data[i][1] elseif data[i][2] > trailWaves then return 0 end end return 0 end --计算神应等级 function this.CulAttri() local wave = this.GetTowerLevel() local attriConfig = ConfigManager.GetConfigDataByKey(ConfigName.GodHoodTreeSetting,"Id",0) local level = 0 for i = 1, #attriConfig.PropertyUnlcokLevels do local num = attriConfig.PropertyUnlcokLevels[i][2] if wave >= num then level = level + 1 end end return level end --计算开启下一神应等级还需要的层数 function this.CulNextAttri() local wave = this.GetTowerLevel() local attriConfig = ConfigManager.GetConfigDataByKey(ConfigName.GodHoodTreeSetting,"Id",0) local numLeft = 0 for i = 1, #attriConfig.PropertyUnlcokLevels do local num = attriConfig.PropertyUnlcokLevels[i][2] if wave < num then numLeft = num - wave end end return numLeft end --计算开启下一神应等级的层数 function this.NextAttriFloor() local wave = this.GetTowerLevel() local attriConfig = ConfigManager.GetConfigDataByKey(ConfigName.GodHoodTreeSetting,"Id",0) local numLeft = 0 for i = 1, #attriConfig.PropertyUnlcokLevels do local num = attriConfig.PropertyUnlcokLevels[i][2] if wave < num then return num end end end --获取当前等级加成的属性 function this.GetCurLvPropertyValue(_type, _id, _lv) local lvConfig = nil --获取当前等级属性加成 for _, configInfo in ConfigPairs(jewerLevelUpConfig) do if configInfo.Type == _type and configInfo.PoolID == _id and configInfo.Level == _lv then lvConfig = configInfo break end end local proList = {} if lvConfig then for i = 1, table.getn(lvConfig.Property) do local info = lvConfig.Property[i] if info then local index = info[1] local skillValue = {} skillValue.currValue = info[2] if info[2] ~= 0 then proList[index] = skillValue end end end end return proList end function this.CheckRedPoint() local needId = treeLevelConfig[this.treeLevel].LvupCost[1] local needCost = treeLevelConfig[this.treeLevel].LvupCost[2] return BagManager.GetTotalItemNum(needId) > needCost end return this