--[[ Tips: 1. open default toast img require("CommonUtils/Toast/Toast.lua").ToastInfo() 2. open specified toast img local szPath = "CommonUtils/Textures/Toast/prompt.png" require("CommonUtils/Toast/Toast.lua").ToastInfo(szPath) ]] local DemoToast = {} local function OnClickBtnShowToast() print("----> DemoToast.OnClickBtnShowToast") local szPath = "CommonUtils/Textures/Toast/prompt.png" require("CommonUtils/Toast/Toast.lua").ToastInfo(szPath) end local function OnClickBtnExit() require("Base/UIHelper.lua"):SwitchUI("CommonUtils/DemoLuaScripts/DemoAll.lua", "CommonUtils/DemoLuaScripts/DemoToast.lua") end local function RegisterTouchEvent() local uiHelper = require("Base/UIHelper.lua") local rootPanel = DemoToast.rootPanel uiHelper:AddClickEvent(rootPanel, "Btn_ShowToast", OnClickBtnShowToast) uiHelper:AddClickEvent(rootPanel, "Btn_Exit", OnClickBtnExit) end function DemoToast.Awake(luaRoot) DemoToast.luaRoot = luaRoot local canvas = CS.UnityEngine.GameObject.Find('Canvas') DemoToast._rootCanvas = canvas local prefabTest = LoadResource('CommonUtils/Prefabs/Demo/ZDemoToastPanel.prefab') local rootPanel = CS.UnityEngine.GameObject.Instantiate(prefabTest, canvas.transform) DemoToast.rootPanel = rootPanel end function DemoToast.Start() RegisterTouchEvent() end function DemoToast.OnDestroy() CS.UnityEngine.GameObject.Destroy(DemoToast.rootPanel) end return DemoToast