390{
404
406
408 {
409 super.InitializeTab(root, console, button, parent);
410
416 m_EnfScriptEdit = MultilineEditBoxWidget.Cast(root.FindAnyWidget(
"MultilineEditBoxWidget0"));
417 m_EnfScriptRun = ButtonWidget.Cast(root.FindAnyWidget(
"RunButton"));
421 }
422
424 {
426 }
427
429 {
432 {
435 }
437 }
438
439 static void PrintS(
string message)
440 {
444 }
445
446 static void PrintS(
bool message)
447 {
449 }
450
451 static void PrintS(
int message)
452 {
453 PrintS(message.ToString());
454 }
455
456 static void PrintS(
float message)
457 {
459 }
460
462 {
464 }
465
467 {
468 PrintS(message.ToString());
469 }
470
471
472 void Add(
string message,
bool isReload =
false)
473 {
474 if (message !=
string.
Empty)
475 {
477 {
478 if (!isReload)
482 }
483 }
484 }
485
486 protected void Clear(
bool clearFile =
false)
487 {
488 if(clearFile)
491 }
492
493
494
496 {
500 {
502 }
504 }
505
507 {
508
510 }
511
513 {
515 }
516
518 {
519 #ifdef DEVELOPER
520 string code;
522 string codeNoReplace = code;
525 code.
Replace(
"Print(",
"ScriptConsoleEnfScriptTab.PrintS(");
526 code.
Replace(
"Print (",
"ScriptConsoleEnfScriptTab.PrintS(");
527 bool success =
g_Game.ExecuteEnforceScript(
"void scConsMain() \n{\n" + code +
"\n}\n",
"scConsMain");
530
533 #endif
534 }
535
537 {
538 if (success)
539 {
541 }
542 else
543 {
545 }
547 }
548
550 {
552 }
553
555 {
556 string code;
562 }
563
565 {
566 int history_index;
568 {
571 if (history_index > -1)
572 {
574 }
576 }
577 }
578
579
581 {
583 {
584 int history_index;
588 {
590 }
592 }
593 }
594
596 {
597 super.OnRPCEx(rpc_type, ctx);
598 #ifdef DIAG_DEVELOPER
599 switch (rpc_type)
600 {
601 case ERPCs.DEV_RPC_SERVER_SCRIPT_RESULT:
602 {
604 {
606 }
607 break;
608 }
609 }
610 #endif
611 }
612
614 {
615 super.OnClick(w,
x,
y,button);
617 {
619 return true;
620 }
622 {
625 return true;
626 }
627
628 return false;
629 }
630
632 {
633 super.OnChange(w,
x,
y, finished);
634 return false;
635 }
636
637
639 {
640 if (!show && (selectedHandler.Type() ==
ScriptConsoleEnfScriptTab || selectedHandler.Type() == ScriptConsoleEnfScriptServerTab))
641 {
642
643 }
644 else
645 {
648 }
649 }
650
651}
652
654{
656 {
658
661 {
664 }
666 }
667
669 {
670 int history_index;
672 {
675 if (history_index > -1)
676 {
678 }
680 }
681 }
682
684 {
686 {
687 int history_index;
688
692 {
694 }
696 }
697 }
698
700 {
702 {
704 return true;
705 }
707 {
710 return true;
711 }
712
713 return false;
714 }
715}
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)