public void TryFixMsglist() { if (!this.useHotfix || !this.init) { return; } string name = "HotfixMsglist.lua"; byte[] array = LuaStatic.Load(name); if (array != null) { ByteReader byteReader = new ByteReader(array); this.hotmsglist = byteReader.ReadDictionary(); } }
public bool DoLuaFile(string name) { if (this.doluafiles.Contains(name) || !this.init) { return(true); } if (this.hotfixLua == null) { return(false); } if (LuaStatic.Load(name) == null) { return(false); } this.hotfixLua.lua.DoFile(name); this.doluafiles.Add(name); return(true); }
/// CG开始播放 public void OnCutsceneStarted(object sender, CutsceneEventArgs e) { Cutscene cs = sender as Cutscene; if (cs != _CurCutscene || _CurCutscene == null) { Common.HobaDebuger.LogWarningFormat("Logic Error: when call OnCutsceneStarted, another cg is playing"); return; } var useCGCamera = _CurCGGlobal.cameraType == CGGlobal.CameraType.CGCamera; if (useCGCamera) { ChangeOtherSetting(false, _CurCGGlobal.UseUICamera); if (_CurCGGlobal.WeatherId > 0) { DynamicEffectManager.Instance.EnterCGEffect(_CurCGGlobal.WeatherId, _CurCGGlobal.GetComponentsInChildren <PostProcessChain>(true)); } } { IntPtr L = LuaScriptMgr.Instance.GetL(); try { var ls = LuaScriptMgr.Instance.GetLuaState(); var oldTop = LuaDLL.lua_gettop(L); LuaDLL.lua_getglobal(L, "OnCGStart"); LuaDLL.lua_pushboolean(L, useCGCamera); if (!ls.PCall(1, 0)) { Common.HobaDebuger.LogLuaError(LuaDLL.lua_tostring(L, -1)); } LuaDLL.lua_settop(L, oldTop); } catch (Exception ex) { Debug.LogException(ex); Debug.LogError(LuaStatic.GetTraceBackInfo(L)); } } _CurCutscene.CutsceneStarted -= OnCutsceneStarted; }
static public int GetLuaReference(IntPtr L) { #if MULTI_STATE return(LuaStatic.GetMetaReference(L, type)); #else if (metaref > 0) { return(metaref); } metaref = LuaStatic.GetMetaReference(L, type); if (metaref > 0) { LuaState.Get(L).OnDestroy += () => { metaref = -1; }; } return(metaref); #endif }
public void Tick(float dt) { #if UseLuaTick IntPtr L = GetL(); if (L != IntPtr.Zero) { int oldTop = LuaDLL.lua_gettop(L); LuaDLL.lua_getglobal(L, "TickGame"); if (!LuaDLL.lua_isnil(L, -1)) { LuaDLL.lua_pushnumber(L, dt); if (LuaDLL.lua_pcall(L, 1, 0, 0) != 0) { HobaDebuger.LogLuaError(LuaDLL.lua_tostring(L, -1), LuaStatic.GetTraceBackInfo(L)); } } LuaDLL.lua_settop(L, oldTop); } #endif TickUnref(); }
private UIBase LoadUISource(EnumUIName uiName, object args) { string name = uiName.ToString(); GameObject ui = Resources.Load <GameObject>(GameConst.ResourceUrl.UI_URL + name); ui = GameObject.Instantiate(ui); ui.transform.parent = mUIRoot; ui.transform.localScale = Vector3.one; ui.transform.localPosition = Vector3.zero; ui.name = name; UIBase uiBase = ui.GetComponent <UIBase>(); if (uiBase == null) { uiBase = ui.AddComponent(LuaStatic.GetType(name)) as UIBase; } mCachedUINameList.Add(uiName); mCachedUIDict[uiName] = uiBase; uiBase.OnLoadedUI(true, args); return(uiBase); }