Initial version - 1.2.0.60
EN: 1.2.0.60 CN: 1.2.0.61 JP: 1.2.0.63 KR: 1.2.0.67
This commit is contained in:
@@ -0,0 +1,832 @@
|
||||
local ConfigData = require("GameCore.Data.ConfigData")
|
||||
local TimerManager = require("GameCore.Timer.TimerManager")
|
||||
local GameResourceLoader = require("Game.Common.Resource.GameResourceLoader")
|
||||
local ResType = GameResourceLoader.ResType
|
||||
local AdventureModuleHelper = CS.AdventureModuleHelper
|
||||
local BaseCtrl = class("BaseCtrl")
|
||||
local sRootPath = Settings.AB_ROOT_PATH
|
||||
local bDebugLog = false
|
||||
local typeof = typeof
|
||||
function BaseCtrl:ctor(goPrefabInstance, objPanel)
|
||||
self._panel = objPanel
|
||||
self._tbTimer = {}
|
||||
self._mapPrefab = {}
|
||||
self._mapLoadAssets = {}
|
||||
self._mapHandler = {}
|
||||
self._mapNode = {}
|
||||
self:ParsePrefab(goPrefabInstance)
|
||||
if type(self.Awake) == "function" then
|
||||
self:Awake()
|
||||
end
|
||||
self._autoRemoveUnusedTimer = nil
|
||||
end
|
||||
function BaseCtrl:ParsePrefab(goPrefabInstance)
|
||||
if goPrefabInstance ~= nil and goPrefabInstance:IsNull() == false then
|
||||
self.gameObject = goPrefabInstance
|
||||
end
|
||||
self:_ParseNode(self._mapNodeConfig)
|
||||
end
|
||||
function BaseCtrl:_PreExit(callback, bPlayFadeOut)
|
||||
self:_UnbindComponentCallback(self._mapNodeConfig)
|
||||
self:_UnbindEventCallback(self._mapEventConfig)
|
||||
self:_RemoveAllTimer()
|
||||
if type(self.OnPreExit) == "function" then
|
||||
self:OnPreExit()
|
||||
end
|
||||
local func_DoCallback = function()
|
||||
if type(callback) == "function" then
|
||||
callback()
|
||||
end
|
||||
end
|
||||
if bPlayFadeOut == true and type(self.FadeOut) == "function" then
|
||||
local nDelayTime = self:FadeOut()
|
||||
if type(nDelayTime) == "number" and 0 < nDelayTime then
|
||||
local func_timer = function(timer)
|
||||
func_DoCallback()
|
||||
end
|
||||
TimerManager.Add(1, nDelayTime, self, func_timer, true, true)
|
||||
else
|
||||
func_DoCallback()
|
||||
end
|
||||
else
|
||||
func_DoCallback()
|
||||
end
|
||||
end
|
||||
function BaseCtrl:_Exit()
|
||||
if type(self.OnDisable) == "function" then
|
||||
self:OnDisable()
|
||||
end
|
||||
if type(self._mapNode) == "table" then
|
||||
for sKey, obj in pairs(self._mapNode) do
|
||||
if type(obj) ~= "table" then
|
||||
self._mapNode[sKey] = 0
|
||||
elseif type(obj.__cname) == "string" then
|
||||
else
|
||||
for i, _obj in ipairs(obj) do
|
||||
if type(_obj) ~= "table" then
|
||||
self._mapNode[sKey][i] = 0
|
||||
else
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
self:_DebugLogDataCount("OnDisable")
|
||||
end
|
||||
function BaseCtrl:_Enter(bPlayFadeIn)
|
||||
self:_BindComponentCallback(self._mapNodeConfig)
|
||||
self:_BindEventCallback(self._mapEventConfig)
|
||||
self:_RegisterRedDot()
|
||||
if type(self.OnEnable) == "function" then
|
||||
self:OnEnable()
|
||||
end
|
||||
if type(self.FadeIn) == "function" then
|
||||
self:FadeIn(bPlayFadeIn)
|
||||
self._panel._nFadeInType = self._panel._nFADEINTYPE
|
||||
end
|
||||
self:_DebugLogDataCount("OnEnable")
|
||||
end
|
||||
function BaseCtrl:_Destroy()
|
||||
if type(self.OnDestroy) == "function" then
|
||||
self:OnDestroy()
|
||||
end
|
||||
for k, v in pairs(self._mapPrefab) do
|
||||
self:DestroyPrefabInstance(k)
|
||||
end
|
||||
for k, v in pairs(self._mapLoadAssets) do
|
||||
self:UnLoadAsset(k)
|
||||
end
|
||||
self._panel = nil
|
||||
self._tbTimer = nil
|
||||
self._mapPrefab = nil
|
||||
self._mapLoadAssets = nil
|
||||
self._mapHandler = nil
|
||||
self._mapNode = nil
|
||||
end
|
||||
function BaseCtrl:_Release()
|
||||
if self.gameObject ~= nil and self.gameObject:IsNull() == false and type(self.OnRelease) == "function" then
|
||||
self:OnRelease()
|
||||
end
|
||||
end
|
||||
function BaseCtrl:_ParseNode(mapNodeConfig)
|
||||
if self.gameObject ~= nil and type(mapNodeConfig) == "table" then
|
||||
local trPrefabRoot = self.gameObject.transform
|
||||
local mapNode = {}
|
||||
local function func_MarkAllNode(trRoot)
|
||||
local nChildCount = trRoot.childCount - 1
|
||||
for i = 0, nChildCount do
|
||||
local trChild = trRoot:GetChild(i)
|
||||
mapNode[trChild.name] = trChild.gameObject
|
||||
if trChild.childCount > 0 then
|
||||
func_MarkAllNode(trChild)
|
||||
end
|
||||
end
|
||||
end
|
||||
func_MarkAllNode(trPrefabRoot)
|
||||
for sKey, mapConfig in pairs(mapNodeConfig) do
|
||||
local sNodeName = mapConfig.sNodeName
|
||||
local nCount = mapConfig.nCount
|
||||
local sComponentName = mapConfig.sComponentName
|
||||
local sCtrlName = mapConfig.sCtrlName
|
||||
local sLanguageId = mapConfig.sLanguageId
|
||||
if type(sNodeName) ~= "string" then
|
||||
sNodeName = tostring(sKey)
|
||||
end
|
||||
local tbNodeName = {}
|
||||
if type(nCount) == "number" then
|
||||
if type(self._mapNode[sKey]) ~= "table" then
|
||||
self._mapNode[sKey] = {}
|
||||
end
|
||||
for i = 1, nCount do
|
||||
table.insert(tbNodeName, sNodeName .. tostring(i))
|
||||
end
|
||||
else
|
||||
table.insert(tbNodeName, sNodeName)
|
||||
end
|
||||
for nIndex, sName in ipairs(tbNodeName) do
|
||||
local bComponentFound = true
|
||||
local objNode
|
||||
local goNode = mapNode[sName]
|
||||
if goNode ~= nil then
|
||||
if type(sCtrlName) == "string" then
|
||||
local objCtrl
|
||||
local nGoInstanceId = goNode:GetInstanceID()
|
||||
for _nObjCtrlIdx, _objCtrl in ipairs(self._panel._tbObjChildCtrl) do
|
||||
if _objCtrl._nGoInstanceId == nGoInstanceId then
|
||||
objCtrl = _objCtrl
|
||||
break
|
||||
end
|
||||
end
|
||||
if objCtrl == nil then
|
||||
local luaClass = require(sCtrlName)
|
||||
objCtrl = luaClass.new(goNode, self._panel)
|
||||
objCtrl._nGoInstanceId = nGoInstanceId
|
||||
table.insert(self._panel._tbObjChildCtrl, objCtrl)
|
||||
end
|
||||
objCtrl:ParsePrefab(goNode)
|
||||
objNode = objCtrl
|
||||
else
|
||||
if sComponentName == nil then
|
||||
sComponentName = "GameObject"
|
||||
end
|
||||
if sComponentName == "GameObject" then
|
||||
objNode = goNode
|
||||
elseif sComponentName == "Transform" then
|
||||
objNode = goNode.transform
|
||||
else
|
||||
local _sComponentName = sComponentName
|
||||
if sComponentName == "InputField_onEndEdit" then
|
||||
_sComponentName = "InputField"
|
||||
end
|
||||
bComponentFound, objNode = goNode:GetNodeComponent(_sComponentName)
|
||||
if objNode ~= nil and type(sLanguageId) == "string" then
|
||||
if _sComponentName == "Text" then
|
||||
if ConfigTable.GetUIText(sLanguageId) then
|
||||
NovaAPI.SetText(objNode, ConfigTable.GetUIText(sLanguageId))
|
||||
else
|
||||
printError("UIText缺失配置:" .. sLanguageId)
|
||||
end
|
||||
elseif _sComponentName == "TMP_Text" then
|
||||
if ConfigTable.GetUIText(sLanguageId) then
|
||||
NovaAPI.SetTMPText(objNode, ConfigTable.GetUIText(sLanguageId))
|
||||
else
|
||||
printError("UIText缺失配置:" .. sLanguageId)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if bComponentFound == true and objNode ~= nil then
|
||||
if type(nCount) == "number" then
|
||||
self._mapNode[sKey][nIndex] = objNode
|
||||
else
|
||||
self._mapNode[sKey] = objNode
|
||||
end
|
||||
else
|
||||
printError("节点找到了但组件没找到,节点名:" .. sName .. ",组件名:" .. sComponentName .. ",panel id:" .. tostring(table.keyof(PanelId, self._panel._nPanelId)))
|
||||
end
|
||||
else
|
||||
printError("界面预设体中配置的节点没找到,预设体名字:" .. trPrefabRoot.name .. ",节点名字:" .. sName)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function BaseCtrl:_BindComponentCallback(mapNodeConfig)
|
||||
if type(mapNodeConfig) ~= "table" then
|
||||
return
|
||||
end
|
||||
local func_DoBind = function(objComp, sCompName, cb, sNodeKey, nIndex)
|
||||
local sHandlerKey = sNodeKey
|
||||
if type(nIndex) == "number" then
|
||||
sHandlerKey = sNodeKey .. tostring(nIndex)
|
||||
end
|
||||
local func_Handler = function(...)
|
||||
local ui_func = ui_handler(self, cb, objComp, nIndex)
|
||||
ui_func(...)
|
||||
EventManager.Hit(EventId.UIOperate)
|
||||
end
|
||||
if sCompName == "Button" then
|
||||
objComp.onClick:AddListener(func_Handler)
|
||||
elseif sCompName == "ButtonEx" then
|
||||
objComp.onClick:AddListener(func_Handler)
|
||||
elseif sCompName == "UIButton" then
|
||||
objComp.onClick:AddListener(func_Handler)
|
||||
elseif sCompName == "NaviButton" then
|
||||
objComp.onClick:AddListener(func_Handler)
|
||||
elseif sCompName == "TMPHyperLink" then
|
||||
objComp.onClick:AddListener(func_Handler)
|
||||
elseif sCompName == "Toggle" then
|
||||
NovaAPI.AddToggleListener(objComp, func_Handler)
|
||||
elseif sCompName == "UIToggle" then
|
||||
NovaAPI.AddUIToggleListener(objComp, func_Handler)
|
||||
elseif sCompName == "ScrollRect" then
|
||||
NovaAPI.AddScrollRectListener(objComp, func_Handler)
|
||||
elseif sCompName == "Slider" then
|
||||
NovaAPI.AddSliderListener(objComp, func_Handler)
|
||||
elseif sCompName == "LoopScrollView" then
|
||||
objComp.onValueChanged:AddListener(func_Handler)
|
||||
elseif sCompName == "InputField" then
|
||||
NovaAPI.AddIPValueChangedListener(objComp, func_Handler)
|
||||
elseif sCompName == "InputField_onEndEdit" then
|
||||
objComp.onEndEdit:AddListener(func_Handler)
|
||||
elseif sCompName == "TMP_Dropdown" then
|
||||
objComp.onValueChanged:AddListener(func_Handler)
|
||||
elseif sCompName == "Dropdown" then
|
||||
NovaAPI.AddDropDownListener(objComp, func_Handler)
|
||||
elseif sCompName == "TMP_InputField" then
|
||||
objComp.onValueChanged:AddListener(func_Handler)
|
||||
elseif sCompName == "LoopScrollSnap" then
|
||||
objComp.onGridSelect:AddListener(func_Handler)
|
||||
elseif sCompName == "UIDrag" then
|
||||
objComp.onDragEvent:AddListener(func_Handler)
|
||||
else
|
||||
if sCompName == "UIZoom" then
|
||||
objComp.onZoom:AddListener(func_Handler)
|
||||
else
|
||||
end
|
||||
end
|
||||
if type(func_Handler) == "function" then
|
||||
self._mapHandler[sHandlerKey] = func_Handler
|
||||
end
|
||||
end
|
||||
for sKey, mapConfig in pairs(mapNodeConfig) do
|
||||
local sCallback = mapConfig.callback
|
||||
local sComponentName = mapConfig.sComponentName
|
||||
local nCount = mapConfig.nCount
|
||||
if type(sCallback) == "string" and type(sComponentName) == "string" then
|
||||
local funcCallback = self[sCallback]
|
||||
if type(funcCallback) == "function" then
|
||||
if type(self._mapNode[sKey]) == "table" and type(nCount) == "number" then
|
||||
for i = 1, nCount do
|
||||
func_DoBind(self._mapNode[sKey][i], sComponentName, funcCallback, sKey, i)
|
||||
end
|
||||
else
|
||||
func_DoBind(self._mapNode[sKey], sComponentName, funcCallback, sKey)
|
||||
end
|
||||
else
|
||||
printError("没有找到组件的回调函数,节点名字:" .. sKey .. ",回调函数名字:" .. sCallback)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function BaseCtrl:_UnbindComponentCallback(mapNodeConfig)
|
||||
if type(mapNodeConfig) ~= "table" then
|
||||
return
|
||||
end
|
||||
local func_DoUnbind = function(objComp, sCompName, sNodeKey, nIndex)
|
||||
local sHandlerKey = sNodeKey
|
||||
if type(nIndex) == "number" then
|
||||
sHandlerKey = sNodeKey .. tostring(nIndex)
|
||||
end
|
||||
local func_Handler = self._mapHandler[sHandlerKey]
|
||||
if objComp ~= nil and func_Handler ~= nil then
|
||||
if sCompName == "Button" then
|
||||
objComp.onClick:RemoveListener(func_Handler)
|
||||
elseif sCompName == "ButtonEx" then
|
||||
objComp.onClick:RemoveListener(func_Handler)
|
||||
elseif sCompName == "UIButton" then
|
||||
objComp.onClick:RemoveListener(func_Handler)
|
||||
elseif sCompName == "NaviButton" then
|
||||
objComp.onClick:RemoveListener(func_Handler)
|
||||
elseif sCompName == "TMPHyperLink" then
|
||||
objComp.onClick:RemoveListener(func_Handler)
|
||||
elseif sCompName == "Toggle" then
|
||||
NovaAPI.RemoveToggleListener(objComp, func_Handler)
|
||||
elseif sCompName == "UIToggle" then
|
||||
NovaAPI.RemoveUIToggleListener(objComp, func_Handler)
|
||||
elseif sCompName == "ScrollRect" then
|
||||
NovaAPI.RemoveScrollRectListener(objComp, func_Handler)
|
||||
elseif sCompName == "Slider" then
|
||||
NovaAPI.RemoveSliderListener(objComp, func_Handler)
|
||||
elseif sCompName == "LoopScrollView" then
|
||||
objComp.onValueChanged:RemoveListener(func_Handler)
|
||||
elseif sCompName == "InputField" then
|
||||
NovaAPI.RemoveIPValueChangedListener(objComp, func_Handler)
|
||||
elseif sCompName == "InputField_onEndEdit" then
|
||||
objComp.onEndEdit:RemoveListener(func_Handler)
|
||||
elseif sCompName == "TMP_Dropdown" then
|
||||
objComp.onValueChanged:RemoveListener(func_Handler)
|
||||
elseif sCompName == "Dropdown" then
|
||||
NovaAPI.RemoveDropDownListener(objComp, func_Handler)
|
||||
elseif sCompName == "TMP_InputField" then
|
||||
objComp.onValueChanged:RemoveListener(func_Handler)
|
||||
elseif sCompName == "LoopScrollSnap" then
|
||||
objComp.onGridSelect:RemoveListener(func_Handler)
|
||||
elseif sCompName == "UIDrag" then
|
||||
objComp.onDragEvent:RemoveListener(func_Handler)
|
||||
elseif sCompName == "UIZoom" then
|
||||
objComp.onZoom:RemoveListener(func_Handler)
|
||||
end
|
||||
end
|
||||
self._mapHandler[sHandlerKey] = nil
|
||||
func_Handler = nil
|
||||
end
|
||||
for sKey, mapConfig in pairs(mapNodeConfig) do
|
||||
local sCallback = mapConfig.callback
|
||||
local sComponentName = mapConfig.sComponentName
|
||||
local nCount = mapConfig.nCount
|
||||
if type(sCallback) == "string" and type(sComponentName) == "string" then
|
||||
local funcCallback = self[sCallback]
|
||||
if type(funcCallback) == "function" then
|
||||
if type(self._mapNode[sKey]) == "table" and type(nCount) == "number" then
|
||||
for i = 1, nCount do
|
||||
func_DoUnbind(self._mapNode[sKey][i], sComponentName, sKey, i)
|
||||
end
|
||||
else
|
||||
func_DoUnbind(self._mapNode[sKey], sComponentName, sKey)
|
||||
end
|
||||
else
|
||||
printError("没有找到组件的回调函数,节点名字:" .. sKey .. ",回调函数名字:" .. sCallback)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function BaseCtrl:_BindEventCallback(mapEventConfig)
|
||||
if type(mapEventConfig) ~= "table" then
|
||||
return
|
||||
end
|
||||
for nEventId, sCallbackName in pairs(mapEventConfig) do
|
||||
local callback = self[sCallbackName]
|
||||
if type(callback) == "function" then
|
||||
EventManager.Add(nEventId, self, callback)
|
||||
end
|
||||
end
|
||||
end
|
||||
function BaseCtrl:_UnbindEventCallback(mapEventConfig)
|
||||
if type(mapEventConfig) ~= "table" then
|
||||
return
|
||||
end
|
||||
for nEventId, sCallbackName in pairs(mapEventConfig) do
|
||||
local callback = self[sCallbackName]
|
||||
if type(callback) == "function" then
|
||||
EventManager.Remove(nEventId, self, callback)
|
||||
end
|
||||
end
|
||||
end
|
||||
function BaseCtrl:_RemoveAllTimer()
|
||||
local n = #self._tbTimer
|
||||
for i = n, 1, -1 do
|
||||
TimerManager.Remove(self._tbTimer[i], false)
|
||||
table.remove(self._tbTimer, i)
|
||||
end
|
||||
if table.nums(self._tbTimer) > 0 then
|
||||
self._tbTimer = {}
|
||||
end
|
||||
if self._autoRemoveUnusedTimer ~= nil then
|
||||
self._autoRemoveUnusedTimer:Cancel()
|
||||
self._autoRemoveUnusedTimer = nil
|
||||
end
|
||||
end
|
||||
function BaseCtrl:_DebugLogDataCount(sTitle)
|
||||
if bDebugLog == false then
|
||||
return
|
||||
end
|
||||
local sCtrlName = self.__cname
|
||||
local sGoName = self.gameObject.name
|
||||
local nTimerCnt = table.nums(self._tbTimer)
|
||||
local nPrefabInsCnt = table.nums(self._mapPrefab)
|
||||
local nHandlerCnt = table.nums(self._mapHandler)
|
||||
local nNodeCnt = table.nums(self._mapNode)
|
||||
local sDebugLog = string.format("[%s.%s] 预设体:%s,计时器数量:%d,自理预设体实例数量:%d,回调数量:%d,节点数量:%d。", sCtrlName, sTitle, sGoName, nTimerCnt, nPrefabInsCnt, nHandlerCnt, nNodeCnt)
|
||||
printLog(sDebugLog)
|
||||
end
|
||||
function BaseCtrl:_RegisterRedDot()
|
||||
if nil ~= self._mapRedDotConfig then
|
||||
for key, cfg in pairs(self._mapRedDotConfig) do
|
||||
local sNodeName = cfg.sNodeName
|
||||
local nNodeIndex = cfg.nNodeIndex
|
||||
local objNode
|
||||
if nil == nNodeIndex then
|
||||
objNode = self._mapNode[sNodeName]
|
||||
elseif nil ~= self._mapNode[sNodeName] then
|
||||
objNode = self._mapNode[sNodeName][nNodeIndex]
|
||||
end
|
||||
if nil == objNode then
|
||||
printError(string.format("绑定红点失败!!! 找不到红点节点.key = %s, nodeName = %s", key, sNodeName))
|
||||
else
|
||||
RedDotManager.RegisterNode(key, cfg.param, objNode.gameObject)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function BaseCtrl:GetPanelId()
|
||||
return self._panel._nPanelId
|
||||
end
|
||||
function BaseCtrl:GetPanelParam()
|
||||
return self._panel:GetPanelParam()
|
||||
end
|
||||
function BaseCtrl:GetAtlasSprite(sAtlasPath, sSpriteName)
|
||||
if string.find(sAtlasPath, "/CommonEx/") ~= nil or string.find(sAtlasPath, "/Common/") ~= nil then
|
||||
printError("新版UI在换过图集做法后,从图集中取Sprite时不应出现/CommonEx/目录 或 /Common/ 目录。" .. sAtlasPath .. "," .. sSpriteName)
|
||||
printError("panel id:" .. self._panel._nPanelId .. ",ctrl name:" .. self.__cname)
|
||||
return nil
|
||||
end
|
||||
local sFullPath = string.format("%sUI/CommonEx/atlas_png/%s/%s.png", sRootPath, sAtlasPath, sSpriteName)
|
||||
return GameResourceLoader.LoadAsset(ResType.Any, sFullPath, typeof(Sprite))
|
||||
end
|
||||
function BaseCtrl:GetPngSprite(sPath)
|
||||
if type(sPath) == "number" then
|
||||
printError("调用接口处需更新,panel id:" .. self._panel._nPanelId .. ",ctrl name:" .. self.__cname)
|
||||
return nil
|
||||
end
|
||||
if string.find(sPath, "Icon/") == nil and string.find(sPath, "Image/") == nil and string.find(sPath, "ImageAvg/") == nil and string.find(sPath, "big_sprites/") == nil then
|
||||
printError("配置表中 Icon 资源字段内容填写错误,应填路径,如:Icon/Item/item_1,panel id:" .. self._panel._nPanelId .. ",ctrl name:" .. self.__cname)
|
||||
return nil
|
||||
else
|
||||
local sp = GameResourceLoader.LoadAsset(ResType.Any, sRootPath .. sPath .. ".png", typeof(Sprite))
|
||||
if sp == nil then
|
||||
printError(string.format("未找到 icon 资源:%s,panel id:%s,ctrl name:%s", sPath, tostring(self._panel._nPanelId), tostring(self.__cname)))
|
||||
end
|
||||
return sp
|
||||
end
|
||||
end
|
||||
function BaseCtrl:GetSprite_FrameColor(nRarity, sFrameType, bBigSprites)
|
||||
local sPngName = sFrameType .. AllEnum.FrameColor_New[nRarity]
|
||||
if bBigSprites then
|
||||
return self:GetPngSprite("UI/big_sprites/" .. sPngName)
|
||||
else
|
||||
return self:GetAtlasSprite("12_rare", sPngName)
|
||||
end
|
||||
end
|
||||
function BaseCtrl:GetSprite_Coin(nCoinItemId)
|
||||
local mapItem = ConfigTable.GetData_Item(nCoinItemId)
|
||||
if mapItem == nil then
|
||||
return nil
|
||||
elseif mapItem.Icon2 == nil or mapItem.Icon2 == "" then
|
||||
return nil
|
||||
else
|
||||
return self:GetPngSprite(mapItem.Icon2)
|
||||
end
|
||||
end
|
||||
function BaseCtrl:GetAvgCharHeadIcon(sSpeakerId, sFace)
|
||||
if sFace == nil then
|
||||
sFace = "002"
|
||||
end
|
||||
if sSpeakerId == nil or sSpeakerId == "" or sSpeakerId == "avg0_1" or sSpeakerId == "0" then
|
||||
sSpeakerId = AdjustMainRoleAvgCharId()
|
||||
end
|
||||
local sIconPath = string.format("Icon/AvgHead/%s/%s_%s", sSpeakerId, sSpeakerId, sFace)
|
||||
return self:GetPngSprite(sIconPath)
|
||||
end
|
||||
function BaseCtrl:SetSprite(imgObj, sPath)
|
||||
local sFullPath = sRootPath .. sPath .. ".png"
|
||||
local bSuc = NovaAPI.SetImageSprite(imgObj, sFullPath)
|
||||
if not bSuc then
|
||||
traceback(string.format("Sprite设置失败:%s,panel id:%s,ctrl name:%s", sFullPath, tostring(self._panel._nPanelId), tostring(self.__cname)))
|
||||
end
|
||||
return bSuc
|
||||
end
|
||||
function BaseCtrl:SetAtlasSprite(imgObj, sAtlasPath, sSpriteName)
|
||||
if string.find(sAtlasPath, "/CommonEx/") ~= nil or string.find(sAtlasPath, "/Common/") ~= nil then
|
||||
printError("新版UI在换过图集做法后,从图集中取Sprite时不应出现/CommonEx/目录 或 /Common/ 目录。" .. sAtlasPath .. "," .. sSpriteName)
|
||||
printError("panel id:" .. self._panel._nPanelId .. ",ctrl name:" .. self.__cname)
|
||||
return false
|
||||
end
|
||||
local sFullPath = string.format("%sUI/CommonEx/atlas_png/%s/%s.png", sRootPath, sAtlasPath, sSpriteName)
|
||||
local bSuc = NovaAPI.SetImageSprite(imgObj, sFullPath)
|
||||
if not bSuc then
|
||||
traceback(string.format("icon设置失败:%s,panel id:%s,ctrl name:%s", sFullPath, tostring(self._panel._nPanelId), tostring(self.__cname)))
|
||||
end
|
||||
return bSuc
|
||||
end
|
||||
function BaseCtrl:SetActivityAtlasSprite(imgObj, sActivityPath, sSpriteName)
|
||||
local sFullPath = string.format("%sUI_Activity/%s/SpriteAtlas/%s.png", sRootPath, sActivityPath, sSpriteName)
|
||||
local bSuc = NovaAPI.SetImageSprite(imgObj, sFullPath)
|
||||
if not bSuc then
|
||||
traceback(string.format("icon设置失败:%s,panel id:%s,ctrl name:%s", sFullPath, tostring(self._panel._nPanelId), tostring(self.__cname)))
|
||||
end
|
||||
return bSuc
|
||||
end
|
||||
function BaseCtrl:SetPngSprite(imgObj, sPath)
|
||||
if type(sPath) == "number" then
|
||||
traceback("调用接口处需更新,panel id:" .. self._panel._nPanelId .. ",ctrl name:" .. self.__cname)
|
||||
NovaAPI.SetImageSpriteAsset(imgObj, nil)
|
||||
return false
|
||||
end
|
||||
if string.find(sPath, "Icon/") == nil and string.find(sPath, "Image/") == nil and string.find(sPath, "ImageAvg/") == nil and string.find(sPath, "big_sprites/") == nil and string.find(sPath, "Disc/") == nil and string.find(sPath, "Play_") == nil and string.find(sPath, "UI_Activity") == nil then
|
||||
traceback("配置表中 Icon 资源字段内容填写错误,应填路径,如:Icon/Item/item_1,panel id:" .. self._panel._nPanelId .. ",ctrl name:" .. self.__cname)
|
||||
NovaAPI.SetImageSpriteAsset(imgObj, nil)
|
||||
return false
|
||||
else
|
||||
local sFullPath = sRootPath .. sPath .. ".png"
|
||||
local bSuc = NovaAPI.SetImageSprite(imgObj, sFullPath)
|
||||
if not bSuc then
|
||||
traceback(string.format("icon设置失败:%s,panel id:%s,ctrl name:%s", sFullPath, tostring(self._panel._nPanelId), tostring(self.__cname)))
|
||||
end
|
||||
return bSuc
|
||||
end
|
||||
end
|
||||
function BaseCtrl:SetSprite_FrameColor(imgObj, nRarity, sFrameType, bBigSprites)
|
||||
local sPngName = sFrameType .. AllEnum.FrameColor_New[nRarity]
|
||||
if bBigSprites then
|
||||
return self:SetPngSprite(imgObj, "UI/big_sprites/" .. sPngName)
|
||||
else
|
||||
return self:SetAtlasSprite(imgObj, "12_rare", sPngName)
|
||||
end
|
||||
end
|
||||
function BaseCtrl:SetSprite_Coin(imgObj, nCoinItemId)
|
||||
local mapItem = ConfigTable.GetData_Item(nCoinItemId)
|
||||
if mapItem == nil then
|
||||
return false
|
||||
elseif mapItem.Icon2 == nil or mapItem.Icon2 == "" then
|
||||
return false
|
||||
else
|
||||
return self:SetPngSprite(imgObj, mapItem.Icon2)
|
||||
end
|
||||
end
|
||||
function BaseCtrl:SetAvgCharHeadIcon(imgObj, sSpeakerId, sFace)
|
||||
if sFace == nil then
|
||||
sFace = "002"
|
||||
end
|
||||
if sSpeakerId == nil or sSpeakerId == "" or sSpeakerId == "avg0_1" or sSpeakerId == "0" then
|
||||
sSpeakerId = AdjustMainRoleAvgCharId()
|
||||
end
|
||||
local sIconPath = string.format("Icon/AvgHead/%s/%s_%s", sSpeakerId, sSpeakerId, sFace)
|
||||
return self:SetPngSprite(imgObj, sIconPath)
|
||||
end
|
||||
function BaseCtrl:GetAvgStageEffect(sName, sType)
|
||||
if sName == nil then
|
||||
return nil
|
||||
end
|
||||
local sFullPath = string.format("%sImageAvg/AvgStageEffect/%s.png", sRootPath, sName)
|
||||
return GameResourceLoader.LoadAsset(ResType.Any, sFullPath, typeof(Texture))
|
||||
end
|
||||
function BaseCtrl:GetAvgPortrait(sAvgCharId, sPose, sFace)
|
||||
local sPathBody = string.format("%sActor2D/CharacterAvg/%s/atlas_png/%s/%s_%s_001.png", sRootPath, sAvgCharId, sPose, sAvgCharId, sPose)
|
||||
local sPathFace = string.format("%sActor2D/CharacterAvg/%s/atlas_png/%s/%s_%s_%s.png", sRootPath, sAvgCharId, sPose, sAvgCharId, sPose, sFace)
|
||||
local sPathBlackBody = string.format("%sActor2D/CharacterAvg/%s/%s_%s_001x.png", sRootPath, sAvgCharId, sAvgCharId, sPose)
|
||||
local spBody = GameResourceLoader.LoadAsset(ResType.Any, sPathBody, typeof(Sprite))
|
||||
local spFace
|
||||
if GameResourceLoader.ExistsAsset(sPathFace) == true then
|
||||
spFace = GameResourceLoader.LoadAsset(ResType.Any, sPathFace, typeof(Sprite))
|
||||
end
|
||||
local spBlackBody = spBody
|
||||
if GameResourceLoader.ExistsAsset(sPathBlackBody) == true then
|
||||
spBlackBody = GameResourceLoader.LoadAsset(ResType.Any, sPathBlackBody, typeof(Sprite))
|
||||
end
|
||||
local sFullPath = string.format("%sActor2D/CharacterAvg/%s/%s.asset", sRootPath, sAvgCharId, sAvgCharId)
|
||||
local objOffset = GameResourceLoader.LoadAsset(ResType.Any, sFullPath, typeof(CS.Actor2DOffsetData))
|
||||
local nX, nY = 0, 0
|
||||
if objOffset == nil then
|
||||
printError(sFullPath)
|
||||
return
|
||||
end
|
||||
local s, x, y = objOffset:GetOffsetData(PanelId.AvgST, indexOfPose(sPose), true, nX, nY)
|
||||
local v3OffsetPos = Vector3(x, y, 0)
|
||||
local v3OffsetScale = Vector3(s, s, 1)
|
||||
return spBody, spFace, v3OffsetPos, v3OffsetScale, spBlackBody
|
||||
end
|
||||
function BaseCtrl:GetAvgPortraitEmojiOffsetData(sAvgCharId, sPose, nEmojiIndex)
|
||||
local sFullPath = string.format("%sActor2D/CharacterAvg/%s/%s.asset", sRootPath, sAvgCharId, sAvgCharId)
|
||||
local objOffset = GameResourceLoader.LoadAsset(ResType.Any, sFullPath, typeof(CS.Actor2DOffsetData))
|
||||
local nX, nY = 0, 0
|
||||
local s, x, y = objOffset:GetEmojiData(PanelId.AvgST, indexOfPose(sPose), nEmojiIndex, nX, nY)
|
||||
local v3OffsetPos = Vector3(x, y, 0)
|
||||
local v3OffsetScale = Vector3(s, math.abs(s), 1)
|
||||
return v3OffsetPos, v3OffsetScale
|
||||
end
|
||||
function BaseCtrl:GetAvgHeadFrameOffsetData(sAvgCharId, sPose, nFrameIndex)
|
||||
local sFullPath = string.format("%sActor2D/CharacterAvg/%s/%s.asset", sRootPath, sAvgCharId, sAvgCharId)
|
||||
local objOffset = GameResourceLoader.LoadAsset(ResType.Any, sFullPath, typeof(CS.Actor2DOffsetData))
|
||||
if nFrameIndex == 2 then
|
||||
nFrameIndex = 3
|
||||
end
|
||||
local nX, nY = 0, 0
|
||||
local s, x, y = objOffset:Get_AvgCharHeadFrameData(PanelId.AvgST, indexOfPose(sPose), nFrameIndex, nX, nY)
|
||||
return x, y, s
|
||||
end
|
||||
function BaseCtrl:OnEvent_AvgSpeedUp_Timer(nRate)
|
||||
local n = #self._tbTimer
|
||||
for i = n, 1, -1 do
|
||||
local timer = self._tbTimer[i]
|
||||
if timer ~= nil then
|
||||
timer:SetSpeed(nRate)
|
||||
end
|
||||
end
|
||||
end
|
||||
function BaseCtrl:SetAvgCharHeadIconByPrefab(img, sPrefabPath)
|
||||
local sFullPath = sRootPath .. sPrefabPath
|
||||
local prefab = GameResourceLoader.LoadAsset(ResType.Any, sFullPath, typeof(GameObject), "UI", self._panel._nPanelId)
|
||||
NovaAPI.SetImageSpriteWithPrefab(img, prefab)
|
||||
end
|
||||
function BaseCtrl:AddTimer(nTargetCount, nInterval, sCallbackName, bAutoRun, bDestroyWhenComplete, nScaleType, tbParam)
|
||||
local callback
|
||||
if type(sCallbackName) == "function" then
|
||||
callback = sCallbackName
|
||||
else
|
||||
callback = self[sCallbackName]
|
||||
end
|
||||
if type(callback) == "function" then
|
||||
local timer = TimerManager.Add(nTargetCount, nInterval, self, callback, bAutoRun, bDestroyWhenComplete, nScaleType, tbParam)
|
||||
if timer ~= nil then
|
||||
if self:GetPanelId() == PanelId.AvgST and type(self._panel.nSpeedRate) == "number" then
|
||||
timer:SetSpeed(self._panel.nSpeedRate)
|
||||
end
|
||||
table.insert(self._tbTimer, timer)
|
||||
end
|
||||
return timer
|
||||
else
|
||||
return nil
|
||||
end
|
||||
end
|
||||
function BaseCtrl:_autoRemoveTimer(timer)
|
||||
local n = #self._tbTimer
|
||||
for i = n, 1, -1 do
|
||||
local timer = self._tbTimer[i]
|
||||
if timer ~= nil and timer:IsUnused() == true then
|
||||
table.remove(self._tbTimer, i)
|
||||
end
|
||||
end
|
||||
end
|
||||
function BaseCtrl:CreatePrefabInstance(sPrefabPath, trParent)
|
||||
local sFullPath = sRootPath .. sPrefabPath
|
||||
local prefab = GameResourceLoader.LoadAsset(ResType.Any, sFullPath, typeof(Object), "UI", self._panel._nPanelId)
|
||||
if trParent == nil then
|
||||
trParent = self.gameObject.transform
|
||||
end
|
||||
local goPrefabIns = instantiate(prefab, trParent)
|
||||
goPrefabIns.name = sPrefabPath
|
||||
self._mapPrefab[sPrefabPath] = goPrefabIns
|
||||
return goPrefabIns
|
||||
end
|
||||
function BaseCtrl:DestroyPrefabInstance(sPrefabPath)
|
||||
local goIns = self._mapPrefab[sPrefabPath]
|
||||
if goIns ~= nil then
|
||||
destroy(goIns)
|
||||
self._mapPrefab[sPrefabPath] = nil
|
||||
end
|
||||
end
|
||||
function BaseCtrl:LoadAsset(sPrefabPath, assetType)
|
||||
local sFullPath = sRootPath .. sPrefabPath
|
||||
if assetType == nil then
|
||||
assetType = typeof(Object)
|
||||
end
|
||||
local prefab = GameResourceLoader.LoadAsset(ResType.Any, sFullPath, assetType, "UI", self._panel._nPanelId)
|
||||
if prefab ~= nil then
|
||||
self._mapLoadAssets[sPrefabPath] = prefab
|
||||
end
|
||||
return prefab
|
||||
end
|
||||
function BaseCtrl:LoadAssetAsync(sPrefabPath, assetType, callback)
|
||||
local sFullPath = sRootPath .. sPrefabPath
|
||||
if assetType == nil then
|
||||
assetType = typeof(Object)
|
||||
end
|
||||
local callBack = function(obj)
|
||||
if obj ~= nil then
|
||||
if obj ~= nil then
|
||||
self._mapLoadAssets[sPrefabPath] = obj
|
||||
end
|
||||
if callback ~= nil then
|
||||
callback(obj)
|
||||
end
|
||||
end
|
||||
end
|
||||
GameResourceLoader.LoadAssetAsync(ResType.Any, sFullPath, assetType, "UI", self._panel._nPanelId, callBack)
|
||||
end
|
||||
function BaseCtrl:UnLoadAsset(sPrefabPath)
|
||||
local prefab = self._mapLoadAssets[sPrefabPath]
|
||||
if prefab ~= nil then
|
||||
prefab = nil
|
||||
self._mapLoadAssets[sPrefabPath] = nil
|
||||
end
|
||||
end
|
||||
function BaseCtrl:SpawnPrefabInstance(prefab, sLuaClassName, sPoolName, parent)
|
||||
local goPrefabIns = AdventureModuleHelper.SpawnPrefabInstance(prefab, sPoolName, parent)
|
||||
local luaClassName = require(sLuaClassName)
|
||||
local objCtrl = luaClassName.new(goPrefabIns, self._panel)
|
||||
objCtrl:_Enter()
|
||||
return objCtrl
|
||||
end
|
||||
function BaseCtrl:DespawnPrefabInstance(objCtrl, sPoolName)
|
||||
if objCtrl ~= nil then
|
||||
objCtrl:_PreExit()
|
||||
objCtrl:_Exit()
|
||||
objCtrl:_Destroy()
|
||||
AdventureModuleHelper.DespawnPrefabInstance(objCtrl.gameObject, sPoolName)
|
||||
end
|
||||
end
|
||||
function BaseCtrl:BindCtrlByNode(goNode, sCtrlName)
|
||||
local objCtrl
|
||||
local luaClass = require(sCtrlName)
|
||||
if luaClass == nil then
|
||||
printError("Ctrl Lua not found, path:" .. sCtrlName)
|
||||
else
|
||||
objCtrl = luaClass.new(goNode, self._panel)
|
||||
table.insert(self._panel._tbObjDyncChildCtrl, objCtrl)
|
||||
objCtrl:_Enter()
|
||||
end
|
||||
return objCtrl
|
||||
end
|
||||
function BaseCtrl:UnbindCtrlByNode(objCtrl)
|
||||
objCtrl:_PreExit()
|
||||
objCtrl:_Exit()
|
||||
objCtrl:_Destroy()
|
||||
objCtrl.gameObject = nil
|
||||
table.remove(self._panel._tbObjDyncChildCtrl, table.indexof(self._panel._tbObjDyncChildCtrl, objCtrl))
|
||||
end
|
||||
function BaseCtrl:SetAnimationCallback(animatior, sCallbackName)
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
local time = animatior:GetCurrentAnimatorStateInfo(0).length
|
||||
self:AddTimer(1, time, sCallbackName, true, true, true)
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
function BaseCtrl:ParseHitDamageDesc(nHitDamageId, nLevel)
|
||||
local sDesc = ""
|
||||
local mapDamage = ConfigTable.GetData_HitDamage(nHitDamageId)
|
||||
if not mapDamage then
|
||||
printError("该 hit damage id 找不到数据:" .. nHitDamageId)
|
||||
sDesc = string.format("<color=#FF0000>%d</color>", nHitDamageId)
|
||||
return sDesc
|
||||
end
|
||||
local nPercent = mapDamage.SkillPercentAmend[nLevel]
|
||||
local nAbs = mapDamage.SkillAbsAmend[nLevel]
|
||||
if not nPercent or not nAbs then
|
||||
printError(string.format("该技能等级在 HitDamage 表中找不到数据, hit damage id:%d, level:%d", nHitDamageId, nLevel))
|
||||
sDesc = string.format("<color=#FF0000>%d</color>", nHitDamageId)
|
||||
return sDesc
|
||||
end
|
||||
nPercent = nPercent * ConfigData.IntFloatPrecision
|
||||
nPercent = FormatNum(nPercent)
|
||||
nAbs = FormatNum(nAbs)
|
||||
local sPercent = nPercent == 0 and "" or tostring(nPercent) .. "%%"
|
||||
local sAbs = nAbs == 0 and "" or tostring(nAbs)
|
||||
if nPercent ~= 0 and nAbs ~= 0 then
|
||||
sDesc = sPercent .. "+" .. sAbs
|
||||
else
|
||||
sDesc = sPercent .. sAbs
|
||||
end
|
||||
return sDesc
|
||||
end
|
||||
function BaseCtrl:ThousandsNumber(number)
|
||||
local formatted = tostring(number)
|
||||
local k
|
||||
while true do
|
||||
formatted, k = string.gsub(formatted, "^(.*-?%d+)(%d%d%d)", "%1,%2")
|
||||
if k == 0 then
|
||||
break
|
||||
end
|
||||
end
|
||||
return formatted
|
||||
end
|
||||
function BaseCtrl:GetGamepadUINode()
|
||||
local tbNode = {}
|
||||
if self.gameObject == nil or type(self._mapNodeConfig) ~= "table" then
|
||||
return tbNode
|
||||
end
|
||||
local add = function(sKey, mapConfig, sComponentName)
|
||||
if mapConfig.sComponentName == sComponentName then
|
||||
local nCount = mapConfig.nCount
|
||||
if type(nCount) == "number" then
|
||||
for i = 1, nCount do
|
||||
local mapNode = self._mapNode[sKey][i]
|
||||
if mapNode then
|
||||
table.insert(tbNode, {
|
||||
mapNode = mapNode,
|
||||
sComponentName = sComponentName,
|
||||
sAction = mapConfig.sAction
|
||||
})
|
||||
end
|
||||
end
|
||||
else
|
||||
local mapNode = self._mapNode[sKey]
|
||||
if mapNode then
|
||||
table.insert(tbNode, {
|
||||
mapNode = mapNode,
|
||||
sComponentName = sComponentName,
|
||||
sAction = mapConfig.sAction
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
for sKey, mapConfig in pairs(self._mapNodeConfig) do
|
||||
add(sKey, mapConfig, "NaviButton")
|
||||
add(sKey, mapConfig, "GamepadScroll")
|
||||
end
|
||||
return tbNode
|
||||
end
|
||||
return BaseCtrl
|
||||
@@ -0,0 +1,300 @@
|
||||
local GameResourceLoader = require("Game.Common.Resource.GameResourceLoader")
|
||||
local ResType = GameResourceLoader.ResType
|
||||
local GameCameraStackManager = CS.GameCameraStackManager
|
||||
local BasePanel = class("BasePanel")
|
||||
local sTopBarCtrlLua = "Game.UI.TopBarEx.TopBarCtrl"
|
||||
local sSafeAreaRoot = "----SafeAreaRoot----"
|
||||
local bDebugLog = false
|
||||
local typeof = typeof
|
||||
function BasePanel:ctor(nIndex, nPanelId, tbParam)
|
||||
self._nIndex = nIndex
|
||||
self._nPanelId = nPanelId
|
||||
self._bIsActive = false
|
||||
self._tbParam = tbParam
|
||||
if self._nFADEINTYPE == nil then
|
||||
self._nFADEINTYPE = 1
|
||||
end
|
||||
if self._nFadeInType == nil then
|
||||
self._nFadeInType = 1
|
||||
end
|
||||
if self._bIsMainPanel == nil then
|
||||
self._bIsMainPanel = true
|
||||
end
|
||||
if self._bAddToBackHistory == nil then
|
||||
self._bAddToBackHistory = true
|
||||
end
|
||||
if self._nSnapshotPrePanel == nil then
|
||||
self._nSnapshotPrePanel = 0
|
||||
end
|
||||
if self._sSortingLayerName == nil then
|
||||
self._sSortingLayerName = AllEnum.SortingLayerName.UI
|
||||
end
|
||||
if self._tbDefine == nil then
|
||||
self._tbDefine = {}
|
||||
end
|
||||
if self._sUIResRootPath ~= nil then
|
||||
self.sUIResRootPath = Settings.AB_ROOT_PATH .. self._sUIResRootPath
|
||||
else
|
||||
self.sUIResRootPath = Settings.AB_ROOT_PATH .. "UI/"
|
||||
end
|
||||
self._tbObjCtrl = {}
|
||||
self._tbObjChildCtrl = {}
|
||||
self._tbObjDyncChildCtrl = {}
|
||||
if type(self.Awake) == "function" then
|
||||
self:Awake()
|
||||
end
|
||||
self.bIsTipsPanel = UTILS.CheckIsTipsPanel(self._nPanelId)
|
||||
end
|
||||
function BasePanel:_PreExit(callback, bPlayFadeOut)
|
||||
if self._bIsActive == false then
|
||||
return
|
||||
end
|
||||
self:_UnbindEventCallback()
|
||||
for sName, objChildCtrl in ipairs(self._tbObjChildCtrl) do
|
||||
objChildCtrl:_PreExit()
|
||||
end
|
||||
for i, objDyncChildCtrl in ipairs(self._tbObjDyncChildCtrl) do
|
||||
objDyncChildCtrl:_PreExit()
|
||||
end
|
||||
local nCount = #self._tbObjCtrl
|
||||
local func_PreExitDone = function()
|
||||
nCount = nCount - 1
|
||||
if nCount == 0 and type(callback) == "function" then
|
||||
callback()
|
||||
end
|
||||
end
|
||||
for i, objCtrl in ipairs(self._tbObjCtrl) do
|
||||
objCtrl:_PreExit(func_PreExitDone, bPlayFadeOut)
|
||||
end
|
||||
end
|
||||
function BasePanel:_PreEnter(callback, goSnapshot)
|
||||
local _trParent = PanelManager.GetUIRoot(self._sSortingLayerName)
|
||||
local nCount = #self._tbDefine
|
||||
local function func_DoInstantiate(nIndex)
|
||||
local func_ProcNext = function()
|
||||
nIndex = nIndex + 1
|
||||
if nIndex > nCount then
|
||||
if type(callback) == "function" then
|
||||
callback()
|
||||
end
|
||||
else
|
||||
func_DoInstantiate(nIndex)
|
||||
end
|
||||
end
|
||||
local objCtrl = self._tbObjCtrl[nIndex]
|
||||
if objCtrl ~= nil and objCtrl.gameObject ~= nil then
|
||||
objCtrl:ParsePrefab()
|
||||
func_ProcNext()
|
||||
else
|
||||
local tbDefine = self._tbDefine[nIndex]
|
||||
local sPrefabFullPath = self.sUIResRootPath .. tbDefine.sPrefabPath
|
||||
local sLuaClassName = tbDefine.sCtrlName
|
||||
local func_PrefabLoaded = function(uiPrefab)
|
||||
local luaClassName = require(sLuaClassName)
|
||||
local trParent = _trParent
|
||||
if sLuaClassName == sTopBarCtrlLua and self._trTopBarParent ~= nil then
|
||||
trParent = self._trTopBarParent
|
||||
end
|
||||
local goPrefabInstance = instantiate(uiPrefab, trParent)
|
||||
goPrefabInstance.name = uiPrefab.name
|
||||
goPrefabInstance.transform:SetAsLastSibling()
|
||||
if nIndex == 1 then
|
||||
self._trTopBarParent = goPrefabInstance.transform:Find(sSafeAreaRoot)
|
||||
if self._trTopBarParent == nil then
|
||||
self._trTopBarParent = goPrefabInstance.transform
|
||||
end
|
||||
if goSnapshot ~= nil and goSnapshot:IsNull() == false then
|
||||
goSnapshot.transform:SetParent(goPrefabInstance.transform)
|
||||
goSnapshot.transform.localScale = Vector3.one
|
||||
goSnapshot.transform:SetAsFirstSibling()
|
||||
local rt = goSnapshot:GetComponent("RectTransform")
|
||||
rt.anchorMax = Vector2.one
|
||||
rt.anchorMin = Vector2.zero
|
||||
rt.anchoredPosition = Vector2.zero
|
||||
end
|
||||
end
|
||||
NovaAPI.ProcResPathNote(goPrefabInstance, GameResourceLoader.MakeBundleGroup("UI", self._nPanelId))
|
||||
if objCtrl == nil then
|
||||
objCtrl = luaClassName.new(goPrefabInstance, self)
|
||||
table.insert(self._tbObjCtrl, objCtrl)
|
||||
else
|
||||
objCtrl:ParsePrefab(goPrefabInstance)
|
||||
if type(objCtrl.Awake) == "function" then
|
||||
objCtrl:Awake()
|
||||
end
|
||||
end
|
||||
func_ProcNext()
|
||||
end
|
||||
local prefab = GameResourceLoader.LoadAsset(ResType.Any, sPrefabFullPath, typeof(Object), "UI", self._nPanelId)
|
||||
if prefab == nil or prefab:IsNull() == true then
|
||||
printError(sPrefabFullPath .. " can not found!!!")
|
||||
end
|
||||
func_PrefabLoaded(prefab)
|
||||
end
|
||||
end
|
||||
func_DoInstantiate(1)
|
||||
self._bIsActive = true
|
||||
end
|
||||
function BasePanel:_Exit()
|
||||
if self._bIsActive == false then
|
||||
return
|
||||
end
|
||||
if type(self.OnDisable) == "function" then
|
||||
self:OnDisable()
|
||||
end
|
||||
for sName, objChildCtrl in ipairs(self._tbObjChildCtrl) do
|
||||
objChildCtrl:_Exit()
|
||||
end
|
||||
for i, objDyncChildCtrl in ipairs(self._tbObjDyncChildCtrl) do
|
||||
objDyncChildCtrl:_Exit()
|
||||
end
|
||||
for i, objCtrl in ipairs(self._tbObjCtrl) do
|
||||
objCtrl:_Exit()
|
||||
end
|
||||
self:_DebugLogDataCount("OnDisable")
|
||||
self._bIsActive = false
|
||||
end
|
||||
function BasePanel:_Enter(bPlayFadeIn)
|
||||
self:_BindEventCallback()
|
||||
for i, objCtrl in ipairs(self._tbObjCtrl) do
|
||||
local canvas = objCtrl.gameObject:GetComponent("Canvas")
|
||||
if canvas ~= nil and canvas:IsNull() == false then
|
||||
NovaAPI.SetCanvasWorldCamera(canvas, GameCameraStackManager.Instance.uiCamera)
|
||||
NovaAPI.SetCanvasSortingName(canvas, self._sSortingLayerName)
|
||||
local nSortingOrder = 0
|
||||
if self._nIndex >= AllEnum.UI_SORTING_ORDER.Guide then
|
||||
nSortingOrder = self._nIndex
|
||||
elseif self.bIsTipsPanel == true then
|
||||
nSortingOrder = AllEnum.UI_SORTING_ORDER.Tips
|
||||
if self._bIsExtraTips == true then
|
||||
nSortingOrder = AllEnum.UI_SORTING_ORDER.TipsEx
|
||||
end
|
||||
elseif self._nPanelId == PanelId.ProVideoGUI then
|
||||
nSortingOrder = AllEnum.UI_SORTING_ORDER.ProVideo
|
||||
else
|
||||
nSortingOrder = self._nIndex * 100 + i
|
||||
end
|
||||
NovaAPI.SetCanvasSortingOrder(canvas, nSortingOrder)
|
||||
objCtrl._nSortingOrder = nSortingOrder
|
||||
NovaAPI.SetCanvasPlaneDistance(canvas, 101)
|
||||
end
|
||||
objCtrl.gameObject:SetActive(true)
|
||||
objCtrl:_Enter(bPlayFadeIn)
|
||||
end
|
||||
for sName, objChildCtrl in ipairs(self._tbObjChildCtrl) do
|
||||
objChildCtrl:_Enter()
|
||||
end
|
||||
if type(self.OnEnable) == "function" then
|
||||
self:OnEnable(bPlayFadeIn)
|
||||
end
|
||||
EventManager.Hit("OnEvent_PanelOnEnableById", self._nPanelId)
|
||||
self:_DebugLogDataCount("OnEnable")
|
||||
end
|
||||
function BasePanel:_AfterEnter()
|
||||
if type(self.OnAfterEnter) == "function" then
|
||||
self:OnAfterEnter()
|
||||
end
|
||||
end
|
||||
function BasePanel:_SetPrefabInstance(bDel)
|
||||
local nCount = #self._tbObjDyncChildCtrl
|
||||
for i = nCount, 1, -1 do
|
||||
local objDyncChildCtrl = self._tbObjDyncChildCtrl[i]
|
||||
objDyncChildCtrl:_Destroy()
|
||||
objDyncChildCtrl.gameObject = nil
|
||||
table.remove(self._tbObjDyncChildCtrl, i)
|
||||
end
|
||||
for i, objCtrl in ipairs(self._tbObjCtrl) do
|
||||
if bDel == true then
|
||||
if objCtrl.__cname == "TopBarCtrl" then
|
||||
objCtrl.gameObject = nil
|
||||
elseif objCtrl.gameObject ~= nil and objCtrl.gameObject:IsNull() == false then
|
||||
destroy(objCtrl.gameObject)
|
||||
objCtrl.gameObject = nil
|
||||
end
|
||||
self._trTopBarParent = nil
|
||||
elseif objCtrl.gameObject ~= nil and objCtrl.gameObject:IsNull() == false then
|
||||
objCtrl.gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
if bDel == true then
|
||||
nCount = #self._tbObjChildCtrl
|
||||
for i = nCount, 1, -1 do
|
||||
local o = self._tbObjChildCtrl[i]
|
||||
o._nGoInstanceId = nil
|
||||
o.gameObject = nil
|
||||
table.remove(self._tbObjChildCtrl, i)
|
||||
end
|
||||
end
|
||||
self:_DebugLogDataCount("Before OnDestroy")
|
||||
end
|
||||
function BasePanel:_Destroy()
|
||||
if type(self.OnDestroy) == "function" then
|
||||
self:OnDestroy()
|
||||
end
|
||||
for i, objCtrl in ipairs(self._tbObjCtrl) do
|
||||
GameResourceLoader.UnloadAsset(objCtrl._panel._nPanelId)
|
||||
objCtrl:_Destroy()
|
||||
end
|
||||
for sName, objChildCtrl in ipairs(self._tbObjChildCtrl) do
|
||||
objChildCtrl:_Destroy()
|
||||
end
|
||||
self:_SetPrefabInstance(true)
|
||||
self._tbParam = nil
|
||||
self._tbObjCtrl = nil
|
||||
self._tbObjChildCtrl = nil
|
||||
self._tbObjDyncChildCtrl = nil
|
||||
end
|
||||
function BasePanel:_Release()
|
||||
if type(self.OnRelease) == "function" then
|
||||
self:OnRelease()
|
||||
end
|
||||
if type(self._tbObjCtrl) == "table" then
|
||||
for i, objCtrl in ipairs(self._tbObjCtrl) do
|
||||
objCtrl:_Release()
|
||||
end
|
||||
end
|
||||
if type(self._tbObjChildCtrl) == "table" then
|
||||
for sName, objChildCtrl in ipairs(self._tbObjChildCtrl) do
|
||||
objChildCtrl:_Release()
|
||||
end
|
||||
end
|
||||
end
|
||||
function BasePanel:_BindEventCallback()
|
||||
if type(self._mapEventConfig) == "table" then
|
||||
for nEventId, sCallbackName in pairs(self._mapEventConfig) do
|
||||
local callback = self[sCallbackName]
|
||||
if type(callback) == "function" then
|
||||
EventManager.Add(nEventId, self, callback)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function BasePanel:_UnbindEventCallback()
|
||||
if type(self._mapEventConfig) == "table" then
|
||||
for nEventId, sCallbackName in pairs(self._mapEventConfig) do
|
||||
local callback = self[sCallbackName]
|
||||
if type(callback) == "function" then
|
||||
EventManager.Remove(nEventId, self, callback)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function BasePanel:_DebugLogDataCount(sTitle)
|
||||
if bDebugLog == false then
|
||||
return
|
||||
end
|
||||
local sPanelName = self.__cname
|
||||
local nObjCtrlCnt = table.nums(self._tbObjCtrl)
|
||||
local nObjChildCtrlCnt = table.nums(self._tbObjChildCtrl)
|
||||
local nObjDyncChildCtrlCnt = table.nums(self._tbObjDyncChildCtrl)
|
||||
local sDebugLog = string.format("[%s.%s] ctrl实例数量:%d,子ctrl实例数量:%d,动态子ctrl实例数量:%d。", sPanelName, sTitle, nObjCtrlCnt, nObjChildCtrlCnt, nObjDyncChildCtrlCnt)
|
||||
printLog(sDebugLog)
|
||||
end
|
||||
function BasePanel:GetPanelParam()
|
||||
if type(self._tbParam) == "table" then
|
||||
return self._tbParam
|
||||
else
|
||||
return nil
|
||||
end
|
||||
end
|
||||
return BasePanel
|
||||
@@ -0,0 +1,258 @@
|
||||
local PanelDefine = {
|
||||
[PanelId.ExeEditor] = "Game.Actor2D.Editor_BBV.ExeEditorPanel",
|
||||
[PanelId.BBVEditor] = "Game.Actor2D.Editor_BBV.BBVEditorPanel",
|
||||
[PanelId.Actor2DEditor] = "Game.Actor2D.Editor.Actor2DEditorPanel",
|
||||
[PanelId.AvgEditor] = "Game.UI.Avg.Editor.AvgEditorPanel",
|
||||
[PanelId.Login] = "Game.UI.Login.LoginPanel",
|
||||
[PanelId.MainView] = "Game.UI.MainViewEx.MainViewPanel",
|
||||
[PanelId.MainViewSide] = "Game.UI.MainViewEx.MainViewSidePanel",
|
||||
[PanelId.LevelMenu] = "Game.UI.LevelMenuEx.LevelMenuPanel",
|
||||
[PanelId.MainlineEx] = "Game.UI.MainlineEx.MainlineExPanel",
|
||||
[PanelId.StoryChapter] = "Game.UI.MainlineEx.StoryChapterPanel",
|
||||
[PanelId.Raid] = "Game.UI.Raid.RaidPanel",
|
||||
[PanelId.MainlineFormation] = "Game.UI.FormationEx.FormationPanel",
|
||||
[PanelId.MainlineFormationDisc] = "Game.UI.MainlineFormationDisc.MainlineFormationDiscPanel",
|
||||
[PanelId.CharSkill] = "Game.UI.CharSkill.CharSkillPanel",
|
||||
[PanelId.FillMaterial] = "Game.UI.FillMaterial.FillMaterialPanel",
|
||||
[PanelId.CharInfo] = "Game.UI.CharacterInfoEx.CharacterInfoPanel",
|
||||
[PanelId.CharAttrDetail] = "Game.UI.CharacterInfoEx.CharAttrDetailPanel",
|
||||
[PanelId.BattleResult] = "Game.UI.BattleResult.BattleResultPanel",
|
||||
[PanelId.BattleResultMask] = "Game.UI.BattleResult.BattleResultMaskPanel",
|
||||
[PanelId.BattleDamage] = "Game.UI.BattleResult.BattleDamagePanel",
|
||||
[PanelId.DailyInstanceResultPanel] = "Game.UI.BattleResult.DailyInstanceResultPanel",
|
||||
[PanelId.CharList] = "Game.UI.CharacterListEx.CharacterListPanel",
|
||||
[PanelId.CharPotential] = "Game.UI.CharacterInfoEx.CharPotentialPanel",
|
||||
[PanelId.ProVideoGUI] = "Game.UI.AVProVideo.AVProVideoGUIPanel",
|
||||
[PanelId.CharTalent] = "Game.UI.CharacterInfoEx.CharTalentPanel",
|
||||
[PanelId.CharUpPanel] = "Game.UI.CharacterInfoEx.CharDevelopmentPanel",
|
||||
[PanelId.CharAdvancePreview] = "Game.UI.CharacterInfoEx.CharAdvancePreviewInfoPanel",
|
||||
[PanelId.CharEquipment] = "Game.UI.CharacterInfoEx.CharEquipmentPanel",
|
||||
[PanelId.GachaSpin] = "Game.UI.GachaEx.GachaPanel",
|
||||
[PanelId.GachaGet] = "Game.UI.GachaPanel.GaChaGetPanel",
|
||||
[PanelId.ShopPanel] = "Game.UI.ShopEx.ShopPanel",
|
||||
[PanelId.ShopPopupPanel] = "Game.UI.ShopEx.ShopPopupPanel",
|
||||
[PanelId.DepotPanel] = "Game.UI.DepotEx.DepotPanel",
|
||||
[PanelId.Disc] = "Game.UI.Disc.DiscPanel",
|
||||
[PanelId.DiscList] = "Game.UI.Disc.DiscListPanel",
|
||||
[PanelId.DiscSample] = "Game.UI.Disc.DiscSamplePanel",
|
||||
[PanelId.DiscPreview] = "Game.UI.DiscSkill.DiscPreviewPanel",
|
||||
[PanelId.DiscSkill] = "Game.UI.DiscSkill.DiscSkillPanel",
|
||||
[PanelId.NoteSkill] = "Game.UI.NoteSkill.NoteSkillPanel",
|
||||
[PanelId.NoteSkillInfo] = "Game.UI.NoteSkill.NoteSkillInfoPanel",
|
||||
[PanelId.NoteSkillPreview] = "Game.UI.NoteSkill.NoteSkillPreviewPanel",
|
||||
[PanelId.RoguelikeResult] = "Game.UI.RoguelikeResultPanel.RoguelikeResultPanel",
|
||||
[PanelId.Settings] = "Game.UI.Settings.SettingsPanel",
|
||||
[PanelId.BattleSettings] = "Game.UI.Settings.BattleSettingsPanel",
|
||||
[PanelId.SettingsPreview] = "Game.UI.Settings.SettingsPreviewPanel",
|
||||
[PanelId.RoguelikeBuildSave] = "Game.UI.BuildPanelEx.BuildSavePanel",
|
||||
[PanelId.BuildRename] = "Game.UI.BuildPanelEx.BuildRenamePanel",
|
||||
[PanelId.Quest] = "Game.UI.Quest.QuestPanel",
|
||||
[PanelId.PureAvgStory] = "Game.UI.Avg.PureAvgPanel",
|
||||
[PanelId.AvgST] = "Game.UI.Avg.AvgPanel",
|
||||
[PanelId.Adventure] = "Game.UI.Battle.MainBattlePanel",
|
||||
[PanelId.DailyInstanceBattlePanel] = "Game.UI.Battle.DailyInstanceBattlePanel",
|
||||
[PanelId.TDBattlePanel] = "Game.UI.Battle.TDBattlePanel",
|
||||
[PanelId.EquipmentInstanceBattlePanel] = "Game.UI.Battle.EquipmentInstanceBattlePanel",
|
||||
[PanelId.RecorderPanel] = "Game.UI.Recorder.RecorderPanel",
|
||||
[PanelId.RecorderMain] = "Game.UI.Recorder.RecorderMainPanel",
|
||||
[PanelId.Hud] = "Game.UI.Hud.HudPanel",
|
||||
[PanelId.MainBattlePause] = "Game.UI.Battle.MainBattlePausePanel",
|
||||
[PanelId.RegionBossFormation] = "Game.UI.RegionBossFormationEx.RegionBossFormationPanel",
|
||||
[PanelId.RogueBossResult] = "Game.UI.RogueBossResult.RogueBossResultPanel",
|
||||
[PanelId.BossInstanceResultPanel] = "Game.UI.BossInstanceResult.BossInstanceResultPanel",
|
||||
[PanelId.RogueBossBuildBrief] = "Game.UI.RegionBossFormationEx.RegionBossBuildPanel",
|
||||
[PanelId.Mail] = "Game.UI.Mail.MailPanel",
|
||||
[PanelId.ReceivePropsTips] = "Game.UI.ReceivePropsEx.ReceivePropsPanel",
|
||||
[PanelId.Friend] = "Game.UI.FriendEx.FriendPanel",
|
||||
[PanelId.FriendCarte] = "Game.UI.FriendEx.FriendCartePanel",
|
||||
[PanelId.RoguelikeLevel] = "Game.UI.FixedRoguelikeLevelSelectEx.FixedRoguelikeLevelSelectPanel",
|
||||
[PanelId.RogueBossLevel] = "Game.UI.FixedRoguelikeLevelSelectEx.RogueBossSelectPanel",
|
||||
[PanelId.WorldClassUpgrade] = "Game.UI.WorldClassEx.WorldClassUpgradePanel",
|
||||
[PanelId.Achievement] = "Game.UI.AchievementEx.AchievementPanel",
|
||||
[PanelId.MonthlyCard] = "Game.UI.MonthlyCard.MonthlyCardPanel",
|
||||
[PanelId.DailyCheckIn] = "Game.UI.CheckIn.DailyCheckInPanel",
|
||||
[PanelId.Mall] = "Game.UI.Mall.MallPanel",
|
||||
[PanelId.MallPopup] = "Game.UI.Mall.MallPopupPanel",
|
||||
[PanelId.MallSkinPreview] = "Game.UI.Mall.MallSkinPreviewPanel",
|
||||
[PanelId.CharShardsConvert] = "Game.UI.Mall.CharShardsConvertPanel",
|
||||
[PanelId.TravelerDuelLevelSelect] = "Game.UI.TravelerDuelLevelSelect.TravelerDuelLevelPanel",
|
||||
[PanelId.DailyInstanceLevelSelect] = "Game.UI.DailyInstanceLevelSelect.DailyInstanceLevelSelectPanel",
|
||||
[PanelId.EquipmentInstanceLevelSelect] = "Game.UI.EquipmentInstanceLevelSelect.EquipmentInstanceLevelSelectPanel",
|
||||
[PanelId.ItemTips] = "Game.UI.CommonTipsEx.ItemTipsPanel",
|
||||
[PanelId.PerkTips] = "Game.UI.CommonTipsEx.PerkTipsPanel",
|
||||
[PanelId.SkillTips] = "Game.UI.CommonTipsEx.SkillTipsPanel",
|
||||
[PanelId.BtnTips] = "Game.UI.CommonTipsEx.BtnTipsPanel",
|
||||
[PanelId.MonsterTips] = "Game.UI.CommonTipsEx.MonsterTipsPanel",
|
||||
[PanelId.EquipmentTips] = "Game.UI.CommonTipsEx.EquipmentTipsPanel",
|
||||
[PanelId.DiscSkillTips] = "Game.UI.CommonTipsEx.DiscSkillTipsPanel",
|
||||
[PanelId.PotentialDetail] = "Game.UI.PotentialDetail.PotentialDetailPanel",
|
||||
[PanelId.RegionBossBattlePanel] = "Game.UI.Battle.RegionBossBattlePanel",
|
||||
[PanelId.DiscSucBar] = "Game.UI.SuccessBarEx.DiscSucBarPanel",
|
||||
[PanelId.SkillSucBar] = "Game.UI.SuccessBarEx.SkillSucBarPanel",
|
||||
[PanelId.CharSucBar] = "Game.UI.SuccessBarEx.CharSucBarPanel",
|
||||
[PanelId.EquipmentSucBar] = "Game.UI.SuccessBarEx.EquipmentSucBarPanel",
|
||||
[PanelId.ReceiveAutoTrans] = "Game.UI.SuccessBarEx.ReceiveAutoTransPanel",
|
||||
[PanelId.CharacterSkinPanel] = "Game.UI.CharacterSkin.CharacterSkinPanel",
|
||||
[PanelId.ReceiveSpecialReward] = "Game.UI.CharacterSkin.ReceiveSpecialRewardPanel",
|
||||
[PanelId.ChooseHomePageRolePanel] = "Game.UI.MainViewBoard.ChooseHomePageRolePanel",
|
||||
[PanelId.ChooseHomePageSkinPanel] = "Game.UI.MainViewBoard.ChooseHomePageSkinPanel",
|
||||
[PanelId.CharBgPanel] = "Game.UI.CharacterInfoEx.CharBgPanel",
|
||||
[PanelId.CampingJoystick] = "Game.UI.Camping.CampingJoystickPanel",
|
||||
[PanelId.FixedRoguelikeShop] = "Game.UI.FixedRoguelikeEx.FRShop.FixedRoguelikeShopPanel",
|
||||
[PanelId.FixedRoguelikeZSPerk] = "Game.UI.FixedRoguelikeEx.FixedRoguelikeZSPerkSelect.FixedRoguelikeZSPerkPanel",
|
||||
[PanelId.FRThemePerkSelect] = "Game.UI.FixedRoguelikeEx.FixedRoguelikePerkSelect.FRThemePerkSelectPanel",
|
||||
[PanelId.FRQuestComplete] = "Game.UI.FixedRoguelikeEx.FixedRoguelikeQuestCompletePanel",
|
||||
[PanelId.PopupSkillPanel] = "Game.UI.CommonTipsEx.PopupSkillPanel",
|
||||
[PanelId.TravelerDuelLevelQuestPanel] = "Game.UI.TravelerDuelLevelSelect.TravelerDuelQuest.TravelerDuelQuestPanel",
|
||||
[PanelId.TDBattleResultPanel] = "Game.UI.BattleResult.TDBattleResultPanel",
|
||||
[PanelId.TDLevelUpgrade] = "Game.UI.TravelerDuelLevelSelect.TDClassUpgradePanel",
|
||||
[PanelId.CharacterRelation] = "Game.UI.CharacterInfoEx.CharacterPlotPanel",
|
||||
[PanelId.ExChangePanel] = "Game.UI.ExChange.ExChangePanel",
|
||||
[PanelId.GachaPreview] = "Game.UI.GachaEx.GachaPreview.GachaPreviewPanel",
|
||||
[PanelId.EnergyBuy] = "Game.UI.EnergyBuy.EnergyBuyPanel",
|
||||
[PanelId.Dictionary] = "Game.UI.Dictionary.DictionaryPanel",
|
||||
[PanelId.DictionaryEntry] = "Game.UI.Dictionary.DictionaryEntryPanel",
|
||||
[PanelId.DictionaryFR] = "Game.UI.Dictionary.DictionaryFRPanel",
|
||||
[PanelId.PopupFunctionUnlock] = "Game.UI.PopupFunctionUnlockPanel.PopupFunctionUnlockPanel",
|
||||
[PanelId.Crafting] = "Game.UI.Crafting.CraftingPanel",
|
||||
[PanelId.CraftingTip] = "Game.UI.Crafting.CraftingTipPanel",
|
||||
[PanelId.SubSkillDisplay] = "Game.UI.Battle.SubSkillDisplay.SubSkillDisplayPanel",
|
||||
[PanelId.BattlePass] = "Game.UI.BattlePass.BattlePassPanel",
|
||||
[PanelId.BattlePassUpgrade] = "Game.UI.BattlePass.BattlePassUpgradePanel",
|
||||
[PanelId.CharFavourReward] = "Game.UI.CharacterFavour.CharFavourRewardPanel",
|
||||
[PanelId.CharFavourTask] = "Game.UI.CharacterFavour.CharFavourTaskPanel",
|
||||
[PanelId.CharFavourLevelUp] = "Game.UI.CharacterFavour.CharFavourLevelUpPanel",
|
||||
[PanelId.CharFavourExpUp] = "Game.UI.CharacterFavour.CharFavourExpUpPanel",
|
||||
[PanelId.CharFavourGift] = "Game.UI.CharacterFavour.CharFavourGiftPanel",
|
||||
[PanelId.CharacterStory] = "Game.UI.CharacterRecord.CharacterStoryPanel",
|
||||
[PanelId.ActivityList] = "Game.UI.ActivityList.ActivityListPanel",
|
||||
[PanelId.ActivityPopUp] = "Game.UI.ActivityList.ActivityPopUpPanel",
|
||||
[PanelId.LoginRewardPopUp] = "Game.UI.Activity.LoginReward.LoginRewardPopUpPanel",
|
||||
[PanelId.Consumable] = "Game.UI.Consumable.ConsumablePanel",
|
||||
[PanelId.CharConsumablePanel] = "Game.UI.CharConsumable.CharConsumablePanel",
|
||||
[PanelId.ChangeGender] = "Game.UI.ChangeGender.ChangeGenderPanel",
|
||||
[PanelId.InfinityTowerBattlePanel] = "Game.UI.Battle.InfinityTowerBattlePanel",
|
||||
[PanelId.InfinityTowerSelectTower] = "Game.UI.InfinityTower.InfinityTowerSelectTowerPanel",
|
||||
[PanelId.Phone] = "Game.UI.Phone.PhonePanel",
|
||||
[PanelId.PhonePopUp] = "Game.UI.Phone.PhonePopUpPanel",
|
||||
[PanelId.DatingLandmark] = "Game.UI.Phone.Dating.DatingLandmarkPanel",
|
||||
[PanelId.Dating] = "Game.UI.Phone.Dating.DatingPanel",
|
||||
[PanelId.DatingTest] = "Game.Editor.Phone.DatingTestPanel",
|
||||
[PanelId.Equipment] = "Game.UI.Equipment.EquipmentPanel",
|
||||
[PanelId.EquipmentInfo] = "Game.UI.Equipment.EquipmentInfoPanel",
|
||||
[PanelId.EquipmentInstanceResult] = "Game.UI.BattleResult.EquipmentInstanceResultPanel",
|
||||
[PanelId.EquipmentRename] = "Game.UI.Equipment.EquipmentRenamePanel",
|
||||
[PanelId.EquipmentAttrPreview] = "Game.UI.Equipment.EquipmentAttrPreviewPanel",
|
||||
[PanelId.EquipmentRoll] = "Game.UI.Equipment.EquipmentRollPanel",
|
||||
[PanelId.TravelerDuelRankingUpload] = "Game.UI.TravelerDuelLevelSelect.TravelerDuelRanking.TravelerDuelRankingUploadPanel",
|
||||
[PanelId.TravelerDuelRankUploadSuccess] = "Game.UI.TravelerDuelLevelSelect.TravelerDuelRanking.TravelerDuelRankUploadSuccessPanel",
|
||||
[PanelId.StarTowerBuildSave] = "Game.UI.StarTower.Build.StarTowerBuildSavePanel",
|
||||
[PanelId.StarTowerLevelSelect] = "Game.UI.StarTowerLevelSelect.StarTowerLevelSelectPanel",
|
||||
[PanelId.StarTowerResult] = "Game.UI.StarTower.StarTowerResultPanel",
|
||||
[PanelId.StarTowerPanel] = "Game.UI.StarTower.StarTowerPanel",
|
||||
[PanelId.StarTowerProloguePanel] = "Game.UI.StarTower.StarTowerProloguePanel",
|
||||
[PanelId.NpcOptionPanel] = "Game.UI.StarTower.NpcOption.NpcOptionPanel",
|
||||
[PanelId.StarTowerShop] = "Game.UI.StarTower.StarTowerShop.StarTowerShopPanel",
|
||||
[PanelId.StarTowerBuildBriefList] = "Game.UI.StarTower.Build.StarTowerBuildBriefPanel",
|
||||
[PanelId.StarTowerBuildDetail] = "Game.UI.StarTower.Build.StarTowerBuildDetailPanel",
|
||||
[PanelId.BuildAttrPreview] = "Game.UI.StarTower.Build.BuildAttrPreviewPanel",
|
||||
[PanelId.FilterPopupPanel] = "Game.UI.Filter.FilterPopupPanel",
|
||||
[PanelId.DispatchPanel] = "Game.UI.Dispatch.DispatchPanel",
|
||||
[PanelId.StarTowerBook] = "Game.UI.StarTowerBook.StarTowerBookPanel",
|
||||
[PanelId.StarTowerGrowth] = "Game.UI.StarTowerGrowth.StarTowerGrowthPanel",
|
||||
[PanelId.StarTowerQuest] = "Game.UI.StarTowerQuest.StarTowerQuestPanel",
|
||||
[PanelId.StarTowerFastBattle] = "Game.UI.StarTowerFastBattle.StarTowerFastBattlePanel",
|
||||
[PanelId.StarTowerFastBattleLog] = "Game.UI.StarTowerFastBattle.StarTowerFastBattleLogPanel",
|
||||
[PanelId.StarTowerFastBattleOption] = "Game.UI.StarTowerFastBattle.StarTowerFastBattleOptionPanel",
|
||||
[PanelId.VampireSurvivorLevelSelectPanel] = "Game.UI.VampireLevelSelect.VampireLevelSelectPanel",
|
||||
[PanelId.VampireSurvivorFateCardInfo] = "Game.UI.VampireLevelSelect.VampireFateCardInfo.VampireFateCardInfoPanel",
|
||||
[PanelId.VampireSurvivorFateCardSelect] = "Game.UI.VampireSurvivor.VampireFateCardSelectPanel",
|
||||
[PanelId.VampireSurvivorBattlePanel] = "Game.UI.Battle.VampireSurvivorBattlePanel",
|
||||
[PanelId.VampireSurvivorSettle] = "Game.UI.VampireSurvivor.VampireSurvivorSettlelPanel",
|
||||
[PanelId.WeeklyCopiesPanel] = "Game.UI.WeeklyCopies.WeeklyCopiesPanel",
|
||||
[PanelId.CharPlot] = "Game.UI.CharacterRecord.CharPlotPanel",
|
||||
[PanelId.MiningGame] = "Game.UI.Play_Mining.MiningGamePanel",
|
||||
[PanelId.MiningGameStory] = "Game.UI.Play_Mining.MiningGameStoryPanel",
|
||||
[PanelId.MiningGameQuest] = "Game.UI.Play_Mining.MiningGameQuestPanel",
|
||||
[PanelId.LoginSetting] = "Game.UI.Settings.LoginSettingsPanel",
|
||||
[PanelId.ScoreBossBattlePanel] = "Game.UI.Battle.ScoreBossBattlePanel",
|
||||
[PanelId.ScoreBossSelectPanel] = "Game.UI.ScoreBoss.ScoreBossSelectPanel",
|
||||
[PanelId.AnnouncementPanel] = "Game.UI.GameAnnouncement.AnnouncementPanel",
|
||||
[PanelId.ScoreBossClearBD] = "Game.UI.ScoreBoss.ScoreBossClearBDPanel",
|
||||
[PanelId.ScoreBossReplaceBD] = "Game.UI.ScoreBoss.ScoreBossReplaceBDPanel",
|
||||
[PanelId.ScoreBossResult] = "Game.UI.ScoreBoss.ScoreBossResultPanel",
|
||||
[PanelId.SkillInstanceLevelSelect] = "Game.UI.SkillInstanceLevelSelect.SkillInstanceLevelSelectPanel",
|
||||
[PanelId.SkillInstanceBattlePanel] = "Game.UI.Battle.SkillInstanceBattlePanel",
|
||||
[PanelId.SkillInstanceResult] = "Game.UI.BattleResult.SkillInstanceResultPanel",
|
||||
[PanelId.ExchangeCodePanel] = "Game.UI.ExchangeCode.ExchangeCodePanel",
|
||||
[PanelId.CookieBoardPanel] = "Game.UI.Play_Cookie.CookieBoardPanel",
|
||||
[PanelId.CookieGamePanel] = "Game.UI.Play_Cookie.CookieGamePanel",
|
||||
[PanelId.CookieQuestPanel] = "Game.UI.Play_Cookie.CookieQuestPanel",
|
||||
[PanelId.LampNoticePanel] = "Game.UI.LampNotice.LampNoticePanel",
|
||||
[PanelId.TrialLevelSelect] = "Game.UI.TrialLevelSelect.TrialLevelSelectPanel",
|
||||
[PanelId.TrialFormation] = "Game.UI.TrialLevelSelect.TrialFormationPanel",
|
||||
[PanelId.TrialBattlePanel] = "Game.UI.TrialBattle.TrialBattlePanel",
|
||||
[PanelId.TrialDepot] = "Game.UI.TrialBattle.TrialDepotPanel",
|
||||
[PanelId.TrialResult] = "Game.UI.TrialBattle.TrialResultPanel",
|
||||
[PanelId.NpcAffinityRewardPanel] = "Game.UI.StarTowerBook.Affinity.AffinityRewardPanel",
|
||||
[PanelId.JointDrillLevelSelect] = "Game.UI.JointDrill.JointDrillLevelSelectPanel",
|
||||
[PanelId.JointDrillBuildList] = "Game.UI.JointDrill.JointDrillBuildListPanel",
|
||||
[PanelId.JointDrillBattlePanel] = "Game.UI.Battle.JointDrillBattlePanel",
|
||||
[PanelId.JointDrillResult] = "Game.UI.JointDrill.JointDrillResultPanel",
|
||||
[PanelId.JointDrillRankUp] = "Game.UI.JointDrill.JointDrillRankUpPanel",
|
||||
[PanelId.JointDrillQuest] = "Game.UI.JointDrill.JointDrillQuestPanel",
|
||||
[PanelId.JointDrillRanking] = "Game.UI.JointDrill.JointDrillRankingPanel",
|
||||
[PanelId.JointDrillRankDetail] = "Game.UI.JointDrill.JointDrillRankDetailPanel",
|
||||
[PanelId.JointDrillRaid] = "Game.UI.JointDrill.JointDrillRaidPanel",
|
||||
[PanelId.TowerDefenseSelectPanel] = "Game.UI.TowerDefense.TowerDefenseSelectPanel",
|
||||
[PanelId.TowerDefenseLevelDetailPanel] = "Game.UI.TowerDefense.TowerDefenseLevelDetailPanel",
|
||||
[PanelId.NPCAffinityLevelUp] = "Game.UI.StarTower.NpcAffinityLevelUp.NPCFavorLevelUpPanel",
|
||||
[PanelId.BuildAttribute] = "Game.UI.BuildAttribute.BuildAttributePanel",
|
||||
[PanelId.TowerDefensePanel] = "Game.UI.TowerDefense.TowerDefensePanel",
|
||||
[PanelId.TowerDefenseCharacterDetailPanel] = "Game.UI.TowerDefense.TowerDefenseCharacterDetailPanel",
|
||||
[PanelId.StoryEntrance] = "Game.UI.MainlineEx.StoryEntrancePanel",
|
||||
[PanelId.StorySet] = "Game.UI.StorySet.StorySetPanel",
|
||||
[PanelId.TowerDefenseHUD] = "Game.UI.TowerDefense.HUD.TowerDefenseHudPanel",
|
||||
[PanelId.TutorialPanel] = "Game.UI.Tutorial.TutorialPanel",
|
||||
[PanelId.CreatePlayer] = "Game.UI.CreatePlayer.CreatePlayerPanel",
|
||||
[PanelId.TowerDefenseQuest] = "Game.UI.TowerDefense.TowerDefenseQuestPanel",
|
||||
[PanelId.TowerDefenseResultPanel] = "Game.UI.TowerDefense.TowerDefenseResultPanel",
|
||||
[PanelId.ScoreBossRankingPanel] = "Game.UI.ScoreBoss.ScoreBossRanking.ScoreBossRankingPanel",
|
||||
[PanelId.TowerDefenseTipsPanel] = "Game.UI.TowerDefense.TowerDefTipsPanel",
|
||||
[PanelId.ActivityLevelsBattlePanel] = "Game.UI.Battle.ActivityLevelsBattlePanel",
|
||||
[PanelId.ActivityLevelsSelectPanel] = "Game.UI.ActivityTheme.Swim.ActivityLevels.ActivityLevelsSelectPanel",
|
||||
[PanelId.ActivityLevelsInstanceResultPanel] = "Game.UI.ActivityTheme.LevelCommon.ActivityLevelsInstanceResultPanel",
|
||||
[PanelId.SwimTheme] = "Game.UI.ActivityTheme.Swim.SwimThemePanel",
|
||||
[PanelId.MiningGameGuidePanel] = "Game.UI.Play_Mining.MiningGameGuidePanel",
|
||||
[PanelId.SwimThemeStory] = "Game.UI.ActivityTheme.Swim.Story.SwimThemeStoryPanel",
|
||||
[PanelId.CharInfoTrial] = "Game.UI.CharacterInfoTrial.CharacterInfoTrialPanel",
|
||||
[PanelId.CharSkillTrial] = "Game.UI.CharacterInfoTrial.CharSkillTrialPanel",
|
||||
[PanelId.CharPotentialTrial] = "Game.UI.CharacterInfoTrial.CharPotentialTrialPanel",
|
||||
[PanelId.CharTalentTrial] = "Game.UI.CharacterInfoTrial.CharTalentTrialPanel",
|
||||
[PanelId.CharBgTrialPanel] = "Game.UI.CharacterInfoTrial.CharBgTrialPanel",
|
||||
[PanelId.SwimTask] = "Game.UI.ActivityTheme.Swim.Task.SwimTaskPanel",
|
||||
[PanelId.SwimShop] = "Game.UI.ActivityTheme.Swim.Shop.ActivityShopPanel",
|
||||
[PanelId.SwimShopPopup] = "Game.UI.ActivityTheme.Swim.Shop.ActivityShopPopupPanel",
|
||||
[PanelId.Shop_10101] = "Game.UI.ActivityTheme.10101.Shop.ActivityShopPanel",
|
||||
[PanelId.ShopPopup_10101] = "Game.UI.ActivityTheme.10101.Shop.ActivityShopPopupPanel",
|
||||
[PanelId.Shop_10102] = "Game.UI.ActivityTheme.10102.Shop.ActivityShopPanel",
|
||||
[PanelId.ShopPopup_10102] = "Game.UI.ActivityTheme.10102.Shop.ActivityShopPopupPanel",
|
||||
[PanelId.TutorialResult] = "Game.UI.Tutorial.TutorialResultPanel",
|
||||
[PanelId.SkinPreviewPanel] = "Game.UI.BattlePass.SkinPreviewPanel",
|
||||
[PanelId.ActivityLevelsSelectPanel_10101] = "Game.UI.ActivityTheme.10101.ActivityLevels.ActivityLevelsSelectPanel",
|
||||
[PanelId.OurRegimentThemePanel] = "Game.UI.ActivityTheme.10101.OurRegimentThemePanel",
|
||||
[PanelId.ActivityLevelsSelectPanel_10102] = "Game.UI.ActivityTheme.10102.ActivityLevels.ActivityLevelsSelectPanel",
|
||||
[PanelId.Task_10102] = "Game.UI.ActivityTheme.10102.Task.DreamTaskPanel",
|
||||
[PanelId.DreamThemePanel] = "Game.UI.ActivityTheme.10102.DreamThemePanel",
|
||||
[PanelId.BdConvertQuestPanel] = "Game.UI.Activity.BdConvert._500001.BdConvertQuestPanel",
|
||||
[PanelId.BdConvertPanel] = "Game.UI.Activity.BdConvert._500001.BdConvertPanel",
|
||||
[PanelId.BdConvertBuildPanel] = "Game.UI.Activity.BdConvert._500001.BdConvertBuildPanel",
|
||||
[PanelId.BdConvertBuildDetail] = "Game.UI.Activity.BdConvert._500001.BdConvertBuildDetailPanel",
|
||||
[PanelId.Task_10101] = "Game.UI.ActivityTheme.10101.Task.OurRegimentTaskPanel",
|
||||
[PanelId.MiningGame_400002] = "Game.UI.Play_Mining_400002.MiningGamePanel",
|
||||
[PanelId.MiningGameGuidePanel_400002] = "Game.UI.Play_Mining_400002.MiningGameGuidePanel",
|
||||
[PanelId.TowerDefenseGiveupPanel] = "Game.UI.TowerDefense.TowerDefenseGiveUpPanel"
|
||||
}
|
||||
if NovaAPI.GetClientChannel() == AllEnum.ChannelName.BanShu then
|
||||
end
|
||||
return PanelDefine
|
||||
@@ -0,0 +1,269 @@
|
||||
local PanelId = {
|
||||
ExeEditor = -4,
|
||||
BBVEditor = -3,
|
||||
Actor2DEditor = -2,
|
||||
AvgEditor = -1,
|
||||
None = 0,
|
||||
Login = 1,
|
||||
MainView = 10,
|
||||
MainlineFormation = 12,
|
||||
CharAdvancePreview = 13,
|
||||
ChooseHomePageRolePanel = 14,
|
||||
CharUpPanel = 15,
|
||||
MainViewSide = 16,
|
||||
CharTalent = 17,
|
||||
DailyInstanceResultPanel = 18,
|
||||
CharInfo = 19,
|
||||
BattleResult = 20,
|
||||
CharList = 21,
|
||||
GachaSpin = 22,
|
||||
GachaGet = 23,
|
||||
CharacterSkinPanel = 26,
|
||||
ShopPanel = 27,
|
||||
ReceiveSpecialReward = 28,
|
||||
DepotPanel = 29,
|
||||
ChooseHomePageSkinPanel = 30,
|
||||
RoguelikeResult = 33,
|
||||
Settings = 34,
|
||||
SettingsPreview = 35,
|
||||
CharSkill = 37,
|
||||
Disc = 38,
|
||||
DiscSkill = 39,
|
||||
NoteSkill = 40,
|
||||
RoguelikeBuildSave = 41,
|
||||
RegionBossFormation = 43,
|
||||
RogueBossResult = 44,
|
||||
RogueBossBuildBrief = 45,
|
||||
Mail = 46,
|
||||
ReceivePropsTips = 47,
|
||||
Friend = 48,
|
||||
Quest = 49,
|
||||
ExChangePanel = 50,
|
||||
FillMaterial = 51,
|
||||
LevelMenu = 54,
|
||||
Mainline = 55,
|
||||
RoguelikeLevel = 56,
|
||||
RogueBossLevel = 57,
|
||||
ItemTips = 59,
|
||||
PerkTips = 60,
|
||||
SkillTips = 61,
|
||||
StrengthPerkTipsPanel = 62,
|
||||
MonsterTips = 64,
|
||||
BtnTips = 66,
|
||||
TravelerDuelLevelSelect = 68,
|
||||
DailyInstanceLevelSelect = 69,
|
||||
Achievement = 71,
|
||||
MonthlyCard = 72,
|
||||
DailyCheckIn = 73,
|
||||
Mall = 74,
|
||||
WorldClassUpgrade = 75,
|
||||
FixedRoguelikeShop = 76,
|
||||
FixedRoguelikeZSPerk = 77,
|
||||
FRThemePerkSelect = 78,
|
||||
FRQuestComplete = 79,
|
||||
PopupSkillPanel = 80,
|
||||
TravelerDuelLevelQuestPanel = 81,
|
||||
TDBattleResultPanel = 82,
|
||||
TDLevelUpgrade = 83,
|
||||
Raid = 84,
|
||||
GachaPreview = 85,
|
||||
Dictionary = 86,
|
||||
BattlePass = 87,
|
||||
Consumable = 88,
|
||||
ChangeGender = 89,
|
||||
CharPotential = 90,
|
||||
ProVideoGUI = 92,
|
||||
AvgBB = 97,
|
||||
PureAvgStory = 98,
|
||||
AvgST = 99,
|
||||
Adventure = 100,
|
||||
MainBattlePause = 101,
|
||||
RegionBossBattlePanel = 103,
|
||||
DailyInstanceBattlePanel = 104,
|
||||
TDBattlePanel = 105,
|
||||
EquipmentInstanceBattlePanel = 106,
|
||||
RecorderPanel = 198,
|
||||
RecorderMain = 199,
|
||||
Hud = 200,
|
||||
DiscSucBar = 201,
|
||||
SkillSucBar = 204,
|
||||
CharSucBar = 205,
|
||||
CharBgPanel = 207,
|
||||
CampingJoystick = 209,
|
||||
BattleResultMask = 210,
|
||||
Guide = 212,
|
||||
CharacterRelation = 213,
|
||||
CharFavourReward = 214,
|
||||
CharFavourTask = 215,
|
||||
CharFavourExpUp = 216,
|
||||
CharFavourLevelUp = 217,
|
||||
CharacterStory = 218,
|
||||
CharEquipment = 219,
|
||||
CharFavourGift = 220,
|
||||
EnergyBuy = 221,
|
||||
PopupFunctionUnlock = 224,
|
||||
Crafting = 231,
|
||||
CraftingTip = 232,
|
||||
SubSkillDisplay = 225,
|
||||
ActivityList = 241,
|
||||
ActivityPopUp = 242,
|
||||
ActivityInfinity = 243,
|
||||
InfinityTowerBattlePanel = 251,
|
||||
InfinityTowerSelectTower = 252,
|
||||
WeeklyCopiesPanel = 253,
|
||||
TrialLevelSelect = 254,
|
||||
TrialBattlePanel = 255,
|
||||
TrialResult = 256,
|
||||
TrialFormation = 257,
|
||||
TrialDepot = 258,
|
||||
TrialActivity = 259,
|
||||
Phone = 261,
|
||||
PhonePopUp = 262,
|
||||
TravelerDuelRankingUpload = 263,
|
||||
TravelerDuelRankUploadSuccess = 264,
|
||||
Equipment = 271,
|
||||
EquipmentInfo = 272,
|
||||
EquipmentInstanceLevelSelect = 273,
|
||||
EquipmentTips = 275,
|
||||
EquipmentInstanceResult = 276,
|
||||
StarTowerQuest = 277,
|
||||
EquipmentRename = 278,
|
||||
EquipmentAttrPreview = 279,
|
||||
EquipmentRoll = 281,
|
||||
StarTowerBuildSave = 303,
|
||||
StarTowerLevelSelect = 304,
|
||||
StarTowerResult = 306,
|
||||
StarTowerPanel = 307,
|
||||
StarTowerProloguePanel = 302,
|
||||
NpcOptionPanel = 308,
|
||||
StarTowerShop = 309,
|
||||
StarTowerBuildBriefList = 310,
|
||||
StarTowerBuildDetail = 311,
|
||||
MainlineEx = 312,
|
||||
StoryChapter = 313,
|
||||
FilterPopupPanel = 314,
|
||||
DiscSkillTips = 315,
|
||||
StarTowerRankUp = 316,
|
||||
LoginRewardPopUp = 317,
|
||||
DispatchPanel = 318,
|
||||
MainlineFormationDisc = 320,
|
||||
CharAttrDetail = 322,
|
||||
ShopPopupPanel = 323,
|
||||
DiscList = 324,
|
||||
DiscSample = 325,
|
||||
BuildRename = 326,
|
||||
ReceiveAutoTrans = 327,
|
||||
FriendCarte = 328,
|
||||
MallPopup = 329,
|
||||
CharShardsConvert = 330,
|
||||
DictionaryEntry = 331,
|
||||
DictionaryPopup = 332,
|
||||
DictionaryFR = 333,
|
||||
BattlePassUpgrade = 334,
|
||||
EquipmentSucBar = 335,
|
||||
BattleSettings = 336,
|
||||
StarTowerBook = 337,
|
||||
DatingLandmark = 338,
|
||||
Dating = 339,
|
||||
StarTowerGrowth = 340,
|
||||
StarTowerFastBattle = 341,
|
||||
StarTowerFastBattleLog = 342,
|
||||
StarTowerFastBattleOption = 343,
|
||||
VampireSurvivorBattlePanel = 344,
|
||||
StarTowerRankLevel = 345,
|
||||
VampireSurvivorLevelSelectPanel = 346,
|
||||
VampireSurvivorFateCardInfo = 347,
|
||||
VampireSurvivorFateCardSelect = 348,
|
||||
VampireSurvivorSettle = 349,
|
||||
CharPlot = 350,
|
||||
Transition = 300,
|
||||
MiningGame = 110,
|
||||
MiningGameStory = 111,
|
||||
MiningGameQuest = 112,
|
||||
LoginSetting = 114,
|
||||
ScoreBossBattlePanel = 115,
|
||||
ScoreBossSelectPanel = 116,
|
||||
AnnouncementPanel = 117,
|
||||
ScoreBossClearBD = 118,
|
||||
ScoreBossReplaceBD = 119,
|
||||
ScoreBossResult = 120,
|
||||
SkillInstanceLevelSelect = 121,
|
||||
SkillInstanceBattlePanel = 122,
|
||||
SkillInstanceResult = 123,
|
||||
NoteSkillInfo = 124,
|
||||
DiscPreview = 125,
|
||||
NoteSkillPreview = 126,
|
||||
PlayerInfo = 127,
|
||||
CharConsumablePanel = 128,
|
||||
ExchangeCodePanel = 129,
|
||||
CookieBoardPanel = 130,
|
||||
CookieGamePanel = 131,
|
||||
LampNoticePanel = 132,
|
||||
NpcAffinityRewardPanel = 133,
|
||||
TowerDefenseSelectPanel = 134,
|
||||
TowerDefenseLevelDetailPanel = 135,
|
||||
TowerDefensePanel = 136,
|
||||
TowerDefenseCharacterDetailPanel = 137,
|
||||
TowerDefenseHUD = 138,
|
||||
TowerDefenseQuest = 139,
|
||||
JointDrillLevelSelect = 140,
|
||||
JointDrillBuildList = 141,
|
||||
JointDrillBattlePanel = 142,
|
||||
JointDrillResult = 144,
|
||||
NPCAffinityLevelUp = 145,
|
||||
StoryEntrance = 146,
|
||||
BuildAttribute = 147,
|
||||
PotentialDetail = 148,
|
||||
SwimTheme = 149,
|
||||
TutorialPanel = 280,
|
||||
CreatePlayer = 150,
|
||||
JointDrillRankUp = 151,
|
||||
JointDrillQuest = 152,
|
||||
TowerDefenseResultPanel = 153,
|
||||
ScoreBossRankingPanel = 154,
|
||||
TowerDefenseTipsPanel = 155,
|
||||
ActivityLevelsBattlePanel = 156,
|
||||
ActivityLevelsSelectPanel = 157,
|
||||
ActivityLevelsInstanceResultPanel = 158,
|
||||
JointDrillRanking = 159,
|
||||
JointDrillRankDetail = 160,
|
||||
JointDrillRaid = 161,
|
||||
MiningGameGuidePanel = 162,
|
||||
SwimThemeStory = 163,
|
||||
BuildAttrPreview = 164,
|
||||
CharInfoTrial = 165,
|
||||
CharSkillTrial = 166,
|
||||
CharPotentialTrial = 167,
|
||||
CharTalentTrial = 168,
|
||||
CharBgTrialPanel = 169,
|
||||
BattleDamage = 170,
|
||||
SwimTask = 171,
|
||||
SwimShop = 172,
|
||||
SwimShopPopup = 173,
|
||||
TutorialResult = 180,
|
||||
BossInstanceResultPanel = 181,
|
||||
MallSkinPreview = 182,
|
||||
StorySet = 183,
|
||||
SkinPreviewPanel = 184,
|
||||
CookieQuestPanel = 185,
|
||||
ActivityLevelsSelectPanel_10101 = 186,
|
||||
OurRegimentThemePanel = 187,
|
||||
ActivityLevelsSelectPanel_10102 = 188,
|
||||
Shop_10101 = 189,
|
||||
ShopPopup_10101 = 190,
|
||||
Shop_10102 = 191,
|
||||
ShopPopup_10102 = 192,
|
||||
Task_10102 = 193,
|
||||
DreamThemePanel = 194,
|
||||
BdConvertQuestPanel = 195,
|
||||
BdConvertPanel = 196,
|
||||
BdConvertBuildPanel = 197,
|
||||
Task_10101 = 351,
|
||||
MiningGame_400002 = 352,
|
||||
MiningGameGuidePanel_400002 = 353,
|
||||
BdConvertActPanel = 354,
|
||||
TowerDefenseGiveupPanel = 355,
|
||||
DatingTest = 356,
|
||||
BdConvertBuildDetail = 357
|
||||
}
|
||||
return PanelId
|
||||
@@ -0,0 +1,712 @@
|
||||
local TimerManager = require("GameCore.Timer.TimerManager")
|
||||
local WwiseAudioMgr = CS.WwiseAudioManager.Instance
|
||||
local ClientMgr = CS.ClientManager
|
||||
local AdventureModuleHelper = CS.AdventureModuleHelper
|
||||
local PanelManager = {}
|
||||
local mapUIRootTransform, mapDefinePanel, objCurPanel, objNextPanel, tbBackHistory, tbDisposablePanel, trSnapshotParent, tbTemplateSnapshot, nThresholdHistoryPanelCount, objTransitionPanel, bMainViewSkipAnimIn
|
||||
local nInputRC = 0
|
||||
local tbGoSnapShot, objPlayerInfoPanel
|
||||
local OnClearRequiredLua = function(listener, strPath)
|
||||
printLog("[Lua重载] 清除了:" .. strPath)
|
||||
package.loaded[strPath] = nil
|
||||
end
|
||||
local TakeSnapshot = function(nType)
|
||||
local goSnapshotIns
|
||||
if nType <= 0 or tbTemplateSnapshot == nil then
|
||||
return goSnapshotIns
|
||||
end
|
||||
local goT = tbTemplateSnapshot[nType]
|
||||
if goT ~= nil and goT:IsNull() == false then
|
||||
goSnapshotIns = instantiate(goT, trSnapshotParent)
|
||||
goSnapshotIns:SetActive(true)
|
||||
local goUIEffectSnapshot
|
||||
if nType == 1 or nType == 3 or nType == 4 then
|
||||
goUIEffectSnapshot = goSnapshotIns.transform:GetChild(0).gameObject
|
||||
else
|
||||
goUIEffectSnapshot = goSnapshotIns
|
||||
end
|
||||
NovaAPI.UIEffectSnapShotCapture(goUIEffectSnapshot)
|
||||
end
|
||||
return goSnapshotIns
|
||||
end
|
||||
local GetPanelName = function(nPanelId)
|
||||
for k, v in pairs(PanelId) do
|
||||
if v == nPanelId then
|
||||
return k
|
||||
end
|
||||
end
|
||||
end
|
||||
local AddTbGoSnapShot = function(nPanelId, goIns)
|
||||
if Settings.bDestroyHistoryUIInstance then
|
||||
if tbGoSnapShot == nil then
|
||||
tbGoSnapShot = {}
|
||||
end
|
||||
if goIns ~= nil then
|
||||
tbGoSnapShot[nPanelId] = {goIns = goIns, bMove = false}
|
||||
end
|
||||
end
|
||||
end
|
||||
local MoveSnapShot = function(nPanelId)
|
||||
if Settings.bDestroyHistoryUIInstance and tbGoSnapShot[nPanelId] ~= nil then
|
||||
tbGoSnapShot[nPanelId].bMove = true
|
||||
tbGoSnapShot[nPanelId].goIns.gameObject.transform:SetParent(trSnapshotParent)
|
||||
end
|
||||
end
|
||||
local GetSnapShot = function(nPanelId)
|
||||
if Settings.bDestroyHistoryUIInstance and tbGoSnapShot[nPanelId] ~= nil then
|
||||
tbGoSnapShot[nPanelId].bMove = false
|
||||
tbGoSnapShot[nPanelId].goIns.gameObject:SetActive(true)
|
||||
return tbGoSnapShot[nPanelId].goIns
|
||||
end
|
||||
end
|
||||
local HideMoveSnapshot = function()
|
||||
if Settings.bDestroyHistoryUIInstance and tbGoSnapShot ~= nil then
|
||||
for _, v in pairs(tbGoSnapShot) do
|
||||
if v.bMove and v.goIns ~= nil then
|
||||
v.goIns.gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
local RemoveTbSnapShot = function(nPanelId)
|
||||
if Settings.bDestroyHistoryUIInstance and tbGoSnapShot[nPanelId] ~= nil then
|
||||
local goIns = tbGoSnapShot[nPanelId].goIns
|
||||
if goIns ~= nil then
|
||||
destroy(goIns)
|
||||
end
|
||||
tbGoSnapShot[nPanelId] = nil
|
||||
end
|
||||
end
|
||||
local CheckThresholdCount = function()
|
||||
if nThresholdHistoryPanelCount == nil then
|
||||
nThresholdHistoryPanelCount = ConfigTable.GetConfigNumber("MaxHistoryPanel")
|
||||
end
|
||||
local nCurCount = #tbBackHistory
|
||||
if nCurCount > nThresholdHistoryPanelCount then
|
||||
local nDelCount = nCurCount - nThresholdHistoryPanelCount
|
||||
local tbNeedRemovePanelIndex = {}
|
||||
for i = 1, nCurCount do
|
||||
if tbBackHistory[i]._nPanelId ~= PanelId.MainView then
|
||||
table.insert(tbNeedRemovePanelIndex, i)
|
||||
nDelCount = nDelCount - 1
|
||||
if nDelCount <= 0 then
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
nDelCount = #tbNeedRemovePanelIndex
|
||||
if nDelCount == nCurCount - nThresholdHistoryPanelCount then
|
||||
for i = nDelCount, 1, -1 do
|
||||
local nPanelIndex = tbNeedRemovePanelIndex[i]
|
||||
RemoveTbSnapShot(tbBackHistory[nPanelIndex]._nPanelId)
|
||||
tbBackHistory[nPanelIndex]:_Exit()
|
||||
tbBackHistory[nPanelIndex]:_Destroy()
|
||||
table.remove(tbBackHistory, nPanelIndex)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
local DoBackToTarget = function(nTargetIndex)
|
||||
if type(nTargetIndex) ~= "number" then
|
||||
nTargetIndex = 1
|
||||
end
|
||||
local nCount = #tbBackHistory
|
||||
if nTargetIndex < nCount and objCurPanel ~= nil then
|
||||
local func_PreExitDone = function()
|
||||
if objCurPanel._bAddToBackHistory == true then
|
||||
table.remove(tbBackHistory, nCount)
|
||||
end
|
||||
nCount = #tbBackHistory
|
||||
for i = nCount, nTargetIndex + 1, -1 do
|
||||
local objPanel = tbBackHistory[i]
|
||||
RemoveTbSnapShot(objPanel._nPanelId)
|
||||
objPanel:_PreExit()
|
||||
objPanel:_Exit()
|
||||
objPanel:_Destroy()
|
||||
table.remove(tbBackHistory, i)
|
||||
end
|
||||
local objBackPanel = tbBackHistory[nTargetIndex]
|
||||
if type(objBackPanel.Awake) == "function" then
|
||||
objBackPanel:Awake()
|
||||
end
|
||||
local goSnapshot = GetSnapShot(objBackPanel._nPanelId)
|
||||
objBackPanel:_PreEnter(nil, goSnapshot)
|
||||
objCurPanel:_Exit()
|
||||
objBackPanel:_Enter()
|
||||
objCurPanel:_Destroy()
|
||||
objCurPanel = objBackPanel
|
||||
printLog("[界面切换] 已返回至历史队列指定的索引:" .. tostring(nTargetIndex) .. ",界面:" .. GetPanelName(objCurPanel._nPanelId))
|
||||
end
|
||||
objCurPanel:_PreExit(func_PreExitDone, true)
|
||||
end
|
||||
PanelManager.CloseAllDisposablePanel()
|
||||
end
|
||||
local CloseCurPanel = function()
|
||||
local nLastIndex = #tbBackHistory
|
||||
if objCurPanel == nil then
|
||||
return
|
||||
end
|
||||
if objCurPanel._bAddToBackHistory ~= true or objCurPanel._bAddToBackHistory == true and 1 < nLastIndex then
|
||||
local func_DoBack = function()
|
||||
if objCurPanel._bAddToBackHistory == true then
|
||||
table.remove(tbBackHistory, nLastIndex)
|
||||
end
|
||||
nLastIndex = #tbBackHistory
|
||||
local objBackPanel = tbBackHistory[nLastIndex]
|
||||
local goSnapshot = GetSnapShot(objBackPanel._nPanelId)
|
||||
objBackPanel:_PreEnter(nil, goSnapshot)
|
||||
objCurPanel:_Exit()
|
||||
objBackPanel:_Enter()
|
||||
objCurPanel:_Destroy()
|
||||
objCurPanel = objBackPanel
|
||||
objCurPanel:_AfterEnter()
|
||||
printLog("[界面切换] 已完成:关闭当前并打开历史队列的最后一个, 当前打开的界面:" .. GetPanelName(objCurPanel._nPanelId))
|
||||
end
|
||||
RemoveTbSnapShot(objCurPanel._nPanelId)
|
||||
objCurPanel:_PreExit(func_DoBack, true)
|
||||
end
|
||||
end
|
||||
local ClosePanel = function(nPanelId)
|
||||
if objCurPanel ~= nil then
|
||||
if objCurPanel._nPanelId == nPanelId then
|
||||
CloseCurPanel()
|
||||
else
|
||||
local nCount = #tbBackHistory
|
||||
for i = nCount, 1, -1 do
|
||||
local objPanel = tbBackHistory[i]
|
||||
if objPanel._nPanelId == nPanelId then
|
||||
table.remove(tbBackHistory, i)
|
||||
objPanel:_Destroy()
|
||||
RemoveTbSnapShot(objPanel._nPanelId)
|
||||
objPanel = nil
|
||||
printLog("[界面切换] 仅关闭指定的界面:" .. GetPanelName(nPanelId))
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
local OnClosePanel = function(listener, nPanelId)
|
||||
if objNextPanel ~= nil then
|
||||
printError("[界面切换] 关闭界面:" .. GetPanelName(nPanelId) .. " 失败,上一次界面切换流程尚未完成,正在处理:" .. GetPanelName(objNextPanel._nPanelId))
|
||||
return
|
||||
end
|
||||
if type(nPanelId) == "number" then
|
||||
local bIsMainPanel = true
|
||||
if type(tbDisposablePanel) == "table" then
|
||||
for i, v in ipairs(tbDisposablePanel) do
|
||||
if v._nPanelId == nPanelId then
|
||||
EventManager.Hit("Guide_CloseDisposablePanel", nPanelId)
|
||||
v:_PreExit()
|
||||
v:_Exit()
|
||||
v:_Destroy()
|
||||
table.remove(tbDisposablePanel, i)
|
||||
RemoveTbSnapShot(v._nPanelId)
|
||||
bIsMainPanel = false
|
||||
printLog("[界面切换] 关闭了非主 Panel 界面:" .. GetPanelName(nPanelId))
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
if bIsMainPanel == true then
|
||||
ClosePanel(nPanelId)
|
||||
end
|
||||
end
|
||||
end
|
||||
local OnCloseCurPanel = function(listener)
|
||||
if objCurPanel ~= nil and objCurPanel._bIsMainPanel == true then
|
||||
CloseCurPanel()
|
||||
end
|
||||
end
|
||||
local EnterNext = function()
|
||||
objNextPanel:_Enter(true)
|
||||
if objCurPanel ~= nil then
|
||||
if objCurPanel._bAddToBackHistory == true then
|
||||
objCurPanel:_SetPrefabInstance(Settings.bDestroyHistoryUIInstance)
|
||||
else
|
||||
objCurPanel:_Destroy()
|
||||
end
|
||||
end
|
||||
objCurPanel = objNextPanel
|
||||
objNextPanel = nil
|
||||
objCurPanel:_AfterEnter()
|
||||
printLog("[界面切换] 完成,当前界面:" .. tostring(objCurPanel._nPanelId) .. ", " .. GetPanelName(objCurPanel._nPanelId))
|
||||
end
|
||||
local ExitCurrent = function()
|
||||
if objCurPanel == nil then
|
||||
EnterNext()
|
||||
else
|
||||
objCurPanel:_Exit()
|
||||
EnterNext()
|
||||
end
|
||||
end
|
||||
local PreEnterNext = function()
|
||||
local goSnapshot = TakeSnapshot(objNextPanel._nSnapshotPrePanel)
|
||||
AddTbGoSnapShot(objNextPanel._nPanelId, goSnapshot)
|
||||
cs_coroutine.start(function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
objNextPanel:_PreEnter(ExitCurrent, goSnapshot)
|
||||
HideMoveSnapshot()
|
||||
end)
|
||||
end
|
||||
local PreExitCurrent = function()
|
||||
if objCurPanel == nil then
|
||||
PreEnterNext()
|
||||
else
|
||||
MoveSnapShot(objCurPanel._nPanelId)
|
||||
objCurPanel:_PreExit(PreEnterNext, true)
|
||||
end
|
||||
end
|
||||
local OnOpenPanel = function(listener, nPanelId, ...)
|
||||
if objNextPanel ~= nil then
|
||||
printError("[界面切换] 打开界面:" .. GetPanelName(nPanelId) .. " 失败,上一次界面切换流程尚未完成,正在处理:" .. GetPanelName(objNextPanel._nPanelId))
|
||||
return
|
||||
end
|
||||
if nPanelId == PanelId.MainView and 0 < #tbBackHistory then
|
||||
EventManager.Hit(EventId.CloesCurPanel)
|
||||
return
|
||||
end
|
||||
if objCurPanel ~= nil and objCurPanel._nPanelId == nPanelId then
|
||||
return
|
||||
end
|
||||
local luaClass = require(mapDefinePanel[nPanelId])
|
||||
local tbParameter = {}
|
||||
for i = 1, select("#", ...) do
|
||||
local param = select(i, ...)
|
||||
table.insert(tbParameter, param)
|
||||
end
|
||||
local nIndex = 1
|
||||
if objCurPanel ~= nil then
|
||||
nIndex = objCurPanel._nIndex + 1
|
||||
end
|
||||
local objTempPanel = luaClass.new(nIndex, nPanelId, tbParameter)
|
||||
if objTempPanel._bIsMainPanel == true then
|
||||
objNextPanel = objTempPanel
|
||||
if objNextPanel._bAddToBackHistory == true then
|
||||
table.insert(tbBackHistory, objNextPanel)
|
||||
end
|
||||
PreExitCurrent()
|
||||
else
|
||||
local _bHasOpenTips = false
|
||||
for i, v in ipairs(tbDisposablePanel) do
|
||||
if _bHasOpenTips == false then
|
||||
_bHasOpenTips = UTILS.CheckIsTipsPanel(v._nPanelId)
|
||||
end
|
||||
if v._nPanelId == nPanelId then
|
||||
MoveSnapShot(v._nPanelId)
|
||||
objTempPanel:_PreExit()
|
||||
objTempPanel:_Exit()
|
||||
objTempPanel:_Destroy()
|
||||
objTempPanel = nil
|
||||
printLog("[界面切换] 打开非主 Panel:" .. GetPanelName(nPanelId) .. " 失败,不能重复打开。")
|
||||
return
|
||||
end
|
||||
end
|
||||
objTempPanel._nIndex = objTempPanel._nIndex + #tbDisposablePanel
|
||||
objTempPanel._bIsExtraTips = _bHasOpenTips
|
||||
local goSnapshot = TakeSnapshot(objTempPanel._nSnapshotPrePanel)
|
||||
objTempPanel:_PreEnter(nil, goSnapshot)
|
||||
objTempPanel:_Enter()
|
||||
table.insert(tbDisposablePanel, objTempPanel)
|
||||
printLog("[界面切换] 打开非主 Panel:" .. GetPanelName(nPanelId) .. "成功。")
|
||||
end
|
||||
CheckThresholdCount()
|
||||
end
|
||||
local OnOpenLoading = function(listener, objTarget, callbackUpdate, callbackDone)
|
||||
if objTarget == nil or type(callbackUpdate) == "function" then
|
||||
else
|
||||
end
|
||||
end
|
||||
local OnBlockInput = function(listener, bEnable)
|
||||
if bEnable == true then
|
||||
ClientMgr.Instance:EnableInputBlock()
|
||||
else
|
||||
ClientMgr.Instance:DisableInputBlock()
|
||||
end
|
||||
end
|
||||
local OnTemporaryBlockInput = function(listener, nDuration, callback)
|
||||
if 0 < nDuration then
|
||||
local timerCallback = function()
|
||||
OnBlockInput(PanelManager, false)
|
||||
if type(callback) == "function" then
|
||||
callback()
|
||||
end
|
||||
end
|
||||
OnBlockInput(PanelManager, true)
|
||||
TimerManager.Add(1, nDuration, PanelManager, timerCallback, true, true, true)
|
||||
end
|
||||
end
|
||||
local OnMarkCurCanvasFullRectWH = function()
|
||||
if trSnapshotParent ~= nil and trSnapshotParent:IsNull() == false then
|
||||
local rt = trSnapshotParent:GetComponent("RectTransform")
|
||||
Settings.CURRENT_CANVAS_FULL_RECT_WIDTH = rt.rect.width
|
||||
Settings.CURRENT_CANVAS_FULL_RECT_HEIGHT = rt.rect.height
|
||||
Settings.CANVAS_SCALE = rt.localScale.x
|
||||
end
|
||||
end
|
||||
local function OnCSLuaManagerShutdown()
|
||||
if objCurPanel ~= nil then
|
||||
objCurPanel:_PreExit()
|
||||
objCurPanel:_Exit()
|
||||
objCurPanel:_Destroy()
|
||||
end
|
||||
EventManager.Remove(EventId.CSLuaManagerShutdown, PanelManager, OnCSLuaManagerShutdown)
|
||||
EventManager.Remove(EventId.OpenPanel, PanelManager, OnOpenPanel)
|
||||
EventManager.Remove(EventId.ClosePanel, PanelManager, OnClosePanel)
|
||||
EventManager.Remove(EventId.CloesCurPanel, PanelManager, OnCloseCurPanel)
|
||||
EventManager.Remove(EventId.OpenLoading, PanelManager, OnOpenLoading)
|
||||
EventManager.Remove(EventId.BlockInput, PanelManager, OnBlockInput)
|
||||
EventManager.Remove(EventId.TemporaryBlockInput, PanelManager, OnTemporaryBlockInput)
|
||||
EventManager.Remove("ReEnterLogin", PanelManager, PanelManager.OnConfirmBackToLogIn)
|
||||
EventManager.Remove("OnSdkLogout", PanelManager, PanelManager.OnConfirmBackToLogIn)
|
||||
EventManager.Remove(EventId.MarkFullRectWH, PanelManager, OnMarkCurCanvasFullRectWH)
|
||||
EventManager.Remove("ClearRequiredLua", PanelManager, OnClearRequiredLua)
|
||||
end
|
||||
local AddEventCallback = function()
|
||||
EventManager.Add(EventId.CSLuaManagerShutdown, PanelManager, OnCSLuaManagerShutdown)
|
||||
EventManager.Add(EventId.OpenPanel, PanelManager, OnOpenPanel)
|
||||
EventManager.Add(EventId.ClosePanel, PanelManager, OnClosePanel)
|
||||
EventManager.Add(EventId.CloesCurPanel, PanelManager, OnCloseCurPanel)
|
||||
EventManager.Add(EventId.OpenLoading, PanelManager, OnOpenLoading)
|
||||
EventManager.Add(EventId.BlockInput, PanelManager, OnBlockInput)
|
||||
EventManager.Add(EventId.TemporaryBlockInput, PanelManager, OnTemporaryBlockInput)
|
||||
EventManager.Add("ReEnterLogin", PanelManager, PanelManager.OnConfirmBackToLogIn)
|
||||
EventManager.Add("OnSdkLogout", PanelManager, PanelManager.OnConfirmBackToLogIn)
|
||||
EventManager.Add(EventId.MarkFullRectWH, PanelManager, OnMarkCurCanvasFullRectWH)
|
||||
EventManager.Add("ClearRequiredLua", PanelManager, OnClearRequiredLua)
|
||||
end
|
||||
local InitGuidePanel = function()
|
||||
if AVG_EDITOR == true then
|
||||
return
|
||||
end
|
||||
local GuidePanel = require("Game.UI.Guide.GuidePanel")
|
||||
local objGuidePanel = GuidePanel.new(AllEnum.UI_SORTING_ORDER.Guide, PanelId.Guide, {})
|
||||
objGuidePanel:_PreEnter()
|
||||
objGuidePanel:_Enter()
|
||||
end
|
||||
local InitTransitionPanel = function()
|
||||
local TransitionPanel = require("Game.UI.TransitionEx.TransitionPanel")
|
||||
objTransitionPanel = TransitionPanel.new(AllEnum.UI_SORTING_ORDER.Transition, PanelId.Transition, {})
|
||||
objTransitionPanel:_PreEnter()
|
||||
objTransitionPanel:_Enter()
|
||||
end
|
||||
local CreateCBTTips = function()
|
||||
if EXE_EDITOR == true then
|
||||
return
|
||||
end
|
||||
local GameResourceLoader = require("Game.Common.Resource.GameResourceLoader")
|
||||
local ResType = GameResourceLoader.ResType
|
||||
local prefab = GameResourceLoader.LoadAsset(ResType.Any, Settings.AB_ROOT_PATH .. "UI/CBT_Tips/CBT_TipsPanel.prefab", typeof(Object), "UI", -999)
|
||||
local trParent = PanelManager.GetUIRoot(AllEnum.SortingLayerName.UI_Top)
|
||||
local goPrefabInstance = instantiate(prefab, trParent)
|
||||
goPrefabInstance.name = prefab.name
|
||||
goPrefabInstance.transform:SetAsLastSibling()
|
||||
local _canvasCBTTips = goPrefabInstance:GetComponent("Canvas")
|
||||
NovaAPI.SetCanvasWorldCamera(_canvasCBTTips, CS.GameCameraStackManager.Instance.uiCamera)
|
||||
end
|
||||
local CreatePlayerInfoTips = function()
|
||||
if EXE_EDITOR == true then
|
||||
return
|
||||
end
|
||||
local PlayerInfoPanel = require("Game.UI.PlayerInfo.PlayerInfoPanel")
|
||||
objPlayerInfoPanel = PlayerInfoPanel.new(AllEnum.UI_SORTING_ORDER.Player_Info, PanelId.PlayerInfo, {})
|
||||
objPlayerInfoPanel:_PreEnter()
|
||||
objPlayerInfoPanel:_Enter()
|
||||
end
|
||||
function PanelManager.Init()
|
||||
local goUIRoot = GameObject.Find("==== UI ROOT ====")
|
||||
if goUIRoot ~= nil then
|
||||
mapUIRootTransform = {}
|
||||
mapUIRootTransform[0] = goUIRoot.transform
|
||||
local func_CacheRootTransform = function(sSortingLayerName, sNodeName)
|
||||
local trNode = goUIRoot.transform:Find(sNodeName)
|
||||
mapUIRootTransform[sSortingLayerName] = trNode
|
||||
end
|
||||
func_CacheRootTransform(AllEnum.SortingLayerName.HUD, "---- HUD ----")
|
||||
func_CacheRootTransform(AllEnum.SortingLayerName.UI, "---- UI ----")
|
||||
func_CacheRootTransform(AllEnum.SortingLayerName.UI_Top, "---- UI TOP ----")
|
||||
func_CacheRootTransform(AllEnum.SortingLayerName.UI_Video, "---- UI Video ----")
|
||||
func_CacheRootTransform(AllEnum.SortingLayerName.Overlay, "---- UI OVERLAY ----")
|
||||
trSnapshotParent = mapUIRootTransform[0]:Find("---- UI ----/Snapshot")
|
||||
tbTemplateSnapshot = {}
|
||||
tbTemplateSnapshot[1] = trSnapshotParent:GetChild(0).gameObject
|
||||
tbTemplateSnapshot[2] = trSnapshotParent:GetChild(1).gameObject
|
||||
tbTemplateSnapshot[3] = trSnapshotParent:GetChild(2).gameObject
|
||||
tbTemplateSnapshot[4] = trSnapshotParent:GetChild(3).gameObject
|
||||
OnMarkCurCanvasFullRectWH()
|
||||
end
|
||||
objCurPanel = nil
|
||||
objNextPanel = nil
|
||||
tbBackHistory = {}
|
||||
tbDisposablePanel = {}
|
||||
mapDefinePanel = require("GameCore.UI.PanelDefine")
|
||||
AddEventCallback()
|
||||
InitGuidePanel()
|
||||
InitTransitionPanel()
|
||||
local goBootstrapUI = GameObject.Find("==== Builtin UI ====/BootstrapUI")
|
||||
GameObject.Destroy(goBootstrapUI)
|
||||
local goLaunchUI = GameObject.Find("==== Builtin UI ====/LaunchUI")
|
||||
NovaAPI.CloseLaunchLoading(goLaunchUI)
|
||||
CreatePlayerInfoTips()
|
||||
end
|
||||
function PanelManager.GetUIRoot(sSortingLayerName)
|
||||
if sSortingLayerName == nil then
|
||||
sSortingLayerName = 0
|
||||
end
|
||||
return mapUIRootTransform[sSortingLayerName]
|
||||
end
|
||||
function PanelManager.Home()
|
||||
local nBackToIdx = 1
|
||||
for nIndex, objPanel in ipairs(tbBackHistory) do
|
||||
if objPanel._nPanelId == PanelId.MainMenu then
|
||||
nBackToIdx = nIndex
|
||||
break
|
||||
end
|
||||
end
|
||||
DoBackToTarget(nBackToIdx)
|
||||
end
|
||||
function PanelManager.OnConfirmBackToLogIn()
|
||||
if objCurPanel == nil then
|
||||
return
|
||||
end
|
||||
if objCurPanel._bAddToBackHistory ~= true then
|
||||
objCurPanel:_PreExit()
|
||||
objCurPanel:_Exit()
|
||||
objCurPanel:_Destroy()
|
||||
objCurPanel = nil
|
||||
end
|
||||
local nCount = #tbBackHistory
|
||||
for i = nCount, 1, -1 do
|
||||
local objPanel = tbBackHistory[i]
|
||||
objPanel:_PreExit()
|
||||
objPanel:_Exit()
|
||||
objPanel:_Destroy()
|
||||
table.remove(tbBackHistory, i)
|
||||
RemoveTbSnapShot(objPanel._nPanelId)
|
||||
if objCurPanel ~= nil and objCurPanel == objPanel then
|
||||
objCurPanel = nil
|
||||
end
|
||||
objPanel = nil
|
||||
end
|
||||
PlayerData.UnInit()
|
||||
PlayerData.Init()
|
||||
NovaAPI.ExitGame()
|
||||
end
|
||||
function PanelManager.Release()
|
||||
if type(tbBackHistory) == "table" then
|
||||
for i, objPanel in ipairs(tbBackHistory) do
|
||||
objPanel:_Release()
|
||||
end
|
||||
end
|
||||
end
|
||||
function PanelManager.GetCurPanelId()
|
||||
if objCurPanel ~= nil then
|
||||
return objCurPanel._nPanelId
|
||||
end
|
||||
return 0
|
||||
end
|
||||
function PanelManager.GetDisposablePanelState(nPanelId)
|
||||
for i, v in ipairs(tbDisposablePanel) do
|
||||
if v._nPanelId == nPanelId then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
function PanelManager.CheckPanelOpen(nPanelId)
|
||||
if type(tbBackHistory) == "table" then
|
||||
for i, objPanel in ipairs(tbBackHistory) do
|
||||
if objPanel._nPanelId == nPanelId then
|
||||
return true, objPanel._bIsActive
|
||||
end
|
||||
end
|
||||
end
|
||||
if type(tbDisposablePanel) == "table" then
|
||||
for i, v in ipairs(tbDisposablePanel) do
|
||||
if v._nPanelId == nPanelId then
|
||||
return true, v._bIsActive
|
||||
end
|
||||
end
|
||||
end
|
||||
return false, false
|
||||
end
|
||||
function PanelManager.CheckNextPanelOpening()
|
||||
return objNextPanel ~= nil
|
||||
end
|
||||
function PanelManager.SetMainViewSkipAnimIn(bIn)
|
||||
bMainViewSkipAnimIn = bIn
|
||||
end
|
||||
function PanelManager.GetMainViewSkipAnimIn()
|
||||
return bMainViewSkipAnimIn
|
||||
end
|
||||
function PanelManager.InputEnable(bAudioStop, bDisActiveUICombat)
|
||||
print("PanelManager.InputEnable")
|
||||
local resume = function()
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
NovaAPI.InputEnable()
|
||||
AdventureModuleHelper.ResumeLogic()
|
||||
if bAudioStop then
|
||||
WwiseAudioMgr:PostEvent("char_common_all_stop")
|
||||
WwiseAudioMgr:PostEvent("mon_common_all_stop")
|
||||
else
|
||||
WwiseAudioMgr:PostEvent("char_common_all_resume")
|
||||
WwiseAudioMgr:PostEvent("mon_common_all_resume")
|
||||
end
|
||||
if not bDisActiveUICombat then
|
||||
WwiseAudioMgr:PostEvent("ui_loading_combatSFX_active", nil, false)
|
||||
end
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
nInputRC = nInputRC - 1
|
||||
if nInputRC == 0 then
|
||||
resume()
|
||||
end
|
||||
if nInputRC < 0 then
|
||||
nInputRC = 0
|
||||
printError("InputEnable与InputDisable使用不匹配,请成对使用")
|
||||
resume()
|
||||
end
|
||||
end
|
||||
function PanelManager.InputDisable()
|
||||
print("PanelManager.InputDisable")
|
||||
if nInputRC == 0 then
|
||||
NovaAPI.InputDisable()
|
||||
AdventureModuleHelper.PauseLogic()
|
||||
WwiseAudioMgr:PostEvent("ui_loading_combatSFX_mute", nil, false)
|
||||
WwiseAudioMgr:PostEvent("char_common_all_pause")
|
||||
WwiseAudioMgr:PostEvent("mon_common_all_pause")
|
||||
end
|
||||
nInputRC = nInputRC + 1
|
||||
end
|
||||
function PanelManager.ClearInputState()
|
||||
nInputRC = 0
|
||||
end
|
||||
local goDiscSkillActive, goSelect1, goSelect2, goSelect3, goDashboard, trSupportRole, trMainRole, trSkillHint, trJoystick, goTransition, goPlayerInfo
|
||||
function PanelManager.SwitchUI()
|
||||
if mapUIRootTransform == nil then
|
||||
return
|
||||
end
|
||||
local trUIRoot
|
||||
trUIRoot = mapUIRootTransform[AllEnum.SortingLayerName.UI]
|
||||
if trUIRoot ~= nil then
|
||||
if goDiscSkillActive == nil or goDiscSkillActive ~= nil and goDiscSkillActive:IsNull() == true then
|
||||
goDiscSkillActive = trUIRoot:Find("DiscSkillActivePanel")
|
||||
if goDiscSkillActive ~= nil and goDiscSkillActive:IsNull() == false then
|
||||
goDiscSkillActive:SetParent(mapUIRootTransform[0])
|
||||
end
|
||||
end
|
||||
if goSelect1 == nil or goSelect1 ~= nil and goSelect1:IsNull() == true then
|
||||
goSelect1 = trUIRoot:Find("FateCardSelectPanel")
|
||||
if goSelect1 ~= nil and goSelect1:IsNull() == false then
|
||||
goSelect1:SetParent(mapUIRootTransform[0])
|
||||
end
|
||||
end
|
||||
if goSelect2 == nil or goSelect2 ~= nil and goSelect2:IsNull() == true then
|
||||
goSelect2 = trUIRoot:Find("NoteSelectPanel")
|
||||
if goSelect2 ~= nil and goSelect2:IsNull() == false then
|
||||
goSelect2:SetParent(mapUIRootTransform[0])
|
||||
end
|
||||
end
|
||||
if goSelect3 == nil or goSelect3 ~= nil and goSelect3:IsNull() == true then
|
||||
goSelect3 = trUIRoot:Find("PotentialSelectPanel")
|
||||
if goSelect3 ~= nil and goSelect3:IsNull() == false then
|
||||
goSelect3:SetParent(mapUIRootTransform[0])
|
||||
end
|
||||
end
|
||||
if goDashboard == nil or goDashboard ~= nil and goDashboard:IsNull() == true then
|
||||
goDashboard = trUIRoot:Find("BattleDashboard")
|
||||
if goDashboard ~= nil and goDashboard:IsNull() == false then
|
||||
goDashboard:SetParent(mapUIRootTransform[0])
|
||||
trSupportRole = goDashboard:Find("--safe_area--/--support_role--")
|
||||
trMainRole = goDashboard:Find("--safe_area--/--main_role--")
|
||||
trSkillHint = goDashboard:Find("--safe_area--/--skill_hint--")
|
||||
trJoystick = goDashboard:Find("--safe_area--/--joystick--")
|
||||
end
|
||||
end
|
||||
if 0 < trUIRoot.localScale.x then
|
||||
trUIRoot.localScale = Vector3.zero
|
||||
trJoystick.localScale = Vector3.zero
|
||||
else
|
||||
trUIRoot.localScale = Vector3.one
|
||||
trJoystick.localScale = Vector3.one
|
||||
end
|
||||
end
|
||||
trUIRoot = mapUIRootTransform[AllEnum.SortingLayerName.UI_Top]
|
||||
if trUIRoot ~= nil then
|
||||
if goTransition == nil or goTransition ~= nil and goTransition:IsNull() == true then
|
||||
goTransition = trUIRoot:Find("TransitionPanel")
|
||||
if goTransition ~= nil and goTransition:IsNull() == false then
|
||||
goTransition:SetParent(mapUIRootTransform[0])
|
||||
end
|
||||
end
|
||||
if 0 < trUIRoot.localScale.x then
|
||||
trUIRoot.localScale = Vector3.zero
|
||||
else
|
||||
trUIRoot.localScale = Vector3.one
|
||||
end
|
||||
end
|
||||
trUIRoot = mapUIRootTransform[AllEnum.SortingLayerName.Overlay]
|
||||
if trUIRoot ~= nil then
|
||||
if goPlayerInfo == nil or goPlayerInfo ~= nil and goPlayerInfo:IsNull() == true then
|
||||
goPlayerInfo = trUIRoot:Find("PlayerInfoPanel/----AdaptedArea----")
|
||||
end
|
||||
if 0 < goPlayerInfo.localScale.x then
|
||||
goPlayerInfo.localScale = Vector3.zero
|
||||
else
|
||||
goPlayerInfo.localScale = Vector3.one
|
||||
end
|
||||
end
|
||||
end
|
||||
function PanelManager.SwitchSkillBtn()
|
||||
if mapUIRootTransform == nil then
|
||||
return
|
||||
end
|
||||
if goDashboard == nil or goDashboard ~= nil and goDashboard:IsNull() == true then
|
||||
local trUIRoot = mapUIRootTransform[AllEnum.SortingLayerName.UI]
|
||||
goDashboard = trUIRoot:Find("BattleDashboard")
|
||||
if goDashboard ~= nil and goDashboard:IsNull() == false then
|
||||
goDashboard:SetParent(mapUIRootTransform[0])
|
||||
trSupportRole = goDashboard:Find("--safe_area--/--support_role--")
|
||||
trMainRole = goDashboard:Find("--safe_area--/--main_role--")
|
||||
trSkillHint = goDashboard:Find("--safe_area--/--skill_hint--")
|
||||
trJoystick = goDashboard:Find("--safe_area--/--joystick--")
|
||||
end
|
||||
end
|
||||
if 0 < trSupportRole.localScale.x then
|
||||
trSupportRole.localScale = Vector3.zero
|
||||
trMainRole.localScale = Vector3.zero
|
||||
trSkillHint.localScale = Vector3.zero
|
||||
else
|
||||
trSupportRole.localScale = Vector3.one
|
||||
trMainRole.localScale = Vector3.one
|
||||
trSkillHint.localScale = Vector3.one
|
||||
end
|
||||
end
|
||||
function PanelManager.CloseAllDisposablePanel()
|
||||
if type(tbDisposablePanel) == "table" then
|
||||
local n = #tbDisposablePanel
|
||||
for i = n, 1, -1 do
|
||||
local objTempPanel = tbDisposablePanel[i]
|
||||
objTempPanel:_PreExit()
|
||||
objTempPanel:_Exit()
|
||||
objTempPanel:_Destroy()
|
||||
objTempPanel = nil
|
||||
table.remove(tbDisposablePanel, i)
|
||||
end
|
||||
if 0 < n then
|
||||
printLog("[界面切换] 同时关闭所有非主 Panel 界面")
|
||||
end
|
||||
end
|
||||
end
|
||||
function PanelManager.CheckInTransition()
|
||||
if objTransitionPanel ~= nil then
|
||||
local nStatus = objTransitionPanel:GetTransitionStatus()
|
||||
if nStatus ~= AllEnum.TransitionStatus.OutAnimDone then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
return PanelManager
|
||||
Reference in New Issue
Block a user