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
@@ -376,10 +376,11 @@ function GoldenSpyCompanionItem:_CheckVision()
local tbRemoveItems = {}
for _, item in ipairs(tempItems) do
if item.Ctrl ~= self then
local removeItem
local hitArea = item.Ctrl:GetHitArea()
if hitArea and self:_HitAreaInSector(hitArea, vx, vy, forwardAngle, halfAngle, radius) then
if item.Ctrl == self.floorCtrl.catchedItem then
goto lbl_228
goto lbl_229
end
if item.Ctrl:GetItemCfg().ItemType == GameEnum.GoldenSpyItem.Boom then
item.Ctrl:Boom(nil)
@@ -423,7 +424,7 @@ function GoldenSpyCompanionItem:_CheckVision()
end
tbRemoveItems = {}
end
::lbl_228::
::lbl_229::
end
end
function GoldenSpyCompanionItem:_StartVisionCheck()
@@ -242,6 +242,7 @@ function GoldenSpyFloorCtrl:Shoot(nSpeed, nRadius, nFactor, onRetractComplete, o
end
function GoldenSpyFloorCtrl:RemoveItem(itemCtrl)
local bDelSuccess = false
local itemId = itemCtrl:GetItemCfg().Id
for i = #self.tbItem, 1, -1 do
if self.tbItem[i].Ctrl == itemCtrl then
table.insert(self.tbNeedRemoveItem, self.tbItem[i])
@@ -251,7 +252,7 @@ function GoldenSpyFloorCtrl:RemoveItem(itemCtrl)
end
end
if bDelSuccess then
self.levelCtrl.GoldenSpyFloorData:DeleteItem(itemCtrl:GetItemCfg().Id)
self.levelCtrl.GoldenSpyFloorData:DeleteItem(itemId)
end
end
function GoldenSpyFloorCtrl:DropItem()
@@ -581,6 +581,7 @@ function GoldenSpyLevelCtrl:ShowBuffSelect(tbBuff, callback)
local tbShowItem = {}
local tbItems = self.GoldenSpyFloorData:GetItems()
local tbHasBuff = self.GoldenSpyLevelData:GetBuffData()
local curFloor = self.GoldenSpyLevelData:GetCurFloor()
for _, v in pairs(tbItems) do
local itemCfg = ConfigTable.GetData("GoldenSpyItem", v.itemId)
if itemCfg ~= nil and itemCfg.ShowValue ~= false then
@@ -686,7 +687,7 @@ function GoldenSpyLevelCtrl:SubTime(nTime)
if not self.bChangeTime then
self._mapNode.imgWarning.gameObject:SetActive(true)
self.bChangeTime = true
local subtimeTimer = self:AddTimer(1, 0.8, function()
local subtimeTimer = self:AddTimer(1, 0.4, function()
self._mapNode.imgWarning.gameObject:SetActive(false)
self.bChangeTime = false
end, true, true, true)
@@ -1075,8 +1076,8 @@ function GoldenSpyLevelCtrl:OnBtnClick_Frozen()
end, true, true, true)
table.insert(self.tbTimer, timer)
local img_frozenCD = self._mapNode.img_frozenCD
img_frozenCD.gameObject:SetActive(true)
img_frozenCD.fillAmount = 1
img_frozenCD.gameObject:SetActive(true)
self.FrozenTweener = DOTween.To(function()
return img_frozenCD.fillAmount
end, function(value)
@@ -1090,28 +1091,14 @@ function GoldenSpyLevelCtrl:OnBtnClick_ToolBox()
local tbShowItem = {}
local tbItems = self.GoldenSpyFloorData:GetItems()
local tbHasBuff = self.GoldenSpyLevelData:GetBuffData()
local curFloor = self.GoldenSpyLevelData:GetCurFloor()
for _, v in pairs(tbItems) do
local itemCfg = ConfigTable.GetData("GoldenSpyItem", v.itemId)
if itemCfg ~= nil and itemCfg.ShowValue ~= false then
local nScore = itemCfg.Score
for _, n in ipairs(tbHasBuff) do
local buffCfg = ConfigTable.GetData("GoldenSpyBuffCard", n.buffId)
if buffCfg ~= nil and buffCfg.EffectType == GameEnum.GoldenSpyBuffEffect.AddScore then
if buffCfg.BuffType == GameEnum.GoldenSpyBuffType.TemporaryBuff then
if n.bActive and table.indexof(n.tbActiveFloor, curFloor) > 0 and buffCfg.Params[1] == itemCfg.ItemType then
nScore = nScore + buffCfg.Params[2]
end
elseif buffCfg.BuffType == GameEnum.GoldenSpyBuffType.DelayBuff then
if n.bActive and table.indexof(n.tbActiveFloor, curFloor) > 0 and buffCfg.Params[1] == itemCfg.ItemType then
nScore = nScore + buffCfg.Params[2]
end
elseif buffCfg.BuffType == GameEnum.GoldenSpyBuffType.PermanentBuff then
if n.bActive and buffCfg.Params[1] == itemCfg.ItemType then
nScore = nScore + buffCfg.Params[2]
end
elseif buffCfg.BuffType == GameEnum.GoldenSpyBuffType.SkillCountBuff then
end
if buffCfg ~= nil and buffCfg.EffectType == GameEnum.GoldenSpyBuffEffect.AddScore and buffCfg.Params[1] == itemCfg.ItemType then
nScore = nScore + buffCfg.Params[2]
end
end
local itemData = {
@@ -306,12 +306,12 @@ function GoldenSpyLevelData:AddBuff(nBuffId)
elseif buffCfg.BuffType == GameEnum.GoldenSpyBuffType.SkillCountBuff then
buffEntity.bActive = true
if buffCfg.EffectType == GameEnum.GoldenSpyBuffEffect.AddSkillUseCount then
self.tbSkillData[buffCfg.Params[1]] = self.tbSkillData[buffCfg.Params[1]] + buffCfg.Params[2]
self.tbSkillData[buffCfg.Params[1]] = (self.tbSkillData[buffCfg.Params[1]] or 0) + buffCfg.Params[2]
EventManager.Hit("GoldenSpy_UpdateSkillCount", buffCfg.Params[1], self.tbSkillData[buffCfg.Params[1]])
end
end
table.insert(self.tbBuff, buffEntity)
if self.taskData ~= nil and self.taskData.nScore > 0 and buffCfg.EffectType == GameEnum.GoldenSpyBuffEffect.AddExScoreFactor then
if self.taskData ~= nil and 0 < self.taskData.nScore and buffCfg.EffectType == GameEnum.GoldenSpyBuffEffect.AddExScoreFactor then
if buffCfg.BuffType == GameEnum.GoldenSpyBuffType.TemporaryBuff then
if buffEntity.bActive and 0 < table.indexof(buffEntity.tbActiveFloor, self.nCurFloor) then
self.taskData.nScore = self.taskData.nScore * (1 + buffCfg.Params[1] / 100.0)
@@ -29,22 +29,26 @@ GoldenSpyPauseCtrl._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"
},
btn_dic = {
sComponentName = "NaviButton",
callback = "OnBtnClick_OpenDic",
sAction = "Depot"
sAction = "Depot",
sActionIconType = "Dark"
}
}
GoldenSpyPauseCtrl._mapEventConfig = {}
@@ -43,7 +43,7 @@ function GoldenSpySafeBoxItem:OnSkill_Boom(callback)
if callback then
callback()
end
if self.gameObject ~= nil then
if self.gameObject then
self.gameObject:SetActive(false)
end
end
@@ -140,7 +140,7 @@ function JointDrillActCtrl:OnBtnClick_Start()
return
end
EventManager.Hit("PlayJointDrillActAnim", "JointDrill_Act_01_out", function()
EventManager.Hit(EventId.OpenPanel, PanelId.JointDrillLevelSelect_1, self.actData.nActId)
EventManager.Hit(EventId.OpenPanel, PanelId.JointDrillLevelSelect_510001, self.actData.nActId)
end)
end
function JointDrillActCtrl:OnBtnClick_Detail()
@@ -140,7 +140,7 @@ function JointDrillActCtrl:OnBtnClick_Start()
return
end
EventManager.Hit("PlayJointDrillActAnim", "JointDrill_Act_01_out", function()
EventManager.Hit(EventId.OpenPanel, PanelId.JointDrillLevelSelect_2, self.actData.nActId)
EventManager.Hit(EventId.OpenPanel, PanelId.JointDrillLevelSelect_510003, self.actData.nActId)
end)
end
function JointDrillActCtrl:OnBtnClick_Detail()
@@ -0,0 +1,175 @@
local JointDrillActCtrl = class("JointDrillActCtrl", BaseCtrl)
local ClientManager = CS.ClientManager.Instance
JointDrillActCtrl._mapNodeConfig = {
btnDetail = {
sComponentName = "UIButton",
callback = "OnBtnClick_Detail"
},
txtDetail = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_Btn_Detail"
},
btnWaitStart = {
sComponentName = "UIButton",
callback = "OnEvent_WaitStart"
},
txtBtnWaitStart = {
sComponentName = "TMP_Text",
sLanguageId = "JointDrill_Act_Wait_Start"
},
imgBtnMask = {},
btnStart = {
sComponentName = "UIButton",
callback = "OnBtnClick_Start"
},
txtBtnStart = {
sComponentName = "TMP_Text",
sLanguageId = "JointDrill_Act_Goto"
},
txtActDesc = {sComponentName = "TMP_Text"},
txtActTime = {sComponentName = "TMP_Text"},
txtFuncLock = {sComponentName = "TMP_Text"},
txtBeta = {
sComponentName = "TMP_Text",
sLanguageId = "JointDrill_Beta_Tip"
},
goCommon = {
sNodeName = "---Common---"
}
}
JointDrillActCtrl._mapEventConfig = {
PlayJointDrillActAnim = "OnEvent_PlayAnim"
}
function JointDrillActCtrl:InitActData(actData)
self.actData = actData
self.nActId = actData:GetActId()
self.mapActCfg = self.actData:GetJointDrillActCfg()
if self.mapActCfg == nil then
return
end
NovaAPI.SetTMPText(self._mapNode.txtActDesc, self.mapActCfg.DescText)
self:StartActTimer()
local bPlayCond, sTips = self.actData:CheckActJumpCond()
self._mapNode.txtFuncLock.gameObject:SetActive(not bPlayCond)
if not bPlayCond then
NovaAPI.SetTMPText(self._mapNode.txtFuncLock, sTips)
end
end
function JointDrillActCtrl:GetTimeStr(nRemainTime)
local sTimeStr = ""
if nRemainTime <= 60 then
local sec = math.floor(nRemainTime)
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Sec") or "", sec)
elseif 60 < nRemainTime and nRemainTime <= 3600 then
local min = math.floor(nRemainTime / 60)
local sec = math.floor(nRemainTime - min * 60)
if sec == 0 then
min = min - 1
sec = 60
end
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Min") or "", min, sec)
elseif 3600 < nRemainTime and nRemainTime <= 86400 then
local hour = math.floor(nRemainTime / 3600)
local min = math.floor((nRemainTime - hour * 3600) / 60)
if min == 0 then
hour = hour - 1
min = 60
end
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Hour") or "", hour, min)
elseif 86400 < nRemainTime then
local day = math.floor(nRemainTime / 86400)
local hour = math.floor((nRemainTime - day * 86400) / 3600)
if hour == 0 then
day = day - 1
hour = 24
end
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Day") or "", day, hour)
end
return sTimeStr
end
function JointDrillActCtrl:StartActTimer()
if self.timer ~= nil then
self.timer:Cancel()
self.timer = nil
end
local nOpenTime = self.actData:GetActOpenTime()
local nCloseTime = self.actData:GetActEndTime()
local nStartTime = nOpenTime + self.mapActCfg.DrillStartTime
local nEndTime = nStartTime + self.mapActCfg.DrillDurationTime
local nStatus = 0
local refreshTime = function()
local nCurTime = ClientManager.serverTimeStamp
local sTime = ""
local nRemainTime = 0
if nCurTime < nStartTime then
nStatus = AllEnum.JointDrillActStatus.WaitStart
nRemainTime = math.max(nStartTime - nCurTime, 0)
sTime = orderedFormat(ConfigTable.GetUIText("JointDrill_Act_Wait_Start_Time"), self:GetTimeStr(nRemainTime))
elseif nCurTime >= nStartTime and nCurTime < nEndTime then
nStatus = AllEnum.JointDrillActStatus.Start
nRemainTime = math.max(nEndTime - nCurTime, 0)
sTime = orderedFormat(ConfigTable.GetUIText("JointDrill_Act_Start_Time"), self:GetTimeStr(nRemainTime))
else
nStatus = AllEnum.JointDrillActStatus.WaitClose
nRemainTime = math.max(nCloseTime - nCurTime, 0)
sTime = orderedFormat(ConfigTable.GetUIText("JointDrill_Act_Wait_Close_Time"), self:GetTimeStr(nRemainTime))
end
if nRemainTime <= 0 and self.timer ~= nil then
self.timer:Cancel()
self.timer = nil
end
self._mapNode.btnStart.gameObject:SetActive(nStatus ~= AllEnum.JointDrillActStatus.WaitStart)
self._mapNode.btnWaitStart.gameObject:SetActive(nStatus == AllEnum.JointDrillActStatus.WaitStart)
NovaAPI.SetTMPText(self._mapNode.txtActTime, sTime)
end
refreshTime()
self.timer = self:AddTimer(0, 1, refreshTime, true, true, true)
end
function JointDrillActCtrl:ClearActivity()
end
function JointDrillActCtrl:OnEvent_WaitStart()
local bPlayCond = self.actData:CheckActJumpCond(true)
if not bPlayCond then
return
end
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("JointDrill_Act_Wait_Start_Tip"))
end
function JointDrillActCtrl:OnBtnClick_Start()
local bPlayCond = self.actData:CheckActJumpCond(true)
if not bPlayCond then
return
end
EventManager.Hit("PlayJointDrillActAnim", "JointDrill_Act_01_out", function()
EventManager.Hit(EventId.OpenPanel, PanelId.JointDrillLevelSelect_510005, self.actData.nActId)
end)
end
function JointDrillActCtrl:OnBtnClick_Detail()
if self.mapActCfg == nil then
return
end
local msg = {
nType = AllEnum.MessageBox.Desc,
sContent = self.mapActCfg.DetailDesc,
sTitle = ConfigTable.GetUIText("Activity_Btn_Detail")
}
EventManager.Hit(EventId.OpenMessageBox, msg)
end
function JointDrillActCtrl:OnEvent_PlayAnim(sAnim, callback)
if self.animRoot ~= nil then
local nAnimTime = NovaAPI.GetAnimClipLength(self.animRoot, {sAnim})
self.animRoot:Play(sAnim, 0, 0)
self:AddTimer(1, nAnimTime, function()
if callback ~= nil then
callback()
end
end, true, true, true)
elseif callback ~= nil then
callback()
end
end
function JointDrillActCtrl:OnEnable()
self.animRoot = self.gameObject:GetComponent("Animator")
end
function JointDrillActCtrl:OnDisable()
end
return JointDrillActCtrl
@@ -1,7 +1,6 @@
local LoginRewardPopUpCtrl_01 = class("LoginRewardPopUpCtrl_01", BaseCtrl)
local ClientManager = CS.ClientManager.Instance
LoginRewardPopUpCtrl_01._mapNodeConfig = {
imgActivity = {sComponentName = "Image"},
goActTime = {},
txtActivityTime = {sComponentName = "TMP_Text"},
btnActivity = {
@@ -51,7 +51,8 @@ LoginSpRewardCtrl_Lsv._mapNodeConfig = {
LoginSpRewardCtrl_Lsv._mapEventConfig = {
ClickLoginRewardTips = "OnEvent_ClickLoginRewardTips",
[EventId.ShowBubbleVoiceText] = "OnEvent_ShowBubbleVoiceText",
ActivityListChangeTab = "OnEvent_ActivityListChangeTab"
ActivityListChangeTab = "OnEvent_ActivityListChangeTab",
[EventId.ClosePanel] = "OnEvent_ClosePanel"
}
function LoginSpRewardCtrl_Lsv:RefreshRemainTime()
local endTime = self.actData:GetActEndTime()
@@ -306,4 +307,10 @@ function LoginSpRewardCtrl_Lsv:OnEvent_ActivityListChangeTab(nId)
PlayerVoiceData:StopCharVoice()
end
end
function LoginSpRewardCtrl_Lsv:OnEvent_ClosePanel(nPanelId)
if nPanelId == PanelId.DiscSample then
self.bPlayVoice = false
self:PlayVoice()
end
end
return LoginSpRewardCtrl_Lsv
@@ -0,0 +1,386 @@
local MiningGameCtrl = class("MiningGameCtrl", BaseCtrl)
local WwiseAudioMgr = CS.WwiseAudioManager.Instance
local listPrefabPath = "UI_Activity/_400011/GridCell/"
local assetPath = "UI_Activity/_400011/SpriteAtlas/Sprite/"
local signal_typeA = "zs_mining_signal_01"
local signal_typeB = "zs_mining_signal_02"
local signal_typeC = "zs_mining_signal_03"
local signal_typeD = "zs_mining_signal_04"
MiningGameCtrl._mapNodeConfig = {
TopBar = {
sNodeName = "TopBarPanel",
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
},
animator = {
sNodeName = "----SafeAreaRoot----",
sComponentName = "Animator"
},
GirdListPrefab = {},
cellPos = {nCount = 21},
txt_scoreTitle = {
sComponentName = "TMP_Text",
sLanguageId = "MiningGame_ScoreTitle"
},
txt_score = {sComponentName = "TMP_Text"},
animator_score = {sNodeName = "bg_score", sComponentName = "Animator"},
txt_level = {sComponentName = "TMP_Text"},
char = {nCount = 2},
imgShovel = {},
Btn_Axe = {
sComponentName = "UIButton",
callback = "OnBtnClick_OpenAxeTips"
},
txt_rewardTitle = {
sComponentName = "TMP_Text",
sLanguageId = "MiningGame_ItemTitle"
},
signal = {nCount = 3},
txt_Amount = {sComponentName = "TMP_Text"},
btn_guide = {
sComponentName = "UIButton",
callback = "OnBtnClick_OpenGuidePanel"
},
txt_guide = {
sComponentName = "TMP_Text",
sLanguageId = "MiningGame_Guide"
},
btn_reward = {
sComponentName = "UIButton",
callback = "OnBtnClick_OpenTask"
},
txt_reward = {
sComponentName = "TMP_Text",
sLanguageId = "MiningGame_Reward"
},
reward_reddot = {},
FinishPanel = {},
txt_finish = {
sComponentName = "TMP_Text",
sLanguageId = "MiningGame_Finish"
},
GoNextLevelPanel = {},
txt_NextLevel = {
sComponentName = "TMP_Text",
sLanguageId = "MiningGame_FinishLevel"
}
}
MiningGameCtrl._mapEventConfig = {
MiningUpdateLevel = "OnEvent_UpdateLevelData",
MiningUpdateCell = "OnEvent_UpdateGridCell",
MiningUpdateReward = "OnEvent_UpdateRewardStatus",
MiningAxeUpdate = "OnEvent_UpdateAxeCount",
MiningKnockResult = "OnEvent_MiningKnockResult",
MiningGameUpdateScore = "OnEvent_UpdateScore",
MiningGameRewardFxOver = "OnEvent_UpdateScoreFx",
MiningShowReward = "OnEvent_ShowReward",
Mining_Error = "OnEvent_Error"
}
MiningGameCtrl._mapRedDotConfig = {}
function MiningGameCtrl:Awake()
local param = self:GetPanelParam()
if type(param) == "table" then
self.nActId = param[1]
end
self.nNewScore = 0
self.bInPassAnim = false
self.passAnimCb = nil
self._mapNode.FinishPanel:SetActive(false)
self._mapNode.GoNextLevelPanel:SetActive(false)
self.miningData = PlayerData.Activity:GetActivityDataById(self.nActId)
if self.miningData:GetIsFirstIn() then
local cb = function()
local DicConfig = ConfigTable.GetData("TopBar", "MiningGame_400011")
if DicConfig ~= nil then
local dicId = DicConfig.EntryId
if dicId ~= 0 then
EventManager.Hit(EventId.OpenPanel, PanelId.DictionaryEntry, dicId, true)
end
end
self.miningData:SetIsFirstIn()
end
self:AddTimer(1, 0.9, cb, true, true, true)
EventManager.Hit(EventId.TemporaryBlockInput, 1.1)
end
end
function MiningGameCtrl:OnEnable()
if self.miningData:CheckActivityOpen() then
self:UpdateLevelData()
else
NovaAPI.InputDisable()
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Activity_MiningEnd"))
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
EventManager.Hit(EventId.ClosePanel, PanelId.MiningGame_400011)
NovaAPI.InputEnable()
end
cs_coroutine.start(wait)
end
local bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActId)
if bInActGroup then
local mapActivityData = ConfigTable.GetData("Activity", self.nActId)
local actGroupId = mapActivityData.MidGroupId
local actGroupData = PlayerData.Activity:GetActivityGroupDataById(actGroupId)
local taskActId = actGroupData:GetActivityDataByIndex(AllEnum.ActivityThemeFuncIndex.Task).ActivityId
local taskActData = PlayerData.Activity:GetActivityDataById(taskActId)
if taskActData ~= nil and taskActData:CheckActivityOpen() then
RedDotManager.RegisterNode(RedDotDefine.Activity_Group_Task_Group, {
nActGroupId,
taskActId,
mapActivityData.MiniGameRedDot
}, self._mapNode.reward_reddot)
return
end
end
end
function MiningGameCtrl:OnDisable(...)
if self.gridListCtrl ~= nil then
self:UnbindCtrlByNode(self.gridListCtrl)
end
self.gridListCtrl = nil
end
function MiningGameCtrl:OnDestroy()
if PlayerData.Activity:IsActivityInActivityGroup(self.nActId) then
local mapActivityData = ConfigTable.GetData("Activity", self.nActId)
local actGroupId = mapActivityData.MidGroupId
local actGroupData = PlayerData.Activity:GetActivityGroupDataById(actGroupId)
local taskActId = actGroupData:GetActivityDataByIndex(AllEnum.ActivityThemeFuncIndex.Task).ActivityId
local taskActData = PlayerData.Activity:GetActivityDataById(taskActId)
if taskActData ~= nil and taskActData:CheckActivityOpen() then
RedDotManager.UnRegisterNode(RedDotDefine.Activity_Group_Task_Group, {
actGroupId,
taskActId,
mapActivityData.MiniGameRedDot
}, self._mapNode.reward_reddot)
return
end
end
end
function MiningGameCtrl:InitData()
self.tbRewardDataList = {}
self.goBgPrefab = nil
end
function MiningGameCtrl:UpdateLevelData()
self:InitData()
local config = self.miningData:GetMiningCfg()
local prefabPath = listPrefabPath .. config.GridListPrefab .. ".prefab"
if self.gridListCtrl == nil then
for i = 1, 21 do
delChildren(self._mapNode.cellPos[i].transform)
local goCell = self:CreatePrefabInstance(prefabPath, self._mapNode.cellPos[i].transform)
goCell.name = "cell" .. i
end
self.gridListCtrl = self:BindCtrlByNode(self._mapNode.GirdListPrefab, "Game.UI.Activity.Mining.400011.MiningGridListCtrl")
self.gridListCtrl:SetData(self.nActId)
end
self:UpdateSupData()
NovaAPI.SetTMPText(self._mapNode.txt_level, orderedFormat(ConfigTable.GetUIText("MiningGame_Level"), self.miningData:GetLevel()))
self:InitRewardList()
self.tbRewardDataList = self.miningData:GetCurLevelRewardData()
self:UpdateRewardList()
local tbCellData = self.miningData:GetCellData()
local funcCallback = function(nId)
self:KnockCallback(nId)
end
for _, v in pairs(tbCellData) do
self.gridListCtrl:InitGridCell(v, funcCallback)
end
EventManager.Hit(EventId.BlockInput, true)
self:AddTimer(1, 0.55, function()
self.gridListCtrl:HideReward()
self.gridListCtrl:InitRewardList(self.tbRewardDataList)
EventManager.Hit(EventId.BlockInput, false)
end, true, true, true, nil)
self:UpdateAxeCount(self.miningData:GetAxeCount())
self:UpdateScore(self.miningData:GetScore())
self.miningData:DoEnterResult()
self:CheckPassAllLevel()
end
function MiningGameCtrl:UpdateSupData()
local tbSupIdList = self.miningData:GetSupDataList()
if tbSupIdList == nil or #tbSupIdList == 0 then
return
end
for _, char in pairs(self._mapNode.char) do
char:SetActive(false)
end
for i = 1, math.min(#tbSupIdList, 2) do
local char = self._mapNode.char[i]
local img_head = char.transform:Find("bg/img_head"):GetComponent("Image")
local txt_skillName = char.transform:Find("bg/txt_skillName"):GetComponent("TMP_Text")
local txt_skillDesc = char.transform:Find("bg/txt_skillDesc"):GetComponent("TMP_Text")
local supConfig = ConfigTable.GetData("MiningSupport", tbSupIdList[i].nId)
if supConfig ~= nil then
NovaAPI.SetTMPText(txt_skillName, supConfig.SkillName)
NovaAPI.SetTMPText(txt_skillDesc, supConfig.SkillDes)
if supConfig.CharIcon ~= "" then
self:SetPngSprite(img_head, supConfig.CharIcon, AllEnum.CharHeadIconSurfix.S)
end
char:SetActive(true)
end
end
end
function MiningGameCtrl:InitRewardList()
for _, go in ipairs(self._mapNode.signal) do
go:SetActive(false)
end
end
function MiningGameCtrl:UpdateRewardList()
for i = 1, math.min(#self.tbRewardDataList, 3) do
local rewardData = self.tbRewardDataList[i]
local rewardConfig = ConfigTable.GetData("MiningTreasure", rewardData.nId)
if rewardConfig ~= nil then
local img_get = self._mapNode.signal[i].transform:Find("bg_reward/img_get")
local img_signal = self._mapNode.signal[i].transform:Find("bg_reward/img_signal")
if rewardConfig.MiningItemType == GameEnum.miningRewardType.RewardTypeA then
self:SetPngSprite(img_signal:GetComponent("Image"), assetPath .. signal_typeA)
elseif rewardConfig.MiningItemType == GameEnum.miningRewardType.RewardTypeB then
self:SetPngSprite(img_signal:GetComponent("Image"), assetPath .. signal_typeB)
elseif rewardConfig.MiningItemType == GameEnum.miningRewardType.RewardTypeC then
self:SetPngSprite(img_signal:GetComponent("Image"), assetPath .. signal_typeC)
else
self:SetPngSprite(img_signal:GetComponent("Image"), assetPath .. signal_typeD)
end
img_signal:GetComponent("Image"):SetNativeSize()
img_get.gameObject:SetActive(rewardData.bIsGet)
self._mapNode.signal[i]:SetActive(true)
end
end
end
function MiningGameCtrl:UpdateGridCell(data, nEffectType)
self.gridListCtrl:ChangeGridState(data, nEffectType)
end
function MiningGameCtrl:KnockCallback(nId)
if self.miningData:GetAxeCount() == 0 then
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("MiningGame_NoAxeTips"))
return
end
self.miningData:RequestKnockCell(nId)
end
function MiningGameCtrl:UpdateAxeCount(nCount)
NovaAPI.SetTMPText(self._mapNode.txt_Amount, tostring(nCount))
end
function MiningGameCtrl:UpdateScore(score)
local sScore = self:formatNumber(score)
NovaAPI.SetTMPText(self._mapNode.txt_score, sScore)
end
function MiningGameCtrl:formatNumber(n)
local s = tostring(n)
local result = ""
local count = 0
for i = #s, 1, -1 do
count = count + 1
result = s:sub(i, i) .. result
if count % 3 == 0 and count < #s then
result = "," .. result
end
end
return result
end
function MiningGameCtrl:CheckPassAllLevel()
local bPassAllLevel = self.miningData:GetPassAllLevelResult()
self._mapNode.FinishPanel:SetActive(bPassAllLevel)
self._mapNode.imgShovel:SetActive(not bPassAllLevel)
self._mapNode.GirdListPrefab:SetActive(not bPassAllLevel)
end
function MiningGameCtrl:OnBtnClick_OpenGuidePanel()
EventManager.Hit(EventId.OpenPanel, PanelId.MiningGameGuidePanel_400011, self.nActId)
end
function MiningGameCtrl:OnBtnClick_OpenTask()
if PlayerData.Activity:IsActivityInActivityGroup(self.nActId) then
local mapActivityData = ConfigTable.GetData("Activity", self.nActId)
local actGroupId = mapActivityData.MidGroupId
local actGroupData = PlayerData.Activity:GetActivityGroupDataById(actGroupId)
local taskActId = actGroupData:GetActivityDataByIndex(AllEnum.ActivityThemeFuncIndex.Task).ActivityId
local taskActData = PlayerData.Activity:GetActivityDataById(taskActId)
if taskActData ~= nil and taskActData:CheckActivityOpen() then
EventManager.Hit(EventId.OpenPanel, PanelId.Task_11100, taskActId, GameEnum.ActivityTaskTabType.Tab4)
return
end
RedDotManager.UnRegisterNode(RedDotDefine.Activity_Group_Task_Group, {
actGroupId,
taskActId,
mapActivityData.MiniGameRedDot
}, self._mapNode.reward_reddot)
self._mapNode.reward_reddot:SetActive(false)
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Activity_End_Notice"))
end
end
function MiningGameCtrl:OnBtnClick_OpenAxeTips()
UTILS.ClickItemGridWithTips(self.miningData:GetAxeId(), self._mapNode.Btn_Axe.transform, true, false, true)
end
function MiningGameCtrl:OnEvent_UpdateScore(score)
self.nNewScore = score
end
function MiningGameCtrl:OnEvent_UpdateScoreFx()
self._mapNode.animator_score:Play("score_in")
self:UpdateScore(self.nNewScore)
end
function MiningGameCtrl:OnEvent_UpdateRewardStatus(nId)
local nIndex = 0
for i = 1, #self.tbRewardDataList do
if self.tbRewardDataList[i].nId == nId then
nIndex = i
end
end
if nIndex == 0 then
return
end
self.gridListCtrl:FindReward(nIndex, self._mapNode.txt_score:GetComponent("RectTransform"))
local img_get = self._mapNode.signal[nIndex].transform:Find("bg_reward/img_get")
img_get.gameObject:SetActive(true)
for _, rewardData in pairs(self.tbRewardDataList) do
if rewardData.bIsGet == false then
return
end
end
EventManager.Hit(EventId.BlockInput, true)
self.bInPassAnim = true
self._mapNode.GoNextLevelPanel:SetActive(true)
WwiseAudioMgr:PostEvent("mode_digging1_complete")
self:AddTimer(1, 2.3, function()
self._mapNode.animator:Play("MiningGamePanel_out")
end, true, true, true)
self:AddTimer(1, 2.5, function()
self._mapNode.GoNextLevelPanel:SetActive(false)
end, true, true, true)
self:AddTimer(1, 2.7, function()
if self.passAnimCb ~= nil then
self.passAnimCb()
self.bInPassAnim = false
end
EventManager.Hit(EventId.BlockInput, false)
end, true, true, true)
end
function MiningGameCtrl:OnEvent_MiningKnockResult(tbSkillData)
for k, v in pairs(tbSkillData) do
local gridData = v.tbUpdateGrid
for _, n in pairs(gridData) do
self:UpdateGridCell(n, v.nEffectType)
end
end
end
function MiningGameCtrl:OnEvent_UpdateLevelData()
if self.bInPassAnim then
function self.passAnimCb()
self:UpdateLevelData()
end
else
self:UpdateLevelData()
end
end
function MiningGameCtrl:OnEvent_UpdateGridCell(data, nEffectType)
self:UpdateGridCell(data, nEffectType)
end
function MiningGameCtrl:OnEvent_UpdateAxeCount(nCount)
self:UpdateAxeCount(nCount)
end
function MiningGameCtrl:OnEvent_ShowReward()
self.gridListCtrl:ShowReward(self.tbRewardDataList)
end
function MiningGameCtrl:OnEvent_Error()
EventManager.Hit(EventId.BlockInput, true)
self.miningData:RequestLevelData(0, function()
EventManager.Hit(EventId.BlockInput, false)
end)
end
return MiningGameCtrl
@@ -0,0 +1,50 @@
local MiningGameGuideCardCtrl = class("MiningGameGuideCardCtrl", BaseCtrl)
MiningGameGuideCardCtrl._mapNodeConfig = {
btn = {
sComponentName = "UIButton",
callback = "OnBtnClick_Selected"
},
img_selected = {},
iconTra = {
sNodeName = "img_icon",
sComponentName = "RectTransform"
},
img_icon = {sComponentName = "Image"},
img_type = {nCount = 4}
}
MiningGameGuideCardCtrl._mapEventConfig = {
MiningGame_SelectedCard = "OnEvent_SelectedCard"
}
MiningGameGuideCardCtrl._mapRedDotConfig = {}
function MiningGameGuideCardCtrl:SetData(id)
local config = ConfigTable.GetData("MiningTreasure", id)
if config == nil then
return
end
self.nId = id
if config.Icon ~= "" then
self:SetPngSprite(self._mapNode.img_icon, config.Icon)
self._mapNode.iconTra.localRotation = Quaternion.Euler(0, 0, config.SelfRotate)
end
for index, go in pairs(self._mapNode.img_type) do
if index == config.MiningItemType then
go:SetActive(true)
else
go:SetActive(false)
end
end
end
function MiningGameGuideCardCtrl:SetSelected(id)
if id == self.nId then
self._mapNode.img_selected:SetActive(true)
else
self._mapNode.img_selected:SetActive(false)
end
end
function MiningGameGuideCardCtrl:OnBtnClick_Selected()
EventManager.Hit("MiningGame_SelectedCard", self.nId)
end
function MiningGameGuideCardCtrl:OnEvent_SelectedCard(id)
self:SetSelected(id)
end
return MiningGameGuideCardCtrl
@@ -0,0 +1,106 @@
local MiningGameGuideCtrl = class("MiningGameGuideCtrl", BaseCtrl)
MiningGameGuideCtrl._mapNodeConfig = {
TopBar = {
sNodeName = "TopBarPanel",
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
},
txt_titleSSR = {
sComponentName = "TMP_Text",
sLanguageId = "MiningGame_ItemType_SSR"
},
txt_titleSR = {
sComponentName = "TMP_Text",
sLanguageId = "MiningGame_ItemType_SR"
},
ContentSSR = {
sComponentName = "RectTransform"
},
ContentSR = {
sComponentName = "RectTransform"
},
iconTra = {
sNodeName = "img_icon",
sComponentName = "RectTransform"
},
img_icon = {sComponentName = "Image"},
txt_score = {sComponentName = "TMP_Text"},
txt_name = {sComponentName = "TMP_Text"},
txt_des = {sComponentName = "TMP_Text"},
animator = {
sNodeName = "-----Right-----",
sComponentName = "Animator"
}
}
MiningGameGuideCtrl._mapEventConfig = {
MiningGame_SelectedCard = "OnEvent_SelectedCard"
}
MiningGameGuideCtrl._mapRedDotConfig = {}
function MiningGameGuideCtrl:Awake()
local param = self:GetPanelParam()
if type(param) == "table" then
self.nActId = param[1]
end
self.miningData = PlayerData.Activity:GetActivityDataById(self.nActId)
local idList = self.miningData:GetDicGroupId()
self.cardPrefabPath = "UI_Activity/_400011/CardCell.prefab"
self.CardCtrl = {}
self:InitList(idList)
end
function MiningGameGuideCtrl:OnDestroy()
self:Unbind()
end
function MiningGameGuideCtrl:InitList(list)
local firstId = 0
for _, id in ipairs(list) do
local go
local config = ConfigTable.GetData("MiningTreasure", id)
if config ~= nil then
if config.MiningItemRarity == GameEnum.miningRewardRarity.miningSSR then
go = self:CreatePrefabInstance(self.cardPrefabPath, self._mapNode.ContentSSR)
if firstId == 0 then
firstId = config.Id
end
elseif config.MiningItemRarity == GameEnum.miningRewardRarity.miningSR then
go = self:CreatePrefabInstance(self.cardPrefabPath, self._mapNode.ContentSR)
if firstId == 0 then
firstId = config.Id
end
end
if go ~= nil then
go.name = config.Id
local ctrl = self:BindCtrlByNode(go, "Game.UI.Activity.Mining.400011.MiningGameGuideCardCtrl")
ctrl:SetData(config.Id)
table.insert(self.CardCtrl, ctrl)
end
end
end
if firstId ~= 0 then
self:OnSelected(firstId)
EventManager.Hit("MiningGame_SelectedCard", firstId)
end
CS.UnityEngine.UI.LayoutRebuilder.ForceRebuildLayoutImmediate(self._mapNode.ContentSSR)
CS.UnityEngine.UI.LayoutRebuilder.ForceRebuildLayoutImmediate(self._mapNode.ContentSR)
end
function MiningGameGuideCtrl:OnSelected(id)
local config = ConfigTable.GetData("MiningTreasure", id)
if config == nil then
return
end
if config.Icon ~= "" then
self:SetPngSprite(self._mapNode.img_icon, config.Icon)
self._mapNode.iconTra.localRotation = Quaternion.Euler(0, 0, config.SelfRotate)
end
NovaAPI.SetTMPText(self._mapNode.txt_score, ConfigTable.GetUIText("MiningGame_Guide_Score") .. config.Score)
NovaAPI.SetTMPText(self._mapNode.txt_name, config.Name)
NovaAPI.SetTMPText(self._mapNode.txt_des, config.Des)
self._mapNode.animator:Play("MiningGameGuidePanel_R_in")
end
function MiningGameGuideCtrl:Unbind()
for _, ctrl in pairs(self.CardCtrl) do
self:UnbindCtrlByNode(ctrl)
end
end
function MiningGameGuideCtrl:OnEvent_SelectedCard(id)
self:OnSelected(id)
end
return MiningGameGuideCtrl
@@ -0,0 +1,21 @@
local MiningGameGuidePanel = class("MiningGameGuidePanel", BasePanel)
MiningGameGuidePanel._sUIResRootPath = "UI_Activity/"
MiningGameGuidePanel._tbDefine = {
{
sPrefabPath = "_400011/MiningGameGuidePanel.prefab",
sCtrlName = "Game.UI.Activity.Mining.400011.MiningGameGuideCtrl"
}
}
function MiningGameGuidePanel:Awake()
end
function MiningGameGuidePanel:OnEnable()
end
function MiningGameGuidePanel:OnAfterEnter()
end
function MiningGameGuidePanel:OnDisable()
end
function MiningGameGuidePanel:OnDestroy()
end
function MiningGameGuidePanel:OnRelease()
end
return MiningGameGuidePanel
@@ -0,0 +1,23 @@
local MiningGamePanel = class("MiningGamePanel", BasePanel)
MiningGamePanel._bIsMainPanel = true
MiningGamePanel._bAddToBackHistory = true
MiningGamePanel._sUIResRootPath = "UI_Activity/"
MiningGamePanel._tbDefine = {
{
sPrefabPath = "_400011/MiningGamePanel.prefab",
sCtrlName = "Game.UI.Activity.Mining.400011.MiningGameCtrl"
}
}
function MiningGamePanel:Awake()
end
function MiningGamePanel:OnEnable()
end
function MiningGamePanel:OnAfterEnter()
end
function MiningGamePanel:OnDisable()
end
function MiningGamePanel:OnDestroy()
end
function MiningGamePanel:OnRelease()
end
return MiningGamePanel
@@ -0,0 +1,73 @@
local MiningGameQuestCtrl = class("MiningGameQuestCtrl", BaseCtrl)
local totalLength = 520
local totalHeight = 37
MiningGameQuestCtrl._mapNodeConfig = {
loopSv = {
sNodeName = "questList",
sComponentName = "LoopScrollView"
},
rtBarFill = {
sComponentName = "RectTransform"
},
btn_AllReceive = {
sComponentName = "UIButton",
callback = "OnBtnClick_AllReceive"
},
txt_AllReceive = {
ComponentName = "TMP_Text",
"Mining_Quest_AllReceive"
}
}
MiningGameQuestCtrl._mapEventConfig = {
MiningQuestUpdate = "InitQuestData"
}
function MiningGameQuestCtrl:Awake(...)
local param = self:GetPanelParam()
if type(param) == "table" then
self.nActId = param[1]
end
self:InitData()
end
function MiningGameQuestCtrl:OnDisable()
for nInstanceId, objCtrl in pairs(self.tbGridCtrl) do
self:UnbindCtrlByNode(objCtrl)
self.tbGridCtrl[nInstanceId] = nil
end
self.tbGridCtrl = {}
end
function MiningGameQuestCtrl:InitData()
self.actData = PlayerData.Activity:GetActivityDataById(self.nActId)
self.tbQuestList = {}
self.tbGridCtrl = {}
end
function MiningGameQuestCtrl:InitQuestData()
self.tbQuestList = self.actData:GetAllQuestData()
table.sort(self.tbQuestList, function(a, b)
if a.nStatus == b.nStatus then
return a.Id < b.Id
end
return a.nStatus < b.nStatus
end)
if nil ~= self.tbQuestList then
for nInstanceId, objCtrl in pairs(self.tbGridCtrl) do
self:UnbindCtrlByNode(objCtrl)
self.tbGridCtrl[nInstanceId] = nil
end
self._mapNode.loopSv:SetAnim(0.1)
self._mapNode.loopSv:Init(#self.tbQuestList, self, self.OnGridRefresh)
EventManager.Hit(EventId.TemporaryBlockInput, 0.5)
end
self._mapNode.rtBarFill.sizeDelta = Vector2(self.actData:GetCompleteCount() / #self.tbQuestList * totalLength, totalHeight)
end
function MiningGameQuestCtrl:OnGridRefresh(goGrid, gridIndex)
local nIndex = gridIndex + 1
local nInstanceId = goGrid:GetInstanceID()
if not self.tbGridCtrl[nInstanceId] then
self.tbGridCtrl[nInstanceId] = self:BindCtrlByNode(goGrid, "Game.UI.Activity.Mining.400011.MiningQuestCellCtrl")
end
self.tbGridCtrl[nInstanceId]:SetData(self.nActId, self.tbQuestList[nIndex])
end
function MiningGameQuestCtrl:OnBtnClick_AllReceive()
PlayerData.Activity:SendReceivePerQuest(self.nActId, 0, nil)
end
return MiningGameQuestCtrl
@@ -0,0 +1,22 @@
local MiningGameQuestPanel = class("MiningGamePanel", BasePanel)
MiningGameQuestPanel._bIsMainPanel = true
MiningGameQuestPanel._sUIResRootPath = "UI_Activity/"
MiningGameQuestPanel._tbDefine = {
{
sPrefabPath = "_400011/MiningGameQuestPanel.prefab",
sCtrlName = "Game.UI.Activity.Mining.400011.MiningGameQuestCtrl"
}
}
function MiningGameQuestPanel:Awake()
end
function MiningGameQuestPanel:OnEnable()
end
function MiningGameQuestPanel:OnAfterEnter()
end
function MiningGameQuestPanel:OnDisable()
end
function MiningGameQuestPanel:OnDestroy()
end
function MiningGameQuestPanel:OnRelease()
end
return MiningGameQuestPanel
@@ -0,0 +1,328 @@
local MiningGridCellCtrl = class("MiningGridCellCtrl", BaseCtrl)
local WwiseAudioMgr = CS.WwiseAudioManager.Instance
MiningGridCellCtrl._mapNodeConfig = {
image_SuperHard = {sComponentName = "Image"},
btn_SuperHard = {
sNodeName = "image_SuperHard",
sComponentName = "UIButton"
},
image_Hard = {sComponentName = "Image"},
btn_Hard = {sNodeName = "image_Hard", sComponentName = "UIButton"},
image_Normal = {sComponentName = "Image"},
btn_Normal = {
sNodeName = "image_Normal",
sComponentName = "UIButton"
},
image_Fragile = {sComponentName = "Image"},
btn_Fragile = {
sNodeName = "image_Fragile",
sComponentName = "UIButton"
},
effect = {},
effect_Spade = {},
effect_OnHit = {},
effect_Reward = {},
effect_Critical = {},
effect_UnUseAxe = {},
effect_Spurting = {},
effect_Transform = {},
_Hint = {}
}
function MiningGridCellCtrl:Init()
self.nIndex = 0
self.bMark = false
self.funcCallback = nil
self.tbTimer = {}
end
function MiningGridCellCtrl:InitTempEffectData()
self.bNextIsCritical = false
self.bNextIsUnUse = false
end
function MiningGridCellCtrl:Awake(...)
self._mapNode.image_SuperHard.alphaHitTestMinimumThreshold = 0.1
self._mapNode.image_Hard.alphaHitTestMinimumThreshold = 0.1
self._mapNode.image_Normal.alphaHitTestMinimumThreshold = 0.1
self._mapNode.image_Fragile.alphaHitTestMinimumThreshold = 0.1
self:SetChildActive(self._mapNode.effect, false)
self:SetChildActive(self._mapNode.effect_OnHit, false)
end
function MiningGridCellCtrl:SetChildActive(go, bActive)
local nChildCount = go.transform.childCount
for i = 1, nChildCount do
local child = go.transform:GetChild(i - 1)
child.gameObject:SetActive(bActive)
end
end
function MiningGridCellCtrl:SetData(nId, nStatus, bMark, btnCallback, nIndex)
self:Init()
self:InitTempEffectData()
self._mapNode._Hint:SetActive(false)
self.nId = nId
self.nIndex = nIndex
self.funcCallback = btnCallback
self.nStatus = nil
self:UpdateData(nStatus)
self.bMark = bMark
if self.bMark and nStatus ~= GameEnum.miningGridType.Destroyed then
self:UpdateEffect(GameEnum.miningSupportEffect.TreasureMarkerOnGridDestroyed)
end
end
function MiningGridCellCtrl:UpdateData(nStatus, nEffectType, bPlayCellInAnim)
local oldStatus = self.nStatus
self.nStatus = nStatus
self:UpdateImage(nStatus, bPlayCellInAnim)
self:ClearButtonListener()
self:ClearTimer()
self:SetChildActive(self._mapNode.effect, false)
self:SetChildActive(self._mapNode.effect_OnHit, false)
if nEffectType == GameEnum.miningSupportEffect.TreasureMarkerOnGridDestroyed then
self.bMark = true
end
if nStatus ~= GameEnum.miningGridType.Destroyed and self.bMark then
self:UpdateEffect(GameEnum.miningSupportEffect.TreasureMarkerOnGridDestroyed)
end
if nEffectType == GameEnum.miningSupportEffect.Dig then
self:PlayDigSound(oldStatus)
end
self:SetButtonListener(nStatus, self.funcCallback)
if nEffectType ~= nil then
self:UpdateEffect(nEffectType)
end
self:UpdateOnHitAnima(oldStatus)
end
function MiningGridCellCtrl:ClearTimer()
for key, timer in pairs(self.tbTimer) do
timer:_Stop()
end
self.tbTimer = {}
end
function MiningGridCellCtrl:UpdateEffect(nEffectType)
local timer
if nEffectType == GameEnum.miningSupportEffect.Dig then
self:UpdateDigEffect()
elseif nEffectType == GameEnum.miningSupportEffect.NeighborDestroyed then
elseif nEffectType == GameEnum.miningSupportEffect.AreaDamageOnDig then
WwiseAudioMgr:PostEvent("mode_digging2_sputter")
self._mapNode.effect_Spurting:SetActive(true)
timer = self:AddTimer(1, 0.5, function()
self._mapNode.effect_Spurting:SetActive(false)
local index = table.indexof(self.tbTimer, timer)
if 0 < index then
table.remove(self.tbTimer, index)
end
end, true, true, true, nil)
table.insert(self.tbTimer, timer)
elseif nEffectType == GameEnum.miningSupportEffect.ConsumePreserver then
self.bNextIsUnUse = true
elseif nEffectType == GameEnum.miningSupportEffect.ConverterOnEnterLayer then
WwiseAudioMgr:PostEvent("mode_digging2_transform")
self._mapNode.effect_Transform:SetActive(true)
timer = self:AddTimer(1, 1, function()
self._mapNode.effect_Transform:SetActive(false)
local index = table.indexof(self.tbTimer, timer)
if 0 < index then
table.remove(self.tbTimer, index)
end
end, true, true, true, nil)
table.insert(self.tbTimer, timer)
elseif nEffectType == GameEnum.miningSupportEffect.ConverterOnReceiveTreasure then
WwiseAudioMgr:PostEvent("mode_digging2_transform")
self._mapNode.effect_Transform:SetActive(true)
timer = self:AddTimer(1, 1, function()
self._mapNode.effect_Transform:SetActive(false)
local index = table.indexof(self.tbTimer, timer)
if 0 < index then
table.remove(self.tbTimer, index)
end
end, true, true, true, nil)
table.insert(self.tbTimer, timer)
elseif nEffectType == GameEnum.miningSupportEffect.ConverterOnGridDestroyed then
WwiseAudioMgr:PostEvent("mode_digging2_transform")
self._mapNode.effect_Transform:SetActive(true)
timer = self:AddTimer(1, 1, function()
self._mapNode.effect_Transform:SetActive(false)
local index = table.indexof(self.tbTimer, timer)
if 0 < index then
table.remove(self.tbTimer, index)
end
end, true, true, true, nil)
table.insert(self.tbTimer, timer)
elseif nEffectType == GameEnum.miningSupportEffect.CriticalDamage then
self.bNextIsCritical = true
elseif nEffectType == GameEnum.miningSupportEffect.TreasureMarkerOnGridDestroyed then
self._mapNode.effect_Reward:SetActive(true)
WwiseAudioMgr:PostEvent("mode_digging1_cast_targat")
elseif nEffectType == GameEnum.miningSupportEffect.Char134 then
WwiseAudioMgr:PostEvent("mode_digging2_sputter")
self._mapNode.effect_Spurting:SetActive(true)
timer = self:AddTimer(1, 0.5, function()
self._mapNode.effect_Spurting:SetActive(false)
local index = table.indexof(self.tbTimer, timer)
if 0 < index then
table.remove(self.tbTimer, index)
end
end, true, true, true, nil)
table.insert(self.tbTimer, timer)
elseif nEffectType == GameEnum.miningSupportEffect.Char156 then
WwiseAudioMgr:PostEvent("mode_digging2_transform")
self._mapNode.effect_Transform:SetActive(true)
timer = self:AddTimer(1, 1, function()
self._mapNode.effect_Transform:SetActive(false)
local index = table.indexof(self.tbTimer, timer)
if 0 < index then
table.remove(self.tbTimer, index)
end
end, true, true, true, nil)
table.insert(self.tbTimer, timer)
elseif nEffectType == GameEnum.miningSupportEffect.Npc132 then
elseif nEffectType == GameEnum.miningSupportEffect.Max then
elseif nEffectType == GameEnum.miningSupportEffect.ProbRefundConsumeOnEmptyDigDestroy then
self._mapNode.effect_UnUseAxe:SetActive(true)
timer = self:AddTimer(1, 1, function()
self._mapNode.effect_UnUseAxe:SetActive(false)
local index = table.indexof(self.tbTimer, timer)
if 0 < index then
table.remove(self.tbTimer, index)
end
end, true, true, true, nil)
table.insert(self.tbTimer, timer)
end
end
function MiningGridCellCtrl:UpdateDigEffect()
local timer
self._mapNode.effect_Spade:SetActive(true)
self:AddTimer(1, 0.14, function()
self._mapNode.effect_Spade:SetActive(false)
end, true, true, true, nil)
if not self.bNextIsCritical and not self.bNextIsUnUse then
elseif self.bNextIsCritical then
self._mapNode.effect_Critical:SetActive(true)
timer = self:AddTimer(1, 1, function()
self._mapNode.effect_Critical:SetActive(false)
local index = table.indexof(self.tbTimer, timer)
if 0 < index then
table.remove(self.tbTimer, index)
end
self.bNextIsCritical = false
end, true, true, true, nil)
table.insert(self.tbTimer, timer)
elseif self.bNextIsUnUse then
self._mapNode.effect_UnUseAxe:SetActive(true)
timer = self:AddTimer(1, 1, function()
self._mapNode.effect_UnUseAxe:SetActive(false)
local index = table.indexof(self.tbTimer, timer)
if 0 < index then
table.remove(self.tbTimer, index)
end
self.bNextIsUnUse = false
end, true, true, true, nil)
table.insert(self.tbTimer, timer)
end
end
function MiningGridCellCtrl:UpdateImage(cellType, bPlayInAnima)
self._mapNode.image_SuperHard.gameObject:SetActive(false)
self._mapNode.image_Hard.gameObject:SetActive(false)
self._mapNode.image_Normal.gameObject:SetActive(false)
self._mapNode.image_Fragile.gameObject:SetActive(false)
if cellType == GameEnum.miningGridType.Fragile then
self._mapNode.image_Fragile.gameObject:SetActive(true)
if bPlayInAnima then
local anim = self._mapNode.image_Fragile.gameObject:GetComponent("Animator")
anim:Play("Cell_in")
end
elseif cellType == GameEnum.miningGridType.Normal then
self._mapNode.image_Normal.gameObject:SetActive(true)
if bPlayInAnima then
local anim = self._mapNode.image_Normal.gameObject:GetComponent("Animator")
anim:Play("Cell_in")
end
elseif cellType == GameEnum.miningGridType.Hard then
self._mapNode.image_Hard.gameObject:SetActive(true)
if bPlayInAnima then
local anim = self._mapNode.image_Hard.gameObject:GetComponent("Animator")
anim:Play("Cell_in")
end
elseif cellType == GameEnum.miningGridType.SuperHard then
self._mapNode.image_SuperHard.gameObject:SetActive(true)
if bPlayInAnima then
local anim = self._mapNode.image_SuperHard.gameObject:GetComponent("Animator")
anim:Play("Cell_in")
end
else
self._mapNode.effect_Reward:SetActive(false)
end
end
function MiningGridCellCtrl:UpdateOnHitAnima(cellType)
local imgOnHit_SuperHard = self._mapNode.effect_OnHit.transform:Find("imgOnHit_SuperHard")
local imgOnHit_Hard = self._mapNode.effect_OnHit.transform:Find("imgOnHit_Hard")
local imgOnHit_Normal = self._mapNode.effect_OnHit.transform:Find("imgOnHit_Normal")
local imgOnHit_Fragile = self._mapNode.effect_OnHit.transform:Find("imgOnHit_Fragile")
local wwiseEvent, go
if cellType == GameEnum.miningGridType.Fragile then
go = imgOnHit_Fragile
elseif cellType == GameEnum.miningGridType.Normal then
go = imgOnHit_Normal
elseif cellType == GameEnum.miningGridType.Hard then
go = imgOnHit_Hard
else
if cellType == GameEnum.miningGridType.SuperHard then
go = imgOnHit_SuperHard
else
end
end
if go ~= nil then
self._mapNode.effect_OnHit:SetActive(true)
go.gameObject:SetActive(true)
self:AddTimer(1, 0.26, function()
go.gameObject:SetActive(false)
self._mapNode.effect_OnHit:SetActive(false)
end, true, true, true, nil)
end
end
function MiningGridCellCtrl:PlayDigSound(oldStatus)
local wwiseEvent
if oldStatus == GameEnum.miningGridType.Fragile then
wwiseEvent = "mode_digging1_dig_light"
elseif oldStatus == GameEnum.miningGridType.Normal then
wwiseEvent = "mode_digging1_dig_light"
elseif oldStatus == GameEnum.miningGridType.Hard then
wwiseEvent = "mode_digging1_dig_medium"
elseif oldStatus == GameEnum.miningGridType.SuperHard then
wwiseEvent = "mode_digging1_dig_heavy"
end
if wwiseEvent ~= nil then
WwiseAudioMgr:PostEvent(wwiseEvent)
end
end
function MiningGridCellCtrl:SetButtonListener(cellType, callback)
if cellType == GameEnum.miningGridType.Fragile then
self._mapNode.btn_Fragile.onClick:AddListener(function(...)
callback(self.nId)
end)
elseif cellType == GameEnum.miningGridType.Normal then
self._mapNode.btn_Normal.onClick:AddListener(function(...)
callback(self.nId)
end)
elseif cellType == GameEnum.miningGridType.Hard then
self._mapNode.btn_Hard.onClick:AddListener(function(...)
callback(self.nId)
end)
else
if cellType == GameEnum.miningGridType.SuperHard then
self._mapNode.btn_SuperHard.onClick:AddListener(function(...)
callback(self.nId)
end)
else
end
end
end
function MiningGridCellCtrl:ClearButtonListener()
self._mapNode.btn_SuperHard.onClick:RemoveAllListeners()
self._mapNode.btn_Hard.onClick:RemoveAllListeners()
self._mapNode.btn_Normal.onClick:RemoveAllListeners()
self._mapNode.btn_Fragile.onClick:RemoveAllListeners()
end
function MiningGridCellCtrl:ShowHint()
self._mapNode._Hint:SetActive(true)
end
return MiningGridCellCtrl
@@ -0,0 +1,222 @@
local MiningGridListCtrl = class("MiningGridListCtrl", BaseCtrl)
local WwiseAudioMgr = CS.WwiseAudioManager.Instance
local miningCellType = GameEnum.miningCellType
local ColumnCount = {
2,
3,
4,
3,
4,
3,
2
}
MiningGridListCtrl._mapNodeConfig = {
cell = {
nCount = 21,
sCtrlName = "Game.UI.Activity.Mining.400011.MiningGridCellCtrl"
},
reward_Go = {nCount = 3},
reward = {nCount = 3, sComponentName = "Image"}
}
function MiningGridListCtrl:Init()
self.nActId = 0
self:HideReward()
end
function MiningGridListCtrl:OnDestroy(...)
end
function MiningGridListCtrl:SetData(actId)
self.nActId = actId
end
function MiningGridListCtrl:InitGridCell(data, callback)
self.destroyCallback = callback
local funcCallback = function(nId)
self:Knock(nId)
end
self._mapNode.cell[data.nIndex]:SetData(data.nId, data.nStatus, data.bMark, funcCallback, data.nIndex)
end
function MiningGridListCtrl:HideReward()
for _, go in pairs(self._mapNode.reward_Go) do
go:SetActive(false)
end
end
function MiningGridListCtrl:FindReward(rewardIndex, scoreTra)
WwiseAudioMgr:PostEvent("mode_digging1_get")
EventManager.Hit(EventId.BlockInput, true)
local go = self._mapNode.reward_Go[rewardIndex]
local Trail = self._mapNode.reward[rewardIndex].transform:Find("Trail")
Trail.gameObject:SetActive(true)
local animaFunc = function()
go.transform:SetAsLastSibling()
local beginPos = go.transform.position
local controlPos = Vector3(1, -2, 0)
local endPos = scoreTra.position
local wait = function()
local totalMoveTime = 0.3
local moveTime = 0
local normalizedTime = 0
while normalizedTime < 1 do
moveTime = moveTime + CS.UnityEngine.Time.unscaledDeltaTime
normalizedTime = moveTime / totalMoveTime
normalizedTime = normalizedTime <= 1 and normalizedTime or 1
local x, y, z = UTILS.GetBezierPointByT(beginPos, controlPos, endPos, normalizedTime)
local angleZ = 100 * normalizedTime * 2
angleZ = angleZ <= 100 and angleZ or 100
go.transform.localEulerAngles = Vector3(0, 0, angleZ)
go.transform.position = Vector3(x, y, z)
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
end
go:SetActive(false)
go.transform:SetSiblingIndex(1)
Trail.gameObject:SetActive(false)
EventManager.Hit("MiningGameRewardFxOver")
EventManager.Hit(EventId.BlockInput, false)
end
cs_coroutine.start(wait)
end
local img_reward = self._mapNode.reward[rewardIndex]
local animator = img_reward:GetComponent("Animator")
animator:Play("reward_in")
self:AddTimer(1, 0.5, animaFunc)
end
function MiningGridListCtrl:ChangeGridState(data, nEffectType)
self._mapNode.cell[data.nIndex]:UpdateData(data.nStatus, nEffectType, true)
end
function MiningGridListCtrl:Knock(nId)
self.destroyCallback(nId)
end
function MiningGridListCtrl:InitRewardList(tbRewardList)
for i = 1, math.min(3, #tbRewardList) do
local rewardConfig = ConfigTable.GetData("MiningTreasure", tbRewardList[i].nId)
if rewardConfig ~= nil then
local rewardImage = self._mapNode.reward[i]
local Trail = rewardImage.transform:Find("Trail")
Trail.gameObject:SetActive(false)
local go = self._mapNode.reward_Go[i]
if rewardConfig.Icon ~= "" then
self:SetPngSprite(rewardImage, rewardConfig.Icon)
rewardImage:SetNativeSize()
end
local rewardPosList = tbRewardList[i].tbPosIndex
if rewardConfig.MiningItemType == GameEnum.miningRewardType.RewardTypeA then
go.transform.anchoredPosition = self._mapNode.cell[rewardPosList[1]].gameObject.transform.parent.anchoredPosition
elseif rewardConfig.MiningItemType == GameEnum.miningRewardType.RewardTypeB then
local pos1 = self._mapNode.cell[rewardPosList[1]].gameObject.transform.parent.anchoredPosition
local pos2 = self._mapNode.cell[rewardPosList[2]].gameObject.transform.parent.anchoredPosition
go.transform.anchoredPosition = (pos1 + pos2) / 2
elseif rewardConfig.MiningItemType == GameEnum.miningRewardType.RewardTypeC then
go.transform.anchoredPosition = self._mapNode.cell[rewardPosList[2]].gameObject.transform.parent.anchoredPosition
elseif rewardConfig.MiningItemType == GameEnum.miningRewardType.RewardTypeD then
local pos1 = self._mapNode.cell[rewardPosList[1]].gameObject.transform.parent.anchoredPosition
local pos2 = self._mapNode.cell[rewardPosList[2]].gameObject.transform.parent.anchoredPosition
local pos3 = self._mapNode.cell[rewardPosList[3]].gameObject.transform.parent.anchoredPosition
go.transform.anchoredPosition = (pos1 + pos2 + pos3) / 3
end
go.transform.localRotation = Quaternion.Euler(0, 0, 0)
if rewardConfig.MiningItemType == GameEnum.miningRewardType.RewardTypeB or rewardConfig.MiningItemType == GameEnum.miningRewardType.RewardTypeC then
local rotate = self:GetRotation(rewardPosList)
go.transform.localRotation = Quaternion.Euler(0, 0, rotate)
elseif rewardConfig.MiningItemType == GameEnum.miningRewardType.RewardTypeD then
local rotate = self:GetRotationByTypeD(rewardPosList)
go.transform.localRotation = Quaternion.Euler(0, 0, rotate)
end
if not tbRewardList[i].bIsGet then
go:SetActive(true)
end
end
end
end
function MiningGridListCtrl:GetRotation(posList)
table.sort(posList, function(a, b)
return a < b
end)
local nDir = self:GetDir(posList[2], posList[1])
return (nDir - 1) * 60
end
function MiningGridListCtrl:GetRotationByTypeD(posList)
local n2GridColumn = 0
local n1GridColumn = 0
local tbColList = {}
for _, pos in ipairs(posList) do
local nC, nR = self:GetGridIndex(pos)
if tbColList[nC] == nil then
tbColList[nC] = 1
else
tbColList[nC] = tbColList[nC] + 1
end
end
for key, value in pairs(tbColList) do
if value == 2 then
n2GridColumn = key
else
n1GridColumn = key
end
end
local nRotate = 0
if n2GridColumn > n1GridColumn then
nRotate = -90
elseif n2GridColumn < n1GridColumn then
nRotate = 90
end
return nRotate
end
function MiningGridListCtrl:GetDir(nRootIndex, nDirIndex)
local nDir = 0
local nRootC, nRootR = self:GetGridIndex(nRootIndex)
local nDirC, nDirR = self:GetGridIndex(nDirIndex)
if nRootC == nDirC then
if nRootR > nDirR then
nDir = GameEnum.miningRewardDir.Down
else
nDir = GameEnum.miningRewardDir.Up
end
elseif nRootC > nDirC then
if (nRootC % 2 == 1 or nRootC == 2) and nRootC ~= 7 then
if nRootR == nDirR then
nDir = GameEnum.miningRewardDir.LeftUp
else
nDir = GameEnum.miningRewardDir.LeftDown
end
elseif nRootR == nDirR then
nDir = GameEnum.miningRewardDir.LeftDown
else
nDir = GameEnum.miningRewardDir.LeftUp
end
elseif nRootC < nDirC then
if nRootC % 2 == 1 and nRootC ~= 1 then
if nRootR == nDirR then
nDir = GameEnum.miningRewardDir.RightUp
else
nDir = GameEnum.miningRewardDir.RightDown
end
elseif nRootR == nDirR then
nDir = GameEnum.miningRewardDir.RightDown
else
nDir = GameEnum.miningRewardDir.RightUp
end
end
return nDir
end
function MiningGridListCtrl:GetGridIndex(nIndex)
local nColumn = 0
local nRow = 0
local nTemp = 0
for i = 1, #ColumnCount do
local nlastTemo = nTemp
nTemp = nTemp + ColumnCount[i]
if nIndex <= nTemp then
nColumn = i
nRow = nIndex - nlastTemo
break
end
end
return nColumn, nRow
end
function MiningGridListCtrl:ShowReward(tbRewardList)
for i = 1, math.min(3, #tbRewardList) do
local rewardPosList = tbRewardList[i].tbPosIndex
for _, index in pairs(rewardPosList) do
self._mapNode.cell[index]:ShowHint()
end
end
end
return MiningGridListCtrl
@@ -0,0 +1,83 @@
local MiningQuestCellCtrl = class("MiningQuestCellCtrl", BaseCtrl)
local JumpUtil = require("Game.Common.Utils.JumpUtil")
local totalLength = 520
local totalHeight = 37
MiningQuestCellCtrl._mapNodeConfig = {
txtTitle = {sComponentName = "TMP_Text"},
btn_Receive = {
sComponentName = "UIButton",
callback = "OnBtnClick_Receive"
},
txt_Receive = {
sComponentName = "TMP_Text",
"Mining_Quest_Receive"
},
btn_JumpTo = {
sComponentName = "UIButton",
callback = "OnBtnClick_JumpTo"
},
txt_JumoTo = {
sComponentName = "TMP_Text",
"Mining_Quest_Jump"
},
go_UnComplete = {},
go_Received = {},
go_ReceivedMask = {},
rtBarFill = {
sComponentName = "RectTransform"
},
btnReward = {
sComponentName = "UIButton",
callback = "OnBtnClick_Reward"
},
rtReward = {
sCtrlName = "Game.UI.TemplateEx.TemplateItemCtrl"
}
}
function MiningQuestCellCtrl:Init()
end
function MiningQuestCellCtrl:Awake(...)
end
function MiningQuestCellCtrl:OnDisable()
end
function MiningQuestCellCtrl:SetData(nActId, questData)
self.questData = questData
self.tbConfig = ConfigTable.GetData("MiningQuestConfig", self.questData.nId)
NovaAPI.SetText(self._mapNode.txtTitle, ConfigTable.GetUIText(self.tbConfig.QuestDes))
end
function MiningQuestCellCtrl:UpdateCellStatus()
self._mapNode.btn_Receive:SetActive(false)
self._mapNode.btn_JumpTo:SetActive(false)
self._mapNode.go_UnComplete:SetActive(false)
self._mapNode.go_Received:SetActive(false)
self._mapNode.go_ReceivedMask:SetActive(false)
if self.questData.nStatus == AllEnum.ActQuestStatus.Complete then
self._mapNode.btn_Receive:SetActive(true)
self._mapNode.rtBarFill.sizeDelta = Vector2(totalLength, totalHeight)
elseif self.questData.nStatus == AllEnum.ActQuestStatus.UnComplete then
self._mapNode.rtBarFill.sizeDelta = Vector2(self.questData.progress.Cur / self.questData.progress.Max * totalLength, totalHeight)
if self.tbConfig.JumpTo ~= nil or next(self.tbConfig.JumpTo) ~= nil then
self._mapNode.btn_JumpTo:SetActive(true)
else
self._mapNode.go_UnComplete:SetActive(true)
end
else
self._mapNode.go_Received:SetActive(true)
self._mapNode.go_ReceivedMask:SetActive(true)
self._mapNode.rtBarFill.sizeDelta = Vector2(totalLength, totalHeight)
end
end
function MiningQuestCellCtrl:OnBtnClick_Receive()
PlayerData.Activity:SendReceivePerQuest(self.nActId, self.nQuestId, nil)
end
function MiningQuestCellCtrl:OnBtnClick_JumpTo()
if nil ~= self.nJumpTo and 0 ~= self.nJumpTo then
JumpUtil.JumpTo(self.nJumpTo)
end
end
function MiningQuestCellCtrl:OnBtnClick_Reward(btn)
if nil ~= self.rewardId then
UTILS.ClickItemGridWithTips(self.rewardId, btn.transform, true, true, true)
end
end
return MiningQuestCellCtrl
@@ -0,0 +1,62 @@
local MiningStoryCtrl = class("MiningStoryCtrl", BaseCtrl)
MiningStoryCtrl._mapNodeConfig = {
txt_Title = {sComponentName = "TMP_Text"},
loosv = {
sNodeName = "storyList",
sComponentName = "LoopScrollView"
},
btn_Close = {
sComponentName = "UIButton",
callback = "OnBtnClick_ClosePanel"
}
}
MiningStoryCtrl._mapEventConfig = {
MiningStoryFinish = "RefreshData"
}
function MiningStoryCtrl:Init()
self.tbStoryList = {}
self.tbGridCtrl = {}
self.actData = nil
end
function MiningStoryCtrl:Awake(...)
local param = self:GetPanelParam()
if type(param) == "table" then
self.nActId = param[1]
end
self:RefreshData()
end
function MiningStoryCtrl:OnDisable()
end
function MiningStoryCtrl:OnDestroy(...)
if not self.tbGridCtrl then
for k, v in pairs(self.tbGridCtrl) do
self:UnBindCtrlByNode(v)
end
end
end
function MiningStoryCtrl:RefreshData(...)
self:Init()
self:GetData()
end
function MiningStoryCtrl:GetData()
self.actData = PlayerData.Activity:GetActivityDataById(self.nActId)
self.tbStoryList = self.actData:GetGroupStoryData()
table.sort(self.tbStoryList, function(a, b)
return a.id < b.id
end)
self._mapNode.loosv:SetAnim(0.1)
self._mapNode.loosv:Init(#self.tbStoryList, self, self.OnGridRefresh)
end
function MiningStoryCtrl:OnGridRefresh(gridGo, gridIndex)
local nIndex = gridIndex + 1
local nInstanceId = gridGo:GetInstanceID()
if not self.tbGridCtrl[nInstanceId] then
self.tbGridCtrl[nInstanceId] = self:BindCtrlByNode(gridGo, "Game.Activity.Mining.400011.MiningStoryCellCtrl")
end
local data = self.tbStoryList[nIndex]
self.tbGridCtrl[nInstanceId]:SetData(data.id, nIndex, data.bIsLock, data.bIsRead)
end
function MiningStoryCtrl:OnBtnClick_ClosePanel()
EventManager.Hit(EventId.ClosePanel, PanelId.MiningGameStory_400002)
end
return MiningStoryCtrl
@@ -0,0 +1,22 @@
local MiningStoryPanel = class("MiningStoryPanel", BasePanel)
MiningStoryPanel._bIsMainPanel = false
MiningStoryPanel._sUIResRootPath = "UI_Activity/"
MiningStoryPanel._tbDefine = {
{
sPrefabPath = "_400011/MiningStoryPanel.prefab",
sCtrlName = "Game.UI.Activity.Mining.400011.MiningStoryCtrl"
}
}
function MiningStoryPanel:Awake()
end
function MiningStoryPanel:OnEnable()
end
function MiningStoryPanel:OnAfterEnter()
end
function MiningStoryPanel:OnDisable()
end
function MiningStoryPanel:OnDestroy()
end
function MiningStoryPanel:OnRelease()
end
return MiningStoryPanel
@@ -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
@@ -135,7 +135,7 @@ end
function ActivityTowerDefenseCtrl:OnGridBtnClick(go, nIndex)
local nDataIndex = nIndex + 1
local itemId = self.tbReward[nDataIndex]
UTILS.ClickItemGridWithTips(itemId, go.transform:Find("btnGrid"), true, false, false)
UTILS.ClickItemGridWithTips(itemId, go.transform:Find("btnGrid"), true, true, false)
end
function ActivityTowerDefenseCtrl:InitQuest()
local allCount = self.actData:GetAllQuestCount()