516{
530
532
534 {
535 super.InitializeTab(root, console, button, parent);
536
542 m_EnfScriptEdit = MultilineEditBoxWidget.Cast(root.FindAnyWidget(
"MultilineEditBoxWidget0"));
543 m_EnfScriptRun = ButtonWidget.Cast(root.FindAnyWidget(
"RunButton"));
547 }
548
550 {
552 }
553
555 {
558 {
561 }
563 }
564
565 static void PrintS(
string message)
566 {
570 }
571
572 static void PrintS(
bool message)
573 {
575 }
576
577 static void PrintS(
int message)
578 {
579 PrintS(message.ToString());
580 }
581
582 static void PrintS(
float message)
583 {
585 }
586
588 {
590 }
591
593 {
594 PrintS(message.ToString());
595 }
596
597
598 void Add(
string message,
bool isReload =
false)
599 {
600 if (message !=
string.
Empty)
601 {
603 {
604 if (!isReload)
608 }
609 }
610 }
611
612 protected void Clear(
bool clearFile =
false)
613 {
614 if(clearFile)
617 }
618
619
620
622 {
626 {
628 }
630 }
631
633 {
634
636 }
637
639 {
641 }
642
644 {
645 #ifdef DEVELOPER
646 string code;
648 string codeNoReplace = code;
651 code.
Replace(
"Print(",
"ScriptConsoleEnfScriptTab.PrintS(");
652 code.
Replace(
"Print (",
"ScriptConsoleEnfScriptTab.PrintS(");
653 bool success =
g_Game.ExecuteEnforceScript(
"void scConsMain() \n{\n" + code +
"\n}\n",
"scConsMain");
656
659 #endif
660 }
661
663 {
664 if (success)
665 {
667 }
668 else
669 {
671 }
673 }
674
676 {
678 }
679
681 {
682 string code;
688 }
689
691 {
692 int history_index;
694 {
697 if (history_index > -1)
698 {
700 }
702 }
703 }
704
705
707 {
709 {
710 int history_index;
714 {
716 }
718 }
719 }
720
722 {
723 super.OnRPCEx(rpc_type, ctx);
724 #ifdef DIAG_DEVELOPER
725 switch (rpc_type)
726 {
727 case ERPCs.DEV_RPC_SERVER_SCRIPT_RESULT:
728 {
730 {
732 }
733 break;
734 }
735 }
736 #endif
737 }
738
740 {
741 super.OnClick(w,
x,
y,button);
743 {
745 return true;
746 }
748 {
751 return true;
752 }
753
754 return false;
755 }
756
758 {
759 super.OnChange(w,
x,
y, finished);
760 return false;
761 }
762
763
765 {
766 if (!show && (selectedHandler.Type() ==
ScriptConsoleEnfScriptTab || selectedHandler.Type() == ScriptConsoleEnfScriptServerTab))
767 {
768
769 }
770 else
771 {
774 }
775 }
776
777}
778
780{
782 {
784
787 {
790 }
792 }
793
795 {
796 int history_index;
798 {
801 if (history_index > -1)
802 {
804 }
806 }
807 }
808
810 {
812 {
813 int history_index;
814
818 {
820 }
822 }
823 }
824
826 {
828 {
830 return true;
831 }
833 {
836 return true;
837 }
838
839 return false;
840 }
841}
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)