tcx_xiyou_yueNan
zhangjiannan 2025-01-15 11:26:51 +08:00
parent 400db99795
commit 43b2b39991
5 changed files with 59 additions and 23 deletions

View File

@ -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
return MoneyUtil

View File

@ -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

View File

@ -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)

View File

@ -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 = {}

View File

@ -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