GlobalFunctions = GlobalFunctions or {} function ShowNotice(info) local uiControllerPath = "UI/Public/ZUITextNotice.lua" require("Base/UIHelper.lua"):OpenUI(uiControllerPath) require(uiControllerPath).NoticeInfo(info) end function ShowDialogOK(tips) local uiControllerPath = "UI/Public/ZUIPanelDialogOK.lua" require("Base/UIHelper.lua"):OpenUI(uiControllerPath) require(uiControllerPath).SetInfo(tips) end function ShowDialogConfirm(tips, confirmFunction, cancelFunction) local uiControllerPath = "UI/Public/ZUIPanelDialogConfirm.lua" require("Base/UIHelper.lua"):OpenUI(uiControllerPath) require(uiControllerPath).SetInfo(tips, confirmFunction, cancelFunction) end function Debug(...) CS.UnityEngine.Debug.Log(...) end function Debugf(format, ...) CS.UnityEngine.Debug.Log(string.format(format, ...)) end function Warn(...) CS.UnityEngine.Debug.LogWarning(...) end function Warnf(format, ...) CS.UnityEngine.Debug.LogWarning(string.format(format, ...)) end function LoadResource(resPath) --Warnf("---- ----> isEditor: %s Path: %s", tostring(CS.UnityEngine.Application.isEditor), resPath) if CS.UnityEngine.Application.isEditor == true then return CS.SFramework.SResourceManagerE.LoadResource(resPath) else return CS.SFramework.SResourceManagerR.LoadResource(resPath) end end function GetCache(key, value) local dataRelay = require("Base/DataRelay.lua") local cache = dataRelay:GetCache(dataRelay.KEY_TYPE[key], value) return cache end function SetCache(key, value) local dataRelay = require("Base/DataRelay.lua") dataRelay:SetCache(dataRelay.KEY_TYPE[key], value) end function PrintTable(tab, csp) local szTabel = require("Base/Utils.lua"):Table2String(tab, csp) print(szTabel) end local function __TRACKBACK__(szErrorMsg) local szTrackText = debug.traceback(tostring(szErrorMsg), 6); print("---------------------------------------- TRACKBACK ----------------------------------------"); print(szTrackText, "LUA ERROR"); print("---------------------------------------- TRACKBACK ----------------------------------------"); local szExceptionText = "LUA EXCEPTION\n" .. szTrackText; --[[Error("---------------------------------------- TRACKBACK ----------------------------------------"); Error(szTrackText .. " LUA ERROR"); Error("---------------------------------------- TRACKBACK ----------------------------------------"); Error(szExceptionText)]] CS.UnityEngine.Debug.LogWarning(szExceptionText) return false; end function SafeCall(fnFunc, ...) local tArgs = { ... }; return xpcall(function() return fnFunc(table.unpack(tArgs)) end, __TRACKBACK__); end