c1_lua/lua/app/module/gm/dev_tool_manager.lua
2023-04-03 10:59:13 +08:00

91 lines
2.5 KiB
Lua

local DevToolManager = class("DevToolManager", BaseModule)
function DevToolManager:showDevListUI()
if Platform:getIsPublishChannel() then
return
end
local params = {
aniType = UIManager.ANI_TYPE.NONE,
}
UIManager:showUI("app/ui/gm/dev_tool_list_ui", params)
end
function DevToolManager:showOrHideDevListUI()
if Platform:getIsPublishChannel() then
return
end
-- local uiObj = UIManager:getUIByIndex("app/ui/gm/dev_tool_list_ui")
-- if uiObj then
-- uiObj:closeUI()
-- else
-- local params = {
-- aniType = UIManager.ANI_TYPE.NONE,
-- }
-- UIManager:showUI("app/ui/gm/dev_tool_list_ui", params)
-- end
local uiObj = UIManager:getUIByIndex(UIManager.UI_PATH.GM_TOO_UI)
if uiObj then
uiObj:closeUI()
else
UIManager:showUI(UIManager.UI_PATH.GM_TOO_UI)
end
end
function DevToolManager:showOrHideFloatingIcon()
if Platform:getIsPublishChannel() then
return
end
local showFloatingIcon = LocalData:getGMShowFloatingIcon()
if self.floatingIconObject then
if showFloatingIcon then
self.floatingIconObject:getLuaComponent("app/ui/gm/component/gm_floating_icon"):show()
else
self.floatingIconObject:getLuaComponent("app/ui/gm/component/gm_floating_icon"):hide()
end
elseif showFloatingIcon then
UIPrefabManager:loadUIWidgetAsync("assets/prefabs/ui/gm/gm_floating_window.prefab", UIManager:getMainCanvas(), function(uiObj)
if self.floatingIconObject then
uiObj:destroy()
return
end
uiObj:getComponent(GConst.TYPEOF_UNITY_CLASS.CANVAS).overrideSorting = true
uiObj:getComponent(GConst.TYPEOF_UNITY_CLASS.CANVAS).sortingOrder = 32767
self.floatingIconObject = uiObj
self.floatingIconObject:addLuaComponent("app/ui/gm/component/gm_floating_icon")
end)
end
end
function DevToolManager:showLightSetting()
if Platform:getIsPublishChannel() then
return
end
local params = {
aniType = UIManager.ANI_TYPE.NONE,
}
UIManager:showUI("app/ui/gm/light_setting_ui", params)
end
function DevToolManager:cacheDemoFightInfo(atkInfo, defInfo, useDemoFightCfg)
self.demoFightAtkInfo = atkInfo
self.demoFightDefInfo = defInfo
self.useDemoFightCfg = useDemoFightCfg
end
function DevToolManager:getCacheDemoFightInfo()
return self.demoFightAtkInfo, self.demoFightDefInfo, self.useDemoFightCfg
end
function DevToolManager:dealGM(paramsList)
self:sendMessage(ProtoMsgType.FromMsgEnum.GMReq, paramsList, {}, self.onDealGMFinish)
end
function DevToolManager:onDealGMFinish(parmas, code, result)
if code and code ~= 0 then
return
end
ModuleManager.LoginManager:goToLoginScene()
end
return DevToolManager