Update - 1.7.0.88
EN: 1.7.0.88 CN: 1.7.0.90 JP: 1.7.0.91 KR: 1.7.0.94
This commit is contained in:
@@ -18,27 +18,40 @@ function PenguinBaseCardCtrl:RefreshIcon(bOpen)
|
||||
self._mapNode.imgBg:SetActive(not bOpen)
|
||||
self._mapNode.imgIcon.gameObject:SetActive(bOpen)
|
||||
end
|
||||
function PenguinBaseCardCtrl:PlayInAni()
|
||||
self.animator:Play("PengUinCard_Base")
|
||||
end
|
||||
function PenguinBaseCardCtrl:PlayFlipAni()
|
||||
if self._mapNode.imgBg.activeSelf == false then
|
||||
return
|
||||
end
|
||||
self._mapNode.imgIcon.gameObject:SetActive(true)
|
||||
self.animator:Play("PengUinCard_Base_Turn", 0, 0)
|
||||
WwiseManger:PostEvent("Mode_Card_trunover")
|
||||
self.animator.speed = self._panel.mapLevel.nSpeed
|
||||
local nAnimTime = NovaAPI.GetAnimClipLength(self.animator, {
|
||||
"PengUinCard_Base_Turn"
|
||||
})
|
||||
nAnimTime = nAnimTime / self._panel.mapLevel.nSpeed
|
||||
self:AddTimer(1, nAnimTime, function()
|
||||
self._mapNode.imgBg:SetActive(false)
|
||||
end, true, true, true)
|
||||
end
|
||||
function PenguinBaseCardCtrl:PlayReplaceAni()
|
||||
self.animator:Play("PengUinCard_Base_Double", 0, 0)
|
||||
self.animator.speed = self._panel.mapLevel.nSpeed
|
||||
end
|
||||
function PenguinBaseCardCtrl:PlayTriggerAni(pos)
|
||||
if table.indexof(self._panel.mapLevel.tbHandRank, self.nSuit) == 0 then
|
||||
return
|
||||
end
|
||||
self.animator:Play("PengUinCard_Base_Open", 0, 0)
|
||||
WwiseManger:PostEvent("Mode_Card_cast")
|
||||
self.animator.speed = self._panel.mapLevel.nSpeed
|
||||
end
|
||||
function PenguinBaseCardCtrl:PlayHideAni()
|
||||
self.animator:Play("PengUinCard_Base_Out", 0, 0)
|
||||
self.animator.speed = self._panel.mapLevel.nSpeed
|
||||
end
|
||||
function PenguinBaseCardCtrl:Awake()
|
||||
self.animator = self.gameObject:GetComponent("Animator")
|
||||
|
||||
@@ -174,7 +174,9 @@ function PenguinCard:Trigger(nTriggerPhase, mapTriggerSource, callback)
|
||||
self.nTriggerCount = self.nTriggerCount + 1
|
||||
end
|
||||
if callback then
|
||||
printLog("企鹅牌触发:" .. " " .. self.sName .. " " .. self.sDesc)
|
||||
if NovaAPI.IsEditorPlatform() then
|
||||
printLog("企鹅牌触发:" .. " " .. self.sName .. " " .. self.sDesc)
|
||||
end
|
||||
callback(self.nEffectType, self.tbEffectParam)
|
||||
end
|
||||
EventManager.Hit("PenguinCardTriggered", self.nSlotIndex)
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
local PenguinCardConfirmCtrl = class("PenguinCardConfirmCtrl", BaseCtrl)
|
||||
PenguinCardConfirmCtrl._mapNodeConfig = {
|
||||
blur = {
|
||||
sNodeName = "t_fullscreen_blur_blue"
|
||||
},
|
||||
aniBlur = {
|
||||
sNodeName = "t_fullscreen_blur_blue",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
btnCloseBg = {
|
||||
sNodeName = "snapshot",
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
txtWindowTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "MessageBox_Title"
|
||||
},
|
||||
window = {},
|
||||
aniWindow = {sNodeName = "window", sComponentName = "Animator"},
|
||||
btnClose = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
txtContentMain = {sComponentName = "TMP_Text"},
|
||||
btnCancel = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
btnConfirm = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Confirm"
|
||||
},
|
||||
txtBtnCancel = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "MessageBox_Cancel"
|
||||
},
|
||||
txtBtnConfirm = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "MessageBox_Confirm"
|
||||
},
|
||||
btnAgain = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_Again"
|
||||
},
|
||||
againSelect = {},
|
||||
texAgainTip = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "PenguinCard_SkipTips"
|
||||
},
|
||||
goAgain = {}
|
||||
}
|
||||
PenguinCardConfirmCtrl._mapEventConfig = {PenguinCard_OpenConfirm = "Open"}
|
||||
function PenguinCardConfirmCtrl:Open(mapMsg)
|
||||
self._panel.mapLevel:Pause()
|
||||
self:PlayInAni()
|
||||
self:Refresh(mapMsg)
|
||||
end
|
||||
function PenguinCardConfirmCtrl:Refresh(mapMsg)
|
||||
local sContent = mapMsg.sContent
|
||||
self.callbackConfirm = mapMsg.callbackConfirm
|
||||
self.callbackAgain = mapMsg.callbackAgain
|
||||
self._mapNode.btnAgain.gameObject:SetActive(self.callbackAgain ~= nil)
|
||||
self._mapNode.againSelect:SetActive(false)
|
||||
self._mapNode.goAgain.gameObject:SetActive(self.callbackAgain ~= nil)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtContentMain, sContent)
|
||||
end
|
||||
function PenguinCardConfirmCtrl:PlayInAni()
|
||||
self.gameObject:SetActive(true)
|
||||
self._mapNode.blur:SetActive(true)
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
self._mapNode.window:SetActive(true)
|
||||
self._mapNode.aniWindow:Play("t_window_04_t_in")
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.3)
|
||||
end
|
||||
function PenguinCardConfirmCtrl:Close(callback)
|
||||
self._mapNode.aniWindow:Play("t_window_04_t_out")
|
||||
self._mapNode.aniBlur:SetTrigger("tOut")
|
||||
self:AddTimer(1, 0.2, function()
|
||||
self._mapNode.window:SetActive(false)
|
||||
self.gameObject:SetActive(false)
|
||||
self._panel.mapLevel:Resume()
|
||||
if callback then
|
||||
callback()
|
||||
end
|
||||
end, true, true, true)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.2)
|
||||
end
|
||||
function PenguinCardConfirmCtrl:Awake()
|
||||
self._mapNode.window:SetActive(false)
|
||||
end
|
||||
function PenguinCardConfirmCtrl:OnEnable()
|
||||
end
|
||||
function PenguinCardConfirmCtrl:OnDisable()
|
||||
end
|
||||
function PenguinCardConfirmCtrl:OnBtnClick_Close()
|
||||
self:Close()
|
||||
end
|
||||
function PenguinCardConfirmCtrl:OnBtnClick_Confirm()
|
||||
self:Close(self.callbackConfirm)
|
||||
end
|
||||
function PenguinCardConfirmCtrl:OnBtnClick_Again()
|
||||
self._mapNode.againSelect:SetActive(not self._mapNode.againSelect.activeSelf)
|
||||
if self.callbackAgain then
|
||||
self.callbackAgain(self._mapNode.againSelect.activeSelf)
|
||||
end
|
||||
end
|
||||
return PenguinCardConfirmCtrl
|
||||
@@ -37,16 +37,32 @@ PenguinCardCtrl._mapNodeConfig = {
|
||||
Log = {
|
||||
sNodeName = "---Log---",
|
||||
sCtrlName = "Game.UI.Play_PenguinCard.PenguinCardLogCtrl"
|
||||
},
|
||||
Confirm = {
|
||||
sNodeName = "---Confirm---",
|
||||
sCtrlName = "Game.UI.Play_PenguinCard.PenguinCardConfirmCtrl"
|
||||
}
|
||||
}
|
||||
PenguinCardCtrl._mapEventConfig = {
|
||||
PenguinCard_RunState_Start = "RunState_Start",
|
||||
PenguinCard_RunState_Prepare = "RunState_Prepare",
|
||||
PenguinCard_RunState_Dealing = "RunState_Dealing",
|
||||
PenguinCard_RunState_Flip = "RunState_Flip",
|
||||
PenguinCard_RunState_Settlement = "RunState_Settlement",
|
||||
PenguinCard_RunState_Complete = "RunState_Complete",
|
||||
PenguinCard_QuitState_Start = "QuitState_Start",
|
||||
PenguinCard_QuitState_Prepare = "QuitState_Prepare",
|
||||
PenguinCard_QuitState_Dealing = "QuitState_Dealing",
|
||||
PenguinCard_QuitState_Flip = "QuitState_Flip",
|
||||
PenguinCard_QuitState_Settlement = "QuitState_Settlement",
|
||||
PenguinCard_QuitState_Complete = "QuitState_Complete",
|
||||
PenguinCard_Change = "OnEvent_Change"
|
||||
}
|
||||
function PenguinCardCtrl:RunState_Start()
|
||||
self:CloseAll()
|
||||
end
|
||||
function PenguinCardCtrl:QuitState_Start()
|
||||
end
|
||||
function PenguinCardCtrl:RunState_Prepare()
|
||||
self._mapNode.Prepare.gameObject:SetActive(true)
|
||||
self._mapNode.Slot.gameObject:SetActive(true)
|
||||
@@ -54,6 +70,11 @@ function PenguinCardCtrl:RunState_Prepare()
|
||||
self._mapNode.Flip.gameObject:SetActive(false)
|
||||
self._mapNode.Prepare:Refresh()
|
||||
self._mapNode.Slot:Refresh()
|
||||
if self.bIn then
|
||||
self.bIn = false
|
||||
else
|
||||
WwiseManger:PostEvent("Mode_Card_nextround")
|
||||
end
|
||||
EventManager.Hit("Guide_PassiveCheck_Msg", "Guide_PenguinCard_301")
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
@@ -61,27 +82,95 @@ function PenguinCardCtrl:RunState_Prepare()
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
function PenguinCardCtrl:QuitState_Prepare(nNextState)
|
||||
if nNextState == 0 then
|
||||
self._mapNode.Slot:PlayOutAni()
|
||||
self._mapNode.Prepare:PlayOutAni()
|
||||
WwiseManger:PostEvent("Mode_Card_dissolve")
|
||||
elseif nNextState == 2 then
|
||||
self._mapNode.Prepare:PlayOutAni()
|
||||
WwiseManger:PostEvent("Mode_Card_dissolve")
|
||||
elseif nNextState == 5 then
|
||||
self._mapNode.Slot:PlayOutAni()
|
||||
self._mapNode.Prepare:PlayOutAni()
|
||||
self.animator:Play("PengUinCard_Bg_Result")
|
||||
WwiseManger:PostEvent("Mode_Card_dissolve")
|
||||
end
|
||||
end
|
||||
function PenguinCardCtrl:RunState_Dealing()
|
||||
self._mapNode.Prepare.gameObject:SetActive(false)
|
||||
self._mapNode.Flip.gameObject:SetActive(true)
|
||||
self._mapNode.Flip:Refresh_Dealing()
|
||||
EventManager.Hit("Guide_PassiveCheck_Msg", "Guide_PenguinCard_302")
|
||||
end
|
||||
function PenguinCardCtrl:QuitState_Dealing(nNextState)
|
||||
if nNextState == 0 then
|
||||
self._mapNode.Slot:PlayOutAni()
|
||||
self._mapNode.Flip:PlayOutAni()
|
||||
WwiseManger:PostEvent("Mode_Card_dissolve")
|
||||
elseif nNextState == 5 then
|
||||
self._mapNode.Slot:PlayOutAni()
|
||||
self._mapNode.Flip:PlayOutAni()
|
||||
self.animator:Play("PengUinCard_Bg_Result")
|
||||
WwiseManger:PostEvent("Mode_Card_dissolve")
|
||||
end
|
||||
end
|
||||
function PenguinCardCtrl:RunState_Flip()
|
||||
self._mapNode.Flip:Refresh_Flip()
|
||||
end
|
||||
function PenguinCardCtrl:QuitState_Flip(nNextState)
|
||||
self._mapNode.Flip:StopShowAllOn()
|
||||
if nNextState == 0 then
|
||||
self._mapNode.Slot:PlayOutAni()
|
||||
self._mapNode.Flip:PlayOutAni()
|
||||
WwiseManger:PostEvent("Mode_Card_dissolve")
|
||||
elseif nNextState == 5 then
|
||||
self._mapNode.Slot:PlayOutAni()
|
||||
self._mapNode.Flip:PlayOutAni()
|
||||
self.animator:Play("PengUinCard_Bg_Result")
|
||||
WwiseManger:PostEvent("Mode_Card_dissolve")
|
||||
end
|
||||
end
|
||||
function PenguinCardCtrl:RunState_Settlement()
|
||||
self._mapNode.Flip:Refresh_Settlement()
|
||||
end
|
||||
function PenguinCardCtrl:QuitState_Settlement(nNextState)
|
||||
if nNextState == 0 then
|
||||
self._mapNode.Slot:PlayOutAni()
|
||||
self._mapNode.Flip:PlayOutAni()
|
||||
WwiseManger:PostEvent("Mode_Card_dissolve")
|
||||
elseif nNextState == 1 then
|
||||
self._mapNode.Flip:PlayOutAni()
|
||||
WwiseManger:PostEvent("Mode_Card_dissolve")
|
||||
elseif nNextState == 2 then
|
||||
self._mapNode.Flip:PlayRoundAni()
|
||||
elseif nNextState == 5 then
|
||||
self._mapNode.Slot:PlayOutAni()
|
||||
self._mapNode.Flip:PlayOutAni()
|
||||
self.animator:Play("PengUinCard_Bg_Result")
|
||||
WwiseManger:PostEvent("Mode_Card_dissolve")
|
||||
end
|
||||
end
|
||||
function PenguinCardCtrl:RunState_Complete()
|
||||
self._mapNode.Result:Open()
|
||||
end
|
||||
function PenguinCardCtrl:Awake()
|
||||
function PenguinCardCtrl:QuitState_Complete()
|
||||
end
|
||||
function PenguinCardCtrl:CloseAll()
|
||||
self._mapNode.Prepare.gameObject:SetActive(false)
|
||||
self._mapNode.Slot.gameObject:SetActive(false)
|
||||
self._mapNode.Flip.gameObject:SetActive(false)
|
||||
self._mapNode.CardInfo.gameObject:SetActive(false)
|
||||
self._mapNode.Pause.gameObject:SetActive(false)
|
||||
self._mapNode.HandRank.gameObject:SetActive(false)
|
||||
self._mapNode.Result.gameObject:SetActive(false)
|
||||
self._mapNode.Log.gameObject:SetActive(false)
|
||||
self._mapNode.Confirm.gameObject:SetActive(false)
|
||||
end
|
||||
function PenguinCardCtrl:Awake()
|
||||
self.bIn = true
|
||||
self.animator = self.gameObject:GetComponent("Animator")
|
||||
self:CloseAll()
|
||||
end
|
||||
function PenguinCardCtrl:OnEnable()
|
||||
self._panel.mapLevel:StartGame()
|
||||
|
||||
@@ -1,21 +1,27 @@
|
||||
local PenguinCardFlipCtrl = class("PenguinCardFlipCtrl", BaseCtrl)
|
||||
local WwiseManger = CS.WwiseAudioManager.Instance
|
||||
local LoopType = CS.DG.Tweening.LoopType
|
||||
local _, BtnOn = ColorUtility.TryParseHtmlString("#CC8E2B")
|
||||
local _, BtnOff = ColorUtility.TryParseHtmlString("#796443")
|
||||
local ScaleUpTime = 0.3
|
||||
local ScaleDownTime = 0.12
|
||||
local _, BtnOn = ColorUtility.TryParseHtmlString("#b48339")
|
||||
local _, BtnOff = ColorUtility.TryParseHtmlString("#3E3C5B")
|
||||
PenguinCardFlipCtrl._mapNodeConfig = {
|
||||
goHandRankOff = {},
|
||||
aniHandRankBg = {
|
||||
sNodeName = "imgHandRankBg",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
txtFlipTip = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "PenguinCard_FlipAllCardTip"
|
||||
},
|
||||
goHandRankOn = {},
|
||||
txtHandRank = {sComponentName = "TMP_Text"},
|
||||
imgSuitCount = {nCount = 6, sComponentName = "Image"},
|
||||
btnHandRank = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_HandRank"
|
||||
},
|
||||
imgRoundTitleBg = {},
|
||||
txtRoundTip = {sComponentName = "TMP_Text"},
|
||||
btnShow = {
|
||||
nCount = 5,
|
||||
sComponentName = "UIButton",
|
||||
@@ -32,6 +38,7 @@ PenguinCardFlipCtrl._mapNodeConfig = {
|
||||
callback = "OnBtnClick_NextRound"
|
||||
},
|
||||
txtBtnNextRound = {sComponentName = "TMP_Text"},
|
||||
goNextRoundOn = {},
|
||||
btnShowAll = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_ShowAll"
|
||||
@@ -40,6 +47,7 @@ PenguinCardFlipCtrl._mapNodeConfig = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "PenguinCard_Btn_FlipAll"
|
||||
},
|
||||
goShowAllOn = {},
|
||||
btnAuto = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Auto"
|
||||
@@ -82,49 +90,91 @@ PenguinCardFlipCtrl._mapNodeConfig = {
|
||||
trRoundScoreRatio = {
|
||||
sNodeName = "txtRoundScoreRatio",
|
||||
sComponentName = "Transform"
|
||||
},
|
||||
aniRoundScoreBaseBg = {
|
||||
sNodeName = "imgRoundScoreBaseBg",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
aniRoundScoreRatioBg = {
|
||||
sNodeName = "imgRoundScoreRatioBg",
|
||||
sComponentName = "Animator"
|
||||
}
|
||||
}
|
||||
PenguinCardFlipCtrl._mapEventConfig = {
|
||||
PenguinCard_ChangeRoundScore = "OnEvent_ChangeRoundScore",
|
||||
PenguinCard_ReplaceBaseCard = "OnEvent_ReplaceBaseCard",
|
||||
PenguinCard_ShowBaseCard = "OnEvent_ShowBaseCard"
|
||||
PenguinCard_ShowBaseCard = "OnEvent_ShowBaseCard",
|
||||
PenguinCard_Pause = "OnEvent_Pause",
|
||||
PenguinCard_Resume = "OnEvent_Resume",
|
||||
PenguinCard_QuitScoreAni = "QuitScoreAni"
|
||||
}
|
||||
function PenguinCardFlipCtrl:Refresh_Dealing()
|
||||
self._mapNode.imgNextRound:SetActive(false)
|
||||
self._mapNode.btnNextRound.gameObject:SetActive(false)
|
||||
self._mapNode.btnShowAll.gameObject:SetActive(false)
|
||||
self._mapNode.imgRoundTitleBg:SetActive(false)
|
||||
self._mapNode.goNextRoundOn:SetActive(false)
|
||||
self._mapNode.btnShowAll.gameObject:SetActive(true)
|
||||
self._mapNode.btnShowAll.interactable = false
|
||||
self._mapNode.goShowAllOn:SetActive(false)
|
||||
self:RefreshRoundScore()
|
||||
self._mapNode.goHandRankOff:SetActive(true)
|
||||
self._mapNode.goHandRankOn:SetActive(false)
|
||||
self._mapNode.aniRoundScoreBaseBg.gameObject:SetActive(false)
|
||||
self._mapNode.aniRoundScoreBaseBg.gameObject:SetActive(true)
|
||||
self._mapNode.aniRoundScoreRatioBg.gameObject:SetActive(false)
|
||||
self._mapNode.aniRoundScoreRatioBg.gameObject:SetActive(true)
|
||||
self._mapNode.aniHandRankBg:Play("PengUinCard_HandRank_Off", 1, 0)
|
||||
for i = 1, 5 do
|
||||
self._mapNode.btnShow[i].interactable = true
|
||||
self._mapNode.PenguinBaseCard[i]:Refresh(self._panel.mapLevel.tbBaseCardId[i])
|
||||
self._mapNode.PenguinBaseCard[i]:PlayInAni()
|
||||
end
|
||||
if self._panel.mapLevel.nCurRound == 1 then
|
||||
self.animator:Play("PengUinCard_Flip_in", 0, 0)
|
||||
local nAnimTime = NovaAPI.GetAnimClipLength(self.animator, {
|
||||
"PengUinCard_Flip_in"
|
||||
})
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, nAnimTime)
|
||||
else
|
||||
self.animator:Play("PengUinCard_Flip_Card_in", 0, 0)
|
||||
local nAnimTime = NovaAPI.GetAnimClipLength(self.animator, {
|
||||
"PengUinCard_Flip_Card_in"
|
||||
})
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, nAnimTime)
|
||||
end
|
||||
WwiseManger:PostEvent("Mode_Card_nextround")
|
||||
end
|
||||
function PenguinCardFlipCtrl:Refresh_Flip()
|
||||
self._mapNode.btnShowAll.gameObject:SetActive(true)
|
||||
self._mapNode.btnShowAll.interactable = true
|
||||
self:StartShowAllOn()
|
||||
self.mapHandRankScore = {}
|
||||
end
|
||||
function PenguinCardFlipCtrl:Refresh_Settlement()
|
||||
if self._panel.mapLevel.nRoundLimit > self._panel.mapLevel.nCurRound then
|
||||
self._mapNode.imgNextRound:SetActive(true)
|
||||
end
|
||||
self._mapNode.btnNextRound.gameObject:SetActive(true)
|
||||
self._mapNode.btnNextRound.interactable = false
|
||||
self:AddTimer(1, 2 / self._panel.mapLevel.nSpeed, function()
|
||||
self._mapNode.btnNextRound.interactable = true
|
||||
end, true, true, true)
|
||||
self._mapNode.btnShowAll.gameObject:SetActive(false)
|
||||
self._mapNode.goShowAllOn:SetActive(false)
|
||||
self:RefreshRoundCount()
|
||||
self._mapNode.goHandRankOff:SetActive(false)
|
||||
self._mapNode.goHandRankOn:SetActive(true)
|
||||
self._mapNode.aniHandRankBg:Play("PengUinCard_HandRank_On", 0, 0)
|
||||
self:RefreshHandRank()
|
||||
for i = 1, 5 do
|
||||
self._mapNode.PenguinBaseCard[i]:PlayTriggerAni()
|
||||
self._mapNode.btnShow[i].interactable = false
|
||||
end
|
||||
self:PlayScoreAni()
|
||||
end
|
||||
function PenguinCardFlipCtrl:RefreshRoundCount()
|
||||
NovaAPI.SetTMPText(self._mapNode.txtRound, orderedFormat(ConfigTable.GetUIText("PenguinCard_LeftRound"), self._panel.mapLevel.nRoundLimit - self._panel.mapLevel.nCurRound))
|
||||
if self._panel.mapLevel.nRoundLimit == self._panel.mapLevel.nCurRound then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtBtnNextRound, ConfigTable.GetUIText("PenguinCard_Btn_EndTurn"))
|
||||
NovaAPI.SetTMPText(self._mapNode.txtRoundTip, ConfigTable.GetUIText("PenguinCard_EndTurnTip"))
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.txtBtnNextRound, ConfigTable.GetUIText("PenguinCard_Btn_NextRound"))
|
||||
NovaAPI.SetTMPText(self._mapNode.txtRoundTip, ConfigTable.GetUIText("PenguinCard_NextRoundTip"))
|
||||
end
|
||||
end
|
||||
function PenguinCardFlipCtrl:RefreshHandRank()
|
||||
@@ -144,7 +194,8 @@ end
|
||||
function PenguinCardFlipCtrl:RefreshRoundScore()
|
||||
NovaAPI.SetTMPText(self._mapNode.txtRoundScore, self:ThousandsNumber(clearFloat(self._panel.mapLevel.nRoundScore)))
|
||||
NovaAPI.SetTMPText(self._mapNode.txtRoundScoreBase, self:ThousandsNumber(clearFloat(self._panel.mapLevel.nRoundValue)))
|
||||
NovaAPI.SetTMPText(self._mapNode.txtRoundScoreRatio, string.format("%.1f", self._panel.mapLevel.nRoundRatio * self._panel.mapLevel.nRoundMultiRatio))
|
||||
local nRatio = self._panel.mapLevel.nRoundMultiRatio > 0 and self._panel.mapLevel.nRoundRatio * self._panel.mapLevel.nRoundMultiRatio or self._panel.mapLevel.nRoundRatio
|
||||
NovaAPI.SetTMPText(self._mapNode.txtRoundScoreRatio, string.format("%.1f", nRatio))
|
||||
end
|
||||
function PenguinCardFlipCtrl:RefreshButton()
|
||||
self:RefreshAuto()
|
||||
@@ -170,18 +221,185 @@ function PenguinCardFlipCtrl:RefreshSpeed()
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtBtnSpeed, bFast and BtnOn or BtnOff)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtBtnSpeed, "<size=32>×</size>" .. self._panel.mapLevel.nSpeed)
|
||||
end
|
||||
function PenguinCardFlipCtrl:NextRound()
|
||||
function PenguinCardFlipCtrl:StartShowAllOn()
|
||||
self:StopShowAllOn()
|
||||
if self._mapNode.goShowAllOn.activeSelf == true then
|
||||
return
|
||||
end
|
||||
self.timerNextRoundOn = self:AddTimer(1, 3, function()
|
||||
self._mapNode.goShowAllOn:SetActive(true)
|
||||
end, true, true, true)
|
||||
end
|
||||
function PenguinCardFlipCtrl:StopShowAllOn()
|
||||
if self.timerNextRoundOn then
|
||||
self.timerNextRoundOn:Cancel()
|
||||
self.timerNextRoundOn = nil
|
||||
end
|
||||
end
|
||||
function PenguinCardFlipCtrl:PlayRoundAni()
|
||||
for i = 1, 5 do
|
||||
self._mapNode.PenguinBaseCard[i]:PlayHideAni()
|
||||
end
|
||||
self:AddTimer(1, 0.567, function()
|
||||
self._panel.mapLevel:SwitchGameState()
|
||||
end, true, true, true)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.567)
|
||||
self.animator:Play("PengUinCard_Flip_Card_out", 0, 0)
|
||||
self._mapNode.aniHandRankBg:Play("PengUinCard_HandRank_Off", 0, 0)
|
||||
self:QuitScoreAni()
|
||||
end
|
||||
function PenguinCardFlipCtrl:NextTurn()
|
||||
function PenguinCardFlipCtrl:QuitScoreAni()
|
||||
if self.sequence then
|
||||
self.sequence:Kill()
|
||||
self.sequence = nil
|
||||
WwiseManger:PostEvent("Mode_Card_stop")
|
||||
if not self.bEndScore and self._panel.mapLevel.nRoundMultiRatio and self._panel.mapLevel.nRoundRatio and self._panel.mapLevel.nRoundValue and self._panel.mapLevel.nRoundScore then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtRoundScoreBase, self:ThousandsNumber(math.floor(self._panel.mapLevel.nRoundValue)))
|
||||
local nRatio = self._panel.mapLevel.nRoundMultiRatio > 0 and self._panel.mapLevel.nRoundRatio * self._panel.mapLevel.nRoundMultiRatio or self._panel.mapLevel.nRoundRatio
|
||||
NovaAPI.SetTMPText(self._mapNode.txtRoundScoreRatio, string.format("%.1f", nRatio))
|
||||
NovaAPI.SetTMPText(self._mapNode.txtRoundScore, self:ThousandsNumber(math.floor(self._panel.mapLevel.nRoundScore)))
|
||||
end
|
||||
end
|
||||
if self.timerNextRoundOn then
|
||||
self.timerNextRoundOn:Cancel()
|
||||
self.timerNextRoundOn = nil
|
||||
end
|
||||
end
|
||||
function PenguinCardFlipCtrl:PlayScoreAni()
|
||||
self:QuitScoreAni()
|
||||
local bFire = self._panel.mapLevel.nRoundValue >= self.nFireScore
|
||||
local nTextTime = bFire and 0.6 / self._panel.mapLevel.nSpeed or 0.4 / self._panel.mapLevel.nSpeed
|
||||
self.bEndScore = false
|
||||
self.sequence = DOTween.Sequence()
|
||||
if self.mapHandRankScore and self.mapHandRankScore.nBeforeValue ~= self.mapHandRankScore.nAfterValue then
|
||||
local tw1 = DOTween.To(function()
|
||||
return self.mapHandRankScore.nBeforeValue
|
||||
end, function(v)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtRoundScoreBase, self:ThousandsNumber(math.floor(v)))
|
||||
end, self.mapHandRankScore.nAfterValue, nTextTime)
|
||||
local tw2 = self._mapNode.trRoundScoreBase:DOScale(1.2, ScaleUpTime / self._panel.mapLevel.nSpeed):SetEase(Ease.OutQuart)
|
||||
local tw3 = self._mapNode.trRoundScoreBase:DOScale(1, ScaleDownTime / self._panel.mapLevel.nSpeed):SetEase(Ease.InQuad)
|
||||
if bFire then
|
||||
self.sequence:AppendCallback(function()
|
||||
self:PlayFireAni()
|
||||
end)
|
||||
end
|
||||
self.sequence:AppendCallback(function()
|
||||
WwiseManger:PostEvent("Mode_Card_integral")
|
||||
end)
|
||||
self.sequence:Append(tw2)
|
||||
self.sequence:Join(tw1)
|
||||
self.sequence:AppendInterval(ScaleUpTime / self._panel.mapLevel.nSpeed)
|
||||
self.sequence:Append(tw3)
|
||||
end
|
||||
if self.mapHandRankScore and self.mapHandRankScore.nBeforeRatio ~= self.mapHandRankScore.nAfterRatio then
|
||||
local tw1 = DOTween.To(function()
|
||||
return self.mapHandRankScore.nBeforeRatio
|
||||
end, function(v)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtRoundScoreRatio, string.format("%.1f", v))
|
||||
end, self.mapHandRankScore.nAfterRatio, nTextTime)
|
||||
local tw2 = self._mapNode.trRoundScoreRatio:DOScale(1.2, ScaleUpTime / self._panel.mapLevel.nSpeed):SetEase(Ease.OutQuart)
|
||||
local tw3 = self._mapNode.trRoundScoreRatio:DOScale(1, ScaleDownTime / self._panel.mapLevel.nSpeed):SetEase(Ease.InQuad)
|
||||
if bFire then
|
||||
self.sequence:AppendCallback(function()
|
||||
self:PlayFireAni()
|
||||
end)
|
||||
end
|
||||
self.sequence:AppendCallback(function()
|
||||
WwiseManger:PostEvent("Mode_Card_integral")
|
||||
end)
|
||||
self.sequence:Append(tw2)
|
||||
self.sequence:Join(tw1)
|
||||
self.sequence:AppendInterval(ScaleUpTime / self._panel.mapLevel.nSpeed)
|
||||
self.sequence:Append(tw3)
|
||||
end
|
||||
self.sequence:AppendCallback(function()
|
||||
EventManager.Hit("PenguinCardWaitPlay")
|
||||
end)
|
||||
if self.mapHandRankScore and self.mapHandRankScore.nAfterValue ~= self._panel.mapLevel.nRoundValue then
|
||||
local tw1 = DOTween.To(function()
|
||||
return self.mapHandRankScore.nAfterValue
|
||||
end, function(v)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtRoundScoreBase, self:ThousandsNumber(math.floor(v)))
|
||||
end, self._panel.mapLevel.nRoundValue, nTextTime)
|
||||
local tw2 = self._mapNode.trRoundScoreBase:DOScale(1.2, ScaleUpTime / self._panel.mapLevel.nSpeed):SetEase(Ease.OutQuart)
|
||||
local tw3 = self._mapNode.trRoundScoreBase:DOScale(1, ScaleDownTime / self._panel.mapLevel.nSpeed):SetEase(Ease.InQuad)
|
||||
if bFire then
|
||||
self.sequence:AppendCallback(function()
|
||||
self:PlayFireAni()
|
||||
end)
|
||||
end
|
||||
self.sequence:AppendCallback(function()
|
||||
WwiseManger:PostEvent("Mode_Card_integral")
|
||||
end)
|
||||
self.sequence:Append(tw2)
|
||||
self.sequence:Join(tw1)
|
||||
self.sequence:AppendInterval(ScaleUpTime / self._panel.mapLevel.nSpeed)
|
||||
self.sequence:Append(tw3)
|
||||
end
|
||||
local nRatio = self._panel.mapLevel.nRoundMultiRatio > 0 and self._panel.mapLevel.nRoundRatio * self._panel.mapLevel.nRoundMultiRatio or self._panel.mapLevel.nRoundRatio
|
||||
if self.mapHandRankScore and self.mapHandRankScore.nAfterRatio ~= nRatio then
|
||||
local tw1 = DOTween.To(function()
|
||||
return self.mapHandRankScore.nAfterRatio
|
||||
end, function(v)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtRoundScoreRatio, string.format("%.1f", v))
|
||||
end, nRatio, nTextTime)
|
||||
local tw2 = self._mapNode.trRoundScoreRatio:DOScale(1.2, ScaleUpTime / self._panel.mapLevel.nSpeed):SetEase(Ease.OutQuart)
|
||||
local tw3 = self._mapNode.trRoundScoreRatio:DOScale(1, ScaleDownTime / self._panel.mapLevel.nSpeed):SetEase(Ease.InQuad)
|
||||
if bFire then
|
||||
self.sequence:AppendCallback(function()
|
||||
self:PlayFireAni()
|
||||
end)
|
||||
end
|
||||
self.sequence:AppendCallback(function()
|
||||
WwiseManger:PostEvent("Mode_Card_integral")
|
||||
end)
|
||||
self.sequence:Append(tw2)
|
||||
self.sequence:Join(tw1)
|
||||
self.sequence:AppendInterval(ScaleUpTime / self._panel.mapLevel.nSpeed)
|
||||
self.sequence:Append(tw3)
|
||||
end
|
||||
local callback = dotween_callback_handler(self, function()
|
||||
WwiseManger:PostEvent("Mode_Card_coin_stop")
|
||||
end)
|
||||
local tw1 = DOTween.To(function()
|
||||
return 0
|
||||
end, function(v)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtRoundScore, self:ThousandsNumber(math.floor(v)))
|
||||
end, self._panel.mapLevel.nRoundScore, nTextTime):OnComplete(callback)
|
||||
local tw2 = self._mapNode.trRoundScore:DOScale(1.1, ScaleUpTime / self._panel.mapLevel.nSpeed):SetEase(Ease.OutQuart)
|
||||
local tw3 = self._mapNode.trRoundScore:DOScale(1, ScaleDownTime / self._panel.mapLevel.nSpeed):SetEase(Ease.InQuad)
|
||||
self.sequence:AppendCallback(function()
|
||||
WwiseManger:PostEvent("Mode_Card_coin")
|
||||
end)
|
||||
self.sequence:Append(tw2)
|
||||
self.sequence:Join(tw1)
|
||||
self.sequence:AppendInterval(ScaleUpTime / self._panel.mapLevel.nSpeed)
|
||||
self.sequence:Append(tw3)
|
||||
self.sequence:AppendCallback(function()
|
||||
self._mapNode.imgRoundTitleBg:SetActive(true)
|
||||
end)
|
||||
self.sequence:SetUpdate(true)
|
||||
local reset = dotween_callback_handler(self, function()
|
||||
self.bEndScore = true
|
||||
self.timerNextRoundOn = self:AddTimer(1, 3, function()
|
||||
self._mapNode.goNextRoundOn:SetActive(true)
|
||||
end, true, true, true)
|
||||
end)
|
||||
self.sequence:OnComplete(reset)
|
||||
end
|
||||
function PenguinCardFlipCtrl:PlayOutAni()
|
||||
for i = 1, 5 do
|
||||
self._mapNode.PenguinBaseCard[i]:PlayHideAni()
|
||||
end
|
||||
self.animator:Play("PengUinCard_Flip_out", 0, 0)
|
||||
self:QuitScoreAni()
|
||||
end
|
||||
function PenguinCardFlipCtrl:PlayFireAni()
|
||||
self._mapNode.aniRoundScoreBaseBg:Play("PengUinCard_Flip_Score_Hot_01")
|
||||
self._mapNode.aniRoundScoreBaseBg.speed = self._panel.mapLevel.nSpeed
|
||||
self._mapNode.aniRoundScoreRatioBg:Play("PengUinCard_Flip_Score_Hot_02")
|
||||
self._mapNode.aniRoundScoreRatioBg.speed = self._panel.mapLevel.nSpeed
|
||||
end
|
||||
function PenguinCardFlipCtrl:Awake()
|
||||
self.animator = self.gameObject:GetComponent("Animator")
|
||||
self.nFireScore = ConfigTable.GetConfigNumber("PenguinCardFeverScore")
|
||||
end
|
||||
function PenguinCardFlipCtrl:OnEnable()
|
||||
end
|
||||
@@ -197,13 +415,15 @@ function PenguinCardFlipCtrl:OnBtnClick_ShowAll(btn)
|
||||
self._panel.mapLevel:ShowBaseCard()
|
||||
end
|
||||
function PenguinCardFlipCtrl:OnBtnClick_NextRound(btn)
|
||||
self._panel.mapLevel:StopAuto()
|
||||
self:QuitScoreAni()
|
||||
if self._panel.mapLevel.nRoundLimit == self._panel.mapLevel.nCurRound and self._panel.mapLevel.nCurTurn < self._panel.mapLevel.nMaxTurn then
|
||||
local callback = function()
|
||||
self._panel.mapLevel:SwitchGameState()
|
||||
end
|
||||
EventManager.Hit("PenguinCard_OpenLog", self._panel.mapLevel.nCurTurn, false, callback)
|
||||
else
|
||||
self:NextRound()
|
||||
self._panel.mapLevel:SwitchGameState()
|
||||
end
|
||||
end
|
||||
function PenguinCardFlipCtrl:OnBtnClick_Auto(btn)
|
||||
@@ -221,42 +441,52 @@ function PenguinCardFlipCtrl:OnBtnClick_Speed(btn)
|
||||
self._panel.mapLevel:SetAutoSpeed(nSpeed)
|
||||
self:RefreshSpeed()
|
||||
end
|
||||
function PenguinCardFlipCtrl:OnEvent_ChangeRoundScore(nBeforeValue, nBeforeRatio, nBeforeScore)
|
||||
function PenguinCardFlipCtrl:OnEvent_ChangeRoundScore(nBeforeValue, nBeforeRatio, nBeforeScore, bFromHandRank)
|
||||
if bFromHandRank then
|
||||
self.mapHandRankScore = {
|
||||
nBeforeValue = nBeforeValue,
|
||||
nAfterValue = self._panel.mapLevel.nRoundValue,
|
||||
nBeforeRatio = nBeforeRatio,
|
||||
nAfterRatio = self._panel.mapLevel.nRoundMultiRatio > 0 and self._panel.mapLevel.nRoundRatio * self._panel.mapLevel.nRoundMultiRatio or self._panel.mapLevel.nRoundRatio
|
||||
}
|
||||
return
|
||||
end
|
||||
if self._panel.mapLevel.nGameState == 4 then
|
||||
return
|
||||
end
|
||||
local bFire = self._panel.mapLevel.nRoundValue >= self.nFireScore
|
||||
if bFire then
|
||||
self:PlayFireAni()
|
||||
end
|
||||
local nTextTime = bFire and 0.6 / self._panel.mapLevel.nSpeed or 0.4 / self._panel.mapLevel.nSpeed
|
||||
if nBeforeValue ~= self._panel.mapLevel.nRoundValue then
|
||||
WwiseManger:PostEvent("Mode_Card_integral")
|
||||
DOTween.To(function()
|
||||
return nBeforeValue
|
||||
end, function(v)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtRoundScoreBase, self:ThousandsNumber(math.floor(v)))
|
||||
end, self._panel.mapLevel.nRoundValue, 1)
|
||||
end, self._panel.mapLevel.nRoundValue, nTextTime)
|
||||
local callback = dotween_callback_handler(self, function()
|
||||
self._mapNode.trRoundScoreBase:DOScale(1, 0.1)
|
||||
self._mapNode.trRoundScoreBase:DOScale(1, ScaleDownTime / self._panel.mapLevel.nSpeed):SetEase(Ease.InQuad):SetUpdate(true)
|
||||
end)
|
||||
self._mapNode.trRoundScoreBase:DOScale(2, 0.2):SetUpdate(true):OnComplete(callback)
|
||||
self._mapNode.trRoundScoreBase:DOScale(1.2, ScaleUpTime / self._panel.mapLevel.nSpeed):SetEase(Ease.OutQuart):SetUpdate(true):OnComplete(callback)
|
||||
end
|
||||
if nBeforeRatio ~= self._panel.mapLevel.nRoundRatio * self._panel.mapLevel.nRoundMultiRatio then
|
||||
local nRatio = 0 < self._panel.mapLevel.nRoundMultiRatio and self._panel.mapLevel.nRoundRatio * self._panel.mapLevel.nRoundMultiRatio or self._panel.mapLevel.nRoundRatio
|
||||
if nBeforeRatio ~= nRatio then
|
||||
WwiseManger:PostEvent("Mode_Card_integral")
|
||||
DOTween.To(function()
|
||||
return nBeforeRatio
|
||||
end, function(v)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtRoundScoreRatio, string.format("%.1f", v))
|
||||
end, self._panel.mapLevel.nRoundRatio * self._panel.mapLevel.nRoundMultiRatio, 1)
|
||||
end, nRatio, nTextTime)
|
||||
local callback = dotween_callback_handler(self, function()
|
||||
self._mapNode.trRoundScoreRatio:DOScale(1, 0.1)
|
||||
self._mapNode.trRoundScoreRatio:DOScale(1, ScaleDownTime / self._panel.mapLevel.nSpeed):SetEase(Ease.InQuad):SetUpdate(true)
|
||||
end)
|
||||
self._mapNode.trRoundScoreRatio:DOScale(2, 0.2):SetUpdate(true):OnComplete(callback)
|
||||
end
|
||||
if nBeforeScore ~= self._panel.mapLevel.nRoundScore then
|
||||
DOTween.To(function()
|
||||
return nBeforeScore
|
||||
end, function(v)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtRoundScore, self:ThousandsNumber(math.floor(v)))
|
||||
end, self._panel.mapLevel.nRoundScore, 1)
|
||||
local callback = dotween_callback_handler(self, function()
|
||||
self._mapNode.trRoundScore:DOScale(1, 0.1)
|
||||
end)
|
||||
self._mapNode.trRoundScore:DOScale(2, 0.2):SetUpdate(true):OnComplete(callback)
|
||||
self._mapNode.trRoundScoreRatio:DOScale(1.2, ScaleUpTime / self._panel.mapLevel.nSpeed):SetEase(Ease.OutQuart):SetUpdate(true):OnComplete(callback)
|
||||
end
|
||||
end
|
||||
function PenguinCardFlipCtrl:OnEvent_ShowBaseCard(nIndex)
|
||||
self:StartShowAllOn()
|
||||
if nIndex == nil then
|
||||
for i = 1, 5 do
|
||||
self._mapNode.PenguinBaseCard[i]:PlayFlipAni()
|
||||
@@ -272,4 +502,15 @@ function PenguinCardFlipCtrl:OnEvent_ReplaceBaseCard(nIndex)
|
||||
self._mapNode.PenguinBaseCard[nIndex]:PlayReplaceAni()
|
||||
self._mapNode.btnShow[nIndex].interactable = false
|
||||
end
|
||||
function PenguinCardFlipCtrl:OnEvent_Pause()
|
||||
if self.sequence then
|
||||
self.sequence:Pause()
|
||||
WwiseManger:PostEvent("Mode_Card_stop")
|
||||
end
|
||||
end
|
||||
function PenguinCardFlipCtrl:OnEvent_Resume()
|
||||
if self.sequence then
|
||||
self.sequence:Play()
|
||||
end
|
||||
end
|
||||
return PenguinCardFlipCtrl
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
local PenguinCardHandRankCtrl = class("PenguinCardHandRankCtrl", BaseCtrl)
|
||||
local ConfigData = require("GameCore.Data.ConfigData")
|
||||
PenguinCardHandRankCtrl._mapNodeConfig = {
|
||||
blur = {
|
||||
sNodeName = "t_fullscreen_blur_blue"
|
||||
@@ -65,7 +66,7 @@ function PenguinCardHandRankCtrl:OnGridRefresh(goGrid, gridIndex)
|
||||
NovaAPI.SetTMPText(txtName, mapCfg.Title)
|
||||
NovaAPI.SetTMPText(txtDesc, mapCfg.Desc)
|
||||
NovaAPI.SetTMPText(txtScoreBase, self:ThousandsNumber(mapCfg.Value))
|
||||
NovaAPI.SetTMPText(txtScoreRatio, string.format("%.1f", mapCfg.Ratio + 1))
|
||||
NovaAPI.SetTMPText(txtScoreRatio, string.format("%.1f", mapCfg.Ratio * ConfigData.IntFloatPrecision + 1))
|
||||
end
|
||||
end
|
||||
function PenguinCardHandRankCtrl:PlayInAni()
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
local PenguinCardInfoCtrl = class("PenguinCardInfoCtrl", BaseCtrl)
|
||||
local WwiseManger = CS.WwiseAudioManager.Instance
|
||||
local _, NotMaxLevel = ColorUtility.TryParseHtmlString("#FFF7EA")
|
||||
local _, MaxLevel = ColorUtility.TryParseHtmlString("#ffe075")
|
||||
PenguinCardInfoCtrl._mapNodeConfig = {
|
||||
blur = {
|
||||
sNodeName = "t_fullscreen_blur_blue"
|
||||
@@ -14,6 +15,7 @@ PenguinCardInfoCtrl._mapNodeConfig = {
|
||||
txtName = {sComponentName = "TMP_Text"},
|
||||
imgUp = {},
|
||||
txtDesc = {sComponentName = "TMP_Text"},
|
||||
aniInfo = {sNodeName = "goInfo", sComponentName = "Animator"},
|
||||
btnRight = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Right"
|
||||
@@ -42,7 +44,7 @@ PenguinCardInfoCtrl._mapNodeConfig = {
|
||||
}
|
||||
PenguinCardInfoCtrl._mapEventConfig = {
|
||||
PenguinCard_OpenInfo = "Open",
|
||||
PenguinCard_SelectPenguinCard = "Close",
|
||||
PenguinCard_SelectPenguinCard = "OnEvent_Select",
|
||||
PenguinCard_SalePenguinCard = "Close"
|
||||
}
|
||||
function PenguinCardInfoCtrl:Open(mapCard, nSelectIndex)
|
||||
@@ -86,6 +88,7 @@ function PenguinCardInfoCtrl:Refresh()
|
||||
local nAfter = mapUpgradeCard.nLevel + mapSelectCard.nLevel
|
||||
nAfter = nAfter > mapUpgradeCard.nMaxLevel and mapUpgradeCard.nMaxLevel or nAfter
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLevel, orderedFormat(ConfigTable.GetUIText("PenguinCard_CardLevel"), nAfter))
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtLevel, nAfter == mapUpgradeCard.nMaxLevel and MaxLevel or NotMaxLevel)
|
||||
local nId = mapUpgradeCard:GetIdByLevel(mapUpgradeCard.nGroupId, nAfter)
|
||||
local mapCfg = ConfigTable.GetData("PenguinCard", nId)
|
||||
if mapCfg then
|
||||
@@ -96,11 +99,13 @@ function PenguinCardInfoCtrl:Refresh()
|
||||
else
|
||||
self._mapNode.imgUp:SetActive(false)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLevel, orderedFormat(ConfigTable.GetUIText("PenguinCard_CardLevel"), self.mapCard.nLevel))
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtLevel, self.mapCard.nLevel == self.mapCard.nMaxLevel and MaxLevel or NotMaxLevel)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtDesc, self.mapCard.sDesc)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtBtnSelect, ConfigTable.GetUIText("PenguinCard_Btn_Select"))
|
||||
end
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLevel, orderedFormat(ConfigTable.GetUIText("PenguinCard_CardLevel"), self.mapCard.nLevel))
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtLevel, self.mapCard.nLevel == self.mapCard.nMaxLevel and MaxLevel or NotMaxLevel)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtDesc, self.mapCard.sDesc)
|
||||
end
|
||||
end
|
||||
@@ -114,64 +119,103 @@ function PenguinCardInfoCtrl:PlayInAni()
|
||||
cs_coroutine.start(wait)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.3)
|
||||
end
|
||||
function PenguinCardInfoCtrl:Close()
|
||||
function PenguinCardInfoCtrl:Close(bBuy)
|
||||
self.animator:Play("PengUinCard_CardInfo_out")
|
||||
if bBuy == true then
|
||||
self._mapNode.aniInfo:Play("PengUinCard_CardInfo_Card_Give", 0, 0)
|
||||
else
|
||||
self._mapNode.aniInfo:Play("PengUinCard_CardInfo_Card_out", 0, 0)
|
||||
end
|
||||
self._mapNode.aniBlur:SetTrigger("tOut")
|
||||
self:AddTimer(1, 0.2, function()
|
||||
self:AddTimer(1, 0.4, function()
|
||||
self._mapNode.goInfo:SetActive(false)
|
||||
self.gameObject:SetActive(false)
|
||||
self._panel.mapLevel:Resume()
|
||||
end, true, true, true)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.2)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.4)
|
||||
end
|
||||
function PenguinCardInfoCtrl:Awake()
|
||||
self._mapNode.goInfo:SetActive(false)
|
||||
self.animator = self.gameObject:GetComponent("Animator")
|
||||
end
|
||||
function PenguinCardInfoCtrl:OnEnable()
|
||||
end
|
||||
function PenguinCardInfoCtrl:OnDisable()
|
||||
end
|
||||
function PenguinCardInfoCtrl:OnBtnClick_Right()
|
||||
local switch = function(callback)
|
||||
self._mapNode.aniInfo:Play("PengUinCard_CardInfo_Card_out_l", 0, 0)
|
||||
local nAnimTime = NovaAPI.GetAnimClipLength(self._mapNode.aniInfo, {
|
||||
"PengUinCard_CardInfo_Card_out_l"
|
||||
})
|
||||
self:AddTimer(1, nAnimTime, function()
|
||||
callback()
|
||||
self._mapNode.aniInfo:Play("PengUinCard_CardInfo_Card_in_r", 0, 0)
|
||||
end, true, true, true)
|
||||
end
|
||||
if self.bSelect then
|
||||
local nMax = #self._panel.mapLevel.tbSelectablePenguinCard
|
||||
if nMax > self.nSelectIndex then
|
||||
self.nSelectIndex = self.nSelectIndex + 1
|
||||
else
|
||||
self.nSelectIndex = 1
|
||||
local callback = function()
|
||||
local nMax = #self._panel.mapLevel.tbSelectablePenguinCard
|
||||
if nMax > self.nSelectIndex then
|
||||
self.nSelectIndex = self.nSelectIndex + 1
|
||||
else
|
||||
self.nSelectIndex = 1
|
||||
end
|
||||
self.mapCard = self._panel.mapLevel.tbSelectablePenguinCard[self.nSelectIndex]
|
||||
self:Refresh()
|
||||
end
|
||||
self.mapCard = self._panel.mapLevel.tbSelectablePenguinCard[self.nSelectIndex]
|
||||
self:Refresh()
|
||||
switch(callback)
|
||||
else
|
||||
local nMax = #self.tbHasIndex
|
||||
local nIndex = table.indexof(self.tbHasIndex, self.mapCard.nSlotIndex)
|
||||
if nMax > nIndex then
|
||||
nIndex = nIndex + 1
|
||||
else
|
||||
nIndex = 1
|
||||
local callback = function()
|
||||
local nMax = #self.tbHasIndex
|
||||
local nIndex = table.indexof(self.tbHasIndex, self.mapCard.nSlotIndex)
|
||||
if nMax > nIndex then
|
||||
nIndex = nIndex + 1
|
||||
else
|
||||
nIndex = 1
|
||||
end
|
||||
self.mapCard = self._panel.mapLevel.tbPenguinCard[self.tbHasIndex[nIndex]]
|
||||
self:Refresh()
|
||||
end
|
||||
self.mapCard = self._panel.mapLevel.tbPenguinCard[self.tbHasIndex[nIndex]]
|
||||
self:Refresh()
|
||||
switch(callback)
|
||||
end
|
||||
end
|
||||
function PenguinCardInfoCtrl:OnBtnClick_Left()
|
||||
local switch = function(callback)
|
||||
self._mapNode.aniInfo:Play("PengUinCard_CardInfo_Card_out_r", 0, 0)
|
||||
local nAnimTime = NovaAPI.GetAnimClipLength(self._mapNode.aniInfo, {
|
||||
"PengUinCard_CardInfo_Card_out_r"
|
||||
})
|
||||
self:AddTimer(1, nAnimTime, function()
|
||||
callback()
|
||||
self._mapNode.aniInfo:Play("PengUinCard_CardInfo_Card_in_l", 0, 0)
|
||||
end, true, true, true)
|
||||
end
|
||||
if self.bSelect then
|
||||
local nMax = #self._panel.mapLevel.tbSelectablePenguinCard
|
||||
if self.nSelectIndex > 1 then
|
||||
self.nSelectIndex = self.nSelectIndex - 1
|
||||
else
|
||||
self.nSelectIndex = nMax
|
||||
local callback = function()
|
||||
local nMax = #self._panel.mapLevel.tbSelectablePenguinCard
|
||||
if self.nSelectIndex > 1 then
|
||||
self.nSelectIndex = self.nSelectIndex - 1
|
||||
else
|
||||
self.nSelectIndex = nMax
|
||||
end
|
||||
self.mapCard = self._panel.mapLevel.tbSelectablePenguinCard[self.nSelectIndex]
|
||||
self:Refresh()
|
||||
end
|
||||
self.mapCard = self._panel.mapLevel.tbSelectablePenguinCard[self.nSelectIndex]
|
||||
self:Refresh()
|
||||
switch(callback)
|
||||
else
|
||||
local nMax = #self.tbHasIndex
|
||||
local nIndex = table.indexof(self.tbHasIndex, self.mapCard.nSlotIndex)
|
||||
if 1 < nIndex then
|
||||
nIndex = nIndex - 1
|
||||
else
|
||||
nIndex = nMax
|
||||
local callback = function()
|
||||
local nMax = #self.tbHasIndex
|
||||
local nIndex = table.indexof(self.tbHasIndex, self.mapCard.nSlotIndex)
|
||||
if 1 < nIndex then
|
||||
nIndex = nIndex - 1
|
||||
else
|
||||
nIndex = nMax
|
||||
end
|
||||
self.mapCard = self._panel.mapLevel.tbPenguinCard[self.tbHasIndex[nIndex]]
|
||||
self:Refresh()
|
||||
end
|
||||
self.mapCard = self._panel.mapLevel.tbPenguinCard[self.tbHasIndex[nIndex]]
|
||||
self:Refresh()
|
||||
switch(callback)
|
||||
end
|
||||
end
|
||||
function PenguinCardInfoCtrl:OnBtnClick_Sale()
|
||||
@@ -190,4 +234,10 @@ function PenguinCardInfoCtrl:OnBtnClick_Select()
|
||||
end
|
||||
self._panel.mapLevel:SelectPenguinCard(self.nSelectIndex)
|
||||
end
|
||||
function PenguinCardInfoCtrl:OnEvent_Select()
|
||||
self:Close(true)
|
||||
end
|
||||
function PenguinCardInfoCtrl:OnEvent_Sale()
|
||||
self:Close(false)
|
||||
end
|
||||
return PenguinCardInfoCtrl
|
||||
|
||||
@@ -1,39 +1,69 @@
|
||||
local PenguinCardItemCtrl = class("PenguinCardItemCtrl", BaseCtrl)
|
||||
local WwiseManger = CS.WwiseAudioManager.Instance
|
||||
local _, NotMaxLevel = ColorUtility.TryParseHtmlString("#FFF7EA")
|
||||
local _, MaxLevel = ColorUtility.TryParseHtmlString("#ffe075")
|
||||
PenguinCardItemCtrl._mapNodeConfig = {
|
||||
AnimRoot = {sComponentName = "Animator"},
|
||||
imgBg = {},
|
||||
imgIcon = {sComponentName = "Image"},
|
||||
txtLevel = {sComponentName = "TMP_Text"},
|
||||
txtName = {sComponentName = "TMP_Text"},
|
||||
imgUp = {},
|
||||
txtTrigger = {nCount = 2, sComponentName = "TMP_Text"},
|
||||
aniTrigger = {
|
||||
sNodeName = "txtTrigger",
|
||||
nCount = 2,
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
goTrigger = {},
|
||||
btnOpenInfo = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_OpenInfo"
|
||||
}
|
||||
}
|
||||
PenguinCardItemCtrl._mapEventConfig = {
|
||||
PenguinCardTriggered = "OnEvent_Triggered"
|
||||
PenguinCardTriggered = "OnEvent_Triggered",
|
||||
PenguinCardWaitPlay = "OnEvent_WaitPlay"
|
||||
}
|
||||
function PenguinCardItemCtrl:Refresh_Select(mapCard, nSelectIndex)
|
||||
function PenguinCardItemCtrl:Refresh_Select(mapCard, nSelectIndex, bRoll)
|
||||
self.mapCard = mapCard
|
||||
self.nSelectIndex = nSelectIndex
|
||||
self._mapNode.txtLevel.gameObject:SetActive(false)
|
||||
self._mapNode.txtName.gameObject:SetActive(true)
|
||||
self._mapNode.imgBg:SetActive(true)
|
||||
self._mapNode.imgBg:SetActive(bRoll)
|
||||
self._mapNode.imgIcon.gameObject:SetActive(true)
|
||||
self._mapNode.goTrigger:SetActive(false)
|
||||
self:SetSprite(self._mapNode.imgIcon, "UI/Play_PenguinCard/SpriteAtlas/Sprite/" .. mapCard.sIcon)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtName, mapCard.sName)
|
||||
local bUpgrade = self._panel.mapLevel:CheckUpgradePenguinCard(mapCard)
|
||||
self._mapNode.imgUp:SetActive(bUpgrade)
|
||||
self._mapNode.AnimRoot:Play("PengUinCard_Bd_Shopin", 0, 0)
|
||||
end
|
||||
function PenguinCardItemCtrl:Refresh_Slot(mapCard)
|
||||
self.mapCard = mapCard
|
||||
self.nEffectCount = 0
|
||||
self.bWaitPlay = false
|
||||
self._mapNode.txtLevel.gameObject:SetActive(true)
|
||||
self._mapNode.txtName.gameObject:SetActive(false)
|
||||
self._mapNode.imgBg:SetActive(false)
|
||||
self._mapNode.imgUp:SetActive(false)
|
||||
self._mapNode.goTrigger:SetActive(false)
|
||||
self:SetSprite(self._mapNode.imgIcon, "UI/Play_PenguinCard/SpriteAtlas/Sprite/" .. mapCard.sIcon)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLevel, orderedFormat(ConfigTable.GetUIText("PenguinCard_CardLevel"), mapCard.nLevel))
|
||||
if mapCard.nLevel == mapCard.nMaxLevel then
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtLevel, MaxLevel)
|
||||
else
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtLevel, NotMaxLevel)
|
||||
end
|
||||
end
|
||||
function PenguinCardItemCtrl:RefreshUpgrade(nGroupId)
|
||||
if self.mapCard.nGroupId == nGroupId then
|
||||
self._mapNode.imgUp:SetActive(false)
|
||||
end
|
||||
end
|
||||
function PenguinCardItemCtrl:PlayFlipAni()
|
||||
self._mapNode.imgBg:SetActive(true)
|
||||
self._mapNode.txtName.gameObject:SetActive(false)
|
||||
self._mapNode.AnimRoot:Play("PengUinCard_Bd_Shopturn", 0, 0)
|
||||
local nAnimTime = NovaAPI.GetAnimClipLength(self._mapNode.AnimRoot, {
|
||||
"PengUinCard_Bd_Shopturn"
|
||||
@@ -47,6 +77,7 @@ function PenguinCardItemCtrl:PlayHideAni()
|
||||
end
|
||||
function PenguinCardItemCtrl:PlaySelectAni(callback)
|
||||
self._mapNode.AnimRoot:Play("PengUinCard_Bd_Bdin", 0, 0)
|
||||
WwiseManger:PostEvent("Mode_Card_appear")
|
||||
local nAnimTime = NovaAPI.GetAnimClipLength(self._mapNode.AnimRoot, {
|
||||
"PengUinCard_Bd_Bdin"
|
||||
})
|
||||
@@ -58,6 +89,7 @@ function PenguinCardItemCtrl:PlaySelectAni(callback)
|
||||
end
|
||||
function PenguinCardItemCtrl:PlayUpgradeAni(callback)
|
||||
self._mapNode.AnimRoot:Play("PengUinCard_Bd_Up", 0, 0)
|
||||
WwiseManger:PostEvent("Mode_Card_levelup")
|
||||
self:AddTimer(1, 0.2, function()
|
||||
if callback then
|
||||
callback()
|
||||
@@ -65,7 +97,9 @@ function PenguinCardItemCtrl:PlayUpgradeAni(callback)
|
||||
end, true, true, true)
|
||||
end
|
||||
function PenguinCardItemCtrl:PlaySaleAni(callback)
|
||||
self._mapNode.goTrigger:SetActive(false)
|
||||
self._mapNode.AnimRoot:Play("PengUinCard_Bd_Bdout", 0, 0)
|
||||
WwiseManger:PostEvent("Mode_Card_giveup")
|
||||
local nAnimTime = NovaAPI.GetAnimClipLength(self._mapNode.AnimRoot, {
|
||||
"PengUinCard_Bd_Bdout"
|
||||
})
|
||||
@@ -75,6 +109,53 @@ function PenguinCardItemCtrl:PlaySaleAni(callback)
|
||||
end
|
||||
end, true, true, true)
|
||||
end
|
||||
function PenguinCardItemCtrl:PlayTriggerAni()
|
||||
if self.bTriggerCd then
|
||||
self:PlayEffectAni()
|
||||
return
|
||||
end
|
||||
if not self.bTriggerCd then
|
||||
self.bTriggerCd = true
|
||||
self:AddTimer(1, 1.433, function()
|
||||
self.bTriggerCd = false
|
||||
end, true, true, true)
|
||||
end
|
||||
self._mapNode.AnimRoot:Play("PengUinCard_Bd_Open", 0, 0)
|
||||
self._mapNode.AnimRoot.speed = self._panel.mapLevel.nSpeed
|
||||
WwiseManger:PostEvent("Mode_Card_cast")
|
||||
self.nEffectCount = 0
|
||||
self:PlayEffectAni()
|
||||
end
|
||||
function PenguinCardItemCtrl:PlayEffectAni()
|
||||
if self.nEffectCount == nil then
|
||||
self.nEffectCount = 0
|
||||
end
|
||||
local sDesc = ""
|
||||
if self.mapCard.nEffectType == GameEnum.PenguinCardEffectType.IncreaseBasicChips then
|
||||
self.nEffectCount = self.nEffectCount + self.mapCard.tbEffectParam[1]
|
||||
sDesc = orderedFormat(ConfigTable.GetUIText("PenguinCard_Trigger_AddScore"), self.nEffectCount)
|
||||
elseif self.mapCard.nEffectType == GameEnum.PenguinCardEffectType.IncreaseMultiplier then
|
||||
self.nEffectCount = self.nEffectCount + self.mapCard.tbEffectParam[1]
|
||||
sDesc = orderedFormat(ConfigTable.GetUIText("PenguinCard_Trigger_AddRatio"), self.nEffectCount)
|
||||
elseif self.mapCard.nEffectType == GameEnum.PenguinCardEffectType.MultiMultiplier then
|
||||
self.nEffectCount = self.nEffectCount + self.mapCard.tbEffectParam[1]
|
||||
sDesc = orderedFormat(ConfigTable.GetUIText("PenguinCard_Trigger_MultiRatio"), self.nEffectCount)
|
||||
end
|
||||
self._mapNode.goTrigger:SetActive(sDesc ~= "")
|
||||
if self.mapCard.nEffectType == GameEnum.PenguinCardEffectType.IncreaseBasicChips then
|
||||
self._mapNode.txtTrigger[1].gameObject:SetActive(false)
|
||||
self._mapNode.txtTrigger[2].gameObject:SetActive(true)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTrigger[2], sDesc)
|
||||
self._mapNode.aniTrigger[2]:Play("PengUinCard_Bd_Trigger_in", 0, 0)
|
||||
self._mapNode.aniTrigger[2].speed = self._panel.mapLevel.nSpeed
|
||||
elseif self.mapCard.nEffectType == GameEnum.PenguinCardEffectType.IncreaseMultiplier or self.mapCard.nEffectType == GameEnum.PenguinCardEffectType.MultiMultiplier then
|
||||
self._mapNode.txtTrigger[1].gameObject:SetActive(true)
|
||||
self._mapNode.txtTrigger[2].gameObject:SetActive(false)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTrigger[1], sDesc)
|
||||
self._mapNode.aniTrigger[1]:Play("PengUinCard_Bd_Trigger_in", 0, 0)
|
||||
self._mapNode.aniTrigger[1].speed = self._panel.mapLevel.nSpeed
|
||||
end
|
||||
end
|
||||
function PenguinCardItemCtrl:Awake()
|
||||
end
|
||||
function PenguinCardItemCtrl:OnEnable()
|
||||
@@ -91,7 +172,16 @@ function PenguinCardItemCtrl:OnEvent_Triggered(nSlotIndex)
|
||||
if not (self.mapCard and self.mapCard ~= 0 and self.mapCard.nSlotIndex) or nSlotIndex ~= self.mapCard.nSlotIndex then
|
||||
return
|
||||
end
|
||||
self._mapNode.AnimRoot:Play("PengUinCard_Bd_Open", 0, 0)
|
||||
self._mapNode.AnimRoot.speed = self._panel.mapLevel.nSpeed
|
||||
if self.mapCard.nTriggerPhase == GameEnum.PenguinCardTriggerPhase.Settlement then
|
||||
self.bWaitPlay = true
|
||||
return
|
||||
end
|
||||
self:PlayTriggerAni()
|
||||
end
|
||||
function PenguinCardItemCtrl:OnEvent_WaitPlay()
|
||||
if self.bWaitPlay == true then
|
||||
self.bWaitPlay = false
|
||||
self:PlayTriggerAni()
|
||||
end
|
||||
end
|
||||
return PenguinCardItemCtrl
|
||||
|
||||
@@ -77,7 +77,7 @@ function PenguinCardLevelGridCtrl:RefreshLock(nLevelId)
|
||||
local sTip = ConfigTable.GetUIText("PenguinCard_Level_LockLevel")
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLock, sTip)
|
||||
self.bLock = true
|
||||
self.sLockTip = sTip
|
||||
self.sLockTip = ConfigTable.GetUIText("PenguinCard_Level_LockLevelTips")
|
||||
return
|
||||
end
|
||||
self._mapNode.goMask:SetActive(false)
|
||||
@@ -122,14 +122,24 @@ function PenguinCardLevelGridCtrl:EnterLevel()
|
||||
if not bOpen then
|
||||
EventManager.Hit(EventId.OpenMessageBox, {
|
||||
nType = AllEnum.MessageBox.Alert,
|
||||
sContent = ConfigTable.GetUIText("Activity_Invalid_Tip_3")
|
||||
sContent = ConfigTable.GetUIText("Activity_Invalid_Tip_3"),
|
||||
callbackConfirm = function()
|
||||
PanelManager.Home()
|
||||
end,
|
||||
callbackCancel = function()
|
||||
PanelManager.Home()
|
||||
end
|
||||
})
|
||||
return
|
||||
end
|
||||
if self.bLock then
|
||||
EventManager.Hit(EventId.OpenMessageBox, self.sLockTip)
|
||||
return
|
||||
end
|
||||
self.actData:EnterLevel(self.nLevelId)
|
||||
local callback = function()
|
||||
self.actData:EnterLevel(self.nLevelId)
|
||||
end
|
||||
EventManager.Hit("PenguinCard_EnterLevel", callback)
|
||||
end
|
||||
function PenguinCardLevelGridCtrl:Awake()
|
||||
end
|
||||
@@ -138,9 +148,7 @@ end
|
||||
function PenguinCardLevelGridCtrl:OnDisable()
|
||||
end
|
||||
function PenguinCardLevelGridCtrl:OnBtnClick_Level()
|
||||
local callback = function()
|
||||
self:EnterLevel()
|
||||
end
|
||||
EventManager.Hit("PenguinCard_ClickLevel", self.gameObject, callback)
|
||||
self:EnterLevel()
|
||||
EventManager.Hit("PenguinCard_ClickLevel", self.gameObject)
|
||||
end
|
||||
return PenguinCardLevelGridCtrl
|
||||
|
||||
@@ -41,8 +41,14 @@ function PenguinCardLogCtrl:Open(nTurn, bAll, callback)
|
||||
self.nMax = self._panel.mapLevel.nCurTurn
|
||||
self.nTurn = nTurn
|
||||
self.callback = callback
|
||||
self._mapNode.btnRight.gameObject:SetActive(bAll)
|
||||
self._mapNode.btnLeft.gameObject:SetActive(bAll)
|
||||
if self._panel.mapLevel.mapLog[self.nMax] == nil then
|
||||
self.nMax = self.nMax - 1
|
||||
if self.nTurn > self.nMax then
|
||||
self.nTurn = self.nMax
|
||||
end
|
||||
end
|
||||
self._mapNode.btnRight.gameObject:SetActive(bAll and self.nMax > 1)
|
||||
self._mapNode.btnLeft.gameObject:SetActive(bAll and self.nMax > 1)
|
||||
self:PlayInAni()
|
||||
self:Refresh()
|
||||
end
|
||||
@@ -54,6 +60,7 @@ function PenguinCardLogCtrl:Refresh()
|
||||
local nCount = #self.tbRound
|
||||
self._mapNode.sv.gameObject:SetActive(0 < nCount)
|
||||
if 0 < nCount then
|
||||
self._mapNode.sv:SetAnim(0.08)
|
||||
self._mapNode.sv:Init(nCount, self, self.OnGridRefresh)
|
||||
end
|
||||
end
|
||||
@@ -81,26 +88,25 @@ end
|
||||
function PenguinCardLogCtrl:PlayInAni()
|
||||
self.gameObject:SetActive(true)
|
||||
self._mapNode.blur:SetActive(true)
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
self._mapNode.window:SetActive(true)
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
self._mapNode.window:SetActive(true)
|
||||
WwiseManger:PostEvent("Mode_Card_sum")
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.3)
|
||||
end
|
||||
function PenguinCardLogCtrl:Close()
|
||||
self.animator:Play("PengUinCard_Log_out")
|
||||
self._mapNode.aniBlur:SetTrigger("tOut")
|
||||
self:AddTimer(1, 0.2, function()
|
||||
self:AddTimer(1, 0.333, function()
|
||||
self._mapNode.window:SetActive(false)
|
||||
self.gameObject:SetActive(false)
|
||||
if self.callback then
|
||||
self.callback()
|
||||
end
|
||||
end, true, true, true)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.2)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.333)
|
||||
end
|
||||
function PenguinCardLogCtrl:Awake()
|
||||
self._mapNode.window:SetActive(false)
|
||||
self.animator = self.gameObject:GetComponent("Animator")
|
||||
end
|
||||
function PenguinCardLogCtrl:OnEnable()
|
||||
end
|
||||
|
||||
@@ -72,7 +72,7 @@ function PenguinCardPauseCtrl:Refresh()
|
||||
for i, v in ipairs(self._panel.mapLevel.tbStarScore) do
|
||||
self._mapNode.imgStarOff[i]:SetActive(v > self._panel.mapLevel.nScore)
|
||||
self._mapNode.imgStarOn[i]:SetActive(v <= self._panel.mapLevel.nScore)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTarget[i], orderedFormat(ConfigTable.GetUIText("PenguinCard_Pause_StarDesc"), v))
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTarget[i], orderedFormat(ConfigTable.GetUIText("PenguinCard_Pause_StarDesc"), self:ThousandsNumber(v)))
|
||||
end
|
||||
end
|
||||
function PenguinCardPauseCtrl:PlayInAni()
|
||||
@@ -109,13 +109,13 @@ end
|
||||
function PenguinCardPauseCtrl:OnBtnClick_Giveup()
|
||||
self:Close()
|
||||
self:AddTimer(1, 0.2, function()
|
||||
self._panel.mapLevel:GiveupGame()
|
||||
self._panel.mapLevel:CompleteGame()
|
||||
end, true, true, true)
|
||||
end
|
||||
function PenguinCardPauseCtrl:OnBtnClick_Restart()
|
||||
self:Close()
|
||||
self:AddTimer(1, 0.2, function()
|
||||
self._panel.mapLevel:StartGame()
|
||||
self._panel.mapLevel:RestartGame()
|
||||
end, true, true, true)
|
||||
end
|
||||
return PenguinCardPauseCtrl
|
||||
|
||||
@@ -4,6 +4,9 @@ local _, Black = ColorUtility.TryParseHtmlString("#3E3C5B")
|
||||
local _, Red = ColorUtility.TryParseHtmlString("#ef3d5c")
|
||||
local _, LineOff = ColorUtility.TryParseHtmlString("#8C8296")
|
||||
local _, LineOn = ColorUtility.TryParseHtmlString("#756980")
|
||||
local StarPos1 = 144
|
||||
local StarPos2 = 218
|
||||
local StarPos3 = 277
|
||||
PenguinCardPrepareCtrl._mapNodeConfig = {
|
||||
txtAddMax = {
|
||||
nCount = 3,
|
||||
@@ -51,6 +54,8 @@ PenguinCardPrepareCtrl._mapNodeConfig = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
txtLeftTurn = {sComponentName = "TMP_Text"},
|
||||
imgDescBg = {},
|
||||
txtLevelDesc = {sComponentName = "TMP_Text"},
|
||||
txtSelectTip = {sComponentName = "TMP_Text"},
|
||||
PenguinCardItem = {
|
||||
nCount = 3,
|
||||
@@ -62,6 +67,7 @@ PenguinCardPrepareCtrl._mapNodeConfig = {
|
||||
},
|
||||
txtBtnRoll = {sComponentName = "TMP_Text"},
|
||||
txtRollCost = {sComponentName = "TMP_Text"},
|
||||
trBtnRoll = {sNodeName = "btnRoll", sComponentName = "Transform"},
|
||||
btnStartTurn = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_StartTurn"
|
||||
@@ -69,7 +75,20 @@ PenguinCardPrepareCtrl._mapNodeConfig = {
|
||||
txtBtnStartTurn = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "PenguinCard_Btn_NextTurn"
|
||||
}
|
||||
},
|
||||
btnWin = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Win"
|
||||
},
|
||||
txtBtnWin = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "PenguinCard_Btn_Win"
|
||||
},
|
||||
txtWinTip = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "PenguinCard_WinTip"
|
||||
},
|
||||
aniWin = {sNodeName = "--Info--", sComponentName = "Animator"}
|
||||
}
|
||||
PenguinCardPrepareCtrl._mapEventConfig = {
|
||||
PenguinCard_AddRound = "OnEvent_AddRound",
|
||||
@@ -77,7 +96,8 @@ PenguinCardPrepareCtrl._mapEventConfig = {
|
||||
PenguinCard_AddRoll = "OnEvent_AddRoll",
|
||||
PenguinCard_ChangeScore = "OnEvent_ChangeScore",
|
||||
PenguinCard_RollPenguinCard = "OnEvent_RollPenguinCard",
|
||||
PenguinCard_SelectPenguinCard = "OnEvent_SelectPenguinCard"
|
||||
PenguinCard_SelectPenguinCard = "OnEvent_SelectPenguinCard",
|
||||
PenguinCard_SalePenguinCard = "OnEvent_SalePenguinCard"
|
||||
}
|
||||
function PenguinCardPrepareCtrl:Refresh()
|
||||
self:RefreshAddRound()
|
||||
@@ -86,6 +106,7 @@ function PenguinCardPrepareCtrl:Refresh()
|
||||
self:RefreshScore()
|
||||
self:RefreshLeftTurn()
|
||||
self:RefreshRoll()
|
||||
self:RefreshWin()
|
||||
end
|
||||
function PenguinCardPrepareCtrl:RefreshAddRound()
|
||||
local bMax = self._panel.mapLevel.nRoundLimit >= self._panel.mapLevel.nMaxRound
|
||||
@@ -137,15 +158,11 @@ function PenguinCardPrepareCtrl:RefreshAddRollCost()
|
||||
end
|
||||
function PenguinCardPrepareCtrl:RefreshScore()
|
||||
NovaAPI.SetTMPText(self._mapNode.txtScore, self:ThousandsNumber(clearFloat(self._panel.mapLevel.nScore)))
|
||||
local nMax = self._panel.mapLevel.tbStarScore[3]
|
||||
if nMax == 0 then
|
||||
nMax = self._panel.mapLevel.nScore
|
||||
if self._panel.mapLevel.tbStarScore[3] > 0 then
|
||||
local nStar = self._panel.mapLevel:GetStar()
|
||||
local nPos = self:GetStarPos(nStar, self._panel.mapLevel.nScore)
|
||||
self._mapNode.imgStarProgress.sizeDelta = Vector2(nPos, 24)
|
||||
end
|
||||
local nP = self._panel.mapLevel.nScore / nMax
|
||||
if 1 < nP then
|
||||
nP = 1
|
||||
end
|
||||
self._mapNode.imgStarProgress.sizeDelta = Vector2(nP * 276.94, 24)
|
||||
for i, v in ipairs(self._panel.mapLevel.tbStarScore) do
|
||||
self._mapNode.imgStarOff[i]:SetActive(v > self._panel.mapLevel.nScore)
|
||||
self._mapNode.imgStarOn[i]:SetActive(v <= self._panel.mapLevel.nScore)
|
||||
@@ -153,22 +170,59 @@ function PenguinCardPrepareCtrl:RefreshScore()
|
||||
NovaAPI.SetImageColor(self._mapNode.imgLine[i], v > self._panel.mapLevel.nScore and LineOff or LineOn)
|
||||
end
|
||||
end
|
||||
self._mapNode.imgDescBg.gameObject:SetActive(self._panel.mapLevel.sLevelDesc ~= "")
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLevelDesc, self._panel.mapLevel.sLevelDesc)
|
||||
end
|
||||
function PenguinCardPrepareCtrl:GetStarPos(nStar, nScore)
|
||||
nStar = nStar + 1
|
||||
if nStar < 1 then
|
||||
nStar = 1
|
||||
end
|
||||
if 3 < nStar then
|
||||
nStar = 3
|
||||
end
|
||||
local nMax = self._panel.mapLevel.tbStarScore[nStar]
|
||||
if nStar == 1 then
|
||||
local nP = nScore / nMax
|
||||
if 1 < nP then
|
||||
nP = 1
|
||||
end
|
||||
return nP * StarPos1
|
||||
elseif nStar == 2 then
|
||||
local nStarScore1 = self._panel.mapLevel.tbStarScore[1]
|
||||
local nIntervalScore = nMax - nStarScore1
|
||||
local nIntervalPos = StarPos2 - StarPos1
|
||||
local nP = (nScore - nStarScore1) / nIntervalScore
|
||||
if 1 < nP then
|
||||
nP = 1
|
||||
end
|
||||
return nP * nIntervalPos + StarPos1
|
||||
elseif nStar == 3 then
|
||||
local nStarScore2 = self._panel.mapLevel.tbStarScore[2]
|
||||
local nIntervalScore = nMax - nStarScore2
|
||||
local nIntervalPos = StarPos3 - StarPos2
|
||||
local nP = (nScore - nStarScore2) / nIntervalScore
|
||||
if 1 < nP then
|
||||
nP = 1
|
||||
end
|
||||
return nP * nIntervalPos + StarPos2
|
||||
end
|
||||
end
|
||||
function PenguinCardPrepareCtrl:RefreshLeftTurn()
|
||||
local nLeft = self._panel.mapLevel.nMaxTurn - self._panel.mapLevel.nCurTurn + 1
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLeftTurn, orderedFormat(ConfigTable.GetUIText("PenguinCard_LeftTurn"), nLeft))
|
||||
end
|
||||
function PenguinCardPrepareCtrl:RefreshRoll()
|
||||
self:RefreshRollCard()
|
||||
function PenguinCardPrepareCtrl:RefreshRoll(bRoll)
|
||||
self:RefreshRollCard(bRoll)
|
||||
self:RefreshRollDesc()
|
||||
self:RefreshRollCost()
|
||||
end
|
||||
function PenguinCardPrepareCtrl:RefreshRollCard()
|
||||
function PenguinCardPrepareCtrl:RefreshRollCard(bRoll)
|
||||
local nMax = #self._panel.mapLevel.tbSelectablePenguinCard
|
||||
for i = 1, 3 do
|
||||
self._mapNode.PenguinCardItem[i].gameObject:SetActive(i <= nMax)
|
||||
if i <= nMax then
|
||||
self._mapNode.PenguinCardItem[i]:Refresh_Select(self._panel.mapLevel.tbSelectablePenguinCard[i], i)
|
||||
self._mapNode.PenguinCardItem[i]:Refresh_Select(self._panel.mapLevel.tbSelectablePenguinCard[i], i, bRoll)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -202,17 +256,40 @@ function PenguinCardPrepareCtrl:RefreshRollCost()
|
||||
NovaAPI.SetTMPText(self._mapNode.txtRollCost, self:ThousandsNumber(nCost))
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtRollCost, nCost > self._panel.mapLevel.nScore and Red or White_Normal)
|
||||
end
|
||||
function PenguinCardPrepareCtrl:StartTurn()
|
||||
local nMax = #self._panel.mapLevel.tbSelectablePenguinCard
|
||||
for i = 1, nMax do
|
||||
self._mapNode.PenguinCardItem[i]:PlayHideAni()
|
||||
function PenguinCardPrepareCtrl:RefreshWin()
|
||||
local nStar = self._panel.mapLevel:GetStar()
|
||||
if self._panel.mapLevel.bPreTurnWin then
|
||||
self._mapNode.imgStarOff[3]:SetActive(true)
|
||||
self._mapNode.imgStarOn[3]:SetActive(false)
|
||||
self._mapNode.btnWin.gameObject:SetActive(false)
|
||||
self._mapNode.txtWinTip.gameObject:SetActive(false)
|
||||
self:AddTimer(1, 0.7, function()
|
||||
self._mapNode.btnWin.gameObject:SetActive(true)
|
||||
self._mapNode.txtWinTip.gameObject:SetActive(true)
|
||||
self._mapNode.btnWin.interactable = true
|
||||
self._mapNode.imgStarOff[3]:SetActive(false)
|
||||
self._mapNode.imgStarOn[3]:SetActive(true)
|
||||
self._mapNode.aniWin:Play("PengUinCard_Prepare_Info_Win")
|
||||
WwiseManger:PostEvent("Mode_Card_level_win")
|
||||
end, true, true, true)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.7)
|
||||
else
|
||||
self._mapNode.btnWin.gameObject:SetActive(nStar == 3)
|
||||
self._mapNode.txtWinTip.gameObject:SetActive(nStar == 3)
|
||||
self._mapNode.btnWin.interactable = nStar == 3
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtBtnStartTurn, nStar == 3 and ConfigTable.GetUIText("PenguinCard_Btn_ContinueTurn") or ConfigTable.GetUIText("PenguinCard_Btn_NextTurn"))
|
||||
end
|
||||
function PenguinCardPrepareCtrl:PlayOutAni()
|
||||
self.animator:Play("PengUinCard_Prepare_out", 0, 0)
|
||||
for i = 1, 3 do
|
||||
if self._mapNode.PenguinCardItem[i].gameObject.activeSelf == true then
|
||||
self._mapNode.PenguinCardItem[i]:PlayHideAni()
|
||||
end
|
||||
end
|
||||
self:AddTimer(1, 0.5, function()
|
||||
self._panel.mapLevel:SwitchGameState()
|
||||
end, true, true, true)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.5)
|
||||
end
|
||||
function PenguinCardPrepareCtrl:Awake()
|
||||
self.animator = self.gameObject:GetComponent("Animator")
|
||||
end
|
||||
function PenguinCardPrepareCtrl:OnEnable()
|
||||
end
|
||||
@@ -230,24 +307,36 @@ end
|
||||
function PenguinCardPrepareCtrl:OnBtnClick_Roll(btn)
|
||||
self._panel.mapLevel:RollPenguinCard()
|
||||
end
|
||||
function PenguinCardPrepareCtrl:OnBtnClick_Win(btn)
|
||||
self._panel.mapLevel:CompleteGame()
|
||||
end
|
||||
function PenguinCardPrepareCtrl:OnBtnClick_StartTurn(btn)
|
||||
if not self._panel.mapLevel.bSelectedPenguinCard then
|
||||
local bWarn = self._panel.mapLevel.bWarning
|
||||
if not self._panel.mapLevel.bSelectedPenguinCard and bWarn then
|
||||
local isSelectAgain = false
|
||||
local confirmCallback = function()
|
||||
self._panel.mapLevel:SetWarning(not isSelectAgain)
|
||||
self._panel.mapLevel:SwitchGameState()
|
||||
end
|
||||
local againCallback = function(isSelect)
|
||||
isSelectAgain = isSelect
|
||||
end
|
||||
local msg = {
|
||||
nType = AllEnum.MessageBox.Confirm,
|
||||
sContent = ConfigTable.GetUIText("PenguinCard_Tip_NotSelectedPenguinCard"),
|
||||
callbackConfirm = function()
|
||||
self:StartTurn()
|
||||
end
|
||||
callbackConfirm = confirmCallback,
|
||||
callbackAgain = againCallback
|
||||
}
|
||||
EventManager.Hit(EventId.OpenMessageBox, msg)
|
||||
EventManager.Hit("PenguinCard_OpenConfirm", msg)
|
||||
else
|
||||
self:StartTurn()
|
||||
self._panel.mapLevel:SwitchGameState()
|
||||
end
|
||||
end
|
||||
function PenguinCardPrepareCtrl:OnEvent_AddRoll()
|
||||
self:RefreshAddRoll()
|
||||
self:RefreshRollDesc()
|
||||
self:RefreshRollCost()
|
||||
local ani = self._mapNode.trBtnRoll:Find("AnimRoot"):GetComponent("Animator")
|
||||
ani:Play("PengUinCard_Prepare_Roll_Add", 0, 0)
|
||||
end
|
||||
function PenguinCardPrepareCtrl:OnEvent_AddSlot()
|
||||
self:RefreshAddSlot()
|
||||
@@ -255,24 +344,27 @@ end
|
||||
function PenguinCardPrepareCtrl:OnEvent_AddRound()
|
||||
self:RefreshAddRound()
|
||||
end
|
||||
function PenguinCardPrepareCtrl:OnEvent_ChangeScore(nBefore)
|
||||
function PenguinCardPrepareCtrl:OnEvent_ChangeScore(nBefore, nBeforeStar, nStar)
|
||||
self:RefreshAddRoundCost()
|
||||
self:RefreshAddSlotCost()
|
||||
self:RefreshAddRollCost()
|
||||
if nBefore < self._panel.mapLevel.nScore and self._panel.mapLevel.nGameState == 1 then
|
||||
WwiseManger:PostEvent("Mode_Card_coin")
|
||||
end
|
||||
local callback = dotween_callback_handler(self, function()
|
||||
if nBefore < self._panel.mapLevel.nScore and self._panel.mapLevel.nGameState == 1 then
|
||||
WwiseManger:PostEvent("Mode_Card_coin_stop")
|
||||
end
|
||||
end)
|
||||
DOTween.To(function()
|
||||
return nBefore
|
||||
end, function(v)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtScore, self:ThousandsNumber(math.floor(v)))
|
||||
end, self._panel.mapLevel.nScore, 1)
|
||||
local nMax = self._panel.mapLevel.tbStarScore[3]
|
||||
if nMax == 0 then
|
||||
nMax = self._panel.mapLevel.nScore
|
||||
end, self._panel.mapLevel.nScore, 0.5):OnComplete(callback)
|
||||
if self._panel.mapLevel.tbStarScore[3] > 0 then
|
||||
local nPos = self:GetStarPos(nStar, self._panel.mapLevel.nScore)
|
||||
self._mapNode.imgStarProgress:DOSizeDelta(Vector2(nPos, 24), 0.5):SetEase(Ease.OutQuad)
|
||||
end
|
||||
local nP = self._panel.mapLevel.nScore / nMax
|
||||
if 1 < nP then
|
||||
nP = 1
|
||||
end
|
||||
self._mapNode.imgStarProgress:DOSizeDelta(Vector2(nP * 276.94, 24), 0.5)
|
||||
for i, v in ipairs(self._panel.mapLevel.tbStarScore) do
|
||||
self._mapNode.imgStarOff[i]:SetActive(v > self._panel.mapLevel.nScore)
|
||||
self._mapNode.imgStarOn[i]:SetActive(v <= self._panel.mapLevel.nScore)
|
||||
@@ -280,10 +372,31 @@ function PenguinCardPrepareCtrl:OnEvent_ChangeScore(nBefore)
|
||||
NovaAPI.SetImageColor(self._mapNode.imgLine[i], v > self._panel.mapLevel.nScore and LineOff or LineOn)
|
||||
end
|
||||
end
|
||||
if self._panel.mapLevel.nGameState == 1 then
|
||||
if nBeforeStar == 3 and nStar < 3 then
|
||||
self._mapNode.btnWin.interactable = false
|
||||
self._mapNode.aniWin:Play("PengUinCard_Prepare_Info_Nowin")
|
||||
WwiseManger:PostEvent("Mode_Card_level_wingo")
|
||||
self:AddTimer(1, 0.5, function()
|
||||
self._mapNode.btnWin.gameObject:SetActive(false)
|
||||
self._mapNode.txtWinTip.gameObject:SetActive(false)
|
||||
end, true, true, true)
|
||||
elseif nBeforeStar < 3 and nStar == 3 then
|
||||
self._mapNode.btnWin.gameObject:SetActive(true)
|
||||
self._mapNode.txtWinTip.gameObject:SetActive(true)
|
||||
self._mapNode.btnWin.interactable = false
|
||||
self._mapNode.aniWin:Play("PengUinCard_Prepare_Info_Win")
|
||||
WwiseManger:PostEvent("Mode_Card_level_win")
|
||||
self:AddTimer(1, 1, function()
|
||||
self._mapNode.btnWin.interactable = true
|
||||
end, true, true, true)
|
||||
end
|
||||
end
|
||||
end
|
||||
function PenguinCardPrepareCtrl:OnEvent_RollPenguinCard()
|
||||
self:RefreshRoll()
|
||||
self:RefreshRoll(true)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.5)
|
||||
WwiseManger:PostEvent("Mode_Card_refresh")
|
||||
end
|
||||
function PenguinCardPrepareCtrl:OnEvent_SelectPenguinCard()
|
||||
local nMax = #self._panel.mapLevel.tbSelectablePenguinCard
|
||||
@@ -292,4 +405,11 @@ function PenguinCardPrepareCtrl:OnEvent_SelectPenguinCard()
|
||||
end
|
||||
self:RefreshRollDesc()
|
||||
end
|
||||
function PenguinCardPrepareCtrl:OnEvent_SalePenguinCard(_, nGroupId)
|
||||
for i = 1, 3 do
|
||||
if self._mapNode.PenguinCardItem[i].gameObject.activeSelf == true then
|
||||
self._mapNode.PenguinCardItem[i]:RefreshUpgrade(nGroupId)
|
||||
end
|
||||
end
|
||||
end
|
||||
return PenguinCardPrepareCtrl
|
||||
|
||||
@@ -176,30 +176,49 @@ function PenguinCardResultCtrl:PlayInAni()
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
self._mapNode.goResult:SetActive(true)
|
||||
if self.bWin then
|
||||
self.animator:Play("PengUinCard_Result_Win_in")
|
||||
WwiseManger:PostEvent("Mode_Card_victory")
|
||||
else
|
||||
self.animator:Play("PengUinCard_Result_Finish_in")
|
||||
WwiseManger:PostEvent("Mode_Card_compelete")
|
||||
end
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.3)
|
||||
end
|
||||
function PenguinCardResultCtrl:Close()
|
||||
if self.bWin then
|
||||
self.animator:Play("PengUinCard_Result_Win_out")
|
||||
else
|
||||
self.animator:Play("PengUinCard_Result_Finish_out")
|
||||
end
|
||||
self._mapNode.aniBlur:SetTrigger("tOut")
|
||||
self:AddTimer(1, 0.2, function()
|
||||
self:AddTimer(1, 0.333, function()
|
||||
self._mapNode.goResult:SetActive(false)
|
||||
self.gameObject:SetActive(false)
|
||||
local callback = function(bClose)
|
||||
WwiseManger:PostEvent("Mode_Card_stop")
|
||||
if bClose then
|
||||
PanelManager.Home()
|
||||
else
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.PenguinCard)
|
||||
end
|
||||
end
|
||||
self._panel.mapLevel:QuitGame(callback)
|
||||
end, true, true, true)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.2)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.333)
|
||||
end
|
||||
function PenguinCardResultCtrl:Awake()
|
||||
self._mapNode.goResult:SetActive(false)
|
||||
self.animator = self.gameObject:GetComponent("Animator")
|
||||
end
|
||||
function PenguinCardResultCtrl:OnEnable()
|
||||
end
|
||||
function PenguinCardResultCtrl:OnDisable()
|
||||
end
|
||||
function PenguinCardResultCtrl:OnBtnClick_Close()
|
||||
local callback = function()
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.PenguinCard)
|
||||
end
|
||||
self._panel.mapLevel:QuitGame(callback)
|
||||
self:Close()
|
||||
end
|
||||
function PenguinCardResultCtrl:OnBtnClick_Log()
|
||||
EventManager.Hit("PenguinCard_OpenLog", self._panel.mapLevel.nCurTurn, true)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
local PenguinCardSelectCtrl = class("PenguinCardSelectCtrl", BaseCtrl)
|
||||
local WwiseManger = CS.WwiseAudioManager.Instance
|
||||
PenguinCardSelectCtrl._mapNodeConfig = {
|
||||
TopBar = {
|
||||
sNodeName = "TopBarPanel",
|
||||
@@ -23,7 +24,8 @@ PenguinCardSelectCtrl._mapNodeConfig = {
|
||||
goNormalLevel = {}
|
||||
}
|
||||
PenguinCardSelectCtrl._mapEventConfig = {
|
||||
PenguinCard_ClickLevel = "OnEvent_Click"
|
||||
PenguinCard_ClickLevel = "OnEvent_Click",
|
||||
PenguinCard_EnterLevel = "OnEvent_Enter"
|
||||
}
|
||||
PenguinCardSelectCtrl._mapRedDotConfig = {
|
||||
[RedDotDefine.Activity_PenguinCard_AllQuest] = {
|
||||
@@ -44,18 +46,18 @@ function PenguinCardSelectCtrl:Refresh()
|
||||
end
|
||||
end
|
||||
end
|
||||
if self._panel.nPos then
|
||||
NovaAPI.SetHorizontalNormalizedPosition(self._mapNode.sv, self._panel.nPos)
|
||||
elseif self.goFirstLock then
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
if self._panel.nPos then
|
||||
NovaAPI.SetHorizontalNormalizedPosition(self._mapNode.sv, self._panel.nPos)
|
||||
elseif self.goFirstLock ~= nil then
|
||||
self._mapNode.sc:ScrollToClick(self.goFirstLock, 0.01)
|
||||
self.goFirstLock = nil
|
||||
else
|
||||
NovaAPI.SetHorizontalNormalizedPosition(self._mapNode.sv, 1)
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
else
|
||||
NovaAPI.SetHorizontalNormalizedPosition(self._mapNode.sv, 1)
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
EventManager.Hit("Guide_PassiveCheck_Msg", "Guide_PenguinCard_304")
|
||||
end
|
||||
function PenguinCardSelectCtrl:RefreshHard(nIndex, nLevelId)
|
||||
@@ -105,9 +107,14 @@ end
|
||||
function PenguinCardSelectCtrl:OnBtnClick_Quest()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.PenguinCardQuest, self.nActId)
|
||||
end
|
||||
function PenguinCardSelectCtrl:OnEvent_Click(go, callback)
|
||||
self:AddTimer(1, 0.1, callback, true, true, true)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.1)
|
||||
function PenguinCardSelectCtrl:OnEvent_Click(go)
|
||||
self._mapNode.sc:ScrollToClick(go)
|
||||
end
|
||||
function PenguinCardSelectCtrl:OnEvent_Enter(callback)
|
||||
local ani = self.gameObject:GetComponent("Animator")
|
||||
ani:Play("PenguinCardSelect_out")
|
||||
WwiseManger:PostEvent("Mode_Card_level")
|
||||
self:AddTimer(1, 0.5, callback, true, true, true)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.5)
|
||||
end
|
||||
return PenguinCardSelectCtrl
|
||||
|
||||
@@ -5,8 +5,12 @@ PenguinCardSlotCtrl._mapNodeConfig = {
|
||||
nCount = 6,
|
||||
sCtrlName = "Game.UI.Play_PenguinCard.PenguinCardItemCtrl"
|
||||
},
|
||||
goEmptySlot = {nCount = 6},
|
||||
imgSlotLock = {nCount = 6}
|
||||
goEmptySlot = {nCount = 6, sComponentName = "Transform"},
|
||||
aniSlot = {
|
||||
nCount = 6,
|
||||
sNodeName = "goEmptySlot",
|
||||
sComponentName = "Animator"
|
||||
}
|
||||
}
|
||||
PenguinCardSlotCtrl._mapEventConfig = {
|
||||
PenguinCard_AddSlot = "OnEvent_AddSlot",
|
||||
@@ -21,13 +25,24 @@ end
|
||||
function PenguinCardSlotCtrl:RefreshSlot(nIndex)
|
||||
local mapCard = self._panel.mapLevel.tbPenguinCard[nIndex]
|
||||
self._mapNode.PenguinCardItem[nIndex].gameObject:SetActive(mapCard ~= 0)
|
||||
self._mapNode.goEmptySlot[nIndex]:SetActive(mapCard == 0)
|
||||
self._mapNode.goEmptySlot[nIndex].gameObject:SetActive(mapCard == 0)
|
||||
if mapCard == 0 then
|
||||
self._mapNode.imgSlotLock[nIndex]:SetActive(nIndex > self._panel.mapLevel.nSlotCount)
|
||||
local imgSlotLock = self._mapNode.goEmptySlot[nIndex]:Find("imgSlotLock").gameObject
|
||||
imgSlotLock:SetActive(nIndex > self._panel.mapLevel.nSlotCount)
|
||||
else
|
||||
self._mapNode.PenguinCardItem[nIndex]:Refresh_Slot(mapCard)
|
||||
end
|
||||
end
|
||||
function PenguinCardSlotCtrl:PlayOutAni()
|
||||
for i = 1, 6 do
|
||||
local mapCard = self._panel.mapLevel.tbPenguinCard[i]
|
||||
if mapCard == 0 then
|
||||
self._mapNode.aniSlot[i]:Play("PengUinCard_Slot_Unlock_out")
|
||||
else
|
||||
self._mapNode.PenguinCardItem[i]:PlaySaleAni()
|
||||
end
|
||||
end
|
||||
end
|
||||
function PenguinCardSlotCtrl:Awake()
|
||||
end
|
||||
function PenguinCardSlotCtrl:OnEnable()
|
||||
@@ -35,7 +50,16 @@ end
|
||||
function PenguinCardSlotCtrl:OnDisable()
|
||||
end
|
||||
function PenguinCardSlotCtrl:OnEvent_AddSlot()
|
||||
self:RefreshSlot(self._panel.mapLevel.nSlotCount)
|
||||
local nIndex = self._panel.mapLevel.nSlotCount
|
||||
self._mapNode.aniSlot[nIndex]:Play("PengUinCard_Slot_Unlock_in")
|
||||
WwiseManger:PostEvent("Mode_Card_unlock")
|
||||
local nAnimTime = NovaAPI.GetAnimClipLength(self._mapNode.aniSlot[nIndex], {
|
||||
"PengUinCard_Slot_Unlock_in"
|
||||
})
|
||||
self:AddTimer(1, nAnimTime, function()
|
||||
local imgSlotLock = self._mapNode.goEmptySlot[nIndex]:Find("imgSlotLock").gameObject
|
||||
imgSlotLock:SetActive(false)
|
||||
end, true, true, true)
|
||||
end
|
||||
function PenguinCardSlotCtrl:OnEvent_SelectPenguinCard(nSlot, bUpgrade)
|
||||
self._mapNode.PenguinCardItem[nSlot].gameObject:SetActive(true)
|
||||
@@ -47,13 +71,13 @@ function PenguinCardSlotCtrl:OnEvent_SelectPenguinCard(nSlot, bUpgrade)
|
||||
else
|
||||
self._mapNode.PenguinCardItem[nSlot]:Refresh_Slot(self._panel.mapLevel.tbPenguinCard[nSlot])
|
||||
local callback = function()
|
||||
self._mapNode.goEmptySlot[nSlot]:SetActive(false)
|
||||
self._mapNode.goEmptySlot[nSlot].gameObject:SetActive(false)
|
||||
end
|
||||
self._mapNode.PenguinCardItem[nSlot]:PlaySelectAni(callback)
|
||||
end
|
||||
end
|
||||
function PenguinCardSlotCtrl:OnEvent_SalePenguinCard(nSlot)
|
||||
self._mapNode.goEmptySlot[nSlot]:SetActive(true)
|
||||
self._mapNode.goEmptySlot[nSlot].gameObject:SetActive(true)
|
||||
local callback = function()
|
||||
self._mapNode.PenguinCardItem[nSlot].gameObject:SetActive(false)
|
||||
end
|
||||
|
||||
@@ -2,7 +2,9 @@ local PenguinLevel = class("PenguinLevel")
|
||||
local PenguinCard = require("Game.UI.Play_PenguinCard.PenguinCard")
|
||||
local TimerManager = require("GameCore.Timer.TimerManager")
|
||||
local LocalData = require("GameCore.Data.LocalData")
|
||||
local ConfigData = require("GameCore.Data.ConfigData")
|
||||
local GameState = {
|
||||
Start = 0,
|
||||
Prepare = 1,
|
||||
Dealing = 2,
|
||||
Flip = 3,
|
||||
@@ -18,6 +20,7 @@ function PenguinLevel:Init(nFloorId, nLevelId, nActId, tbStarScore)
|
||||
}
|
||||
self.nLevelId = nLevelId
|
||||
self.nActId = nActId
|
||||
self.bWarning = true
|
||||
self:ParseConfigData()
|
||||
self:ParseLocalData()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.PenguinCard, self)
|
||||
@@ -30,6 +33,7 @@ function PenguinLevel:ParseConfigData()
|
||||
self.tbRoundUpgradeCost = ConfigTable.GetConfigNumberArray("PenguinCardRoundUpgradeCost")
|
||||
self.tbSlotUpgradeCost = ConfigTable.GetConfigNumberArray("PenguinCardSlotUpgradeCost")
|
||||
self.tbBuyLimitUpgradeCost = ConfigTable.GetConfigNumberArray("PenguinCardBuyLimitUpgradeCost")
|
||||
self.nFireScore = ConfigTable.GetConfigNumber("PenguinCardFeverScore")
|
||||
self.mapBuyCost = {}
|
||||
local func_ForEach_Line = function(mapData)
|
||||
self.mapBuyCost[mapData.Count] = {
|
||||
@@ -44,15 +48,15 @@ function PenguinLevel:ParseConfigData()
|
||||
Id = mapData.Id,
|
||||
SuitCount = mapData.SuitCount,
|
||||
Value = mapData.Value,
|
||||
Ratio = mapData.Ratio
|
||||
Ratio = mapData.Ratio * ConfigData.IntFloatPrecision
|
||||
}
|
||||
end
|
||||
ForEachTableLine(DataTable.PenguinCardHandRank, func_ForEach_Rank)
|
||||
end
|
||||
function PenguinLevel:ParseLocalData()
|
||||
local bAuto = LocalData.GetLocalData("PenguinCard", "Auto")
|
||||
local bAuto = LocalData.GetPlayerLocalData("PenguinCardAuto")
|
||||
self.bAuto = bAuto == true
|
||||
local nSpeed = LocalData.GetLocalData("PenguinCard", "Speed")
|
||||
local nSpeed = LocalData.GetPlayerLocalData("PenguinCardSpeed")
|
||||
self.nSpeed = nSpeed or 1
|
||||
end
|
||||
function PenguinLevel:ParseLevelData(nFloorId)
|
||||
@@ -66,6 +70,7 @@ function PenguinLevel:ParseLevelData(nFloorId)
|
||||
self.nSlotCount = mapLevelCfg.InitialSlot
|
||||
self.nRoundLimit = mapLevelCfg.InitialRound
|
||||
self.nFixedTurnGroupId = mapLevelCfg.FixedTurn
|
||||
self.sLevelDesc = mapLevelCfg.Floortips
|
||||
self.nBuyLimit = mapLevelCfg.InitialBuyLimit
|
||||
self.nWeightGroupId = mapLevelCfg.WeightGroup
|
||||
local mapPoolCfg = ConfigTable.GetData("PenguinBaseCardPool", mapLevelCfg.PoolId)
|
||||
@@ -112,10 +117,21 @@ function PenguinLevel:StartGame()
|
||||
self:ParseLevelData(self.nFloorId)
|
||||
self:SwitchGameState()
|
||||
end
|
||||
function PenguinLevel:GiveupGame()
|
||||
self:QuitGameState()
|
||||
self.nGameState = GameState.Complete
|
||||
self:RunGameState()
|
||||
function PenguinLevel:CompleteGame()
|
||||
local nNextState = GameState.Complete
|
||||
self:SwitchNextGameState(nNextState, {bManual = true})
|
||||
end
|
||||
function PenguinLevel:RestartGame()
|
||||
local nNextState = GameState.Start
|
||||
local nWaitTime = self:QuitGameState(nNextState)
|
||||
if nWaitTime == 0 then
|
||||
self:StartGame()
|
||||
else
|
||||
TimerManager.Add(1, nWaitTime, self, function()
|
||||
self:StartGame()
|
||||
end, true, true, true)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, nWaitTime)
|
||||
end
|
||||
end
|
||||
function PenguinLevel:QuitGame(callback)
|
||||
local bAct = false
|
||||
@@ -135,18 +151,19 @@ function PenguinLevel:QuitGame(callback)
|
||||
end
|
||||
end
|
||||
if not bAct then
|
||||
callback()
|
||||
callback(true)
|
||||
end
|
||||
self:QuitGameState()
|
||||
self:ClearLevelData()
|
||||
end
|
||||
function PenguinLevel:SwitchGameState()
|
||||
self:QuitGameState()
|
||||
self:CheckNextGameState()
|
||||
self:RunGameState()
|
||||
local nNextState = self:CheckNextGameState()
|
||||
self:SwitchNextGameState(nNextState)
|
||||
end
|
||||
function PenguinLevel:RunGameState()
|
||||
if self.nGameState == GameState.Prepare then
|
||||
function PenguinLevel:RunGameState(mapParam)
|
||||
if self.nGameState == GameState.Start then
|
||||
self:RunState_Start()
|
||||
elseif self.nGameState == GameState.Prepare then
|
||||
self:RunState_Prepare()
|
||||
elseif self.nGameState == GameState.Dealing then
|
||||
self:RunState_Dealing()
|
||||
@@ -155,43 +172,70 @@ function PenguinLevel:RunGameState()
|
||||
elseif self.nGameState == GameState.Settlement then
|
||||
self:RunState_Settlement()
|
||||
elseif self.nGameState == GameState.Complete then
|
||||
self:RunState_Complete()
|
||||
self:RunState_Complete(mapParam)
|
||||
end
|
||||
end
|
||||
function PenguinLevel:QuitGameState()
|
||||
if self.nGameState == GameState.Prepare then
|
||||
self:QuitState_Prepare()
|
||||
function PenguinLevel:QuitGameState(nNextState)
|
||||
local nWaitTime = 0
|
||||
if self.nGameState == GameState.Start then
|
||||
nWaitTime = self:QuitState_Start()
|
||||
elseif self.nGameState == GameState.Prepare then
|
||||
nWaitTime = self:QuitState_Prepare(nNextState)
|
||||
elseif self.nGameState == GameState.Dealing then
|
||||
self:QuitState_Dealing()
|
||||
nWaitTime = self:QuitState_Dealing(nNextState)
|
||||
elseif self.nGameState == GameState.Flip then
|
||||
self:QuitState_Flip()
|
||||
nWaitTime = self:QuitState_Flip(nNextState)
|
||||
elseif self.nGameState == GameState.Settlement then
|
||||
self:QuitState_Settlement()
|
||||
nWaitTime = self:QuitState_Settlement(nNextState)
|
||||
elseif self.nGameState == GameState.Complete then
|
||||
self:QuitState_Complete()
|
||||
nWaitTime = self:QuitState_Complete()
|
||||
end
|
||||
return nWaitTime
|
||||
end
|
||||
function PenguinLevel:CheckNextGameState()
|
||||
if self.nGameState == nil then
|
||||
self.nGameState = GameState.Prepare
|
||||
return GameState.Start
|
||||
elseif self.nGameState == GameState.Start then
|
||||
return GameState.Prepare
|
||||
elseif self.nGameState == GameState.Prepare then
|
||||
self.nGameState = GameState.Dealing
|
||||
return GameState.Dealing
|
||||
elseif self.nGameState == GameState.Dealing then
|
||||
self.nGameState = GameState.Flip
|
||||
return GameState.Flip
|
||||
elseif self.nGameState == GameState.Flip then
|
||||
self.nGameState = GameState.Settlement
|
||||
return GameState.Settlement
|
||||
elseif self.nGameState == GameState.Settlement then
|
||||
if self.nCurRound >= self.nRoundLimit then
|
||||
if self.nCurTurn >= self.nMaxTurn then
|
||||
self.nGameState = GameState.Complete
|
||||
return GameState.Complete
|
||||
else
|
||||
self.nGameState = GameState.Prepare
|
||||
return GameState.Prepare
|
||||
end
|
||||
else
|
||||
self.nGameState = GameState.Dealing
|
||||
return GameState.Dealing
|
||||
end
|
||||
end
|
||||
end
|
||||
function PenguinLevel:SwitchNextGameState(nNextState, mapParam)
|
||||
local nWaitTime = self:QuitGameState(nNextState)
|
||||
if nWaitTime == 0 then
|
||||
self.nGameState = nNextState
|
||||
self:RunGameState(mapParam)
|
||||
else
|
||||
TimerManager.Add(1, nWaitTime, self, function()
|
||||
self.nGameState = nNextState
|
||||
self:RunGameState(mapParam)
|
||||
end, true, true, true)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, nWaitTime)
|
||||
end
|
||||
end
|
||||
function PenguinLevel:RunState_Start()
|
||||
EventManager.Hit("PenguinCard_RunState_Start")
|
||||
self:SwitchGameState()
|
||||
end
|
||||
function PenguinLevel:QuitState_Start()
|
||||
EventManager.Hit("PenguinCard_QuitState_Start")
|
||||
return 0
|
||||
end
|
||||
function PenguinLevel:RunState_Prepare()
|
||||
self.nCurTurn = self.nCurTurn + 1
|
||||
self.nCurRound = 0
|
||||
@@ -202,7 +246,7 @@ function PenguinLevel:RunState_Prepare()
|
||||
self:FreeRollPenguinCard()
|
||||
EventManager.Hit("PenguinCard_RunState_Prepare")
|
||||
end
|
||||
function PenguinLevel:QuitState_Prepare()
|
||||
function PenguinLevel:QuitState_Prepare(nNextState)
|
||||
for _, v in ipairs(self.tbPenguinCard) do
|
||||
if v ~= 0 then
|
||||
v:ResetTurnTrigger()
|
||||
@@ -212,68 +256,107 @@ function PenguinLevel:QuitState_Prepare()
|
||||
self.nTurnBuyCount = 0
|
||||
self.tbSelectablePenguinCard = {}
|
||||
self.bSelectedPenguinCard = false
|
||||
self.bPreTurnWin = false
|
||||
EventManager.Hit("PenguinCard_QuitState_Prepare", nNextState)
|
||||
local nWaitTime = 0
|
||||
if nNextState == GameState.Start then
|
||||
nWaitTime = 0.6
|
||||
elseif nNextState == GameState.Dealing then
|
||||
nWaitTime = 0.45
|
||||
elseif nNextState == GameState.Complete then
|
||||
nWaitTime = 0.6
|
||||
end
|
||||
return nWaitTime
|
||||
end
|
||||
function PenguinLevel:AddRound()
|
||||
if self.nRoundLimit == self.nMaxRound then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("PenguinCard_AddBtnMaxLevel"))
|
||||
EventManager.Hit(EventId.OpenMessageBox, {
|
||||
nType = AllEnum.MessageBox.Tips,
|
||||
sSound = "Mode_Card_refresh_falied",
|
||||
sContent = ConfigTable.GetUIText("PenguinCard_AddBtnMaxLevel")
|
||||
})
|
||||
return
|
||||
end
|
||||
local nCost = self.tbRoundUpgradeCost[self.nRoundLimit + 1]
|
||||
if nCost > self.nScore then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("PenguinCard_NotEnoughScoreUpgrade"))
|
||||
EventManager.Hit(EventId.OpenMessageBox, {
|
||||
nType = AllEnum.MessageBox.Tips,
|
||||
sSound = "Mode_Card_refresh_falied",
|
||||
sContent = ConfigTable.GetUIText("PenguinCard_NotEnoughScoreUpgrade")
|
||||
})
|
||||
return
|
||||
end
|
||||
self.nRoundLimit = self.nRoundLimit + 1
|
||||
self:ChangeScore(-1 * nCost)
|
||||
EventManager.Hit(EventId.OpenMessageBox, {
|
||||
nType = AllEnum.MessageBox.Tips,
|
||||
bPositive = true,
|
||||
sContent = EventManager.Hit(EventId.OpenMessageBox, orderedFormat(ConfigTable.GetUIText("PenguinCard_AddRoundSuccess"), self.nRoundLimit))
|
||||
sSound = "Mode_Card_buy",
|
||||
sContent = orderedFormat(ConfigTable.GetUIText("PenguinCard_AddRoundSuccess"), self.nRoundLimit)
|
||||
})
|
||||
EventManager.Hit("PenguinCard_AddRound")
|
||||
end
|
||||
function PenguinLevel:AddSlot()
|
||||
if self.nSlotCount == self.nMaxSlot then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("PenguinCard_AddBtnMaxLevel"))
|
||||
EventManager.Hit(EventId.OpenMessageBox, {
|
||||
nType = AllEnum.MessageBox.Tips,
|
||||
sSound = "Mode_Card_refresh_falied",
|
||||
sContent = ConfigTable.GetUIText("PenguinCard_AddBtnMaxLevel")
|
||||
})
|
||||
return
|
||||
end
|
||||
local nCost = self.tbSlotUpgradeCost[self.nSlotCount + 1]
|
||||
if nCost > self.nScore then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("PenguinCard_NotEnoughScoreUpgrade"))
|
||||
EventManager.Hit(EventId.OpenMessageBox, {
|
||||
nType = AllEnum.MessageBox.Tips,
|
||||
sSound = "Mode_Card_refresh_falied",
|
||||
sContent = ConfigTable.GetUIText("PenguinCard_NotEnoughScoreUpgrade")
|
||||
})
|
||||
return
|
||||
end
|
||||
self.nSlotCount = self.nSlotCount + 1
|
||||
self:ChangeScore(-1 * nCost)
|
||||
EventManager.Hit(EventId.OpenMessageBox, {
|
||||
nType = AllEnum.MessageBox.Tips,
|
||||
bPositive = true,
|
||||
sContent = EventManager.Hit(EventId.OpenMessageBox, orderedFormat(ConfigTable.GetUIText("PenguinCard_AddSlotSuccess"), self.nSlotCount))
|
||||
sSound = "Mode_Card_buy",
|
||||
sContent = orderedFormat(ConfigTable.GetUIText("PenguinCard_AddSlotSuccess"), self.nSlotCount)
|
||||
})
|
||||
EventManager.Hit("PenguinCard_AddSlot")
|
||||
end
|
||||
function PenguinLevel:AddRoll()
|
||||
if self.nBuyLimit == self.nMaxBuyLimit then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("PenguinCard_AddBtnMaxLevel"))
|
||||
EventManager.Hit(EventId.OpenMessageBox, {
|
||||
nType = AllEnum.MessageBox.Tips,
|
||||
sSound = "Mode_Card_refresh_falied",
|
||||
sContent = ConfigTable.GetUIText("PenguinCard_AddBtnMaxLevel")
|
||||
})
|
||||
return
|
||||
end
|
||||
local nCost = self.tbBuyLimitUpgradeCost[self.nBuyLimit + 1]
|
||||
if nCost > self.nScore then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("PenguinCard_NotEnoughScoreUpgrade"))
|
||||
EventManager.Hit(EventId.OpenMessageBox, {
|
||||
nType = AllEnum.MessageBox.Tips,
|
||||
sSound = "Mode_Card_refresh_falied",
|
||||
sContent = ConfigTable.GetUIText("PenguinCard_NotEnoughScoreUpgrade")
|
||||
})
|
||||
return
|
||||
end
|
||||
self.nBuyLimit = self.nBuyLimit + 1
|
||||
self:ChangeScore(-1 * nCost)
|
||||
EventManager.Hit(EventId.OpenMessageBox, {
|
||||
nType = AllEnum.MessageBox.Tips,
|
||||
bPositive = true,
|
||||
sContent = EventManager.Hit(EventId.OpenMessageBox, orderedFormat(ConfigTable.GetUIText("PenguinCard_AddRollSuccess"), self.nBuyLimit))
|
||||
sSound = "Mode_Card_buy",
|
||||
sContent = orderedFormat(ConfigTable.GetUIText("PenguinCard_AddRollSuccess"), self.nBuyLimit)
|
||||
})
|
||||
EventManager.Hit("PenguinCard_AddRoll")
|
||||
end
|
||||
function PenguinLevel:FreeRollPenguinCard()
|
||||
local tbId = self:GetRollPenguinCardResult()
|
||||
if next(tbId) == nil then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("PenguinCard_Error_EmptyPenguinCard"))
|
||||
EventManager.Hit(EventId.OpenMessageBox, {
|
||||
nType = AllEnum.MessageBox.Tips,
|
||||
sSound = "Mode_Card_refresh_falied",
|
||||
sContent = ConfigTable.GetUIText("PenguinCard_Error_EmptyPenguinCard")
|
||||
})
|
||||
return
|
||||
end
|
||||
self:ClearSelectablePenguinCard()
|
||||
@@ -285,17 +368,29 @@ function PenguinLevel:FreeRollPenguinCard()
|
||||
end
|
||||
function PenguinLevel:RollPenguinCard()
|
||||
if self.nTurnBuyCount >= self.nBuyLimit then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("PenguinCard_RollMax"))
|
||||
EventManager.Hit(EventId.OpenMessageBox, {
|
||||
nType = AllEnum.MessageBox.Tips,
|
||||
sSound = "Mode_Card_refresh_falied",
|
||||
sContent = ConfigTable.GetUIText("PenguinCard_RollMax")
|
||||
})
|
||||
return
|
||||
end
|
||||
local nCost = self:GetRollPenguinCardCost()
|
||||
if nCost > self.nScore then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("PenguinCard_NotEnoughScoreRoll"))
|
||||
EventManager.Hit(EventId.OpenMessageBox, {
|
||||
nType = AllEnum.MessageBox.Tips,
|
||||
sSound = "Mode_Card_refresh_falied",
|
||||
sContent = ConfigTable.GetUIText("PenguinCard_NotEnoughScoreRoll")
|
||||
})
|
||||
return
|
||||
end
|
||||
local tbId = self:GetRollPenguinCardResult()
|
||||
if next(tbId) == nil then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("PenguinCard_Error_EmptyPenguinCard"))
|
||||
EventManager.Hit(EventId.OpenMessageBox, {
|
||||
nType = AllEnum.MessageBox.Tips,
|
||||
sSound = "Mode_Card_refresh_falied",
|
||||
sContent = ConfigTable.GetUIText("PenguinCard_Error_EmptyPenguinCard")
|
||||
})
|
||||
return
|
||||
end
|
||||
self.nTurnBuyCount = self.nTurnBuyCount + 1
|
||||
@@ -350,9 +445,10 @@ end
|
||||
function PenguinLevel:SalePenguinCard(nIndex)
|
||||
self:ChangeScore(self.tbPenguinCard[nIndex].nSoldPrice)
|
||||
local mapCard = self.tbPenguinCard[nIndex]
|
||||
local nGroupId = mapCard.nGroupId
|
||||
self:RecyclePenguinCard(mapCard)
|
||||
self.tbPenguinCard[nIndex] = 0
|
||||
EventManager.Hit("PenguinCard_SalePenguinCard", nIndex)
|
||||
EventManager.Hit("PenguinCard_SalePenguinCard", nIndex, nGroupId)
|
||||
end
|
||||
function PenguinLevel:GetRollPenguinCardCost()
|
||||
local findIntervalIndex = function(x, starts)
|
||||
@@ -426,7 +522,7 @@ function PenguinLevel:RunState_Dealing()
|
||||
self.nRoundScore = 0
|
||||
self.nRoundValue = 0
|
||||
self.nRoundRatio = 1
|
||||
self.nRoundMultiRatio = 1
|
||||
self.nRoundMultiRatio = 0
|
||||
self.mapCalBaseCardPool = clone(self.mapBaseCardPool)
|
||||
for _, v in ipairs(self.tbPenguinCard) do
|
||||
if v ~= 0 then
|
||||
@@ -449,14 +545,34 @@ function PenguinLevel:RunState_Dealing()
|
||||
EventManager.Hit("PenguinCard_RunState_Dealing")
|
||||
self:SwitchGameState()
|
||||
end
|
||||
function PenguinLevel:QuitState_Dealing()
|
||||
function PenguinLevel:QuitState_Dealing(nNextState)
|
||||
EventManager.Hit("PenguinCard_QuitState_Dealing", nNextState)
|
||||
local nWaitTime = 0
|
||||
if nNextState == GameState.Start then
|
||||
nWaitTime = 0.6
|
||||
elseif nNextState == GameState.Flip then
|
||||
nWaitTime = 0.85
|
||||
elseif nNextState == GameState.Complete then
|
||||
nWaitTime = 0.6
|
||||
end
|
||||
return nWaitTime
|
||||
end
|
||||
function PenguinLevel:RunState_Flip()
|
||||
EventManager.Hit("PenguinCard_RunState_Flip")
|
||||
self:PlayAuto()
|
||||
end
|
||||
function PenguinLevel:QuitState_Flip()
|
||||
function PenguinLevel:QuitState_Flip(nNextState)
|
||||
self:StopAuto()
|
||||
EventManager.Hit("PenguinCard_QuitState_Flip", nNextState)
|
||||
local nWaitTime = 0
|
||||
if nNextState == GameState.Start then
|
||||
nWaitTime = 0.6
|
||||
elseif nNextState == GameState.Settlement then
|
||||
nWaitTime = 1
|
||||
elseif nNextState == GameState.Complete then
|
||||
nWaitTime = 0.6
|
||||
end
|
||||
return nWaitTime
|
||||
end
|
||||
function PenguinLevel:ShowBaseCard(nIndex)
|
||||
local add = function(i)
|
||||
@@ -502,10 +618,7 @@ function PenguinLevel:ShowBaseCard(nIndex)
|
||||
local nShowed = self:GetShowedCardCount()
|
||||
if nShowed == self.nBaseCardCount then
|
||||
self:CheckHandRank()
|
||||
TimerManager.Add(1, 0.25, self, function()
|
||||
self:SwitchGameState()
|
||||
end, true, true, true)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.25)
|
||||
self:SwitchGameState()
|
||||
end
|
||||
EventManager.Hit("PenguinCard_ShowBaseCard", nIndex)
|
||||
end
|
||||
@@ -535,12 +648,12 @@ function PenguinLevel:CheckHandRank()
|
||||
end
|
||||
if nAble == nType then
|
||||
self.nHandRankId = v.Id
|
||||
self:ChangeRoundScore(v.Value, v.Ratio, 0)
|
||||
self:ChangeRoundScore(v.Value, v.Ratio, 0, true)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
function PenguinLevel:ChangeRoundScore(nAddValue, nAddRatio, nAddMultiRatio)
|
||||
function PenguinLevel:ChangeRoundScore(nAddValue, nAddRatio, nAddMultiRatio, bFromHandRank)
|
||||
local nBeforeScore = self.nRoundScore
|
||||
local nBeforeBase = self.nRoundValue
|
||||
local nBeforeMultiRatio = self.nRoundMultiRatio
|
||||
@@ -548,7 +661,7 @@ function PenguinLevel:ChangeRoundScore(nAddValue, nAddRatio, nAddMultiRatio)
|
||||
self.nRoundValue = self.nRoundValue + nAddValue
|
||||
self.nRoundMultiRatio = self.nRoundMultiRatio + nAddMultiRatio
|
||||
self.nRoundRatio = self.nRoundRatio + nAddRatio
|
||||
self.nRoundScore = self.nRoundValue * self.nRoundRatio * self.nRoundMultiRatio
|
||||
self.nRoundScore = self.nRoundMultiRatio > 0 and self.nRoundValue * self.nRoundRatio * self.nRoundMultiRatio or self.nRoundValue * self.nRoundRatio
|
||||
local nAddScore = self.nRoundScore - nBeforeScore
|
||||
self.nTurnScore = self.nTurnScore + nAddScore
|
||||
if self.nTurnScore > self.nBestTurnScore then
|
||||
@@ -557,10 +670,14 @@ function PenguinLevel:ChangeRoundScore(nAddValue, nAddRatio, nAddMultiRatio)
|
||||
if self.nRoundScore > self.nBestRoundScore then
|
||||
self.nBestRoundScore = self.nRoundScore
|
||||
end
|
||||
EventManager.Hit("PenguinCard_ChangeRoundScore", nBeforeBase, nBeforeMultiRatio * nBeforeRatio, nBeforeScore)
|
||||
printLog("轮积分变化:" .. nAddScore .. " (" .. nBeforeScore .. " -> " .. self.nRoundScore .. ")")
|
||||
printLog("基础变化:" .. nAddValue .. " (" .. nBeforeBase .. " -> " .. self.nRoundValue .. ")")
|
||||
printLog("倍率变化:" .. self.nRoundRatio * self.nRoundMultiRatio - nBeforeMultiRatio * nBeforeRatio .. " (" .. nBeforeMultiRatio * nBeforeRatio .. " -> " .. self.nRoundRatio * self.nRoundMultiRatio .. ")")
|
||||
local nBeforeAllRatio = 0 < nBeforeMultiRatio and nBeforeMultiRatio * nBeforeRatio or nBeforeRatio
|
||||
local nAfterAllRatio = self.nRoundMultiRatio > 0 and self.nRoundRatio * self.nRoundMultiRatio or self.nRoundRatio
|
||||
EventManager.Hit("PenguinCard_ChangeRoundScore", nBeforeBase, nBeforeAllRatio, nBeforeScore, bFromHandRank)
|
||||
if NovaAPI.IsEditorPlatform() then
|
||||
printLog("轮积分变化:" .. nAddScore .. " (" .. nBeforeScore .. " -> " .. self.nRoundScore .. ")")
|
||||
printLog("基础变化:" .. nAddValue .. " (" .. nBeforeBase .. " -> " .. self.nRoundValue .. ")")
|
||||
printLog("倍率变化:" .. nAfterAllRatio - nBeforeAllRatio .. " (" .. nBeforeAllRatio .. " -> " .. nAfterAllRatio .. ")")
|
||||
end
|
||||
end
|
||||
function PenguinLevel:GetShowedCardCount()
|
||||
local nShowed = 0
|
||||
@@ -595,7 +712,7 @@ function PenguinLevel:RunState_Settlement()
|
||||
EventManager.Hit("PenguinCard_RunState_Settlement")
|
||||
self:PlayAuto()
|
||||
end
|
||||
function PenguinLevel:QuitState_Settlement()
|
||||
function PenguinLevel:QuitState_Settlement(nNextState)
|
||||
self:StopAuto()
|
||||
self:ChangeScore(self.nRoundScore)
|
||||
self.tbHandRank = {}
|
||||
@@ -604,8 +721,20 @@ function PenguinLevel:QuitState_Settlement()
|
||||
self.nRoundScore = 0
|
||||
self.nRoundValue = 0
|
||||
self.nRoundRatio = 1
|
||||
self.nRoundMultiRatio = 1
|
||||
self.nRoundMultiRatio = 0
|
||||
self.mapCalBaseCardPool = {}
|
||||
EventManager.Hit("PenguinCard_QuitState_Settlement", nNextState)
|
||||
local nWaitTime = 0
|
||||
if nNextState == GameState.Start then
|
||||
nWaitTime = 0.6
|
||||
elseif nNextState == GameState.Dealing then
|
||||
nWaitTime = 0.57
|
||||
elseif nNextState == GameState.Prepare then
|
||||
nWaitTime = 0.57
|
||||
elseif nNextState == GameState.Complete then
|
||||
nWaitTime = 0.6
|
||||
end
|
||||
return nWaitTime
|
||||
end
|
||||
function PenguinLevel:AddLog()
|
||||
if not self.mapLog[self.nCurTurn] then
|
||||
@@ -625,17 +754,74 @@ function PenguinLevel:AddLog()
|
||||
self.mapLog[self.nCurTurn].tbRound[self.nCurRound].tbHandRank = clone(self.tbHandRank)
|
||||
self.mapLog[self.nCurTurn].tbRound[self.nCurRound].nHandRankId = self.nHandRankId
|
||||
end
|
||||
function PenguinLevel:RunState_Complete()
|
||||
self.nStar = 0
|
||||
for i, v in ipairs(self.tbStarScore) do
|
||||
if v <= self.nScore then
|
||||
self.nStar = i
|
||||
end
|
||||
end
|
||||
function PenguinLevel:RunState_Complete(mapParam)
|
||||
self.nStar = self:GetStar()
|
||||
EventManager.Hit("PenguinCard_RunState_Complete")
|
||||
if self.nActId then
|
||||
local tab = {}
|
||||
table.insert(tab, {
|
||||
"role_id",
|
||||
tostring(PlayerData.Base._nPlayerId)
|
||||
})
|
||||
table.insert(tab, {
|
||||
"activity_id",
|
||||
tostring(self.nActId)
|
||||
})
|
||||
table.insert(tab, {
|
||||
"battle_id",
|
||||
tostring(self.nLevelId)
|
||||
})
|
||||
table.insert(tab, {
|
||||
"round",
|
||||
tostring(self.nCurTurn)
|
||||
})
|
||||
table.insert(tab, {
|
||||
"result",
|
||||
tostring(self.nStar == 0 and 2 or 1)
|
||||
})
|
||||
local nEnd = mapParam and mapParam.bManual == true and 2 or 1
|
||||
table.insert(tab, {
|
||||
"end_type",
|
||||
tostring(nEnd)
|
||||
})
|
||||
table.insert(tab, {
|
||||
"score",
|
||||
tostring(self.nScore)
|
||||
})
|
||||
table.insert(tab, {
|
||||
"star",
|
||||
tostring(self.nStar)
|
||||
})
|
||||
local sId = ""
|
||||
for i = 1, 6 do
|
||||
if self.tbPenguinCard[i] ~= 0 then
|
||||
if sId == "" then
|
||||
sId = sId .. self.tbPenguinCard[i].nId
|
||||
else
|
||||
sId = sId .. "," .. self.tbPenguinCard[i].nId
|
||||
end
|
||||
end
|
||||
end
|
||||
table.insert(tab, {"card_list", sId})
|
||||
table.insert(tab, {
|
||||
"skill_1",
|
||||
tostring(self.nRoundLimit)
|
||||
})
|
||||
table.insert(tab, {
|
||||
"skill_2",
|
||||
tostring(self.nSlotCount)
|
||||
})
|
||||
table.insert(tab, {
|
||||
"skill_3",
|
||||
tostring(self.nBuyLimit)
|
||||
})
|
||||
NovaAPI.UserEventUpload("minigame_PenguinCard", tab)
|
||||
end
|
||||
end
|
||||
function PenguinLevel:QuitState_Complete()
|
||||
self.nStar = 0
|
||||
EventManager.Hit("PenguinCard_QuitState_Complete")
|
||||
return 0
|
||||
end
|
||||
function PenguinLevel:GetMostHandRank()
|
||||
local nCount = 0
|
||||
@@ -672,18 +858,18 @@ function PenguinLevel:GetBestPenguinCard()
|
||||
end
|
||||
function PenguinLevel:SetAutoState(bAuto)
|
||||
self.bAuto = bAuto
|
||||
LocalData.SetLocalData("PenguinCard", "Auto", self.bAuto)
|
||||
LocalData.SetPlayerLocalData("PenguinCardAuto", self.bAuto)
|
||||
end
|
||||
function PenguinLevel:SetAutoSpeed(nSpeed)
|
||||
self.nSpeed = nSpeed
|
||||
LocalData.SetLocalData("PenguinCard", "Speed", self.nSpeed)
|
||||
LocalData.SetPlayerLocalData("PenguinCardSpeed", self.nSpeed)
|
||||
if self.sequence then
|
||||
self:StopAuto()
|
||||
self:PlayAuto()
|
||||
end
|
||||
end
|
||||
function PenguinLevel:PlayAuto(bClick)
|
||||
if not self.bAuto then
|
||||
if not self.bAuto or self.bPause then
|
||||
return
|
||||
end
|
||||
if self.nGameState == GameState.Flip then
|
||||
@@ -698,14 +884,19 @@ function PenguinLevel:PlayAuto(bClick)
|
||||
end
|
||||
self.sequence:SetUpdate(true)
|
||||
elseif self.nGameState == GameState.Settlement then
|
||||
if not PlayerData.Guide:CheckGuideFinishById(302) then
|
||||
local bKeep = not PlayerData.Guide:CheckGuideFinishById(302)
|
||||
if EditorSettings and EditorSettings.bJumpGuide then
|
||||
bKeep = false
|
||||
end
|
||||
if bKeep then
|
||||
return
|
||||
end
|
||||
self.sequence = DOTween.Sequence()
|
||||
if not bClick then
|
||||
self.sequence:AppendInterval(1 / self.nSpeed)
|
||||
self.sequence:AppendInterval((self.nRoundValue >= self.nFireScore and 7 or 5) / self.nSpeed)
|
||||
end
|
||||
self.sequence:AppendCallback(function()
|
||||
EventManager.Hit("PenguinCard_QuitScoreAni")
|
||||
if self.nRoundLimit == self.nCurRound and self.nCurTurn < self.nMaxTurn then
|
||||
local callback = function()
|
||||
self:SwitchGameState()
|
||||
@@ -725,16 +916,52 @@ function PenguinLevel:StopAuto()
|
||||
end
|
||||
end
|
||||
function PenguinLevel:Pause()
|
||||
self:StopAuto()
|
||||
self.bPause = true
|
||||
if self.sequence then
|
||||
self.sequence:Pause()
|
||||
end
|
||||
EventManager.Hit("PenguinCard_Pause")
|
||||
end
|
||||
function PenguinLevel:Resume()
|
||||
self:PlayAuto()
|
||||
self.bPause = false
|
||||
if self.sequence then
|
||||
self.sequence:Play()
|
||||
else
|
||||
self:PlayAuto()
|
||||
end
|
||||
EventManager.Hit("PenguinCard_Resume")
|
||||
end
|
||||
function PenguinLevel:ChangeScore(nChange)
|
||||
if not nChange or nChange == 0 then
|
||||
return
|
||||
end
|
||||
local nBefore = self.nScore
|
||||
self.nScore = self.nScore + nChange
|
||||
EventManager.Hit("PenguinCard_ChangeScore", nBefore)
|
||||
printLog("总积分变化:" .. nChange .. " (" .. nBefore .. " -> " .. self.nScore .. ")")
|
||||
local nBeforeStar, nStar = 0, 0
|
||||
for i, v in ipairs(self.tbStarScore) do
|
||||
if v <= nBefore then
|
||||
nBeforeStar = i
|
||||
end
|
||||
if v <= self.nScore then
|
||||
nStar = i
|
||||
end
|
||||
end
|
||||
if nBeforeStar < 3 and nStar == 3 and self.nGameState == GameState.Settlement then
|
||||
self.bPreTurnWin = true
|
||||
end
|
||||
EventManager.Hit("PenguinCard_ChangeScore", nBefore, nBeforeStar, nStar)
|
||||
if NovaAPI.IsEditorPlatform() then
|
||||
printLog("总积分变化:" .. nChange .. " (" .. nBefore .. " -> " .. self.nScore .. ")")
|
||||
end
|
||||
end
|
||||
function PenguinLevel:GetStar()
|
||||
local nStar = 0
|
||||
for i, v in ipairs(self.tbStarScore) do
|
||||
if v <= self.nScore then
|
||||
nStar = i
|
||||
end
|
||||
end
|
||||
return nStar
|
||||
end
|
||||
function PenguinLevel:WeightedRandom(tbId, tbWeight, n, tbExcludeGroupId, bDuplicate)
|
||||
if #tbId ~= #tbWeight then
|
||||
@@ -802,6 +1029,9 @@ function PenguinLevel:WeightedRandom(tbId, tbWeight, n, tbExcludeGroupId, bDupli
|
||||
end
|
||||
return result
|
||||
end
|
||||
function PenguinLevel:SetWarning(bAble)
|
||||
self.bWarning = bAble
|
||||
end
|
||||
function PenguinLevel:GetOwnPenguinCardCount()
|
||||
local nCount = 0
|
||||
for i = 1, 6 do
|
||||
|
||||
Reference in New Issue
Block a user