private WebJSON.Macro GetMacroJSON(BrainComponent.Macro m, bool includeScriptContents = false) { return(new WebJSON.Macro() { Offset = m.Offset, Name = m.Name, Script = GetScriptJSON(m.Script, includeScriptContents: includeScriptContents) }); }
private void ParseRequestJSON(WebJSON.Request msg) { switch (msg.Type) { case WebJSON.RequestType.Script: BaseScriptComponent s = GetScriptFromRequest(msg); if (s != null) { Send(new WebJSON.Message() { Type = WebJSON.MessageType.Script, Script = GetScriptJSON(s, true) }); } break; case WebJSON.RequestType.Comport: BrainComponent.Comport c = GetComportFromRequest(msg); if (c != null) { Send(new WebJSON.Message() { Type = WebJSON.MessageType.Comport, Comport = GetComportJSON(c, includeScriptContents: true) }); } break; case WebJSON.RequestType.Macro: BrainComponent.Macro m = GetMacroFromRequest(msg); if (m != null) { Send(new WebJSON.Message() { Type = WebJSON.MessageType.Macro, Macro = GetMacroJSON(m, includeScriptContents: true) }); } break; case WebJSON.RequestType.TransitionExport: if (selectedPerso_ != null && selectedPerso_ is PersoBehaviour) { MindComponent mc = selectedPerso_.GetComponent <MindComponent>(); if (mc != null) { try { var export = mc.TransitionExport; if (export != null) { Send(new WebJSON.Message() { Type = WebJSON.MessageType.TransitionExport, TransitionExport = export }); } } catch (Exception) { } } } break; case WebJSON.RequestType.Screenshot: TakeScreenshot(msg.Screenshot).Forget(); // Start the async task for taking a screenshot break; } }