protected override Variable Evaluate(ParsingScript script) { string res = "OK"; List <Variable> args = script.GetFunctionArgs(); if (m_start) { int port = Utils.GetSafeInt(args, 0, 13337); res = DebuggerServer.StartServer(port); } else { DebuggerServer.StopServer(); } return(new Variable(res)); }
public static async Task<Variable> Execute(ParsingScript script) { char[] toArray = Constants.END_PARSE_ARRAY; Variable result = null; Exception exception = null; #if UNITY_EDITOR || UNITY_STANDALONE || MAIN_THREAD_CHECK // Do nothing: already on the main thread #elif __ANDROID__ scripting.Droid.MainActivity.TheView.RunOnUiThread(() => { #elif __IOS__ scripting.iOS.AppDelegate.GetCurrentController().InvokeOnMainThread(() => { #else #endif try { #if __IOS__ || __ANDROID__ result = script.Execute(toArray); #else result = await script.ExecuteAsync(toArray); #endif } catch (ParsingException exc) { exception = exc; } #if UNITY_EDITOR || UNITY_STANDALONE || MAIN_THREAD_CHECK // Do nothing: already on the main thread or main thread is not required #elif __ANDROID__ || __IOS__ }); #endif if (exception != null) { throw exception; } if (result.Type == Variable.VarType.QUIT) { DebuggerServer.StopServer(); } return result; } }
protected override Variable Evaluate(ParsingScript script) { string res = "OK"; List<Variable> args = script.GetFunctionArgs(); if (m_start) { int port = Utils.GetSafeInt(args, 0, 13337); bool allowRemote = Utils.GetSafeInt(args, 1, 0) == 1; DebuggerServer.AllowedClients = Utils.GetSafeString(args, 2); res = DebuggerServer.StartServer(port, allowRemote); } else { DebuggerServer.StopServer(); } return new Variable(res); }