public void OnInitJSEngine(bool bSuccess) { if (bSuccess) { if (InitLoadScripts != null) { for (var i = 0; i < InitLoadScripts.Length; i++) { JSMgr.evaluate(InitLoadScripts[i]); } } if (JSApi.initErrorHandler() == 1) { Debug.Log("JS: print error stack: YES"); } else { Debug.Log("JS: print error stack: NO"); } initSuccess = true; Debug.Log("JS: Init JSEngine OK"); } else { initFail = true; Debug.Log("JS: Init JSEngine FAIL"); } }
public void OnInitJSEngine(bool bSuccess) { /* * Debugging is only available in desktop platform * */ mDebug = debug && UseJSC; if (bSuccess) { if (InitLoadScripts != null) { for (var i = 0; i < InitLoadScripts.Length; i++) { JSMgr.evaluate(InitLoadScripts[i]); } } if (JSApi.initErrorHandler() == 1) { Debug.Log("JS: print error stack: YES"); } else { Debug.Log("JS: print error stack: NO"); } initSuccess = true; Debug.Log("JS: Init JSEngine OK"); if (mDebug) { Debug.Log("JS: Enable Debugger"); JSApi.enableDebugger(new string[] { JSPathSettings.jsDir }, 1, port); } //获取Manual/UnityEngine_MonoBehaviour下定义的jsb_UpdateJsCom全局方法 idUpdateEvent = JSApi.getObjFunction(0, "jsb_UpdateJsCom"); if (idUpdateEvent <= 0) { Debug.LogError("Can not find JsFunction[jsb_UpdateJsCom]"); } idLateUpdateEvent = JSApi.getObjFunction(0, "jsb_LateUpdateJsCom"); if (idLateUpdateEvent <= 0) { Debug.LogError("Can not find JsFunction[jsb_LateUpdateJsCom]"); } idFixedUpdateEvent = JSApi.getObjFunction(0, "jsb_FixedUpdateJsCom"); if (idFixedUpdateEvent <= 0) { Debug.LogError("Can not find JsFunction[jsb_FixedUpdateJsCom]"); } } else { initFail = true; Debug.Log("JS: Init JSEngine FAIL"); } }
public void OnInitJSEngine(bool bSuccess) { /* * Debugging is only available in desktop platform * */ mDebug = debug && JSC; if (bSuccess) { if (InitLoadScripts != null) { for (var i = 0; i < InitLoadScripts.Length; i++) { // JSMgr.ExecuteFile(InitLoadScripts[i]); JSMgr.evaluate(InitLoadScripts[i]); } } if (JSApi.initErrorHandler() == 1) { Debug.Log("JS: print error stack: YES"); } else { Debug.Log("JS: print error stack: NO"); } initSuccess = true; Debug.Log("JS: Init JSEngine OK"); if (mDebug) { Debug.Log("JS: Enable Debugger"); JSApi.enableDebugger(new string[] { JSBindingSettings.jsDir }, 1, port); } } else { initFail = true; Debug.Log("JS: Init JSEngine FAIL"); } }
public void OnInitJSEngine(bool bSuccess) { if (bSuccess) { System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch(); sw.Start(); { JSMgr.evaluate("Includes"); } sw.Stop(); print(string.Format("JS: Init OK. Loading js cost {0} ms. Enable printing error stack: {1}.", sw.ElapsedMilliseconds, (JSApi.initErrorHandler() == 1 ? "Yes" : "No"))); initSuccess = true; } else { initFail = true; Debug.LogError("JS: Init failed."); } }