diff --git a/Assets/ManagedResources/~Lua/Modules/Common/MoneyUtil.lua b/Assets/ManagedResources/~Lua/Modules/Common/MoneyUtil.lua index c3b926c981..b5824c95d3 100644 --- a/Assets/ManagedResources/~Lua/Modules/Common/MoneyUtil.lua +++ b/Assets/ManagedResources/~Lua/Modules/Common/MoneyUtil.lua @@ -9,41 +9,60 @@ this.MT = MoneyType.RMB function this.Initialize() --this.MT = tonumber(ConfigManager.GetConfigData(ConfigName.SpecialConfig, 79).Value) if GetCurLanguage() == 0 then - this.MT = MoneyType.RMB + this.MT = MoneyType.RMB elseif GetCurLanguage() == 1 then - this.MT = MoneyType.USD + this.MT = MoneyType.USD elseif GetCurLanguage() == 2 then this.MT = MoneyType.MM elseif GetCurLanguage() == 3 then this.MT = MoneyType.THAI else - this.MT = MoneyType.USD + this.MT = MoneyType.USD end local er = ConfigManager.GetConfig(ConfigName.ExchangeRate) for _, v in ConfigPairs(er) do - this.RMB2O[v.Price_1] = v + this.RMB2O[v.Price_1] = v end end -- 获取相应的金额 function this.GetMoney(_rmbp) + --[[ local rmbp = tonumber(_rmbp) if rmbp <= 0 then return rmbp end if not this.RMB2O[rmbp] then - LogError("表 ExchangeRate 错误: 不包含档位:"..tostring(rmbp)) + LogError("表 ExchangeRate 错误: 不包含档位:" .. tostring(rmbp)) return 0 end - LogError("当前挡位:"..this.MT) - local m = this.RMB2O[rmbp]["Price_"..this.MT] + LogError("当前挡位:" .. this.MT) + local m = this.RMB2O[rmbp]["Price_" .. this.MT] if not m then - LogError("表 ExchangeRate 错误: 档位:"..tostring(rmbp).." , 未找到对应的货币类型 "..this.MT) + LogError("表 ExchangeRate 错误: 档位:" .. tostring(rmbp) .. " , 未找到对应的货币类型 " .. this.MT) + return 0 + end + return m + ]] + return _rmbp +end +function this.GetMoney2(_rmbp) + local rmbp = tonumber(_rmbp) + if rmbp <= 0 then + return rmbp + end + if not this.RMB2O[rmbp] then + LogError("表 ExchangeRate 错误: 不包含档位:" .. tostring(rmbp)) + return 0 + end + LogError("当前挡位:" .. this.MT) + local m = this.RMB2O[rmbp]["Price_" .. this.MT] + if not m then + LogError("表 ExchangeRate 错误: 档位:" .. tostring(rmbp) .. " , 未找到对应的货币类型 " .. this.MT) return 0 end return m end - function this.GetCurMoneyType() return this.MT end @@ -55,7 +74,7 @@ local _t2m = { -- 获取货币符号 function this.GetMoneyMark(mt) if not mt then - mt = this.MT + mt = this.MT end if _t2m[mt] then return _t2m[mt] @@ -67,22 +86,34 @@ end local _t2n = { [MoneyType.RMB] = Language[10444], [MoneyType.USD] = "$%s", + [MoneyType.MM] = "$%s", + [MoneyType.THAI] = "$%s", } function this.GetMoneyUnitName(mt) + if not mt then - mt = this.MT + mt = this.MT end + --[[ if _t2n[mt] then return _t2n[mt] end - return _t2n[MoneyType.RMB] + return _t2n[MoneyType.USD] + ]] + return "%s" .. GetLanguageStrById("现金点券") end function this.GetMoneyUnitNameWithMoney(money) local formater = this.GetMoneyUnitName(this.Mt) return string.format(formater, this.GetMoney(money)) end - +function this.GetMoneyUnitNameWithMoney2(money) + if _t2n[this.MT] then + return string.format(_t2n[this.MT], this.GetMoney2(money)) + else + return string.format(_t2n[this.USD], this.GetMoney2(money)) + end +end -- 获取货币单位名称 local _t2n2 = { [MoneyType.RMB] = Language[10445], @@ -90,17 +121,17 @@ local _t2n2 = { } function this.GetMoneyUnitName1(mt) if not mt then - mt = this.MT + mt = this.MT end if _t2n2[mt] then return _t2n2[mt] end return _t2n2[MoneyType.RMB] end + function this.GetMoneyUnitNameWithMoney1(money) local formater = this.GetMoneyUnitName1() return string.format(formater, this.GetMoney(money)) end - -return MoneyUtil \ No newline at end of file +return MoneyUtil diff --git a/Assets/ManagedResources/~Lua/Modules/JourneyWithWind/JourneyWithWindPanel.lua b/Assets/ManagedResources/~Lua/Modules/JourneyWithWind/JourneyWithWindPanel.lua index 899e2737e1..efde3b1f55 100644 --- a/Assets/ManagedResources/~Lua/Modules/JourneyWithWind/JourneyWithWindPanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/JourneyWithWind/JourneyWithWindPanel.lua @@ -468,12 +468,13 @@ function this.ShowDayDataGiftBag() local freetimes = rechargeData.dynamicBuyTimes - rechargeData.buyTimes local imageStr = (freetimes > 0 and isCurGetState) and "s_slbz_1anniuongse" or "s_slbz_1anniuhuise" getBtn:GetComponent("Image").sprite = this.spLoader:LoadSprite(imageStr) - btnText.text = string.format(Language[10444], MoneyUtil.GetMoney(rechargecommodityData.Price)) + btnText.text = string.format(MoneyUtil.GetMoneyUnitName(), MoneyUtil.GetMoney(data.finalNum)) if isOpenLock then --是否到天数 Util.SetGray(getBtn, false) getBtn:GetComponent("Button").enabled = true if freetimes > 0 and isCurGetState then - btnText.text = string.format(Language[10444], MoneyUtil.GetMoney(rechargecommodityData.Price)) + btnText.text = string.format(MoneyUtil.GetMoneyUnitName(), + MoneyUtil.GetMoney(rechargecommodityData.Price)) elseif freetimes <= 0 then btnText.text = Language[10491] getBtn:GetComponent("Button").enabled = false diff --git a/Assets/ManagedResources/~Lua/Modules/SurpriseBox/SurpriseBoxPanel.lua b/Assets/ManagedResources/~Lua/Modules/SurpriseBox/SurpriseBoxPanel.lua index 28cb400665..adfbbc434e 100644 --- a/Assets/ManagedResources/~Lua/Modules/SurpriseBox/SurpriseBoxPanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/SurpriseBox/SurpriseBoxPanel.lua @@ -115,7 +115,7 @@ function SurpriseBox:ShowSingleData(item,data,index) tip:SetActive(false) tipText.text = string.format(Language[12884], data.otherData.BuyDay - self.actData.value) price:SetActive(true) - priceText.text = string.format(Language[10444],MoneyUtil.GetMoney(data.otherData.Price)) + priceText.text = string.format(MoneyUtil.GetMoneyUnitName(), MoneyUtil.GetMoney(data.otherData.Price)) lock:SetActive(false) light1:SetActive(false) light2:SetActive(false) diff --git a/Assets/ManagedResources/~Lua/Modules/TreasureStore/TreasureStorePopup.lua b/Assets/ManagedResources/~Lua/Modules/TreasureStore/TreasureStorePopup.lua index c876759699..b8d6b12838 100644 --- a/Assets/ManagedResources/~Lua/Modules/TreasureStore/TreasureStorePopup.lua +++ b/Assets/ManagedResources/~Lua/Modules/TreasureStore/TreasureStorePopup.lua @@ -196,8 +196,8 @@ function this:SetScrollPre(root, data) itemList[i].Name = Util.GetGameObject(itemList[i].go, "Name"):GetComponent("Text") end local config = ConfigManager.GetConfigData(ConfigName.RechargeCommodityConfig, data.Id) - title.text = string.format(Language[12924], MoneyUtil.GetMoneyUnitNameWithMoney1(config.Rebate), - MoneyUtil.GetMoneyUnitNameWithMoney1(config.Price)) + title.text = string.format(Language[12924], MoneyUtil.GetMoneyUnitNameWithMoney(config.Rebate), + MoneyUtil.GetMoneyUnitNameWithMoney(config.Price)) local rewardArray = data.RewardShow if not itemsGrid then itemsGrid = {} diff --git a/Assets/ManagedResources/~Lua/View/ShopView.lua b/Assets/ManagedResources/~Lua/View/ShopView.lua index 23afca473e..0d481ed317 100644 --- a/Assets/ManagedResources/~Lua/View/ShopView.lua +++ b/Assets/ManagedResources/~Lua/View/ShopView.lua @@ -696,8 +696,12 @@ function this:RechargeShopItemAdapter(shopItem, itemData) --end icon.sprite = self.spLoader:LoadSprite(GetResourcePath(itemInfo.Resources)) num.text = GetLanguageStrById(itemInfo.BaseReward[1][2]) - price.text = MoneyUtil.GetMoneyUnitNameWithMoney(itemInfo.Price) --.. MoneyUtil.GetMoney(itemInfo.Price) - + local rechargeConfig = ConfigManager.GetConfigData(ConfigName.RechargeCommodityConfig, itemData.goodsId) + if rechargeConfig.OtherBuy1 == nil then + price.text = MoneyUtil.GetMoneyUnitNameWithMoney2(itemInfo.Price) --.. MoneyUtil.GetMoney(itemInfo.Price) + else + price.text = MoneyUtil.GetMoneyUnitNameWithMoney(itemInfo.Price) --.. MoneyUtil.GetMoney(itemInfo.Price) + end -- 判断首充赠送 local curBuyCount = itemData.buyTimes if itemInfo.FirstMultiple[1][2] == 0 then