金猪
This commit is contained in:
parent
ccb0f42081
commit
1eb1295c1c
@ -35,6 +35,12 @@ function GoldPigUI:onLoadRootComplete()
|
|||||||
local nowGemImg = uiMap["gold_pig_ui.bg.slider.now_gem_bg.gem_img"]
|
local nowGemImg = uiMap["gold_pig_ui.bg.slider.now_gem_bg.gem_img"]
|
||||||
GFunc.centerImgAndTx(nowGemImg, nowGemTx, 0, -4)
|
GFunc.centerImgAndTx(nowGemImg, nowGemTx, 0, -4)
|
||||||
|
|
||||||
|
local currGold = DataManager.GoldPigData:getGoldCount()
|
||||||
|
local nowGoldTx = uiMap["gold_pig_ui.bg.now_gem_bg.gold_tx"]
|
||||||
|
nowGoldTx:setText(GFunc.intToString(currGold))
|
||||||
|
local nowGoldImg = uiMap["gold_pig_ui.bg.now_gem_bg.gold_img"]
|
||||||
|
GFunc.centerImgAndTx(nowGoldImg, nowGoldTx, 0, -4)
|
||||||
|
|
||||||
local sliderWidth = uiMap["gold_pig_ui.bg.slider"]:getRectWidth()
|
local sliderWidth = uiMap["gold_pig_ui.bg.slider"]:getRectWidth()
|
||||||
uiMap["gold_pig_ui.bg.slider.now_gem_bg"]:setAnchoredPositionX((percent - 0.5) * sliderWidth)
|
uiMap["gold_pig_ui.bg.slider.now_gem_bg"]:setAnchoredPositionX((percent - 0.5) * sliderWidth)
|
||||||
|
|
||||||
|
|||||||
@ -17,6 +17,8 @@ function GoldPigData:init(data, initOnLogin)
|
|||||||
end
|
end
|
||||||
self.data.count = data.add_diamond or 0
|
self.data.count = data.add_diamond or 0
|
||||||
self.lastCount = self.data.count
|
self.lastCount = self.data.count
|
||||||
|
self.data.goldCount = data.add_gold or 0
|
||||||
|
self.lastGoldCount = self.data.goldCount
|
||||||
self.maxCount = self:getMaxCount()
|
self.maxCount = self:getMaxCount()
|
||||||
self.data.fullTime = (data.full_at or 0) // 1000
|
self.data.fullTime = (data.full_at or 0) // 1000
|
||||||
self.data.buyTime = (data.buy_at or 0) // 1000
|
self.data.buyTime = (data.buy_at or 0) // 1000
|
||||||
@ -113,10 +115,13 @@ function GoldPigData:addGoldPigCount()
|
|||||||
end
|
end
|
||||||
if self.data.count >= info.max_diamond then -- 已经满了
|
if self.data.count >= info.max_diamond then -- 已经满了
|
||||||
self.lastCount = self.data.count
|
self.lastCount = self.data.count
|
||||||
|
self.lastGoldCount = self.data.goldCount
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
self.lastCount = self.data.count
|
self.lastCount = self.data.count
|
||||||
|
self.lastGoldCount = self.data.goldCount
|
||||||
self.data.count = self.data.count + info.battle_diamond
|
self.data.count = self.data.count + info.battle_diamond
|
||||||
|
self.data.goldCount = self.data.goldCount + info.battle_gold
|
||||||
if self.data.count >= info.max_diamond then -- 满了
|
if self.data.count >= info.max_diamond then -- 满了
|
||||||
self.data.count = info.max_diamond
|
self.data.count = info.max_diamond
|
||||||
self.data.fullTime = Time:getServerTime()
|
self.data.fullTime = Time:getServerTime()
|
||||||
@ -146,6 +151,10 @@ function GoldPigData:getCount()
|
|||||||
return self.data.count
|
return self.data.count
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function GoldPigData:getGoldCount()
|
||||||
|
return self.data.goldCount
|
||||||
|
end
|
||||||
|
|
||||||
function GoldPigData:getIsFull()
|
function GoldPigData:getIsFull()
|
||||||
return self.data.count >= self.maxCount
|
return self.data.count >= self.maxCount
|
||||||
end
|
end
|
||||||
@ -220,7 +229,9 @@ function GoldPigData:levelDown()
|
|||||||
|
|
||||||
local currLevelInfo = self:getCurrLevelInfo()
|
local currLevelInfo = self:getCurrLevelInfo()
|
||||||
self.data.count = currLevelInfo.min_diamond
|
self.data.count = currLevelInfo.min_diamond
|
||||||
|
self.data.goldCount = currLevelInfo.min_gold
|
||||||
self.lastCount = self.data.count
|
self.lastCount = self.data.count
|
||||||
|
self.lastGoldCount = self.data.goldCount
|
||||||
self.maxCount = self:getMaxCount()
|
self.maxCount = self:getMaxCount()
|
||||||
self.popFlag = false
|
self.popFlag = false
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user