364{
378
380
382 {
383 super.InitializeTab(root, console, button, parent);
384
390 m_EnfScriptEdit = MultilineEditBoxWidget.Cast(root.FindAnyWidget(
"MultilineEditBoxWidget0"));
391 m_EnfScriptRun = ButtonWidget.Cast(root.FindAnyWidget(
"RunButton"));
395 }
396
398 {
400 }
401
403 {
406 {
409 }
411 }
412
413 static void PrintS(
string message)
414 {
418 }
419
420 static void PrintS(
bool message)
421 {
423 }
424
425 static void PrintS(
int message)
426 {
427 PrintS(message.ToString());
428 }
429
430 static void PrintS(
float message)
431 {
433 }
434
436 {
438 }
439
441 {
442 PrintS(message.ToString());
443 }
444
445
446 void Add(
string message,
bool isReload =
false)
447 {
448 if (message !=
string.
Empty)
449 {
451 {
452 if (!isReload)
456 }
457 }
458 }
459
460 protected void Clear(
bool clearFile =
false)
461 {
462 if(clearFile)
465 }
466
467
468
470 {
474 {
476 }
478 }
479
481 {
482
484 }
485
487 {
489 }
490
492 {
493 #ifdef DEVELOPER
494 string code;
496 string codeNoReplace = code;
499 code.
Replace(
"Print(",
"ScriptConsoleEnfScriptTab.PrintS(");
500 code.
Replace(
"Print (",
"ScriptConsoleEnfScriptTab.PrintS(");
501 bool success =
g_Game.ExecuteEnforceScript(
"void scConsMain() \n{\n" + code +
"\n}\n",
"scConsMain");
504
507 #endif
508 }
509
511 {
512 if (success)
513 {
515 }
516 else
517 {
519 }
521 }
522
524 {
526 }
527
529 {
530 string code;
536 }
537
539 {
540 int history_index;
542 {
545 if (history_index > -1)
546 {
548 }
550 }
551 }
552
553
555 {
557 {
558 int history_index;
562 {
564 }
566 }
567 }
568
570 {
571 super.OnRPCEx(rpc_type, ctx);
572 #ifdef DIAG_DEVELOPER
573 switch (rpc_type)
574 {
575 case ERPCs.DEV_RPC_SERVER_SCRIPT_RESULT:
576 {
578 {
580 }
581 break;
582 }
583 }
584 #endif
585 }
586
588 {
589 super.OnClick(w,
x,
y,button);
591 {
593 return true;
594 }
596 {
599 return true;
600 }
601
602 return false;
603 }
604
606 {
607 super.OnChange(w,
x,
y, finished);
608 return false;
609 }
610
611
613 {
614 if (!show && (selectedHandler.Type() ==
ScriptConsoleEnfScriptTab || selectedHandler.Type() == ScriptConsoleEnfScriptServerTab))
615 {
616
617 }
618 else
619 {
622 }
623 }
624
625}
626
628{
630 {
632
635 {
638 }
640 }
641
643 {
644 int history_index;
646 {
649 if (history_index > -1)
650 {
652 }
654 }
655 }
656
658 {
660 {
661 int history_index;
662
666 {
668 }
670 }
671 }
672
674 {
676 {
678 return true;
679 }
681 {
684 return true;
685 }
686
687 return false;
688 }
689}
PluginBase GetPlugin(typename plugin_type)
ref TStringArray m_EnscriptConsoleHistoryServer
int m_EnscriptHistoryRowServer
override void OnRPCEx(int rpc_type, ParamsReadContext ctx)
ButtonWidget m_EnfScriptClear
ScriptConsoleEnfScriptTab ScriptConsoleTabBase OnSelected()
void ResetRunButtonColor()
void Add(string message, bool isReload=false)
TextListboxWidget m_ScriptOutputListbox
static ref TStringArray m_ScriptOutputHistory
static void PrintS(string message)
void ~ScriptConsoleEnfScriptTab()
override bool OnClick(Widget w, int x, int y, int button)
PluginLocalEnscriptHistoryServer m_ModuleLocalEnscriptHistoryServer
void ReloadScriptOutput()
ButtonWidget m_EnfScriptRun
void EnscriptHistoryBack()
override bool OnChange(Widget w, int x, int y, bool finished)
override void InitializeTab(Widget root, ScriptConsole console, Widget button, ScriptConsoleTabBase parent=null)
PluginLocalEnscriptHistory m_ModuleLocalEnscriptHistory
ref TStringArray m_EnscriptConsoleHistory
void ColorRunButton(bool success)
MultilineEditBoxWidget m_EnfScriptEdit
void EnscriptHistoryForward()
static ref Param1< bool > PARAM1_BOOL
static ref Param1< string > PARAM1_STRING
void ReloadScriptOutput()
override void OnSelected()
void EnscriptHistoryBack()
void EnscriptHistoryForward()
override bool OnClick(Widget w, int x, int y, int button)
proto bool Read(void value_in)
proto string ToString(bool simple=true)
proto string ToString(bool beautify=true)
Vector to string.
Serializer ParamsReadContext
proto void Print(void var)
Prints content of variable to console/log.
string String(string s)
Helper for passing string expression to functions with void parameter. Example: Print(String("Hello "...
class array< Class T > TStringArray
proto int Replace(string sample, string replace)
Replace all occurrances of 'sample' in 'str' by 'replace'.
proto string Get(int index)
Gets n-th character from string.
int ARGB(int a, int r, int g, int b)