4 protected int m_EnscriptHistoryRow;
5 protected int m_EnscriptHistoryRowServer;
8 protected PluginLocalEnscriptHistory m_ModuleLocalEnscriptHistory;
9 protected PluginLocalEnscriptHistoryServer m_ModuleLocalEnscriptHistoryServer;
10 protected MultilineEditBoxWidget m_EnfScriptEdit;
11 protected ButtonWidget m_EnfScriptRun;
12 protected ButtonWidget m_EnfScriptClear;
13 protected TextListboxWidget m_ScriptOutputListbox;
14 protected bool m_AllowScriptOutput;
15 protected int m_RunColor;
26 m_EnfScriptEdit = MultilineEditBoxWidget.Cast(root.FindAnyWidget(
"MultilineEditBoxWidget0"));
27 m_EnfScriptRun = ButtonWidget.Cast(root.FindAnyWidget(
"RunButton"));
38 override void OnSelected()
49 static void PrintS(
string message)
53 m_Instance.Add(message);
56 static void PrintS(
bool message)
58 PrintS(message.ToString());
61 static void PrintS(
int message)
63 PrintS(message.ToString());
66 static void PrintS(
float message)
68 PrintS(message.ToString());
71 static void PrintS(
vector message)
73 PrintS(message.ToString());
76 static void PrintS(
Object message)
78 PrintS(message.ToString());
82 void Add(
string message,
bool isReload =
false)
84 if (message !=
string.
Empty)
89 m_ScriptOutputHistory.Insert(message);
96 protected void Clear(
bool clearFile =
false)
105 protected void ReloadScriptOutput()
109 foreach (
string s: m_ScriptOutputHistory)
119 EnscriptHistoryBack();
122 void HistoryForward()
124 EnscriptHistoryForward();
127 protected void RunEnscript()
132 string codeNoReplace = code;
135 code.Replace(
"Print(",
"ScriptConsoleEnfScriptTab.PrintS(");
136 code.Replace(
"Print (",
"ScriptConsoleEnfScriptTab.PrintS(");
137 bool success =
GetGame().ExecuteEnforceScript(
"void scConsMain() \n{\n" + code +
"\n}\n",
"scConsMain");
139 ColorRunButton(success);
146 protected void ColorRunButton(
bool success)
159 protected void ResetRunButtonColor()
164 protected void RunEnscriptServer()
174 protected void EnscriptHistoryBack()
181 if (history_index > -1)
190 protected void EnscriptHistoryForward()
207 super.OnRPCEx(rpc_type, ctx);
208 #ifdef DIAG_DEVELOPER
211 case ERPCs.DEV_RPC_SERVER_SCRIPT_RESULT:
223 override bool OnClick(
Widget w,
int x,
int y,
int button)
225 super.OnClick(w,
x,
y,button);
234 m_ScriptOutputHistory.Clear();
241 override bool OnChange(
Widget w,
int x,
int y,
bool finished)
243 super.OnChange(w,
x,
y, finished);
250 if (!show && (selectedHandler.Type() ==
ScriptConsoleEnfScriptTab || selectedHandler.Type() == ScriptConsoleEnfScriptServerTab))
283 if (history_index > -1)
317 m_ScriptOutputHistory.Clear();