local SUITeachPanel = {} local function OnClickButtonTeach() print("SUITeachPanel.OnClickButtonTeach") local rootPanel = SUITeachPanel.rootPanel local panelVideo = rootPanel.transform:Find("Panel_Video").gameObject local panelQuit = SUITeachPanel.rootPanel.transform:Find("Panel_Quit").gameObject panelQuit:SetActive(false) panelVideo:SetActive(true) end local function OnClickButtonGameType(nSelectGameType) print("SUITeachPanel.OnClickButtonGameType, nSelectGameType:", nSelectGameType) local dataRelay = require("Base/DataRelay.lua") dataRelay:SetCache(dataRelay.KEY_TYPE.GAME_TYPE, nSelectGameType) local SUIAlignPanel = require("UI/SUIAlignPanel.lua") SUIAlignPanel.SetRootPanelActive(true) SUITeachPanel.SetRootPanelActive(false) -- require("Base/UIHelper.lua"):SwitchUI("UI/SUIAlignPanel.lua", "UI/SUITeachPanel.lua") end local function OnClickButtonLearnOk() print("SUITeachPanel.OnClickButtonLearnOk") local rootPanel = SUITeachPanel.rootPanel local panelVideo = rootPanel.transform:Find("Panel_Video").gameObject local panelQuit = SUITeachPanel.rootPanel.transform:Find("Panel_Quit").gameObject panelQuit:SetActive(true) panelVideo:SetActive(false) end local function RegisterButtonQuit() print("SUITeachPanel.RegisterButtonQuit") local panelQuit = SUITeachPanel.rootPanel.transform:Find("Panel_Quit").gameObject require("Base/UIHelper.lua"):RegisterButtonQuit(panelQuit, true) end local function RegisterTouchEvent() local uiHelper = require("Base/UIHelper.lua") local rootPanel = SUITeachPanel.rootPanel local configLinkGame = require("Config/SConfigManager.lua"):GetConfig("configLinkGame") uiHelper:AddClickEvent(rootPanel, "Panel_Video/Button_Learn_OK", OnClickButtonLearnOk) uiHelper:AddClickEvent(rootPanel, "Button_Easy", function () OnClickButtonGameType(configLinkGame.gameType.easy) end) uiHelper:AddClickEvent(rootPanel, "Button_Normal", function () OnClickButtonGameType(configLinkGame.gameType.normal) end) uiHelper:AddClickEvent(rootPanel, "Button_Hard", function () OnClickButtonGameType(configLinkGame.gameType.hard) end) uiHelper:AddClickEvent(rootPanel, "Button_Teach", OnClickButtonTeach) end function SUITeachPanel.SetRootPanelActive(bShow) SUITeachPanel.rootPanel:SetActive(bShow) end local function SetPanelForLoadResourceActive() local panelForLoadResource = SUITeachPanel._rootCanvas.transform:Find("Panel_For_Load_Resource").gameObject local actionSequence = CS.DG.Tweening.DOTween.Sequence() actionSequence:AppendInterval(1) actionSequence:AppendCallback(function () panelForLoadResource:SetActive(false) CS.UnityEngine.GameObject.Destroy(panelForLoadResource) end) end function SUITeachPanel.Awake(luaRoot) SUITeachPanel.luaRoot = luaRoot local canvas = CS.UnityEngine.GameObject.Find("Canvas") SUITeachPanel._rootCanvas = canvas local prefabPanelTeach = LoadResource("Prefabs/UI/SUITeachPanel.prefab") local rootPanel = CS.UnityEngine.GameObject.Instantiate(prefabPanelTeach, SUITeachPanel._rootCanvas.transform) SUITeachPanel.rootPanel = rootPanel end function SUITeachPanel.Start(luaRoot) RegisterTouchEvent() RegisterButtonQuit() -- for fix endPanel first load delay SetPanelForLoadResourceActive() end function SUITeachPanel.Update() end function SUITeachPanel.OnDestroy() CS.UnityEngine.GameObject.Destroy(SUITeachPanel.rootPanel) end return SUITeachPanel