神尊特权兑换修改
parent
97036e465d
commit
b1afca7702
|
@ -4,6 +4,7 @@ local this=NewShenZunExpExchangePopup
|
|||
local storeConfig=ConfigManager.GetConfigData(ConfigName.StoreConfig,1001)
|
||||
local _isClickedReduce = false
|
||||
local _isClickedAdd = false
|
||||
local maxExchangeNum=0
|
||||
function this:InitComponent()
|
||||
this.spLoader = SpriteLoader.New()
|
||||
this.backBtn=Util.GetGameObject(self.gameObject, "backBtn")
|
||||
|
@ -30,6 +31,7 @@ function this:BindEvent()
|
|||
if haveNum>=discostnum then
|
||||
ShopManager.RequestBuyItemByShopId(storeConfig.StoreId, storeConfig.Id, this.exchangeNum, function(msg)
|
||||
Game.GlobalEvent:DispatchEvent(GameEvent.Activity.UpdateShenzunLv)
|
||||
self:ClosePanel()
|
||||
end)
|
||||
else
|
||||
PopupTipPanel.ShowTip("道具不足")
|
||||
|
@ -37,11 +39,13 @@ function this:BindEvent()
|
|||
end)
|
||||
|
||||
Util.AddClick(this.maxBtn,function ()
|
||||
local costId, discostnum, costnum = ShopManager.calculateBuyCost(storeConfig.StoreId, storeConfig.Id, 1)
|
||||
local costId, discostnum, onecostnum = ShopManager.calculateBuyCost(storeConfig.StoreId, storeConfig.Id, 1)
|
||||
local haveNum=BagManager.GetItemCountById(costId)
|
||||
this.exchangeNum=math.floor(haveNum/costnum)
|
||||
local maxCostNum=maxExchangeNum*onecostnum
|
||||
local costNum=maxCostNum>haveNum and haveNum or maxCostNum
|
||||
this.exchangeNum=math.floor(costNum/onecostnum)
|
||||
this.changeNumText.text=this.exchangeNum
|
||||
this.costNum.text=this.exchangeNum*costnum
|
||||
this.costNum.text=this.exchangeNum*onecostnum
|
||||
end)
|
||||
|
||||
Util.AddClick(this.reduceBtn,function ()
|
||||
|
@ -57,6 +61,10 @@ function this:BindEvent()
|
|||
|
||||
Util.AddClick(this.addBtn,function ()
|
||||
local exNum=this.exchangeNum+1
|
||||
if exNum>maxExchangeNum then
|
||||
PopupTipPanel.ShowTip("已达上限")
|
||||
return
|
||||
end
|
||||
local costId, discostnum, costnum = ShopManager.calculateBuyCost(storeConfig.StoreId, storeConfig.Id, exNum)
|
||||
local haveNum=BagManager.GetItemCountById(costId)
|
||||
if haveNum>=discostnum then
|
||||
|
@ -112,6 +120,10 @@ function this:OnOpen(data)
|
|||
local costId, discostnum, costnum = ShopManager.calculateBuyCost(storeConfig.StoreId, storeConfig.Id, this.exchangeNum)
|
||||
this.costNum.text=discostnum
|
||||
this.changeNumText.text=this.exchangeNum
|
||||
local curLv=GetShenzunLv()
|
||||
local expNum=BagManager.GetItemCountById(1352)
|
||||
local prestigeConfig=ConfigManager.GetConfigDataByDoubleKey(ConfigName.PrestigeConfig,"Type",1,"Level",curLv)
|
||||
maxExchangeNum=prestigeConfig.Experience[2]-expNum
|
||||
end
|
||||
|
||||
--长按升级处理
|
||||
|
@ -135,7 +147,7 @@ function this.OnUpdate()
|
|||
if _isClickedAdd then
|
||||
if Time.realtimeSinceStartup - this.timePressStarted > 0.4 then
|
||||
local exNum=this.exchangeNum+1
|
||||
if exNum>=1000 then
|
||||
if exNum>maxExchangeNum then
|
||||
PopupTipPanel.ShowTip("已达上限")
|
||||
_isClickedAdd = false
|
||||
return
|
||||
|
|
Loading…
Reference in New Issue