tcx_xiyou_yueNan
zhangjiannan 2025-01-13 17:13:46 +08:00
parent 57439ef922
commit c2b9dacf80
4 changed files with 70 additions and 58 deletions

View File

@ -3376,7 +3376,8 @@ PlayerTitleRideSkinRedPointTypeStr = {
MoneyType = { MoneyType = {
RMB = 1, -- 人民币 RMB = 1, -- 人民币
USD = 2, -- 美元 USD = 2, -- 美元
MM = 9 -- 美元 MM = 9, -- 越南盾
THAI = 4 --泰铢
} }
-- 金钱文字界面相关常量----------------- -- 金钱文字界面相关常量-----------------

View File

@ -14,6 +14,8 @@ function this.Initialize()
this.MT = MoneyType.USD this.MT = MoneyType.USD
elseif GetCurLanguage() == 2 then elseif GetCurLanguage() == 2 then
this.MT = MoneyType.MM this.MT = MoneyType.MM
elseif GetCurLanguage() == 3 then
this.MT = MoneyType.THAI
else else
this.MT = MoneyType.USD this.MT = MoneyType.USD
end end
@ -33,6 +35,7 @@ function this.GetMoney(_rmbp)
LogError("表 ExchangeRate 错误: 不包含档位:"..tostring(rmbp)) LogError("表 ExchangeRate 错误: 不包含档位:"..tostring(rmbp))
return 0 return 0
end end
LogError("当前挡位:"..this.MT)
local m = this.RMB2O[rmbp]["Price_"..this.MT] local m = this.RMB2O[rmbp]["Price_"..this.MT]
if not m then if not m then
LogError("表 ExchangeRate 错误: 档位:"..tostring(rmbp).." , 未找到对应的货币类型 "..this.MT) LogError("表 ExchangeRate 错误: 档位:"..tostring(rmbp).." , 未找到对应的货币类型 "..this.MT)

View File

@ -12,6 +12,7 @@ local this = PayManager
function this.Initialize() function this.Initialize()
Game.GlobalEvent:AddEvent(GameEvent.MoneyPay.OnPayResultSuccess, this.onSdkPayResult) Game.GlobalEvent:AddEvent(GameEvent.MoneyPay.OnPayResultSuccess, this.onSdkPayResult)
end end
----- 请求支付 ----- 请求支付
----- @param context ----- @param context
---- { ---- {
@ -23,7 +24,7 @@ end
this.EventTrigger = {} this.EventTrigger = {}
function this.onSdkPayResult(id) function this.onSdkPayResult(id)
LogRed("收到sdk支付成功回调商品id = "..id) LogRed("收到sdk支付成功回调商品id = " .. id)
if this.EventTrigger[id] then if this.EventTrigger[id] then
this.EventTrigger[id](id) this.EventTrigger[id](id)
this.EventTrigger[id] = nil this.EventTrigger[id] = nil
@ -31,24 +32,24 @@ function this.onSdkPayResult(id)
local rechargeConfig = ConfigManager.GetConfigData(ConfigName.RechargeCommodityConfig, id) local rechargeConfig = ConfigManager.GetConfigData(ConfigName.RechargeCommodityConfig, id)
if rechargeConfig then if rechargeConfig then
local Price = tostring(rechargeConfig.Price) local Price = tostring(rechargeConfig.Price)
CustomEventManager.SendCustomEvent("mhtPay", Price ,"4") CustomEventManager.SendCustomEvent("mhtPay", Price, "4")
end end
end end
-- 这里发过来的是sdk的orderID -- 这里发过来的是sdk的orderID
function this.RechargeSuccessOrder(msg) function this.RechargeSuccessOrder(msg)
LogRed("充值成功orderId = "..tostring(msg.orderId)) LogRed("充值成功orderId = " .. tostring(msg.orderId))
-- 订单id特殊传值 -- 订单id特殊传值
CustomEventManager.SendCustomEvent("PayOrderId", tostring(msg.orderId) ,"0") CustomEventManager.SendCustomEvent("PayOrderId", tostring(msg.orderId), "0")
end end
function this.Pay(id, func) function this.Pay(id, func)
if not RECHARGEABLE then if not RECHARGEABLE then
return return
end end
LogRed("发起购买商品的请求商品id = "..id) LogRed("发起购买商品的请求商品id = " .. id)
if not func then if not func then
func = function()end func = function() end
end end
-- 请求游戏服务器的orderId -- 请求游戏服务器的orderId
@ -56,21 +57,21 @@ function this.Pay(id, func)
-- if this.EventTrigger[id] then -- if this.EventTrigger[id] then
-- LogError("重复发起购买商品的请求商品id = "..id..", uid = "..PlayerManager.uid) -- LogError("重复发起购买商品的请求商品id = "..id..", uid = "..PlayerManager.uid)
-- PopupTipPanel.ShowTip("您有一个相同的订单正在处理,请稍后再试") -- PopupTipPanel.ShowTip("您有一个相同的订单正在处理,请稍后再试")
-- return -- return
-- end -- end
LogRed("发起购买商品的请求订单id = "..orderId) LogRed("发起购买商品的请求订单id = " .. orderId)
this.EventTrigger[id] = func this.EventTrigger[id] = func
CheckRedPointStatus(RedPointType.GrowthPackage)--成长礼包的红点检测 CheckRedPointStatus(RedPointType.GrowthPackage) --成长礼包的红点检测
--直购商品 --直购商品
local rechargeConfig = ConfigManager.GetConfigData(ConfigName.RechargeCommodityConfig, id) local rechargeConfig = ConfigManager.GetConfigData(ConfigName.RechargeCommodityConfig, id)
--现金点券购买 --现金点券购买
local xjdqNum=BagManager.GetItemCountById(131) local xjdqNum = BagManager.GetItemCountById(131)
if xjdqNum>=rechargeConfig.Price and rechargeConfig.Price>0 and rechargeConfig.OtherBuy1 and #rechargeConfig.OtherBuy1>0 and rechargeConfig.OtherBuy1[1][1]==131 then if xjdqNum >= rechargeConfig.Price and rechargeConfig.Price > 0 and rechargeConfig.OtherBuy1 and #rechargeConfig.OtherBuy1 > 0 and rechargeConfig.OtherBuy1[1][1] == 131 then
local sureFunc=function() local sureFunc = function()
NetManager.MoneyBuyGiftRequest(id) NetManager.MoneyBuyGiftRequest(id)
end end
local cancelFunc=function() local cancelFunc = function()
if AppConst.isSDKLogin and rechargeConfig.Price > 0 then if AppConst.isSDKLogin and rechargeConfig.Price > 0 then
PayManager.SdkPay({ Id = id, orderId = orderId }) PayManager.SdkPay({ Id = id, orderId = orderId })
else else
@ -79,22 +80,22 @@ function this.Pay(id, func)
end) end)
end end
end end
local args={} local args = {}
args[1]=Language[12029] args[1] = Language[12029]
args[2]=Language[12030] args[2] = Language[12030]
args[3]=Language[12031] args[3] = Language[12031]
args[4]=sureFunc args[4] = sureFunc
args[5]=cancelFunc args[5] = cancelFunc
UIManager.OpenPanel(UIName.GMCommonConfirmPanel,args) UIManager.OpenPanel(UIName.GMCommonConfirmPanel, args)
return return
end end
local yhqNum=BagManager.GetItemCountById(108) local yhqNum = BagManager.GetItemCountById(108)
if yhqNum>=rechargeConfig.Price and rechargeConfig.Price>0 then if yhqNum >= rechargeConfig.Price and rechargeConfig.Price > 0 then
local sureFunc=function() local sureFunc = function()
NetManager.SendYHQBuyGoodRequest(id) NetManager.SendYHQBuyGoodRequest(id)
end end
local cancelFunc=function() local cancelFunc = function()
if AppConst.isSDKLogin and rechargeConfig.Price > 0 then if AppConst.isSDKLogin and rechargeConfig.Price > 0 then
PayManager.SdkPay({ Id = id, orderId = orderId }) PayManager.SdkPay({ Id = id, orderId = orderId })
else else
@ -103,16 +104,16 @@ function this.Pay(id, func)
end) end)
end end
end end
local args={} local args = {}
args[1]=Language[12032] args[1] = Language[12032]
args[2]=Language[12033] args[2] = Language[12033]
args[3]=Language[12031] args[3] = Language[12031]
args[4]=sureFunc args[4] = sureFunc
args[5]=cancelFunc args[5] = cancelFunc
UIManager.OpenPanel(UIName.GMCommonConfirmPanel,args) UIManager.OpenPanel(UIName.GMCommonConfirmPanel, args)
return return
end end
if rechargeConfig.BuyType==1 then --人民币 if rechargeConfig.BuyType == 1 then --人民币
if AppConst.isSDKLogin and rechargeConfig.Price > 0 then if AppConst.isSDKLogin and rechargeConfig.Price > 0 then
PayManager.SdkPay({ Id = id, orderId = orderId }) PayManager.SdkPay({ Id = id, orderId = orderId })
else else
@ -120,13 +121,13 @@ function this.Pay(id, func)
this.onSdkPayResult(id) this.onSdkPayResult(id)
end) end)
end end
elseif rechargeConfig.BuyType==2 then --gm余额购买 elseif rechargeConfig.BuyType == 2 then --gm余额购买
NetManager.SendGmBuyGoodRequest(id) NetManager.SendGmBuyGoodRequest(id)
elseif rechargeConfig.BuyType==3 then --rmb/gm余额购买 elseif rechargeConfig.BuyType == 3 then --rmb/gm余额购买
local sureFunc=function() local sureFunc = function()
NetManager.SendGmBuyGoodRequest(id) NetManager.SendGmBuyGoodRequest(id)
end end
local cancelFunc=function() local cancelFunc = function()
if AppConst.isSDKLogin and rechargeConfig.Price > 0 then if AppConst.isSDKLogin and rechargeConfig.Price > 0 then
PayManager.SdkPay({ Id = id, orderId = orderId }) PayManager.SdkPay({ Id = id, orderId = orderId })
else else
@ -135,19 +136,17 @@ function this.Pay(id, func)
end) end)
end end
end end
local args={} local args = {}
args[1]=Language[12034] args[1] = Language[12034]
args[2]=Language[12035] args[2] = Language[12035]
args[3]=Language[12031] args[3] = Language[12031]
args[4]=sureFunc args[4] = sureFunc
args[5]=cancelFunc args[5] = cancelFunc
UIManager.OpenPanel(UIName.GMCommonConfirmPanel,args) UIManager.OpenPanel(UIName.GMCommonConfirmPanel, args)
end end
end) end)
end end
function this.SdkPay(context) function this.SdkPay(context)
local rechargeConfig = ConfigManager.GetConfigData(ConfigName.RechargeCommodityConfig, context.Id) local rechargeConfig = ConfigManager.GetConfigData(ConfigName.RechargeCommodityConfig, context.Id)
local payData = table.clone(context) local payData = table.clone(context)
@ -163,23 +162,22 @@ function this.SdkPay(context)
else else
payData.RechargeId = rechargeConfig.Id payData.RechargeId = rechargeConfig.Id
end end
LogError("paydata.RechargeId=="..payData.RechargeId) LogError("paydata.RechargeId==" .. payData.RechargeId)
this.RequestPay(payData) this.RequestPay(payData)
end end
function this.RequestPay(context) function this.RequestPay(context)
local price = MoneyUtil.GetMoney(context.Price) local price = MoneyUtil.GetMoney(context.Price)
SDKMgr.onPayCallback = function(payResp) SDKMgr.onPayCallback = function(payResp)
Log("onPayCallback::"..payResp) Log("onPayCallback::" .. payResp)
local str = string.split(payResp, "#") local str = string.split(payResp, "#")
local result = tonumber(str[1]) local result = tonumber(str[1])
-- local orderId = str[2] -- local orderId = str[2]
if result == SDK_RESULT.SUCCESS then if result == SDK_RESULT.SUCCESS then
elseif result == SDK_RESULT.FAILED then elseif result == SDK_RESULT.FAILED then
else else
--PopupTipPanel.ShowTip("取消充值" .. result) --PopupTipPanel.ShowTip("取消充值" .. result)
-- DataCenterManager.CommitPayStatus( -- DataCenterManager.CommitPayStatus(
@ -203,17 +201,27 @@ function this.RequestPay(context)
params.serverID = PlayerManager.serverInfo.server_id params.serverID = PlayerManager.serverInfo.server_id
params.serverName = PlayerManager.serverInfo.name params.serverName = PlayerManager.serverInfo.name
-- 角色相关 -- 角色相关
params.roleID = tostring(PlayerManager.uid).."_"..tostring(context.Id).."_"..PackageManager.GetCCCode().."_"..AppConst.Platform--.."_"..tostring(context.orderId or "0").."_"..tostring(LoginManager.ServerId) params.roleID = tostring(PlayerManager.uid) ..
"_" ..
tostring(context.Id) ..
"_" ..
PackageManager.GetCCCode() ..
"_" .. AppConst.Platform --.."_"..tostring(context.orderId or "0").."_"..tostring(LoginManager.ServerId)
params.roleName = PlayerManager.nickName params.roleName = PlayerManager.nickName
params.roleLevel = PlayerManager.level params.roleLevel = PlayerManager.level
params.vip = tostring(VipManager.GetVipLevel()) params.vip = tostring(VipManager.GetVipLevel())
params.guildID = PlayerManager.familyId params.guildID = PlayerManager.familyId
-- 其他 -- 其他
params.payNotifyUrl = "" params.payNotifyUrl = ""
params.extension = tostring(PlayerManager.uid).."_"..tostring(context.Id).."_"..PackageManager.GetCCCode().."_"..AppConst.Platform--.."_"..tostring(context.orderId or "0").."_"..tostring(LoginManager.ServerId) params.extension = tostring(PlayerManager.uid) ..
"_" ..
tostring(context.Id) ..
"_" ..
PackageManager.GetCCCode() ..
"_" .. AppConst.Platform --.."_"..tostring(context.orderId or "0").."_"..tostring(LoginManager.ServerId)
SDKMgr:Pay(params) SDKMgr:Pay(params)
-- --
-- ThinkingAnalyticsManager.Track("create_order", { -- ThinkingAnalyticsManager.Track("create_order", {
-- goods_id = context.Id, -- goods_id = context.Id,
-- goods_name = context.Name, -- goods_name = context.Name,
@ -222,4 +230,4 @@ function this.RequestPay(context)
-- }) -- })
end end
return this return this

View File

@ -82,7 +82,7 @@ function SettingInfo:SetTipShow()
elseif flag == 1 then elseif flag == 1 then
this.dropDownText.text = "English" this.dropDownText.text = "English"
end end
this.dropDown.value = flag this.dropDown.value = flag - 1
if GetCurLanguage() ~= flag then if GetCurLanguage() ~= flag then
this.dropDownTip.gameObject:SetActive(true) this.dropDownTip.gameObject:SetActive(true)
else else
@ -112,9 +112,9 @@ function SettingInfo:BindEvent()
if IsLanguagePack then if IsLanguagePack then
this.dropDown.onValueChanged:AddListener( this.dropDown.onValueChanged:AddListener(
function(value) function(value)
PlayerPrefs.SetInt("language_flag", value) PlayerPrefs.SetInt("language_flag", value + 1)
this:SetTipShow() this:SetTipShow()
if value == GetCurLanguage() then if (value + 1) == GetCurLanguage() then
return return
end end
MsgPanel.ShowTwo(Language[12814], function() end, function() MsgPanel.ShowTwo(Language[12814], function() end, function()