Update - 1.9.0.107

EN: 1.9.0.107
CN: 1.9.0.108
JP: 1.9.0.112
KR: 1.9.0.112
This commit is contained in:
SL1900
2026-05-14 16:00:00 +09:00
parent 4b880806ef
commit eafd8f4088
1034 changed files with 809589 additions and 23067 deletions
@@ -27,6 +27,7 @@ end
function ThrowGiftItemSelectCtrl:FadeOut()
end
function ThrowGiftItemSelectCtrl:OnEnable()
self.animator = self.gameObject:GetComponent("Animator")
self.bSelected = false
self.curIdx = 0
self.tbOriginPos = {}
@@ -48,10 +49,9 @@ end
function ThrowGiftItemSelectCtrl:OnRelease()
end
function ThrowGiftItemSelectCtrl:Refresh(tbItem)
self.animator:Play("rtItemSelect_in")
self._mapNode.btnItemSelectCtrl[1]:Refresh(tbItem[1])
self._mapNode.btnItemSelectCtrl[2]:Refresh(tbItem[2])
self._mapNode.btnItemSelectCtrl[1]:SetSelect(false)
self._mapNode.btnItemSelectCtrl[2]:SetSelect(false)
self._mapNode.btnItemSelectCtrl[1].gameObject.transform.position = self.tbOriginPos[1]
self._mapNode.btnItemSelectCtrl[2].gameObject.transform.position = self.tbOriginPos[2]
self._mapNode.btnItemSelectCtrl[1].gameObject.transform.localEulerAngles = Vector3(0, 0, 0)
@@ -82,9 +82,9 @@ function ThrowGiftItemSelectCtrl:ResetSelect(tbUI)
local nSelect = 1
GamepadUIManager.ClearSelectedUI()
GamepadUIManager.SetSelectedUI(self._mapNode.btnItemSelect[nSelect].gameObject)
if GamepadUIManager.GetCurUIType() == AllEnum.GamepadUIType.Mouse then
self:OnBtnClick_Item(self._mapNode.btnItemSelect[nSelect].gameObject, nSelect)
end
self.curIdx = nSelect
self._mapNode.btnItemSelectCtrl[nSelect]:SetSelect(true)
self._mapNode.btnItemSelectCtrl[nSelect == 2 and 1 or 2]:SetDefault()
end
end, true, true, true)
end
@@ -114,12 +114,16 @@ function ThrowGiftItemSelectCtrl:OnEvent_ThrowGiftItemSelectConfirmClick()
return
end
self.bSelected = true
self._mapNode.btnItemSelectCtrl[self.curIdx]:PlaySelectAnim()
table.insert(self.tbResultIdx, self.curIdx)
if self.nCurItemsIdx < #self.tbItems then
self._mapNode.btnItemSelectCtrl[1]:SetDefault()
self._mapNode.btnItemSelectCtrl[2]:SetDefault()
self.nCurItemsIdx = self.nCurItemsIdx + 1
self.curIdx = 0
self:Refresh(self.tbItems[self.nCurItemsIdx])
self.bSelected = false
else
self._mapNode.btnItemSelectCtrl[self.curIdx]:PlaySelectAnim()
WwiseAudioMgr:PostEvent("Mode_Present_intensify_ok")
local endPos = self._mapNode.rtPos[self.curPosIdx].transform.position
local beginPos = self._mapNode.btnItemSelectCtrl[self.curIdx].gameObject.transform.position
@@ -140,6 +144,9 @@ function ThrowGiftItemSelectCtrl:OnEvent_ThrowGiftItemSelectConfirmClick()
self._mapNode.btnItemSelectCtrl[self.curIdx].gameObject.transform.localEulerAngles = Vector3(0, 0, angleZ)
self._mapNode.btnItemSelectCtrl[self.curIdx].gameObject.transform.position = Vector3(x, y, z)
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
if self == nil or self.gameObject == nil or not self.gameObject then
return
end
end
if self.callback ~= nil and type(self.callback) == "function" then
self.callback(self.tbResultIdx)
@@ -37,7 +37,7 @@ end
function ThrowGiftItemSelectGridCtrl:OnRelease()
end
function ThrowGiftItemSelectGridCtrl:Refresh(nItemId)
self._mapNode.AnimRoot:Play("New State")
self:SetDefault()
local mapItemCfgData = ConfigTable.GetData("ThrowGiftItem", nItemId)
if mapItemCfgData == nil then
self.gameObject:SetActive(false)
@@ -59,6 +59,11 @@ function ThrowGiftItemSelectGridCtrl:SetSelect(bSelect)
end
self._mapNode.imgBgSelect:SetActive(bSelect)
end
function ThrowGiftItemSelectGridCtrl:SetDefault()
self._mapNode.AnimRoot:Play("default")
self._mapNode.btnConfirm.interactable = false
self._mapNode.imgBgSelect:SetActive(false)
end
function ThrowGiftItemSelectGridCtrl:PlaySelectAnim()
self.animator:Play("btnItemSelectCard_out")
end
@@ -82,7 +82,7 @@ function ThrowGiftCtrl:Awake()
self._mapNode.rtItem[1]:SetAction(1)
self._mapNode.rtItem[2]:SetAction(2)
self.tbGamepadUINode = self:GetGamepadUINode()
GamepadUIManager.AddGamepadUINode("ThrowGiftPanel", self.tbGamepadUINode)
GamepadUIManager.AddGamepadUINode(self._panel.sGamepadPanelName, self.tbGamepadUINode)
end
function ThrowGiftCtrl:FadeIn()
end
@@ -167,7 +167,7 @@ function ThrowGiftCtrl:OnEnable()
self:AddTimer(1, 1.7, waitAnim, true, true, true)
end
self:AddTimer(1, 1.3, waitTransion, true, true, true)
self:SetTarget(0, self.mapLevelCfgData.throwGiftLevelParams)
self:SetTarget(0)
end
function ThrowGiftCtrl:OnDisable()
end
@@ -228,7 +228,7 @@ function ThrowGiftCtrl:OpenItemSelect(tbItems, selectCallback)
self._mapNode.rtItem[2]:PlayAnim(3)
end
end
self._mapNode.rtItemSelect:OpenPanel(tbItem, callback, pos)
self._mapNode.rtItemSelect:OpenPanel(tbItems, callback, pos)
end
function ThrowGiftCtrl:OpenSettle(bWin, nScore, nGift, nPenguin, bShowPenguin, changeInfo)
self.mapRecordLevelData = {}
@@ -240,7 +240,7 @@ function ThrowGiftCtrl:OpenSettle(bWin, nScore, nGift, nPenguin, bShowPenguin, c
end
local bShowNextLevel = false
local nNextLevelId = self.nLevelId + 1
local mapNextCfgData = ConfigTable.GetData("ThrowGiftLevel", self.nLevelId, false)
local mapNextCfgData = ConfigTable.GetData("ThrowGiftLevel", nNextLevelId, false)
if mapNextCfgData ~= nil then
bShowNextLevel = self:GetLevelUnlock(nNextLevelId)
end
@@ -340,9 +340,12 @@ function ThrowGiftCtrl:ChangeLevel(nLevelId)
self:AddTimer(1, 1.3, waitTransion, true, true, true)
EventManager.Hit(EventId.SetTransition)
end
EventManager.Hit(EventId.SetTransition, 37, callback)
EventManager.Hit(EventId.SetTransition, self._panel.nTransition, callback)
end
function ThrowGiftCtrl:GetLevelUnlock(nLevelId)
if self.actData == nil then
return true
end
local mapLevelCfgData = ConfigTable.GetData("ThrowGiftLevel", nLevelId)
if mapLevelCfgData == nil then
return false
@@ -409,7 +412,7 @@ function ThrowGiftCtrl:OnEvent_ThrowGift_Exit()
self._mapNode.PausePanel:Close()
end
WwiseAudioMgr:PostEvent("Mode_Present_all_stop")
EventManager.Hit(EventId.ClosePanel, PanelId.ThrowGiftLevelPanel)
EventManager.Hit(EventId.ClosePanel, self._panel.nLevelPanelId)
end
function ThrowGiftCtrl:OnEvent_ThrowGift_Giveup()
if self.levelCtrl ~= nil then
@@ -468,7 +471,7 @@ end
function ThrowGiftCtrl:OnEvent_ThrowGift_NextLevel()
local bShowNextLevel = false
local nNextLevelId = self.nLevelId + 1
local mapNextCfgData = ConfigTable.GetData("ThrowGiftLevel", self.nLevelId, false)
local mapNextCfgData = ConfigTable.GetData("ThrowGiftLevel", nNextLevelId, false)
if mapNextCfgData ~= nil then
bShowNextLevel = self:GetLevelUnlock(nNextLevelId)
end
@@ -27,7 +27,15 @@ ThrowGiftItemDicCtrl._mapNodeConfig = {
AnimRootItemInfo = {sComponentName = "Animator"},
imgItemIconInfo = {sComponentName = "Image"},
TMPItemNameInfo = {sComponentName = "TMP_Text"},
TMPItemDescInfo = {sComponentName = "TMP_Text"}
TMPItemDescInfo = {sComponentName = "TMP_Text"},
btnRight = {
sComponentName = "NaviButton",
callback = "OnBtnClick_Right"
},
btnLeft = {
sComponentName = "NaviButton",
callback = "OnBtnClick_Left"
}
}
ThrowGiftItemDicCtrl._mapEventConfig = {}
ThrowGiftItemDicCtrl._mapRedDotConfig = {}
@@ -39,6 +47,8 @@ function ThrowGiftItemDicCtrl:FadeOut()
end
function ThrowGiftItemDicCtrl:OnEnable()
self.nActivityId = 0
self.nPage = 1
self.nTotalPage = 1
local param = self:GetPanelParam()
if type(param) == "table" then
self.nActivityId = param[1]
@@ -58,14 +68,18 @@ function ThrowGiftItemDicCtrl:OnEnable()
return a.Id < b.Id
end
table.sort(self.tbItem, sort)
for i = 1, 8 do
if self.tbItem[i] ~= nil then
self._mapNode.btnItem[i].gameObject:SetActive(true)
self._mapNode.btnItemCtrl[i]:SetItem(self.tbItem[i].Id, self.mapRecordItemData[self.tbItem[i].Id] ~= nil and 0 < self.mapRecordItemData[self.tbItem[i].Id])
else
self._mapNode.btnItem[i].gameObject:SetActive(false)
end
if 0 < #self.tbItem then
self.nTotalPage = math.ceil(#self.tbItem / 8)
end
if 1 >= self.nTotalPage then
self._mapNode.btnRight.gameObject:SetActive(false)
self._mapNode.btnLeft.gameObject:SetActive(false)
else
self._mapNode.btnRight.gameObject:SetActive(true)
self._mapNode.btnLeft.gameObject:SetActive(true)
end
end
function ThrowGiftItemDicCtrl:RefreshPanel()
end
function ThrowGiftItemDicCtrl:OnDisable()
end
@@ -75,8 +89,22 @@ function ThrowGiftItemDicCtrl:OnRelease()
end
function ThrowGiftItemDicCtrl:OpenPanel()
self.gameObject:SetActive(true)
self:RefreshItems(self.nPage)
end
function ThrowGiftItemDicCtrl:RefreshItems(nPage)
self.nPage = nPage
for i = 1, 8 do
local nItemIdx = i + (self.nPage - 1) * 8
if self.tbItem[nItemIdx] ~= nil then
self._mapNode.btnItem[i].gameObject:SetActive(true)
self._mapNode.btnItemCtrl[i]:SetItem(self.tbItem[nItemIdx].Id, self.mapRecordItemData[self.tbItem[nItemIdx].Id] ~= nil and self.mapRecordItemData[self.tbItem[nItemIdx].Id] > 0)
else
self._mapNode.btnItem[i].gameObject:SetActive(false)
end
end
end
function ThrowGiftItemDicCtrl:OnBtnClick_Item(btn, nIdx)
local nIdx = nIdx + (self.nPage - 1) * 8
local mapConfig = self.tbItem[nIdx]
if mapConfig == nil then
return
@@ -102,4 +130,18 @@ function ThrowGiftItemDicCtrl:OnBtnClick_Close(btn)
end
self:AddTimer(1, 0.2, wait, true, true, true)
end
function ThrowGiftItemDicCtrl:OnBtnClick_Right(btn)
local nPage = self.nPage + 1
if nPage > self.nTotalPage then
nPage = 1
end
self:RefreshItems(nPage)
end
function ThrowGiftItemDicCtrl:OnBtnClick_Left(btn)
local nPage = self.nPage - 1
if nPage < 1 then
nPage = self.nTotalPage
end
self:RefreshItems(nPage)
end
return ThrowGiftItemDicCtrl
@@ -90,6 +90,6 @@ end
function ThrowGiftItemUseBtnCtrl:SetAction(nIdx)
self._mapNodeConfig.btnItem1.sAction = "ThrowGiftItem" .. nIdx
self.tbGamepadUINode = self:GetGamepadUINode()
GamepadUIManager.AddGamepadUINode("ThrowGiftPanel", self.tbGamepadUINode)
GamepadUIManager.AddGamepadUINode(self._panel.sGamepadPanelName, self.tbGamepadUINode)
end
return ThrowGiftItemUseBtnCtrl
@@ -1,33 +1,33 @@
local ThrowGiftLevelTrackLineCtrl = class("ThrowGiftLevelTrackLineCtrl", BaseCtrl)
local ThrowGiftLevelGuideTrackLineCtrl = class("ThrowGiftLevelGuideTrackLineCtrl", BaseCtrl)
local nHeight = 210
local ConfigData = require("GameCore.Data.ConfigData")
ThrowGiftLevelTrackLineCtrl._mapNodeConfig = {
ThrowGiftLevelGuideTrackLineCtrl._mapNodeConfig = {
TemplateDot = {},
rtPool = {sComponentName = "Transform"}
}
ThrowGiftLevelTrackLineCtrl._mapEventConfig = {}
ThrowGiftLevelTrackLineCtrl._mapRedDotConfig = {}
function ThrowGiftLevelTrackLineCtrl:Awake()
ThrowGiftLevelGuideTrackLineCtrl._mapEventConfig = {}
ThrowGiftLevelGuideTrackLineCtrl._mapRedDotConfig = {}
function ThrowGiftLevelGuideTrackLineCtrl:Awake()
self.tbCurDot = {}
self.tbPool = {}
self.nPrevTimer = 0
self.bActive = false
end
function ThrowGiftLevelTrackLineCtrl:FadeIn()
function ThrowGiftLevelGuideTrackLineCtrl:FadeIn()
end
function ThrowGiftLevelTrackLineCtrl:FadeOut()
function ThrowGiftLevelGuideTrackLineCtrl:FadeOut()
end
function ThrowGiftLevelTrackLineCtrl:OnEnable()
function ThrowGiftLevelGuideTrackLineCtrl:OnEnable()
self._mapNode.TemplateDot:SetActive(false)
end
function ThrowGiftLevelTrackLineCtrl:OnDisable()
function ThrowGiftLevelGuideTrackLineCtrl:OnDisable()
self:DestroyAll()
end
function ThrowGiftLevelTrackLineCtrl:OnDestroy()
function ThrowGiftLevelGuideTrackLineCtrl:OnDestroy()
end
function ThrowGiftLevelTrackLineCtrl:OnRelease()
function ThrowGiftLevelGuideTrackLineCtrl:OnRelease()
end
function ThrowGiftLevelTrackLineCtrl:DestroyAll()
function ThrowGiftLevelGuideTrackLineCtrl:DestroyAll()
for _, tbDot in ipairs(self.tbCurDot) do
destroy(tbDot[1].gameObject)
end
@@ -37,7 +37,7 @@ function ThrowGiftLevelTrackLineCtrl:DestroyAll()
self.tbCurDot = {}
self.tbPool = {}
end
function ThrowGiftLevelTrackLineCtrl:Reset()
function ThrowGiftLevelGuideTrackLineCtrl:Reset()
for _, tbDot in ipairs(self.tbCurDot) do
table.insert(self.tbPool, tbDot[1])
tbDot[1]:SetParent(self._mapNode.rtPool)
@@ -45,7 +45,7 @@ function ThrowGiftLevelTrackLineCtrl:Reset()
self.tbCurDot = {}
self.nPrevTimer = 0
end
function ThrowGiftLevelTrackLineCtrl:GetDot()
function ThrowGiftLevelGuideTrackLineCtrl:GetDot()
if #self.tbPool > 0 then
local rtDot = table.remove(self.tbPool)
rtDot:SetParent(self.gameObject.transform)
@@ -60,12 +60,12 @@ function ThrowGiftLevelTrackLineCtrl:GetDot()
table.insert(self.tbCurDot, {rtDot, goOn})
return rtDot
end
function ThrowGiftLevelTrackLineCtrl:AddDot(v2Pos, nAngle)
function ThrowGiftLevelGuideTrackLineCtrl:AddDot(v2Pos, nAngle)
local rtDot = self:GetDot()
rtDot.anchoredPosition = v2Pos
rtDot.localEulerAngles = Vector3(0, 0, nAngle - 90)
end
function ThrowGiftLevelTrackLineCtrl:SetLineActive(nAngle, nSpeed)
function ThrowGiftLevelGuideTrackLineCtrl:SetLineActive(nAngle, nSpeed)
local nConfigAngle = self.mapData.Angle
local nConfigSpeed = self.mapData.Speed
local nSpeedRangeMax = nConfigSpeed + self.mapData.SpeedThreshold
@@ -80,7 +80,7 @@ function ThrowGiftLevelTrackLineCtrl:SetLineActive(nAngle, nSpeed)
end
end
end
function ThrowGiftLevelTrackLineCtrl:InitLine(mapData, v2Pos, nAG, nMaxSpeed)
function ThrowGiftLevelGuideTrackLineCtrl:InitLine(mapData, v2Pos, nAG, nMaxSpeed)
if mapData == nil then
return
end
@@ -104,4 +104,4 @@ function ThrowGiftLevelTrackLineCtrl:InitLine(mapData, v2Pos, nAG, nMaxSpeed)
self:AddDot(Vector2(nBenginingX + dotx, nBenginingY + dotY), nFlyAngle)
end
end
return ThrowGiftLevelTrackLineCtrl
return ThrowGiftLevelGuideTrackLineCtrl
@@ -29,6 +29,11 @@ ThrowGiftLevelInfoGridCtrl._mapNodeConfig = {
nCount = 2,
sCtrlName = "Game.UI.TemplateEx.TemplateItemCtrl"
},
btnReward = {
nCount = 2,
sComponentName = "UIButton",
callback = "OnBtnClick_Reward"
},
btnGo = {
sComponentName = "UIButton",
callback = "OnBtnClick_Go"
@@ -101,8 +106,20 @@ end
function ThrowGiftLevelInfoGridCtrl:OnBtnClick_Go()
EventManager.Hit("ThrowGiftStartBtnClick")
local callback = function()
EventManager.Hit(EventId.OpenPanel, PanelId.ThrowGiftLevelPanel, self.nLevelId, self.nOpenTime)
EventManager.Hit(EventId.OpenPanel, self._panel.nLevelPanelId, self.nLevelId, self.nOpenTime)
end
EventManager.Hit(EventId.SetTransition, 37, callback)
EventManager.Hit(EventId.SetTransition, self._panel.nTransition, callback)
end
function ThrowGiftLevelInfoGridCtrl:OnBtnClick_Reward(goBtn, nIdx)
local mapLevelCfgData = ConfigTable.GetData("ThrowGiftLevel", self.nLevelId)
if mapLevelCfgData == nil then
return
end
local nItemId = nIdx == 1 and mapLevelCfgData.FirstCompleteReward1Tid or mapLevelCfgData.FirstCompleteReward2Tid
local rtItem = nIdx == 1 and self._mapNode.rtItemReward[1].gameObject.transform or self._mapNode.rtItemReward[2].gameObject.transform
if nItemId == 0 then
return
end
UTILS.ClickItemGridWithTips(nItemId, rtItem, true, true, false)
end
return ThrowGiftLevelInfoGridCtrl
@@ -151,6 +151,10 @@ function ThrowGiftLevelSelectCtrl:OnEnable()
end
end
function ThrowGiftLevelSelectCtrl:OnDisable()
if self._switchAnimTimer ~= nil then
self._switchAnimTimer:Cancel()
self._switchAnimTimer = nil
end
end
function ThrowGiftLevelSelectCtrl:OnDestroy()
end
@@ -199,7 +203,7 @@ function ThrowGiftLevelSelectCtrl:RefreshLevelInfoGrid()
tbNewLevel = self.actData:GetNewLevels()
end
for _, nLevelId in ipairs(tbNewLevel) do
if nLevelId > tbCurGroup[2].Id then
if tbCurGroup[2] ~= nil and nLevelId > tbCurGroup[2].Id then
bShowBottomNew = true
break
end
@@ -271,6 +275,9 @@ function ThrowGiftLevelSelectCtrl:GetLevelPass(nLevelId)
return false
end
function ThrowGiftLevelSelectCtrl:GetLevelUnlock(nLevelId)
if self.actData == nil then
return true
end
local mapLevelCfgData = ConfigTable.GetData("ThrowGiftLevel", nLevelId)
if mapLevelCfgData == nil then
return false, 0
@@ -431,7 +438,7 @@ function ThrowGiftLevelSelectCtrl:OnBtnClick_Target()
if mapGroupData ~= nil then
local actData = mapGroupData:GetActivityDataByIndex(AllEnum.ActivityThemeFuncIndex.Task)
if actData ~= nil then
EventManager.Hit(EventId.OpenPanel, PanelId.Task_10105, actData.ActivityId, 4)
EventManager.Hit(EventId.OpenPanel, self._panel.nQuestPanelId, actData.ActivityId, 4)
end
end
end
@@ -7,6 +7,9 @@ ThrowGiftLevelSelectPanel._tbDefine = {
}
}
function ThrowGiftLevelSelectPanel:Awake()
self.nTransition = 37
self.nLevelPanelId = PanelId.ThrowGiftLevelPanel
self.nQuestPanelId = PanelId.Task_10105
end
function ThrowGiftLevelSelectPanel:OnEnable()
end
@@ -0,0 +1,24 @@
local ThrowGiftLevelSelectPanel_400009 = class("ThrowGiftLevelSelectPanel_400009", BasePanel)
ThrowGiftLevelSelectPanel_400009._sUIResRootPath = "UI_Activity/"
ThrowGiftLevelSelectPanel_400009._tbDefine = {
{
sPrefabPath = "_400009/ThrowGiftsLevelSelectPanel.prefab",
sCtrlName = "Game.UI.Activity.ThrowGifts.ThrowGiftLevelSelectCtrl"
}
}
function ThrowGiftLevelSelectPanel_400009:Awake()
self.nTransition = 45
self.nLevelPanelId = PanelId.ThrowGiftLevelPanel_400009
self.nQuestPanelId = PanelId.Task_10107
end
function ThrowGiftLevelSelectPanel_400009:OnEnable()
end
function ThrowGiftLevelSelectPanel_400009:OnAfterEnter()
end
function ThrowGiftLevelSelectPanel_400009:OnDisable()
end
function ThrowGiftLevelSelectPanel_400009:OnDestroy()
end
function ThrowGiftLevelSelectPanel_400009:OnRelease()
end
return ThrowGiftLevelSelectPanel_400009
@@ -8,6 +8,10 @@ ThrowGiftPanel._tbDefine = {
}
}
function ThrowGiftPanel:Awake()
self.nLevelPanelId = PanelId.ThrowGiftLevelPanel
self.sGamepadPanelName = "ThrowGiftPanel"
self.nTransition = 37
self._rootPath = "UI_Activity/_400005/GoalPerfab/Goal%s.prefab"
GamepadUIManager.EnterAdventure(true)
GamepadUIManager.EnableGamepadUI("ThrowGiftPanel", {}, nil, true)
end
@@ -0,0 +1,30 @@
local ThrowGiftPanel_400009 = class("ThrowGiftPanel_400009", BasePanel)
ThrowGiftPanel_400009._sUIResRootPath = "UI_Activity/"
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
ThrowGiftPanel_400009._tbDefine = {
{
sPrefabPath = "_400009/ThrowGiftsPanel.prefab",
sCtrlName = "Game.UI.Activity.ThrowGifts.ThrowGiftCtrl"
}
}
function ThrowGiftPanel_400009:Awake()
self.nLevelPanelId = PanelId.ThrowGiftLevelPanel_400009
self.sGamepadPanelName = "ThrowGiftPanel_400009"
self.nTransition = 45
self._rootPath = "UI_Activity/_400009/GoalPerfab/Goal%s.prefab"
GamepadUIManager.EnterAdventure(true)
GamepadUIManager.EnableGamepadUI(self.sGamepadPanelName, {}, nil, true)
end
function ThrowGiftPanel_400009:OnEnable()
end
function ThrowGiftPanel_400009:OnAfterEnter()
end
function ThrowGiftPanel_400009:OnDisable()
end
function ThrowGiftPanel_400009:OnDestroy()
GamepadUIManager.DisableGamepadUI(self.sGamepadPanelName)
GamepadUIManager.QuitAdventure()
end
function ThrowGiftPanel_400009:OnRelease()
end
return ThrowGiftPanel_400009
@@ -24,17 +24,20 @@ ThrowGiftPauseCtrl._mapNodeConfig = {
btn_exit = {
sComponentName = "NaviButton",
callback = "OnBtnClick_Exit",
sAction = "Giveup"
sAction = "Giveup",
sActionIconType = "Dark"
},
btn_restart = {
sComponentName = "NaviButton",
callback = "OnBtnClick_Restart",
sAction = "Retry"
sAction = "Retry",
sActionIconType = "Dark"
},
btn_continue = {
sComponentName = "NaviButton",
callback = "OnBtnClick_Continue",
sAction = "Back"
sAction = "Back",
sActionIconType = "Dark"
},
txt_dic = {
nCount = 2,
@@ -44,7 +47,8 @@ ThrowGiftPauseCtrl._mapNodeConfig = {
btn_dic = {
sComponentName = "NaviButton",
callback = "OnBtnClick_Dic",
sAction = "Depot"
sAction = "Depot",
sActionIconType = "Dark"
}
}
ThrowGiftPauseCtrl._mapEventConfig = {}
@@ -1,13 +1,18 @@
local ThrowGiftSettleCtrl = class("ThrowGiftSettleCtrl", BaseCtrl)
local WwiseAudioMgr = CS.WwiseAudioManager.Instance
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
ThrowGiftSettleCtrl._mapNodeConfig = {
btnConfirm1 = {
sComponentName = "UIButton",
callback = "OnBtnClick_Confirm1"
sComponentName = "NaviButton",
callback = "OnBtnClick_Confirm1",
sAction = "ThrowGiftSettleConfirm1",
sActionIconType = "Dark"
},
btnConfirm2 = {
sComponentName = "UIButton",
callback = "OnBtnClick_Confirm2"
sComponentName = "NaviButton",
callback = "OnBtnClick_Confirm2",
sAction = "ThrowGiftSettleConfirm2",
sActionIconType = "Dark"
},
txtBtnClose = {
sComponentName = "TMP_Text",
@@ -42,6 +47,8 @@ ThrowGiftSettleCtrl._mapNodeConfig = {
ThrowGiftSettleCtrl._mapEventConfig = {}
ThrowGiftSettleCtrl._mapRedDotConfig = {}
function ThrowGiftSettleCtrl:Awake()
self.tbGamepadUINode = self:GetGamepadUINode()
GamepadUIManager.AddGamepadUINode("ThrowGiftSettle", self.tbGamepadUINode)
end
function ThrowGiftSettleCtrl:FadeIn()
end
@@ -59,6 +66,7 @@ function ThrowGiftSettleCtrl:OnRelease()
end
function ThrowGiftSettleCtrl:ShowSettle(bWin, nScore, nGift, nPenguin, bShowPenguin, bNextUnlock, changeInfo, nLevelId)
self.bWin = bWin
GamepadUIManager.EnableGamepadUI("ThrowGiftSettle", self.tbGamepadUINode)
NovaAPI.SetTMPText(self._mapNode.txtBtnConfirm, self.bWin and ConfigTable.GetUIText("ThrowGift_Settle_NextLevel") or ConfigTable.GetUIText("ThrowGift_Settle_Restart"))
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
@@ -89,6 +97,9 @@ function ThrowGiftSettleCtrl:ShowSettle(bWin, nScore, nGift, nPenguin, bShowPeng
end
EventManager.Hit(EventId.TemporaryBlockInput, nAnimLength)
local timerCb = function()
if self == nil or not self.gameObject then
return
end
if changeInfo ~= nil and #changeInfo.Props > 0 then
local mapLevelData = ConfigTable.GetData("ThrowGiftLevel", nLevelId)
local i = 1
@@ -107,10 +118,12 @@ function ThrowGiftSettleCtrl:ShowSettle(bWin, nScore, nGift, nPenguin, bShowPeng
end
function ThrowGiftSettleCtrl:OnBtnClick_Confirm1()
self.gameObject:SetActive(false)
GamepadUIManager.DisableGamepadUI("ThrowGiftSettle")
EventManager.Hit("ThrowGiftSettle_Exit")
end
function ThrowGiftSettleCtrl:OnBtnClick_Confirm2()
self.gameObject:SetActive(false)
GamepadUIManager.DisableGamepadUI("ThrowGiftSettle")
if self.bWin then
EventManager.Hit("ThrowGiftSettle_NextLevel")
else
@@ -2,6 +2,8 @@ local ThrowGiftsLevelCtrl = class("ThrowGiftsLevelCtrl", BaseCtrl)
local GameResourceLoader = require("Game.Common.Resource.GameResourceLoader")
local ResTypeAny = GameResourceLoader.ResType.Any
local WwiseAudioMgr = CS.WwiseAudioManager.Instance
local nMarkWidth = 36
local nMarkHeight = 56
ThrowGiftsLevelCtrl._mapNodeConfig = {
Scene = {sComponentName = "Transform"},
rtScene = {
@@ -50,11 +52,14 @@ ThrowGiftsLevelCtrl._mapNodeConfig = {
imgInfinite = {},
penguinRoot = {},
rtTemplateGuideTrack = {},
goBeginningMark = {},
rtBeginningMark = {
sComponentName = "RectTransform"
},
rtDebug = {}
}
ThrowGiftsLevelCtrl._mapEventConfig = {}
ThrowGiftsLevelCtrl._mapRedDotConfig = {}
local rootPath = "UI_Activity/_400005/GoalPerfab/Goal%s.prefab"
function ThrowGiftsLevelCtrl:Awake()
self.bDebugMode = false
self.curGiftPenguin = nil
@@ -71,6 +76,7 @@ function ThrowGiftsLevelCtrl:Awake()
self.curPenguinType = 1
self.nNextPenguinType = 1
self.curPenguinSpecialType = 0
self.defaultPenguinSpecialType = 0
self.nLevelTime = -1
self.nLevelScore = 0
self.nTotalThrowGiftCount = 0
@@ -115,12 +121,22 @@ end
function ThrowGiftsLevelCtrl:FadeOut()
end
function ThrowGiftsLevelCtrl:OnEnable()
self.rootPath = self._panel._rootPath
EventManager.Hit("ThrowGiftSetSpeacialFunc", self)
self._mapNode.BeginningPenguinRoot.gameObject:SetActive(false)
self._mapNode.penguinRoot:SetActive(false)
self._mapNode.rtBottleAnim:Play("rtBottle_Empty")
self._mapNode.goBeginningMark:SetActive(false)
end
function ThrowGiftsLevelCtrl:OnDisable()
if self.beginningTweener ~= nil then
self.beginningTweener:Kill()
self.beginningTweener = nil
end
if self.mapUpdateTimer ~= nil then
self.mapUpdateTimer:Cancel()
self.mapUpdateTimer = nil
end
self:ClearTrackLine()
if self.tbGuideTrackCtrl ~= nil and #self.tbGuideTrackCtrl ~= 0 then
self:ClearGuideLine()
@@ -160,11 +176,12 @@ function ThrowGiftsLevelCtrl:SetLevel(parent, nLevelId, mapActData)
if mapFloorCfgData == nil then
return
end
self.defaultPenguinSpecialType = self.mapLevelCfgData.DefaultPenguinItemId
self.maxVelocity = mapFloorCfgData.SpeedMax
self.minVelovity = mapFloorCfgData.SpeedMin
self.nAngleMin = mapFloorCfgData.AngelMin
self.nAG = mapFloorCfgData.Gravity
if self.mapLevelCfgData.Difficulty == GameEnum.ThrowGiftDifficulty.Blind then
if self.mapLevelCfgData.FlightPath == true then
self._mapNode.rtBlindLevelTrack.gameObject:SetActive(true)
end
self.mapFloorCfgData = mapFloorCfgData
@@ -194,8 +211,8 @@ function ThrowGiftsLevelCtrl:SetLevel(parent, nLevelId, mapActData)
}
end
self._mapNode.rtDebug:SetActive(self.bDebugMode)
local nChildCount = self._mapNode.rtObstacleRoot.childCount
for i = 0, nChildCount - 1 do
local nStaticChildCount = self._mapNode.rtObstacleRoot.childCount
for i = 0, nStaticChildCount - 1 do
local goObstacle = self._mapNode.rtObstacleRoot:GetChild(i)
if goObstacle ~= nil then
local rtObstacle = goObstacle:GetComponent("RectTransform")
@@ -206,8 +223,8 @@ function ThrowGiftsLevelCtrl:SetLevel(parent, nLevelId, mapActData)
end
end
end
local nChildCount = self._mapNode.rtSpecialObstacleRoot.childCount
for i = 0, nChildCount - 1 do
local nSpecialChildCount = self._mapNode.rtSpecialObstacleRoot.childCount
for i = 0, nSpecialChildCount - 1 do
local goObstacle = self._mapNode.rtSpecialObstacleRoot:GetChild(i)
if goObstacle ~= nil then
local rtObstacle = goObstacle:GetComponent("RectTransform")
@@ -333,12 +350,14 @@ function ThrowGiftsLevelCtrl:FlyOver(nDelayTime, tbHitGoalId)
self._mapNode.rtBottleAnim:Play("rtBottle_in")
self._mapNode.BeginningPenguinRoot:Play("penguinRoot_jump")
WwiseAudioMgr:PostEvent("Mode_Present_shylock_jump")
self:SetPenguinType(self._mapNode.BeginningPenguinRoot.transform, self.curPenguinType, self.curPenguinSpecialType)
self:SetPenguinType(self._mapNode.rtBottle:Find("AnimRoot/penguinRoot"), self.curPenguinType, self.curPenguinSpecialType)
local nSpecialType = self.curPenguinSpecialType == 0 and self.defaultPenguinSpecialType or self.curPenguinSpecialType
self:SetPenguinType(self._mapNode.BeginningPenguinRoot.transform, self.curPenguinType, nSpecialType)
self:SetPenguinType(self._mapNode.rtBottle:Find("AnimRoot/penguinRoot"), self.curPenguinType, nSpecialType)
self:SetBeginningAngle(0, 0)
local wait = function()
self._mapNode.imgBeginningHint:SetActive(true)
self:SetPenguinType(self._mapNode.rtPenguinBeginningHint, self.curPenguinType, self.curPenguinSpecialType)
local nCurSpecialType = self.curPenguinSpecialType == 0 and self.defaultPenguinSpecialType or self.curPenguinSpecialType
self:SetPenguinType(self._mapNode.rtPenguinBeginningHint, self.curPenguinType, nCurSpecialType)
if self.nTotalPenguinCount ~= 0 then
self._mapNode.BeginningPenguinRoot.gameObject:SetActive(true)
self._mapNode.BeginningPenguinRoot:Play("penguinRoot_in")
@@ -353,14 +372,14 @@ function ThrowGiftsLevelCtrl:FlyOver(nDelayTime, tbHitGoalId)
else
self.nNextPenguinType = self.mapFloorCfgData.InitialGiftSort[self.curPenguinIdx]
end
self:SetPenguinType(self._mapNode.BeginningPenguinRoot.transform, self.nNextPenguinType, 0)
self:SetPenguinType(self._mapNode.BeginningPenguinRoot.transform, self.nNextPenguinType, self.defaultPenguinSpecialType)
else
self._mapNode.BeginningPenguinRoot.gameObject:SetActive(false)
end
end
local waitAnimEnd = function()
self.nLevelType = 1
if self.mapLevelCfgData.Difficulty == GameEnum.ThrowGiftDifficulty.Blind then
if self.mapLevelCfgData.SwitchArrow == true then
self.parent:SetViewBtn(1)
end
end
@@ -505,12 +524,16 @@ function ThrowGiftsLevelCtrl:ActiveItem(nItemId)
self.parent:AddTimeAnim()
WwiseAudioMgr:PostEvent("Mode_Present_prop_overtime")
end
elseif 106 <= nItemId and nItemId <= 108 then
elseif 106 <= nItemId and nItemId <= 110 then
self.curPenguinSpecialType = nItemId
self._mapNode.rtPenguinBeginningHintAnim:Play("imgBeginningHint_in")
if not self.bFlying and self.nLevelType == 1 or self.nLevelType == 3 then
if not self.bFlying and (self.nLevelType == 1 or self.nLevelType == 3) then
if nItemId == 108 then
WwiseAudioMgr:PostEvent("Mode_Present_prop_anteena")
elseif nItemId == 109 then
WwiseAudioMgr:PostEvent("Mode_Present_prop_spring")
elseif nItemId == 110 then
WwiseAudioMgr:PostEvent("Mode_Present_prop_magic")
else
WwiseAudioMgr:PostEvent("Mode_Present_prop_gear")
end
@@ -518,15 +541,26 @@ function ThrowGiftsLevelCtrl:ActiveItem(nItemId)
self:SetPenguinType(self._mapNode.rtPenguinBeginningHint, self.curPenguinType, nItemId)
self._mapNode.rtBottleAnim:Play("rtBottle_switch")
self._mapNode.rtPenguinBeginningHintAnim:Play("imgBeginningHint_in")
else
self:SetPenguinType(self._mapNode.rtPenguinBeginningHint, self.curPenguinType, nItemId)
self:SetPenguinType(self._mapNode.BeginningPenguinRoot.transform, self.curPenguinType, nItemId)
self:SetPenguinType(self._mapNode.rtBottle:Find("AnimRoot/penguinRoot"), self.curPenguinType, nItemId)
end
else
self.mapCurActiveState[nItemId] = 16
self.parent:SetFx(self.mapCurActiveState)
if nItemId == 105 then
WwiseAudioMgr:PostEvent("Mode_Present_prop_power")
self:SetPenguinType(self._mapNode.BeginningPenguinRoot.transform, self.nNextPenguinType, 0)
self:SetPenguinType(self._mapNode.rtBottle:Find("AnimRoot/penguinRoot"), self.curPenguinType, self.curPenguinSpecialType)
self:SetPenguinType(self._mapNode.rtPenguinBeginningHint, self.curPenguinType, self.curPenguinSpecialType)
local nSpecialType = self.curPenguinSpecialType == 0 and self.defaultPenguinSpecialType or self.curPenguinSpecialType
if not self.bFlying and (self.nLevelType == 1 or self.nLevelType == 3) then
self:SetPenguinType(self._mapNode.BeginningPenguinRoot.transform, self.nNextPenguinType, self.defaultPenguinSpecialType)
self:SetPenguinType(self._mapNode.rtBottle:Find("AnimRoot/penguinRoot"), self.curPenguinType, nSpecialType)
self:SetPenguinType(self._mapNode.rtPenguinBeginningHint, self.curPenguinType, nSpecialType)
else
self:SetPenguinType(self._mapNode.BeginningPenguinRoot.transform, self.nNextPenguinType, nSpecialType)
self:SetPenguinType(self._mapNode.rtBottle:Find("AnimRoot/penguinRoot"), self.curPenguinType, nSpecialType)
self:SetPenguinType(self._mapNode.rtPenguinBeginningHint, self.curPenguinType, nSpecialType)
end
elseif nItemId == 102 then
self._mapNode.imgInfinite:SetActive(true)
WwiseAudioMgr:PostEvent("Mode_Present_prop_infinite")
@@ -568,8 +602,9 @@ function ThrowGiftsLevelCtrl:LevelStart()
self._mapNode.rtBottleAnim:Play("rtBottle_in")
self._mapNode.BeginningPenguinRoot:Play("penguinRoot_jump")
WwiseAudioMgr:PostEvent("Mode_Present_shylock_jump")
self:SetPenguinType(self._mapNode.BeginningPenguinRoot.transform, self.curPenguinType, self.curPenguinSpecialType)
self:SetPenguinType(self._mapNode.rtBottle:Find("AnimRoot/penguinRoot"), self.curPenguinType, self.curPenguinSpecialType)
local nSpecialType = self.curPenguinSpecialType == 0 and self.defaultPenguinSpecialType or self.curPenguinSpecialType
self:SetPenguinType(self._mapNode.BeginningPenguinRoot.transform, self.curPenguinType, nSpecialType)
self:SetPenguinType(self._mapNode.rtBottle:Find("AnimRoot/penguinRoot"), self.curPenguinType, nSpecialType)
self:SetBeginningAngle(0, 0)
local wait = function()
if self.nTotalPenguinCount ~= 0 then
@@ -586,14 +621,14 @@ function ThrowGiftsLevelCtrl:LevelStart()
else
self.nNextPenguinType = self.mapFloorCfgData.InitialGiftSort[self.curPenguinIdx]
end
self:SetPenguinType(self._mapNode.BeginningPenguinRoot.transform, self.nNextPenguinType, 0)
self:SetPenguinType(self._mapNode.BeginningPenguinRoot.transform, self.nNextPenguinType, nSpecialType)
else
self._mapNode.BeginningPenguinRoot.gameObject:SetActive(false)
end
self._mapNode.imgBeginningHint:SetActive(true)
self:SetPenguinType(self._mapNode.rtPenguinBeginningHint, self.curPenguinType, self.curPenguinSpecialType)
self:SetPenguinType(self._mapNode.rtPenguinBeginningHint, self.curPenguinType, nSpecialType)
self.nLevelType = 1
if self.mapLevelCfgData.Difficulty == GameEnum.ThrowGiftDifficulty.Blind then
if self.mapLevelCfgData.SwitchArrow == true then
self.parent:SetViewBtn(1)
end
end
@@ -614,7 +649,7 @@ function ThrowGiftsLevelCtrl:LevelStart()
GuideCallback()
end
end
if self.mapLevelCfgData.Difficulty == GameEnum.ThrowGiftDifficulty.Blind then
if self.mapLevelCfgData.SwitchArrow == true then
self.nLevelType = 3
local maxScenePosX = -math.abs((1 - self.scenePivot[1]) * self.sceneSize[1])
self.beginningTweener = DOTween.To(function()
@@ -661,7 +696,7 @@ function ThrowGiftsLevelCtrl:ChangeView(bShow)
local rtScenePos = self._mapNode.rtScene.anchoredPosition
self._mapNode.rtScene.anchoredPosition = Vector2(posX, rtScenePos.y)
end, 3, 0.5):OnComplete(function()
if self.mapLevelCfgData.Difficulty == GameEnum.ThrowGiftDifficulty.Blind then
if self.mapLevelCfgData.SwitchArrow == true then
self.parent:SetViewBtn(1)
end
self.nLevelType = 1
@@ -946,8 +981,9 @@ function ThrowGiftsLevelCtrl:OnUpdate()
nAfterY = nYMin
mapConfig.VyDir = -mapConfig.VyDir
end
mapAciveGoal.OffsetX = nAfterX - rtSpawnPoint.anchoredPosition.x
mapAciveGoal.OffsetY = nAfterY - rtSpawnPoint.anchoredPosition.y
mapAciveGoal.OffsetX = nAfterX - mapAciveGoal.initialPosX
mapAciveGoal.OffsetY = nAfterY - mapAciveGoal.initialPosY
mapAciveGoal.rtGoal.anchoredPosition = Vector2(nAfterX, nAfterY)
end
end
end
@@ -957,20 +993,29 @@ function ThrowGiftsLevelCtrl:OnUpdate()
if self.curGiftPenguin == nil then
return
end
local nCurPosX, nCurPosY
local nCurPosX, nCurPosY, tbCachedGoalId
if self.curGiftPenguin.nSpecialType == 106 then
nCurPosX, nCurPosY = self:NavigationPenguinUpdate(nDeltaTime)
elseif self.curGiftPenguin.nSpecialType == 107 then
nCurPosX, nCurPosY = self:HelmetPenguinUpdate(nDeltaTime)
elseif self.curGiftPenguin.nSpecialType == 108 then
nCurPosX, nCurPosY = self:AntennaPenguinUpdate(nDeltaTime)
elseif self.curGiftPenguin.nSpecialType == 109 then
nCurPosX, nCurPosY = self:BouncePenguinUpdate(nDeltaTime)
elseif self.curGiftPenguin.nSpecialType == 110 then
nCurPosX, nCurPosY = self:SplitPenguinUpdate(nDeltaTime)
nCurPosX, nCurPosY, tbCachedGoalId = self:SplitPenguinUpdate(nDeltaTime)
else
nCurPosX, nCurPosY = self:NormalPenguinUpdate(nDeltaTime)
end
if not self.bFlying then
self:FlyOver(0.5)
local tbHitGoalId = {}
if tbCachedGoalId ~= nil and 0 < #tbCachedGoalId then
for _, tbResult in ipairs(tbCachedGoalId) do
self:HitGoal(tbResult[2], tbResult[1])
table.insert(tbHitGoalId, tbResult[1])
end
end
self:FlyOver(0.5, tbHitGoalId)
return
end
local tbHitGoalId = {}
@@ -987,6 +1032,12 @@ function ThrowGiftsLevelCtrl:OnUpdate()
end
end
end
elseif self.curGiftPenguin.nSpecialType == 109 then
local hitGoalId, hitPos = self:BouncePenguinGoalCheck(nCurPosX, nCurPosY)
if 0 < hitGoalId then
self:HitGoal(hitPos, hitGoalId)
table.insert(tbHitGoalId, hitGoalId)
end
else
local hitGoalId, hitPos = self:NormalGoalCheck(nCurPosX, nCurPosY)
if 0 < hitGoalId then
@@ -1013,7 +1064,7 @@ end
function ThrowGiftsLevelCtrl:NormalGoalCheck(nCurPosX, nCurPosY)
local nSumX = nCurPosX - self.curGiftPenguin.mapStartPos.x
local nSumY = nCurPosY - self.curGiftPenguin.mapStartPos.y
if self.mapLevelCfgData.Difficulty == GameEnum.ThrowGiftDifficulty.Blind and self.nFlyingTime - self._mapNode.rtBlindLevelTrack.nPrevTimer >= self.nLinePointInterval * 2 then
if self.mapLevelCfgData.FlightPath == true and self.nFlyingTime - self._mapNode.rtBlindLevelTrack.nPrevTimer >= self.nLinePointInterval * 2 then
self._mapNode.rtBlindLevelTrack.nPrevTimer = self.nFlyingTime
self._mapNode.rtBlindLevelTrack:AddDot(Vector2(nCurPosX, nCurPosY))
end
@@ -1052,7 +1103,6 @@ function ThrowGiftsLevelCtrl:NormalGoalCheck(nCurPosX, nCurPosY)
return hitGoalId, hitPos
end
function ThrowGiftsLevelCtrl:SplitPenguinGoalCheck()
local bHasSubPenguin = false
local tbCurHit = {}
for _, mapSubPenguin in ipairs(self.curGiftPenguin.tbSubPenguin) do
if mapSubPenguin.bFlying then
@@ -1070,7 +1120,7 @@ function ThrowGiftsLevelCtrl:SplitPenguinGoalCheck()
hitGoalId = nId
mapSubPenguin.bFlying = false
table.insert(tbCurHit, {hitGoalId, hitPos})
table.insert(self.curGiftPenguin.tbCacheSubPenguinGoal, {hitPos, hitGoalId})
table.insert(self.curGiftPenguin.tbCacheSubPenguinGoal, {hitGoalId, hitPos})
break
end
local bHitObstacle = self:CheckCollision(mapSubPenguin.tbBounds, mapAciveGoal.tbBoundsObstacle, nSumX, nSumY, mapAciveGoal.OffsetX, mapAciveGoal.OffsetY)
@@ -1079,15 +1129,103 @@ function ThrowGiftsLevelCtrl:SplitPenguinGoalCheck()
mapSubPenguin.bFlying = false
break
end
if mapSubPenguin.bFlying then
bHasSubPenguin = true
end
end
end
end
if self.mapLevelCfgData.FlightPath == true and self.nFlyingTime - self._mapNode.rtBlindLevelTrack.nPrevTimer >= self.nLinePointInterval * 2 then
self._mapNode.rtBlindLevelTrack.nPrevTimer = self.nFlyingTime
for _, mapSubPenguin in ipairs(self.curGiftPenguin.tbSubPenguin) do
if mapSubPenguin.bFlying then
self._mapNode.rtBlindLevelTrack:AddDot(Vector2(mapSubPenguin.curPosX, mapSubPenguin.curPosY))
end
end
end
local bHasSubPenguin = false
for _, mapSubPenguin in ipairs(self.curGiftPenguin.tbSubPenguin) do
if mapSubPenguin.bFlying then
bHasSubPenguin = true
end
end
self.bFlying = bHasSubPenguin
if not self.bFlying then
self.curGiftPenguin = nil
end
return tbCurHit
end
function ThrowGiftsLevelCtrl:BouncePenguinGoalCheck(nCurPosX, nCurPosY)
local nSumX = nCurPosX - self.curGiftPenguin.mapStartPos.x
local nSumY = nCurPosY - self.curGiftPenguin.mapStartPos.y
if self.mapLevelCfgData.FlightPath == true and self.nFlyingTime - self._mapNode.rtBlindLevelTrack.nPrevTimer >= self.nLinePointInterval * 2 then
self._mapNode.rtBlindLevelTrack.nPrevTimer = self.nFlyingTime
self._mapNode.rtBlindLevelTrack:AddDot(Vector2(nCurPosX, nCurPosY))
end
local hitGoalId = 0
local hitPos
local curVy = self.curGiftPenguin.nVelocityY
for nId, mapAciveGoal in pairs(self.activeGoal) do
local GoalParentPos = mapAciveGoal.rtGoal.anchoredPosition
local bHitGoal, bestNX, bestNY, minDepth = self:CheckCollision(self.curGiftPenguin.tbBounds, mapAciveGoal.tbBoundsHitArea, nSumX, nSumY, mapAciveGoal.OffsetX, mapAciveGoal.OffsetY)
if bHitGoal then
if 0 < curVy then
if self.curGiftPenguin.nHitCount < 3 then
WwiseAudioMgr:PostEvent("Mode_Present_spring")
self.curGiftPenguin.nHitCount = self.curGiftPenguin.nHitCount + 1
nCurPosX = nCurPosX + bestNX * minDepth
nCurPosY = nCurPosY + bestNY * minDepth
nSumX = nSumX + bestNX * minDepth
nSumY = nSumY + bestNY * minDepth
self.curGiftPenguin.curPosX = nCurPosX
self.curGiftPenguin.curPosY = nCurPosY
self.curGiftPenguin.goGiftPenguin.anchoredPosition = Vector2(nCurPosX, nCurPosY)
self.curGiftPenguin.mapStartPos = self.curGiftPenguin.goGiftPenguin.anchoredPosition
local vxAfter, vyAfter = self.ReflectVelocity(self.curGiftPenguin.nVelocityX, curVy, bestNX, bestNY, 1)
self.curGiftPenguin.nHitTime = self.nFlyingTime
self.curGiftPenguin.nVelocityX = vxAfter
self.curGiftPenguin.nVelocityY = vyAfter
self.curGiftPenguin.tbBounds = self:GetLocalSpaceRect(self.curGiftPenguin.goGiftPenguin, self.curGiftPenguin.goGiftPenguin.parent)
break
else
self:DestroyPenguin()
self.bFlying = false
break
end
else
print("hit goal")
hitPos = Vector2(nCurPosX, nCurPosY)
destroy(self.curGiftPenguin.goGiftPenguin.gameObject)
hitGoalId = nId
self.curGiftPenguin = nil
self.bFlying = false
break
end
end
local bHitObstacle, bestNXObstacle, bestNYObstacle, minDepthObstacle = self:CheckCollision(self.curGiftPenguin.tbBounds, mapAciveGoal.tbBoundsObstacle, nSumX, nSumY, mapAciveGoal.OffsetX, mapAciveGoal.OffsetY)
if bHitObstacle then
if self.curGiftPenguin.nHitCount < 3 then
self.curGiftPenguin.nHitCount = self.curGiftPenguin.nHitCount + 1
nCurPosX = nCurPosX + bestNXObstacle * minDepthObstacle
nCurPosY = nCurPosY + bestNYObstacle * minDepthObstacle
nSumX = nSumX + bestNXObstacle * minDepthObstacle
nSumY = nSumY + bestNYObstacle * minDepthObstacle
self.curGiftPenguin.curPosX = nCurPosX
self.curGiftPenguin.curPosY = nCurPosY
self.curGiftPenguin.goGiftPenguin.anchoredPosition = Vector2(nCurPosX, nCurPosY)
self.curGiftPenguin.mapStartPos = self.curGiftPenguin.goGiftPenguin.anchoredPosition
local vxAfter, vyAfter = self.ReflectVelocity(self.curGiftPenguin.nVelocityX, curVy, bestNXObstacle, bestNYObstacle, 1)
self.curGiftPenguin.nHitTime = self.nFlyingTime
self.curGiftPenguin.nVelocityX = vxAfter
self.curGiftPenguin.nVelocityY = vyAfter
self.curGiftPenguin.tbBounds = self:GetLocalSpaceRect(self.curGiftPenguin.goGiftPenguin, self.curGiftPenguin.goGiftPenguin.parent)
break
else
self:DestroyPenguin()
self.bFlying = false
break
end
end
end
return hitGoalId, hitPos
end
function ThrowGiftsLevelCtrl:NormalPenguinUpdate(nDeltaTime)
self.nFlyingTime = self.nFlyingTime + nDeltaTime
local nCurPosX = self.curGiftPenguin.curPosX + nDeltaTime * self.curGiftPenguin.nVelocityX
@@ -1165,6 +1303,7 @@ function ThrowGiftsLevelCtrl:BouncePenguinUpdate(nDeltaTime)
local bHit, bestNX, bestNY, minDepth = self:CheckCollision(self.curGiftPenguin.tbBounds, tbBounds, nSumX, nSumY, 0, 0)
if bHit then
if self.curGiftPenguin.nHitCount < 3 then
WwiseAudioMgr:PostEvent("Mode_Present_spring")
self.curGiftPenguin.nHitCount = self.curGiftPenguin.nHitCount + 1
nCurPosX = nCurPosX + bestNX * minDepth
nCurPosY = nCurPosY + bestNY * minDepth
@@ -1349,7 +1488,8 @@ function ThrowGiftsLevelCtrl:NavigationPenguinUpdate(nDeltaTime)
nCurPosY = self.curGiftPenguin.curPosY + nDeltaTime * self.curGiftPenguin.nVelocityY - 0.5 * self.nAG * nDeltaTime * nDeltaTime
else
nCurPosY = self.curGiftPenguin.curPosY
nCurPosX = self.curGiftPenguin.curPosX + nDeltaTime * self.curGiftPenguin.nVelocityX
local nVelocityX = self.curGiftPenguin.nVelocityX < 600 and 600 or self.curGiftPenguin.nVelocityX
nCurPosX = self.curGiftPenguin.curPosX + nDeltaTime * nVelocityX
self.curGiftPenguin.nVelocityY = 0
end
local checkGoal = checkGetGoal(nCurPosX, nCurPosY)
@@ -1428,6 +1568,7 @@ function ThrowGiftsLevelCtrl:NavigationPenguinUpdate(nDeltaTime)
end
function ThrowGiftsLevelCtrl:SplitPenguinUpdate(nDeltaTime)
local nCurPosX, nCurPosY = 0, 0
local tbCachedGoalId = {}
local Split = function(mapPenguin, nAngle, nVelocity, initPos)
mapPenguin.bSplit = true
local goPenguin = instantiate(self._mapNode.templateBullet, self._mapNode.rtPenguinRoot)
@@ -1454,9 +1595,6 @@ function ThrowGiftsLevelCtrl:SplitPenguinUpdate(nDeltaTime)
imgFx.gameObject:SetActive(self.mapCurActiveState[105] ~= nil)
rtPenguin.anchoredPosition = initPos
goPenguin:SetActive(true)
if self.mapLevelCfgData.Difficulty == GameEnum.ThrowGiftDifficulty.Blind then
self._mapNode.rtBlindLevelTrack:Reset()
end
local mapGiftPenguin = {
goGiftPenguin = rtPenguin,
nState = 0,
@@ -1476,9 +1614,9 @@ function ThrowGiftsLevelCtrl:SplitPenguinUpdate(nDeltaTime)
end
if self.curGiftPenguin.bSplit then
local bHasSubPenguin = false
self.nFlyingTime = self.nFlyingTime + nDeltaTime
for _, mapSubPenguin in ipairs(self.curGiftPenguin.tbSubPenguin) do
if mapSubPenguin.bFlying then
self.nFlyingTime = self.nFlyingTime + nDeltaTime
nCurPosX = mapSubPenguin.curPosX + nDeltaTime * mapSubPenguin.nVelocityX
nCurPosY = mapSubPenguin.curPosY + nDeltaTime * mapSubPenguin.nVelocityY - 0.5 * self.nAG * nDeltaTime * nDeltaTime
mapSubPenguin.nVelocityY = mapSubPenguin.nVelocityY - self.nAG * nDeltaTime
@@ -1537,6 +1675,7 @@ function ThrowGiftsLevelCtrl:SplitPenguinUpdate(nDeltaTime)
end
self.bFlying = bHasSubPenguin
if not self.bFlying then
tbCachedGoalId = clone(self.curGiftPenguin.tbCacheSubPenguinGoal)
self.curGiftPenguin = nil
end
else
@@ -1563,7 +1702,7 @@ function ThrowGiftsLevelCtrl:SplitPenguinUpdate(nDeltaTime)
end
end
if not self.bFlying then
return
return 0, 0, tbCachedGoalId
end
if nCurPosX > 0.5 * self.sceneSize[1] or nCurPosX < -0.5 * self.sceneSize[1] or nCurPosY > 0.5 * self.sceneSize[2] or nCurPosY < -0.5 * self.sceneSize[2] then
print("hit border")
@@ -1571,7 +1710,7 @@ function ThrowGiftsLevelCtrl:SplitPenguinUpdate(nDeltaTime)
self.bFlying = false
end
if not self.bFlying then
return
return 0, 0, {}
end
local tbHittedObs = {}
for _, nSpecialId in ipairs(self.tbExObstacleCur) do
@@ -1604,16 +1743,20 @@ function ThrowGiftsLevelCtrl:SplitPenguinUpdate(nDeltaTime)
local mapSubPenguin = Split(self.curGiftPenguin, nFlyAngle + 20 * i, nCurVelocity, initPos)
table.insert(self.curGiftPenguin.tbSubPenguin, mapSubPenguin)
end
self:DestroySubPenguin(self.curGiftPenguin)
WwiseAudioMgr:PostEvent("Mode_Present_split")
self:DestroySubPenguin(self.curGiftPenguin, true)
end
end
return nCurPosX, nCurPosY
return nCurPosX, nCurPosY, tbCachedGoalId
end
function ThrowGiftsLevelCtrl:SetBeginningAngle(nAngle, nVelocity)
local fixedAngle = nAngle == 0 and 0 or nAngle - 90
self._mapNode.rtBottle.localEulerAngles = Vector3(0, 0, fixedAngle)
self._mapNode.goBeginningMark.transform.localEulerAngles = Vector3(0, 0, fixedAngle)
local sumScale = nVelocity / self.maxVelocity * 0.2
local sumHeight = nVelocity / self.maxVelocity * 3
self._mapNode.rtBottle.localScale = Vector3(1 + sumScale, 1 - sumScale, 1)
self._mapNode.rtBeginningMark.sizeDelta = Vector2(nMarkWidth, nMarkHeight * (1 + sumHeight))
end
function ThrowGiftsLevelCtrl:SetBeginningLine(nAngle, nVelocity)
if self.curPenguinSpecialType == 106 then
@@ -1698,6 +1841,7 @@ function ThrowGiftsLevelCtrl:HitSpecialObstacle(nSpecialId)
elseif mapOriginConfig.mapConfig.Type == GameEnum.SpecialObstacleType.WindForce then
nType = 1
Param.WindForce = mapOriginConfig.mapConfig.Param[1] * 10
Param.nAngle = mapOriginConfig.gameObject.transform.localEulerAngles.z
return true, nType, Param, false
elseif mapOriginConfig.mapConfig.Type == GameEnum.SpecialObstacleType.Portal then
nType = 2
@@ -1712,8 +1856,13 @@ function ThrowGiftsLevelCtrl:SpecialObstacleFunc(mapPenguin, nDeltaTime, nType,
return
end
if nType == 1 then
mapPenguin.nVelocityX = mapPenguin.nVelocityX - Param.WindForce * nDeltaTime
local nAcceleration = Param.WindForce * nDeltaTime
local nAccelerationX = nAcceleration * math.cos(math.rad(Param.nAngle))
local nAccelerationY = nAcceleration * math.sin(math.rad(Param.nAngle))
mapPenguin.nVelocityX = mapPenguin.nVelocityX + nAccelerationX
mapPenguin.nVelocityY = mapPenguin.nVelocityY + nAccelerationY
elseif nType == 2 then
WwiseAudioMgr:PostEvent("Mode_Present_portals")
local nExitId = Param.Exit
local mapExitConfig
for nInstanceId, mapObstacle in pairs(self.mapExObstacleOrigin) do
@@ -1753,6 +1902,8 @@ function ThrowGiftsLevelCtrl:SetPenguinType(rtPenguinRoot, nType, nSpecialType)
local rtGoggles = rtPenguinRoot:Find("penguin_goggles")
local rtAntenna = rtPenguinRoot:Find("penguin_antenna")
local rtHelmet = rtPenguinRoot:Find("penguin_helmet")
local rtSplit = rtPenguinRoot:Find("Penguin_split")
local rtSpring = rtPenguinRoot:Find("Penguin_spring")
local imgFx = rtPenguinRoot:Find("imgFx")
rtRed.gameObject:SetActive(nType == 2)
rtYellow.gameObject:SetActive(nType == 3)
@@ -1760,9 +1911,16 @@ function ThrowGiftsLevelCtrl:SetPenguinType(rtPenguinRoot, nType, nSpecialType)
rtGoggles.gameObject:SetActive(nSpecialType == 106)
rtAntenna.gameObject:SetActive(nSpecialType == 108)
rtHelmet.gameObject:SetActive(nSpecialType == 107)
if rtSplit ~= nil then
rtSplit.gameObject:SetActive(nSpecialType == 110)
rtSpring.gameObject:SetActive(nSpecialType == 109)
end
imgFx.gameObject:SetActive(self.mapCurActiveState[105] ~= nil)
end
function ThrowGiftsLevelCtrl:CreateGoal(nSpawnPointId, mapConfig)
if self.activeGoal[nSpawnPointId] ~= nil then
return
end
local pointOriginPosX = mapConfig.rtPoint.anchoredPosition.x
local pointOriginPosY = mapConfig.rtPoint.anchoredPosition.y
local randomX = math.random(-mapConfig.mapConfig.SpawnRangeTypeX, mapConfig.mapConfig.SpawnRangeTypeX)
@@ -1777,20 +1935,10 @@ function ThrowGiftsLevelCtrl:CreateGoal(nSpawnPointId, mapConfig)
nType = mapConfig.mapConfig.GoalType[mapConfig.nCurGoalIdx]
mapConfig.nCurGoalIdx = mapConfig.nCurGoalIdx + 1
end
local sPath = string.format(rootPath, nType)
local sPath = string.format(self.rootPath, nType)
local goGoalPerfab = GameResourceLoader.LoadAsset(ResTypeAny, Settings.AB_ROOT_PATH .. sPath, typeof(Object))
if goGoalPerfab ~= nil then
local goGoal = instantiate(goGoalPerfab, self._mapNode.rtGoalRoot)
if self.activeGoal[nSpawnPointId] ~= nil then
destroy(self.activeGoal[nSpawnPointId].rtGoal.gameObject)
self.activeGoal[nSpawnPointId].rtGoal = nil
self.activeGoal[nSpawnPointId].rtHitArea = nil
self.activeGoal[nSpawnPointId].rtObstacle = nil
self.activeGoal[nSpawnPointId].nType = 0
self.activeGoal[nSpawnPointId].TMPScore = nil
self.activeGoal[nSpawnPointId].OffsetX = 0
self.activeGoal[nSpawnPointId].OffsetY = 0
end
self.activeGoal[nSpawnPointId] = {}
local rtGoal = goGoal:GetComponent("RectTransform")
rtGoal.anchoredPosition = Vector2(pointOriginPosX + randomX, pointOriginPosY + randomY)
@@ -1813,6 +1961,8 @@ function ThrowGiftsLevelCtrl:CreateGoal(nSpawnPointId, mapConfig)
self.activeGoal[nSpawnPointId].tbBoundsObstacle = self:GetLocalSpaceRect(rtCompObstacle, rtGoal.parent)
self.activeGoal[nSpawnPointId].OffsetX = 0
self.activeGoal[nSpawnPointId].OffsetY = 0
self.activeGoal[nSpawnPointId].initialPosX = pointOriginPosX + randomX
self.activeGoal[nSpawnPointId].initialPosY = pointOriginPosY + randomY
local TMPNode
local rtTMPScore = rtGoal:Find("AnimRoot/TMPLevelScoreAdd")
if rtTMPScore ~= nil then
@@ -1833,6 +1983,8 @@ function ThrowGiftsLevelCtrl:CreateThrowPenguin(nAngle, nVelocity, initPos, nTyp
local rtGoggles = goImgRoot:Find("penguin_goggles")
local rtAntenna = goImgRoot:Find("penguin_antenna")
local rtHelmet = goImgRoot:Find("penguin_helmet")
local rtSplit = goImgRoot:Find("Penguin_split")
local rtSpring = goImgRoot:Find("Penguin_spring")
local rtImgRoot
if goImgRoot ~= nil then
rtImgRoot = goImgRoot:GetComponent("RectTransform")
@@ -1843,10 +1995,12 @@ function ThrowGiftsLevelCtrl:CreateThrowPenguin(nAngle, nVelocity, initPos, nTyp
rtGoggles.gameObject:SetActive(nSpecialType == 106)
rtAntenna.gameObject:SetActive(nSpecialType == 108)
rtHelmet.gameObject:SetActive(nSpecialType == 107)
rtSplit.gameObject:SetActive(nSpecialType == 110)
rtSpring.gameObject:SetActive(nSpecialType == 109)
imgFx.gameObject:SetActive(self.mapCurActiveState[105] ~= nil)
rtPenguin.anchoredPosition = initPos
goPenguin:SetActive(true)
if self.mapLevelCfgData.Difficulty == GameEnum.ThrowGiftDifficulty.Blind then
if self.mapLevelCfgData.FlightPath == true then
self._mapNode.rtBlindLevelTrack:Reset()
end
local mapGiftPenguin = {
@@ -1983,8 +2137,10 @@ function ThrowGiftsLevelCtrl:DestroyPenguin()
imgSmoke.gameObject:SetActive(true)
self:AddTimer(1, 0.5, wait, true, true, true)
end
function ThrowGiftsLevelCtrl:DestroySubPenguin(mapSubPenguin)
WwiseAudioMgr:PostEvent("Mode_Present_out")
function ThrowGiftsLevelCtrl:DestroySubPenguin(mapSubPenguin, bMainPenguin)
if bMainPenguin ~= true then
WwiseAudioMgr:PostEvent("Mode_Present_out")
end
local tempPenguin = mapSubPenguin.goGiftPenguin.gameObject.transform
local wait = function()
destroy(tempPenguin.gameObject)
@@ -2035,6 +2191,7 @@ function ThrowGiftsLevelCtrl:OnDrag_Beginning(mDrag)
nVelocity = self.minVelovity
end
self.nCurVelocity = nVelocity
self._mapNode.goBeginningMark:SetActive(true)
self:SetBeginningAngle(nAngle, nVelocity)
self:SetBeginningLine(nAngle, nVelocity)
WwiseAudioMgr:PostEvent("Mode_Present_pre_lp")
@@ -2074,11 +2231,13 @@ function ThrowGiftsLevelCtrl:OnDrag_Beginning(mDrag)
end
end
elseif mDrag.DragEventType == AllEnum.UIDragType.DragEnd then
WwiseAudioMgr:PostEvent("Mode_Present_pre_lp_stop")
self._mapNode.goBeginningMark:SetActive(false)
if self.curDragBeginPos == nil then
return
end
if self.nCurVelocity == 0 then
if self.mapLevelCfgData.Difficulty == GameEnum.ThrowGiftDifficulty.Blind then
if self.mapLevelCfgData.SwitchArrow == true then
self.parent:SetViewBtn(1)
end
self.curDragBeginPos = nil
@@ -2095,13 +2254,13 @@ function ThrowGiftsLevelCtrl:OnDrag_Beginning(mDrag)
self.nCurAngle = 0
self.nCurVelocity = 0
self._mapNode.rtBottleAnim:Play("rtBottle_out")
WwiseAudioMgr:PostEvent("Mode_Present_pre_lp_stop")
WwiseAudioMgr:PostEvent("Mode_Present_fire")
local wait = function()
local worldPos = self._mapNode.rtBeginningPos:TransformPoint(Vector3.zero)
local sumPos = self._mapNode.rtBeginning:InverseTransformPoint(worldPos)
local beginningPos = self._mapNode.rtBeginning.anchoredPosition
local mapGiftPenguin = self:CreateThrowPenguin(nStartAngle, nStartVelocity, Vector2(beginningPos.x + sumPos.x, beginningPos.y + sumPos.y), self.curPenguinType, self.curPenguinSpecialType)
local nSpecialType = self.curPenguinSpecialType == 0 and self.defaultPenguinSpecialType or self.curPenguinSpecialType
local mapGiftPenguin = self:CreateThrowPenguin(nStartAngle, nStartVelocity, Vector2(beginningPos.x + sumPos.x, beginningPos.y + sumPos.y), self.curPenguinType, nSpecialType)
self.curPenguinSpecialType = 0
self.curGiftPenguin = mapGiftPenguin
if 0 < self.nTotalPenguinCount and self.mapCurActiveState[102] == nil then