Files
JJBB/Assets/Project/Script/LuaScripts/UI/Lua/Camera/cameraBtnControl_CloseUI.txt

72 lines
2.5 KiB
Plaintext
Raw Normal View History

2024-08-23 15:49:34 +08:00
require("Util")
require("LuaUtil")
--[=[ 功能描述
在聊天框左侧增加一个按钮。点击后隐藏目前所有UI显示照相功能相关UI
]=]--
-- 照相按钮控制
cameraBtnControl_CloseUI = {}
local cameraBtn
local UI_Root = "UiRoot(Clone)"
local WorldUIRoot = "WorldUIRoot"
local BaseUIRoot = "BaseUIRoot"
local cameraPanelName = "CameraControlPanel"
function cameraBtnControl_CloseUI.Awake()
if _cameraBtn then
cameraBtn = _cameraBtn:GetComponent("Button")
cameraBtn.onClick:RemoveAllListeners()
cameraBtn.onClick:AddListener(function()
cameraBtnControl_CloseUI.HideAllUI()
end)
end
end
function cameraBtnControl_CloseUI.HideAllUI()
local UI_Root = CS.UnityEngine.GameObject.Find("UiRoot(Clone)").gameObject
local _UICamera = UI_Root.transform:Find("Camera").gameObject
_UICamera:GetComponent("Camera").cullingMask = 32
local _BaseRight = UI_Root.transform:Find("BaseUIRoot");
if _BaseRight.transform:Find("BaseRight/ActiveBtns(Clone)") ~= nil then
local _ActiveBtns = _BaseRight.transform:Find("BaseRight/ActiveBtns(Clone)").gameObject;
_ActiveBtns:SetActive(true);
end
if _BaseRight.transform:Find("BaseRight/SkillBarRoot(Clone)") ~= nil then
local _SkillBarRoot = _BaseRight.transform:Find("BaseRight/SkillBarRoot(Clone)").gameObject;
_SkillBarRoot:SetActive(true);
end
if _BaseRight.transform:Find("BaseLeft/ChatFrameRoot(Clone)") ~= nil then
local _ChatFrameRoot = _BaseRight.transform:Find("BaseLeft/ChatFrameRoot(Clone)/ChatFrameAnchor").gameObject;
_ChatFrameRoot:SetActive(true);
end
if _BaseRight.transform:Find("BaseLeft/MissionDialogAndLeftTabsRoot(Clone)") ~= nil then
local _MissionDialogAndLeftTabsRoot = _BaseRight.transform:Find("BaseLeft/MissionDialogAndLeftTabsRoot(Clone)").gameObject;
_MissionDialogAndLeftTabsRoot:GetComponent("MissionDialogAndLeftTabsLogic"):OnBtnShow()
end
if _BaseRight.transform:Find("ExtraFunTipRoot(Clone)") ~= nil then
local _ExtraFunTipRoot = _BaseRight.transform:Find("ExtraFunTipRoot(Clone)").gameObject;
_ExtraFunTipRoot:SetActive(true);
end
local WorldUIRootObj = CS.UnityEngine.GameObject.Find(WorldUIRoot)
if WorldUIRootObj.transform:Find("JoyStickRoot(Clone)") ~= nil then
local _JoyStickRoot = WorldUIRootObj.transform:Find("JoyStickRoot(Clone)").gameObject;
_JoyStickRoot:SetActive(true);
end
LuaUIMan:CloseUI(cameraPanelName)
end