diff --git a/Assets/ManagedResources/~Lua/Common/GlobalDefine.lua b/Assets/ManagedResources/~Lua/Common/GlobalDefine.lua index 91500c9ec5..9a66b4403e 100644 --- a/Assets/ManagedResources/~Lua/Common/GlobalDefine.lua +++ b/Assets/ManagedResources/~Lua/Common/GlobalDefine.lua @@ -2792,23 +2792,6 @@ MoneyNumViewImageType = { -- 控制 元 和 $ 符号的大小 可自定义 Big_1 = 2, -- 大图 } ---------------------------------- - - --- 首充显示 -IndexValueDef = { - [MoneyType.RMB] = { - [1] = 6,--首充6元 - [2] = 100, --首充100元 - [6] = 1,--首充6元 - [100] = 2, --首充100元 - }, - [MoneyType.USD] = { - [1] = 1,--首充1美元 - [2] = 15, --首充15美元 - [1] = 1,--首充1美元 - [15] = 2, --首充15美元 - }, -} RoleUpStarMatType = { item = 2,--万能狗粮 hero = 1,--英雄 diff --git a/Assets/ManagedResources/~Lua/Modules/FirstRecharge/DayRewardItem.lua b/Assets/ManagedResources/~Lua/Modules/FirstRecharge/DayRewardItem.lua index 6069f7139b..4fc1bb4aa6 100644 --- a/Assets/ManagedResources/~Lua/Modules/FirstRecharge/DayRewardItem.lua +++ b/Assets/ManagedResources/~Lua/Modules/FirstRecharge/DayRewardItem.lua @@ -93,7 +93,8 @@ function DayRewardItem:OnReceivedBtnClicked() self.receiveBtn.gameObject:SetActive(false) self.receivedFlag:SetActive(true) self.redPoint:SetActive(false) - self.mainPanel:SetTabRedPointStatus(IndexValueDef[MoneyUtil.MT][self.context.Values[1][1]]) + local index = FirstRechargeManager.GetFirstRechargeIndexByMoney(self.context.Values[1][1]) + self.mainPanel:SetTabRedPointStatus(index) CheckRedPointStatus(RedPointType.FirstRecharge) if FirstRechargeManager.GetReceiveAll() then Game.GlobalEvent:DispatchEvent(GameEvent.Activity.OnActivityOpenOrClose, { diff --git a/Assets/ManagedResources/~Lua/Modules/FirstRecharge/FirstRechargeManager.lua b/Assets/ManagedResources/~Lua/Modules/FirstRecharge/FirstRechargeManager.lua index 9185c3752a..d57be69975 100644 --- a/Assets/ManagedResources/~Lua/Modules/FirstRecharge/FirstRechargeManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/FirstRecharge/FirstRechargeManager.lua @@ -14,7 +14,6 @@ local AccumRechargeValue local rechargeTime function this.Initialize() - end function this.GetFirstRechargeRedPointStatus() @@ -30,9 +29,10 @@ end function this.GetSixMoneyTabRedPointStatus() local redPoint = false + local money = FirstRechargeManager.GetFirstRechargeMoneyByIndex(1) for _, rewardInfo in ConfigPairs(activityRewardConfig) do if rewardInfo.ActivityId == ActivityTypeDef.FirstRecharge and - rewardInfo.Values[1][1] == IndexValueDef[MoneyUtil.MT][1] then + rewardInfo.Values[1][1] == money then redPoint = redPoint or this.GetDayItemRedPoint(rewardInfo) end end @@ -41,9 +41,10 @@ end function this.GetHundredTabRedPointStatus() local redPoint = false + local money = FirstRechargeManager.GetFirstRechargeMoneyByIndex(2) for _, rewardInfo in ConfigPairs(activityRewardConfig) do if rewardInfo.ActivityId == ActivityTypeDef.FirstRecharge and - rewardInfo.Values[1][1] == IndexValueDef[MoneyUtil.MT][2] then + rewardInfo.Values[1][1] == money then redPoint = redPoint or this.GetDayItemRedPoint(rewardInfo) end end @@ -170,4 +171,52 @@ function this.SetAnimFlag(key) PlayerPrefs.SetInt(PlayerManager.uid..key, GetTimeStamp()) end +-- 获取充值配置数据 +function this.GetFirstRechargeConfig() + if not this.IndexToMoney then + -- 获取首充配置数据 + local firstRechargeConfig = ConfigManager.GetConfigData(ConfigName.SpecialConfig, 129) + if firstRechargeConfig then + local ml = string.split(firstRechargeConfig.Value, "|") + if not ml or not ml[MoneyUtil.MT] then + LogError("未找到对应币种的首充配置数据: "..tostring(MoneyUtil.MT)) + return + end + local itm = string.split(ml[MoneyUtil.MT], "#") + if itm and #itm > 0 then + this.IndexToMoney = {} + for _, v in ipairs(itm) do + table.insert(this.IndexToMoney, tonumber(v)) + end + end + else + LogError("未找到首充配置数据") + return + end + end + return this.IndexToMoney +end +-- 通过首充裆位获取该裆位所需的充值金额 +function this.GetFirstRechargeMoneyByIndex(index) + local config = this.GetFirstRechargeConfig() + if not config then + LogError("未找到首充配置数据") + return + end + return config[index] +end +-- 根据裆位金额获取裆位 +function this.GetFirstRechargeIndexByMoney(money) + local config = this.GetFirstRechargeConfig() + if not config then + LogError("未找到首充配置数据") + return + end + for i, m in ipairs(config) do + if m == money then + return i + end + end +end + return this \ No newline at end of file diff --git a/Assets/ManagedResources/~Lua/Modules/FirstRecharge/FirstRechargePanel.lua b/Assets/ManagedResources/~Lua/Modules/FirstRecharge/FirstRechargePanel.lua index 2a540e60e5..0e582ef3a8 100644 --- a/Assets/ManagedResources/~Lua/Modules/FirstRecharge/FirstRechargePanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/FirstRecharge/FirstRechargePanel.lua @@ -193,7 +193,8 @@ function FirstRechargePanel:OnTabChanged(index) end for i, title in ipairs(self.tabTitles) do title.color = i == index and TextColorDef[2] or TextColorDef[1] - title.text = string.format(Language[12281], string.format(MoneyUtil.GetMoneyUnitName(),IndexValueDef[MoneyUtil.MT][i])) + local money = FirstRechargeManager.GetFirstRechargeMoneyByIndex(i) + title.text = string.format(Language[12281], string.format(MoneyUtil.GetMoneyUnitName(), money)) end self.stageImage6.gameObject:SetActive(index == 1) self.stageImage100.gameObject:SetActive(index == 2) @@ -201,10 +202,13 @@ function FirstRechargePanel:OnTabChanged(index) self.selectTabIndex = index local AccumRecharge = 0 self.offsetIndex = 0 + + local money = FirstRechargeManager.GetFirstRechargeMoneyByIndex(index) + local tempData = {} for _, missInfo in pairs(self.activityInfo.mission) do if missInfo.missionId then - if activityRewardConfig[missInfo.missionId].Values[1][1] == IndexValueDef[MoneyUtil.MT][index] then + if activityRewardConfig[missInfo.missionId].Values[1][1] == money then table.insert(tempData,missInfo) end end @@ -213,7 +217,7 @@ function FirstRechargePanel:OnTabChanged(index) return a.missionId < b.missionId end) for _, missInfo in ipairs(tempData) do - if missInfo and missInfo.progress and activityRewardConfig[missInfo.missionId].Values[1][1] == IndexValueDef[MoneyUtil.MT][index] then + if missInfo and missInfo.progress and activityRewardConfig[missInfo.missionId].Values[1][1] == money then AccumRecharge = missInfo.progress if AccumRecharge >= activityRewardConfig[missInfo.missionId].Values[1][1] then local day = GetTimePass(FirstRechargeManager.GetRechargeTime())--FirstRechargeManager.GetRechargeTime() @@ -247,9 +251,10 @@ end function FirstRechargePanel:ShowContent(index) local tempData = {} + local money = FirstRechargeManager.GetFirstRechargeMoneyByIndex(index) for _, rewardInfo in ConfigPairs(activityRewardConfig) do if rewardInfo.ActivityId == ActivityTypeDef.FirstRecharge and - rewardInfo.Values[1][1] == IndexValueDef[MoneyUtil.MT][index] then + rewardInfo.Values[1][1] == money then table.insert(tempData, rewardInfo) end end