| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- 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(szParent, tips, confirmFunction)
- local canvas = CS.UnityEngine.GameObject.Find("Canvas")
- local dialogOK = canvas.transform:Find("ZUIDialogOKPanel")
- local uiControllerPath = "UI/Public/ZUIPanelDialogOK.lua"
- if dialogOK then
- require("Base/UIHelper.lua"):CloseUI(uiControllerPath)
- end
- require(uiControllerPath).szParent = szParent
- require("Base/UIHelper.lua"):OpenUI(uiControllerPath)
- require(uiControllerPath).SetInfo(tips, confirmFunction)
- end
- function ShowDialogConfirm(szParent, tips, confirmFunction, cancelFunction)
- local canvas = CS.UnityEngine.GameObject.Find("Canvas")
- local dialogConfirm = canvas.transform:Find("ZUIDialogConfirmPanel")
- local uiControllerPath = "UI/Public/ZUIPanelDialogConfirm.lua"
- if dialogConfirm then
- require("Base/UIHelper.lua"):CloseUI(uiControllerPath)
- end
- require(uiControllerPath).szParent = szParent
- 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
|