void Update() { if (_loadassets != null) { _loadassets.timeEvent(); } if (Input.GetKey(KeyCode.Backspace)) { IsShow = !IsShow; } m_FrameCount = m_FrameCount + 1; timePassed = timePassed + Time.deltaTime; if (timePassed > fpsMeasuringDelta) { m_FPS = m_FrameCount / timePassed; timePassed = 0.0f; m_FrameCount = 0; } if (initialize) { LuaManager.CallFunction("main_game.timeEvent"); } }
private void FixedUpdate() { RaycastHit hitInfo; Physics.SphereCast(transform.position, m_CharacterController.radius, Vector3.down, out hitInfo, m_CharacterController.height / 2f, Physics.AllLayers, QueryTriggerInteraction.Ignore); LuaManager.CallFunction("FirstPersonController.FixedUpdate", hitInfo); }
/// <summary> /// 执行Lua方法 /// </summary> public static object[] CallMethod(string module, string func, params object[] args) { LuaManager luaMgr = AppFacade.Instance.GetManager <LuaManager>(ManagerName.Lua); if (luaMgr == null) { return(null); } return(luaMgr.CallFunction(module + "." + func, args)); }
/// <summary> /// 调用lua全局函数 /// </summary> /// <param name="func"></param> /// <param name="args"></param> /// <returns></returns> public static object[] CallGlobalLuaFunction(string func, params object[] args) { LuaManager luaMgr = AppFacade.LuaManager; if (luaMgr == null) { return(null); } return(luaMgr.CallFunction(func, args)); }
void Init() { LuaManager.DoFile("Controller/GameCtrl"); LuaManager.CallFunction("GameCtrl.New"); if (Application.isMobilePlatform) { LuaManager.CallFunction("GameCtrl.Awake", true); } else { LuaManager.CallFunction("GameCtrl.Awake", false); } }
public static object[] CallMethod(string module, string func, params object[] args) { LuaManager manager = AppFacade.Instance.GetManager <LuaManager>("LuaManager"); if (manager == null) { return(null); } StringBuilder stringBuilder = StringBuilderCache.Acquire(256); stringBuilder.AppendFormat("{0}.{1}", module, func); return(manager.CallFunction(StringBuilderCache.GetStringAndRelease(stringBuilder), args)); }
// Use this for initialization private void Start() { m_CharacterController = GetComponent <CharacterController>(); LuaManager.DoFile("Controller/FirstPersonController"); if (Application.isMobilePlatform) { LuaManager.CallFunction("GameCtrl.New", true); } else { LuaManager.CallFunction("GameCtrl.New", false); } LuaManager.CallFunction("FirstPersonController.Start", gameObject); }
static int CallFunction(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); LuaFramework.LuaManager obj = (LuaFramework.LuaManager)ToLua.CheckObject(L, 1, typeof(LuaFramework.LuaManager)); string arg0 = ToLua.CheckString(L, 2); object[] arg1 = ToLua.ToParamsObject(L, 3, count - 2); object[] o = obj.CallFunction(arg0, arg1); ToLua.Push(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
private void Update() { #if UNITY_STANDALONE_WIN if (Input.GetKeyDown(KeyCode.Escape)) { LuaManager luaMgr = AppFacade.Instance.GetManager <LuaManager>(); if (luaMgr == null) { return; } luaMgr.CallFunction("EscapeKeyDown"); } if (Input.GetKey(KeyCode.LeftShift) && Input.GetKeyDown(KeyCode.R)) { #if !UNITY_EDITOR ReStart(); #endif } #endif }
/// <summary> /// 播放指定的过场动画 /// </summary> /// <param name="cutsceneId"></param> /// <returns></returns> private IEnumerator playCutscene(int cutsceneId) { yield return(this.StartCoroutine(loadCutsceneAsync(cutsceneId))); if (curCutscene == null) { yield break; } curCutscene.CutscenePlayed += playCutsceneEvent; curCutscene.Play(); LuaManager.CallFunction("EventManager.SendEvent", "onPlayCutscene", cutsceneId); if (!curCutscene.IsLooping) { this.AddTriggerLog(cutsceneId); //添加记录 } }
public void PlayCutscene(Cutscene cutscene) { if (cutscene == null) { Debug.LogError("并没有预加载的剧情片段!"); return; } cutscene.gameObject.SetActive(true); int cutsceneId = Convert.ToInt32(cutscene.gameObject.name.Substring(8)); cutscene.Play(); curCutscene = cutscene; LuaManager.CallFunction("EventManager.SendEvent", "onPlayCutscene", cutsceneId); if (!cutscene.IsLooping) { this.AddTriggerLog(cutsceneId); //添加记录 } playCutsceneEvent(cutscene, null); }
public void openLogin() { LuaManager.DoFile("View.lua"); LuaManager.CallFunction("View:start"); }
// Update is called once per frame void Update() { LuaManager.CallFunction("GameCtrl.Update"); }
private void Update() { LuaManager.CallFunction("FirstPersonController.Update", m_CharacterController); }