Update - 1.12.0.120
EN: 1.12.0.120 CN: 1.12.0.120 JP: 1.12.0.124 KR: 1.12.0.124
This commit is contained in:
@@ -1,386 +0,0 @@
|
||||
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
|
||||
@@ -1,50 +0,0 @@
|
||||
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
|
||||
@@ -1,106 +0,0 @@
|
||||
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
|
||||
@@ -3,7 +3,7 @@ MiningGameGuidePanel._sUIResRootPath = "UI_Activity/"
|
||||
MiningGameGuidePanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "_400011/MiningGameGuidePanel.prefab",
|
||||
sCtrlName = "Game.UI.Activity.Mining.400011.MiningGameGuideCtrl"
|
||||
sCtrlName = "Game.UI.Activity.Mining.MiningGameGuideCtrl"
|
||||
}
|
||||
}
|
||||
function MiningGameGuidePanel:Awake()
|
||||
|
||||
@@ -5,10 +5,11 @@ MiningGamePanel._sUIResRootPath = "UI_Activity/"
|
||||
MiningGamePanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "_400011/MiningGamePanel.prefab",
|
||||
sCtrlName = "Game.UI.Activity.Mining.400011.MiningGameCtrl"
|
||||
sCtrlName = "Game.UI.Activity.Mining.MiningGameCtrl"
|
||||
}
|
||||
}
|
||||
function MiningGamePanel:Awake()
|
||||
self.nGuidePanelId = PanelId.MiningGameGuidePanel_400011
|
||||
end
|
||||
function MiningGamePanel:OnEnable()
|
||||
end
|
||||
|
||||
@@ -1,73 +0,0 @@
|
||||
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
|
||||
@@ -4,7 +4,7 @@ MiningGameQuestPanel._sUIResRootPath = "UI_Activity/"
|
||||
MiningGameQuestPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "_400011/MiningGameQuestPanel.prefab",
|
||||
sCtrlName = "Game.UI.Activity.Mining.400011.MiningGameQuestCtrl"
|
||||
sCtrlName = "Game.UI.Activity.Mining.MiningGameQuestCtrl"
|
||||
}
|
||||
}
|
||||
function MiningGameQuestPanel:Awake()
|
||||
|
||||
@@ -1,328 +0,0 @@
|
||||
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
|
||||
@@ -1,222 +0,0 @@
|
||||
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
|
||||
@@ -1,83 +0,0 @@
|
||||
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
|
||||
@@ -1,62 +0,0 @@
|
||||
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
|
||||
@@ -1,22 +0,0 @@
|
||||
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
|
||||
Reference in New Issue
Block a user