Update - 1.9.0.103
EN: 1.9.0.103 CN: 1.9.0.104 JP: 1.9.0.106 KR: 1.9.0.108
This commit is contained in:
@@ -1,11 +1,20 @@
|
||||
local PenguinCardCtrl = class("PenguinCardCtrl", BaseCtrl)
|
||||
local WwiseManger = CS.WwiseAudioManager.Instance
|
||||
local PenguinCardUtils = require("Game.UI.Play_PenguinCard.PenguinCardUtils")
|
||||
PenguinCardCtrl._mapNodeConfig = {
|
||||
btnPause = {
|
||||
nCount = 2,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Pause"
|
||||
},
|
||||
btnOpenQuest = {
|
||||
nCount = 2,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_OpenQuest"
|
||||
},
|
||||
Start = {
|
||||
sNodeName = "---Start---",
|
||||
sCtrlName = "Game.UI.Play_PenguinCard.PenguinCardStartCtrl"
|
||||
},
|
||||
Prepare = {
|
||||
sNodeName = "---Prepare---",
|
||||
sCtrlName = "Game.UI.Play_PenguinCard.PenguinCardPrepareCtrl"
|
||||
@@ -41,6 +50,20 @@ PenguinCardCtrl._mapNodeConfig = {
|
||||
Confirm = {
|
||||
sNodeName = "---Confirm---",
|
||||
sCtrlName = "Game.UI.Play_PenguinCard.PenguinCardConfirmCtrl"
|
||||
},
|
||||
Quest = {
|
||||
sNodeName = "---Quest---",
|
||||
sCtrlName = "Game.UI.Play_PenguinCard.PenguinCardQuestSelectCtrl"
|
||||
},
|
||||
BuffTips = {
|
||||
sNodeName = "---BuffTips---",
|
||||
sCtrlName = "Game.UI.Play_PenguinCard.PenguinCardBuffTipsCtrl"
|
||||
},
|
||||
goCurBuff = {},
|
||||
rtBuff = {sNodeName = "---Buff---", sComponentName = "Transform"},
|
||||
cgBuff = {
|
||||
sNodeName = "---Buff---",
|
||||
sComponentName = "CanvasGroup"
|
||||
}
|
||||
}
|
||||
PenguinCardCtrl._mapEventConfig = {
|
||||
@@ -50,31 +73,38 @@ PenguinCardCtrl._mapEventConfig = {
|
||||
PenguinCard_RunState_Flip = "RunState_Flip",
|
||||
PenguinCard_RunState_Settlement = "RunState_Settlement",
|
||||
PenguinCard_RunState_Complete = "RunState_Complete",
|
||||
PenguinCard_RunState_Quest = "RunState_Quest",
|
||||
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_QuitState_Quest = "QuitState_Quest",
|
||||
PenguinCard_AddBuff = "OnEvent_AddBuff",
|
||||
PenguinCard_DeleteBuff = "OnEvent_DeleteBuff",
|
||||
PenguinCard_OpenPause = "OnBtnClick_Pause",
|
||||
PenguinCard_QuestSelectOpen = "OnEvent_QuestSelectOpen",
|
||||
PenguinCard_Change = "OnEvent_Change"
|
||||
}
|
||||
function PenguinCardCtrl:RunState_Start()
|
||||
self:CloseAll()
|
||||
self:ClearBuffItem()
|
||||
self._mapNode.Start.gameObject:SetActive(true)
|
||||
self._mapNode.Start:Refresh()
|
||||
end
|
||||
function PenguinCardCtrl:QuitState_Start()
|
||||
self._mapNode.Start:PlayOutAni()
|
||||
end
|
||||
function PenguinCardCtrl:RunState_Prepare()
|
||||
self._mapNode.Start.gameObject:SetActive(false)
|
||||
self._mapNode.Prepare.gameObject:SetActive(true)
|
||||
self._mapNode.Slot.gameObject:SetActive(true)
|
||||
self._mapNode.Result.gameObject:SetActive(false)
|
||||
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
|
||||
WwiseManger:PostEvent("Mode_Card_nextround")
|
||||
EventManager.Hit("Guide_PassiveCheck_Msg", "Guide_PenguinCard_301")
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
@@ -83,17 +113,19 @@ function PenguinCardCtrl:RunState_Prepare()
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
function PenguinCardCtrl:QuitState_Prepare(nNextState)
|
||||
if nNextState == 0 then
|
||||
if nNextState == PenguinCardUtils.GameState.Start then
|
||||
self._mapNode.Slot:PlayOutAni()
|
||||
self._mapNode.Prepare:PlayOutAni()
|
||||
self:ClearBuffItem()
|
||||
WwiseManger:PostEvent("Mode_Card_dissolve")
|
||||
elseif nNextState == 2 then
|
||||
elseif nNextState == PenguinCardUtils.GameState.Dealing then
|
||||
self._mapNode.Prepare:PlayOutAni()
|
||||
WwiseManger:PostEvent("Mode_Card_dissolve")
|
||||
elseif nNextState == 5 then
|
||||
elseif nNextState == PenguinCardUtils.GameState.Complete then
|
||||
self._mapNode.Slot:PlayOutAni()
|
||||
self._mapNode.Prepare:PlayOutAni()
|
||||
self.animator:Play("PengUinCard_Bg_Result")
|
||||
self:ClearBuffItem()
|
||||
WwiseManger:PostEvent("Mode_Card_dissolve")
|
||||
end
|
||||
end
|
||||
@@ -104,14 +136,16 @@ function PenguinCardCtrl:RunState_Dealing()
|
||||
EventManager.Hit("Guide_PassiveCheck_Msg", "Guide_PenguinCard_302")
|
||||
end
|
||||
function PenguinCardCtrl:QuitState_Dealing(nNextState)
|
||||
if nNextState == 0 then
|
||||
if nNextState == PenguinCardUtils.GameState.Start then
|
||||
self._mapNode.Slot:PlayOutAni()
|
||||
self._mapNode.Flip:PlayOutAni()
|
||||
self:ClearBuffItem()
|
||||
WwiseManger:PostEvent("Mode_Card_dissolve")
|
||||
elseif nNextState == 5 then
|
||||
elseif nNextState == PenguinCardUtils.GameState.Complete then
|
||||
self._mapNode.Slot:PlayOutAni()
|
||||
self._mapNode.Flip:PlayOutAni()
|
||||
self.animator:Play("PengUinCard_Bg_Result")
|
||||
self:ClearBuffItem()
|
||||
WwiseManger:PostEvent("Mode_Card_dissolve")
|
||||
end
|
||||
end
|
||||
@@ -120,14 +154,16 @@ function PenguinCardCtrl:RunState_Flip()
|
||||
end
|
||||
function PenguinCardCtrl:QuitState_Flip(nNextState)
|
||||
self._mapNode.Flip:StopShowAllOn()
|
||||
if nNextState == 0 then
|
||||
if nNextState == PenguinCardUtils.GameState.Start then
|
||||
self._mapNode.Slot:PlayOutAni()
|
||||
self._mapNode.Flip:PlayOutAni()
|
||||
self:ClearBuffItem()
|
||||
WwiseManger:PostEvent("Mode_Card_dissolve")
|
||||
elseif nNextState == 5 then
|
||||
elseif nNextState == PenguinCardUtils.GameState.Complete then
|
||||
self._mapNode.Slot:PlayOutAni()
|
||||
self._mapNode.Flip:PlayOutAni()
|
||||
self.animator:Play("PengUinCard_Bg_Result")
|
||||
self:ClearBuffItem()
|
||||
WwiseManger:PostEvent("Mode_Card_dissolve")
|
||||
end
|
||||
end
|
||||
@@ -135,19 +171,21 @@ function PenguinCardCtrl:RunState_Settlement()
|
||||
self._mapNode.Flip:Refresh_Settlement()
|
||||
end
|
||||
function PenguinCardCtrl:QuitState_Settlement(nNextState)
|
||||
if nNextState == 0 then
|
||||
if nNextState == PenguinCardUtils.GameState.Start then
|
||||
self._mapNode.Slot:PlayOutAni()
|
||||
self._mapNode.Flip:PlayOutAni()
|
||||
self:ClearBuffItem()
|
||||
WwiseManger:PostEvent("Mode_Card_dissolve")
|
||||
elseif nNextState == 1 then
|
||||
elseif nNextState == PenguinCardUtils.GameState.Prepare then
|
||||
self._mapNode.Flip:PlayOutAni()
|
||||
WwiseManger:PostEvent("Mode_Card_dissolve")
|
||||
elseif nNextState == 2 then
|
||||
elseif nNextState == PenguinCardUtils.GameState.Dealing then
|
||||
self._mapNode.Flip:PlayRoundAni()
|
||||
elseif nNextState == 5 then
|
||||
elseif nNextState == PenguinCardUtils.GameState.Complete then
|
||||
self._mapNode.Slot:PlayOutAni()
|
||||
self._mapNode.Flip:PlayOutAni()
|
||||
self.animator:Play("PengUinCard_Bg_Result")
|
||||
self:ClearBuffItem()
|
||||
WwiseManger:PostEvent("Mode_Card_dissolve")
|
||||
end
|
||||
end
|
||||
@@ -156,10 +194,35 @@ function PenguinCardCtrl:RunState_Complete()
|
||||
end
|
||||
function PenguinCardCtrl:QuitState_Complete()
|
||||
end
|
||||
function PenguinCardCtrl:RunState_Quest(bSkip)
|
||||
if bSkip then
|
||||
return
|
||||
end
|
||||
self._mapNode.Quest:Open()
|
||||
end
|
||||
function PenguinCardCtrl:QuitState_Quest(nNextState)
|
||||
if nNextState == PenguinCardUtils.GameState.Start then
|
||||
self._mapNode.Slot:PlayOutAni()
|
||||
self._mapNode.Flip:PlayOutAni()
|
||||
self:ClearBuffItem()
|
||||
WwiseManger:PostEvent("Mode_Card_dissolve")
|
||||
elseif nNextState == PenguinCardUtils.GameState.Prepare then
|
||||
self._mapNode.Flip:PlayOutAni()
|
||||
WwiseManger:PostEvent("Mode_Card_dissolve")
|
||||
elseif nNextState == PenguinCardUtils.GameState.Complete then
|
||||
self._mapNode.Slot:PlayOutAni()
|
||||
self._mapNode.Flip:PlayOutAni()
|
||||
self.animator:Play("PengUinCard_Bg_Result")
|
||||
self:ClearBuffItem()
|
||||
WwiseManger:PostEvent("Mode_Card_dissolve")
|
||||
end
|
||||
end
|
||||
function PenguinCardCtrl:CloseAll()
|
||||
self._mapNode.Start.gameObject:SetActive(false)
|
||||
self._mapNode.Prepare.gameObject:SetActive(false)
|
||||
self._mapNode.Slot.gameObject:SetActive(false)
|
||||
self._mapNode.Flip.gameObject:SetActive(false)
|
||||
self._mapNode.Quest.gameObject:SetActive(false)
|
||||
self._mapNode.CardInfo.gameObject:SetActive(false)
|
||||
self._mapNode.Pause.gameObject:SetActive(false)
|
||||
self._mapNode.HandRank.gameObject:SetActive(false)
|
||||
@@ -167,8 +230,12 @@ function PenguinCardCtrl:CloseAll()
|
||||
self._mapNode.Log.gameObject:SetActive(false)
|
||||
self._mapNode.Confirm.gameObject:SetActive(false)
|
||||
end
|
||||
function PenguinCardCtrl:ClearBuffItem()
|
||||
delChildren(self._mapNode.rtBuff)
|
||||
self.tbBuffItem = {}
|
||||
self._mapNode.Quest:ClearBuffItem()
|
||||
end
|
||||
function PenguinCardCtrl:Awake()
|
||||
self.bIn = true
|
||||
self.animator = self.gameObject:GetComponent("Animator")
|
||||
self:CloseAll()
|
||||
end
|
||||
@@ -182,6 +249,63 @@ end
|
||||
function PenguinCardCtrl:OnBtnClick_Pause(btn)
|
||||
self._mapNode.Pause:Open()
|
||||
end
|
||||
function PenguinCardCtrl:OnBtnClick_OpenQuest(btn)
|
||||
if self._panel.mapLevel.mapQuest == nil then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("PenguinCard_Tip_NoneQuest"))
|
||||
return
|
||||
end
|
||||
self._mapNode.Quest:Open(true)
|
||||
end
|
||||
function PenguinCardCtrl:OnEvent_AddBuff(mapBuff)
|
||||
if not self.tbBuffItem then
|
||||
self.tbBuffItem = {}
|
||||
end
|
||||
local goItemObj = instantiate(self._mapNode.goCurBuff, self._mapNode.rtBuff)
|
||||
goItemObj:SetActive(true)
|
||||
table.insert(self.tbBuffItem, goItemObj)
|
||||
local btn = goItemObj.transform:Find("btnOpenInfo"):GetComponent("UIButton")
|
||||
local imgSelect = goItemObj.transform:Find("btnOpenInfo/AnimRoot/imgSelect").gameObject
|
||||
local imgIcon = goItemObj.transform:Find("btnOpenInfo/AnimRoot/imgIcon"):GetComponent("Image")
|
||||
local ani = goItemObj.transform:Find("btnOpenInfo/AnimRoot"):GetComponent("Animator")
|
||||
self:SetSprite(imgIcon, "UI/Play_PenguinCard/SpriteAtlas/Sprite/" .. mapBuff.sIcon)
|
||||
ani:Play("PenguinCardBuff_in", 0, 0)
|
||||
local click = function()
|
||||
imgSelect:SetActive(true)
|
||||
EventManager.Hit("PenguinCard_OpenBuffTips", mapBuff, function()
|
||||
imgSelect:SetActive(false)
|
||||
end)
|
||||
end
|
||||
btn.onClick:AddListener(click)
|
||||
end
|
||||
function PenguinCardCtrl:OnEvent_DeleteBuff(nIndex, nDelayTime)
|
||||
if not self.tbBuffItem or next(self.tbBuffItem) == nil then
|
||||
return
|
||||
end
|
||||
local goBuff = self.tbBuffItem[nIndex]
|
||||
table.remove(self.tbBuffItem, nIndex)
|
||||
local play = function()
|
||||
local ani = goBuff.transform:Find("btnOpenInfo/AnimRoot"):GetComponent("Animator")
|
||||
ani:Play("PenguinCardBuff_out", 0, 0)
|
||||
self:AddTimer(1, 0.4, function()
|
||||
destroy(goBuff)
|
||||
end, true, true, true)
|
||||
end
|
||||
if goBuff:IsNull() == false then
|
||||
if nDelayTime and 0 < nDelayTime then
|
||||
self:AddTimer(1, nDelayTime, play, true, true, true)
|
||||
else
|
||||
play()
|
||||
end
|
||||
end
|
||||
end
|
||||
function PenguinCardCtrl:OnEvent_QuestSelectOpen()
|
||||
NovaAPI.SetCanvasGroupAlpha(self._mapNode.cgBuff, 0)
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
NovaAPI.SetCanvasGroupAlpha(self._mapNode.cgBuff, 1)
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
function PenguinCardCtrl:OnEvent_Change(callback)
|
||||
callback(self, self._panel.mapLevel)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user