DayZ 1.30
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ Show()

override void OnSelected::Show ( bool show,
ScriptConsoleTabBase selectedHandler )
protected

См. определение в файле ScriptConsoleEnfScriptTab.c строка 515

516{
517 protected static ScriptConsoleEnfScriptTab m_Instance;
518 protected int m_EnscriptHistoryRow;
519 protected int m_EnscriptHistoryRowServer;
522 protected PluginLocalEnscriptHistory m_ModuleLocalEnscriptHistory;
523 protected PluginLocalEnscriptHistoryServer m_ModuleLocalEnscriptHistoryServer;
524 protected MultilineEditBoxWidget m_EnfScriptEdit;
525 protected ButtonWidget m_EnfScriptRun;
526 protected ButtonWidget m_EnfScriptClear;
527 protected TextListboxWidget m_ScriptOutputListbox;
528 protected bool m_AllowScriptOutput;
529 protected int m_RunColor;
530
532
533 override void InitializeTab(Widget root, ScriptConsole console, Widget button, ScriptConsoleTabBase parent = null)
534 {
535 super.InitializeTab(root, console, button, parent);
536
537 m_Instance = this;
538 m_ModuleLocalEnscriptHistory = PluginLocalEnscriptHistory.Cast(GetPlugin(PluginLocalEnscriptHistory));
539 m_ModuleLocalEnscriptHistoryServer = PluginLocalEnscriptHistoryServer.Cast(GetPlugin(PluginLocalEnscriptHistoryServer));
542 m_EnfScriptEdit = MultilineEditBoxWidget.Cast(root.FindAnyWidget("MultilineEditBoxWidget0"));
543 m_EnfScriptRun = ButtonWidget.Cast(root.FindAnyWidget("RunButton"));
544 m_EnfScriptClear = ButtonWidget.Cast(root.FindAnyWidget("ClearButton"));
545 m_ScriptOutputListbox = TextListboxWidget.Cast(root.FindAnyWidget("ScriptOutputListbox"));
546 m_RunColor = m_EnfScriptRun.GetColor();
547 }
548
550 {
551 m_Instance = null;
552 }
553
554 override void OnSelected()
555 {
556 int index = m_EnscriptConsoleHistory.Count() - m_EnscriptHistoryRow - 1;
557 if (m_EnscriptConsoleHistory.IsValidIndex(index))
558 {
559 string text = m_EnscriptConsoleHistory.Get(index);
560 m_EnfScriptEdit.SetText(text);
561 }
563 }
564
565 static void PrintS(string message)
566 {
567 Print(message);
568 if (m_Instance)
569 m_Instance.Add(message);
570 }
571
572 static void PrintS(bool message)
573 {
574 PrintS(message.ToString());
575 }
576
577 static void PrintS(int message)
578 {
579 PrintS(message.ToString());
580 }
581
582 static void PrintS(float message)
583 {
584 PrintS(message.ToString());
585 }
586
587 static void PrintS(vector message)
588 {
589 PrintS(message.ToString());
590 }
591
592 static void PrintS(Object message)
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)
605 m_ScriptOutputHistory.Insert(message);
606 m_ScriptOutputListbox.AddItem(String(message), NULL, 0);
607 m_ScriptOutputListbox.EnsureVisible(m_ScriptOutputListbox.GetNumItems());
608 }
609 }
610 }
611
612 protected void Clear(bool clearFile = false)
613 {
614 if(clearFile)
616 m_ScriptOutputListbox.ClearItems();
617 }
618
619
620
621 protected void ReloadScriptOutput()
622 {
623 m_ScriptOutputListbox.ClearItems();
624 m_AllowScriptOutput = true;
625 foreach ( string s: m_ScriptOutputHistory)
626 {
627 Add(s, true);
628 }
629 m_AllowScriptOutput = false;
630 }
631
632 void HistoryBack()
633 {
634
636 }
637
638 void HistoryForward()
639 {
641 }
642
643 protected void RunEnscript()
644 {
645 #ifdef DEVELOPER
646 string code;
647 m_EnfScriptEdit.GetText(code);
648 string codeNoReplace = code;
649 _player = PlayerBase.Cast(g_Game.GetPlayer());
650 m_AllowScriptOutput = true;
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");
654 m_AllowScriptOutput = false;
655 ColorRunButton(success);
656
657 m_EnscriptConsoleHistory.Insert(codeNoReplace);
658 m_ModuleLocalEnscriptHistory.AddNewLine(codeNoReplace);
659 #endif
660 }
661
662 protected void ColorRunButton(bool success)
663 {
664 if (success)
665 {
666 m_EnfScriptRun.SetColor(ARGB(255,0,255,0));
667 }
668 else
669 {
670 m_EnfScriptRun.SetColor(ARGB(255,255,0,0));
671 }
672 g_Game.GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(ResetRunButtonColor,600);
673 }
674
675 protected void ResetRunButtonColor()
676 {
677 m_EnfScriptRun.SetColor(m_RunColor);
678 }
679
680 protected void RunEnscriptServer()
681 {
682 string code;
683 m_EnfScriptEdit.GetText(code);
685 m_ModuleLocalEnscriptHistoryServer.AddNewLine(code);
687 g_Game.RPCSingleParam(g_Game.GetPlayer(), ERPCs.DEV_RPC_SERVER_SCRIPT, CachedObjectsParams.PARAM1_STRING, true, g_Game.GetPlayer().GetIdentity());
688 }
689
690 protected void EnscriptHistoryBack()
691 {
692 int history_index;
693 if (m_EnfScriptEdit)
694 {
696 history_index = m_EnscriptConsoleHistory.Count() - m_EnscriptHistoryRow - 1;
697 if (history_index > -1)
698 {
699 m_EnfScriptEdit.SetText(m_EnscriptConsoleHistory.Get(history_index));
700 }
702 }
703 }
704
705
706 protected void EnscriptHistoryForward()
707 {
708 if (m_EnfScriptEdit)
709 {
710 int history_index;
712 history_index = m_EnscriptConsoleHistory.Count() - m_EnscriptHistoryRow - 1;
713 if (history_index < m_EnscriptConsoleHistory.Count())
714 {
715 m_EnfScriptEdit.SetText(m_EnscriptConsoleHistory.Get(history_index));
716 }
718 }
719 }
720
721 override void OnRPCEx(int rpc_type, ParamsReadContext ctx)
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
739 override bool OnClick(Widget w, int x, int y, int button)
740 {
741 super.OnClick(w,x,y,button);
742 if (w == m_EnfScriptRun)
743 {
744 RunEnscript();
745 return true;
746 }
747 else if (w == m_EnfScriptClear)
748 {
749 m_ScriptOutputListbox.ClearItems();
750 m_ScriptOutputHistory.Clear();
751 return true;
752 }
753
754 return false;
755 }
756
757 override bool OnChange(Widget w, int x, int y, bool finished)
758 {
759 super.OnChange(w, x, y, finished);
760 return false;
761 }
762
763
764 override void Show(bool show, ScriptConsoleTabBase selectedHandler)
765 {
766 if (!show && (selectedHandler.Type() == ScriptConsoleEnfScriptTab || selectedHandler.Type() == ScriptConsoleEnfScriptServerTab))
767 {
768 //do nothing
769 }
770 else
771 {
772 m_Root.Show(show);
773 m_Root.Enable(show);
774 }
775 }
776
777}
778
779class ScriptConsoleEnfScriptServerTab : ScriptConsoleEnfScriptTab
780{
781 override void OnSelected()
782 {
784
786 if (m_EnscriptConsoleHistoryServer.IsValidIndex(index))
787 {
788 string text = m_EnscriptConsoleHistoryServer.Get(index);
789 m_EnfScriptEdit.SetText(text);
790 }
792 }
793
794 override protected void EnscriptHistoryBack()
795 {
796 int history_index;
797 if (m_EnfScriptEdit)
798 {
801 if (history_index > -1)
802 {
803 m_EnfScriptEdit.SetText(m_EnscriptConsoleHistoryServer.Get(history_index));
804 }
806 }
807 }
808
809 override protected void EnscriptHistoryForward()
810 {
811 if (m_EnfScriptEdit)
812 {
813 int history_index;
814
817 if (history_index < m_EnscriptConsoleHistoryServer.Count())
818 {
819 m_EnfScriptEdit.SetText(m_EnscriptConsoleHistoryServer.Get(history_index));
820 }
822 }
823 }
824
825 override bool OnClick(Widget w, int x, int y, int button)
826 {
827 if (w == m_EnfScriptRun)
828 {
830 return true;
831 }
832 else if (w == m_EnfScriptClear)
833 {
834 m_ScriptOutputListbox.ClearItems();
835 m_ScriptOutputHistory.Clear();
836 return true;
837 }
838
839 return false;
840 }
841}
override void Clear()
Определения ConstructionInfoIcons.c:41
DayZGame g_Game
Определения DayZGame.c:4074
void Show()
Определения DayZGame.c:171
ERPCs
Определения ERPCs.c:2
Empty
Определения Hand_States.c:14
Icon x
Icon y
PluginBase GetPlugin(typename plugin_type)
Определения PluginManager.c:326
PlayerBase _player
Определения QuickBarBase.c:18
static ref RadialMenu m_Instance
Определения RadialMenu.c:55
void ScriptConsole()
Определения ScriptConsole.c:114
ref TStringArray m_EnscriptConsoleHistoryServer
Определения ScriptConsoleEnfScriptTab.c:272
int m_EnscriptHistoryRowServer
Определения ScriptConsoleEnfScriptTab.c:270
override void OnRPCEx(int rpc_type, ParamsReadContext ctx)
Определения ScriptConsoleEnfScriptTab.c:472
ButtonWidget m_EnfScriptClear
Определения ScriptConsoleEnfScriptTab.c:277
ScriptConsoleEnfScriptTab ScriptConsoleTabBase OnSelected()
Определения ScriptConsoleEnfScriptTab.c:267
void ResetRunButtonColor()
Определения ScriptConsoleEnfScriptTab.c:426
void Add(string message, bool isReload=false)
Определения ScriptConsoleEnfScriptTab.c:349
void HistoryForward()
Определения ScriptConsoleEnfScriptTab.c:389
TextListboxWidget m_ScriptOutputListbox
Определения ScriptConsoleEnfScriptTab.c:278
bool m_AllowScriptOutput
Определения ScriptConsoleEnfScriptTab.c:279
static ref TStringArray m_ScriptOutputHistory
Определения ScriptConsoleEnfScriptTab.c:282
int m_RunColor
Определения ScriptConsoleEnfScriptTab.c:280
static void PrintS(string message)
Определения ScriptConsoleEnfScriptTab.c:316
void RunEnscriptServer()
Определения ScriptConsoleEnfScriptTab.c:431
void ~ScriptConsoleEnfScriptTab()
Определения ScriptConsoleEnfScriptTab.c:300
override bool OnClick(Widget w, int x, int y, int button)
Определения ScriptConsoleEnfScriptTab.c:490
PluginLocalEnscriptHistoryServer m_ModuleLocalEnscriptHistoryServer
Определения ScriptConsoleEnfScriptTab.c:274
void ReloadScriptOutput()
Определения ScriptConsoleEnfScriptTab.c:372
ButtonWidget m_EnfScriptRun
Определения ScriptConsoleEnfScriptTab.c:276
void EnscriptHistoryBack()
Определения ScriptConsoleEnfScriptTab.c:441
override bool OnChange(Widget w, int x, int y, bool finished)
Определения ScriptConsoleEnfScriptTab.c:508
void RunEnscript()
Определения ScriptConsoleEnfScriptTab.c:394
override void InitializeTab(Widget root, ScriptConsole console, Widget button, ScriptConsoleTabBase parent=null)
Определения ScriptConsoleEnfScriptTab.c:284
int m_EnscriptHistoryRow
Определения ScriptConsoleEnfScriptTab.c:269
void HistoryBack()
Определения ScriptConsoleEnfScriptTab.c:383
PluginLocalEnscriptHistory m_ModuleLocalEnscriptHistory
Определения ScriptConsoleEnfScriptTab.c:273
ref TStringArray m_EnscriptConsoleHistory
Определения ScriptConsoleEnfScriptTab.c:271
void ColorRunButton(bool success)
Определения ScriptConsoleEnfScriptTab.c:413
MultilineEditBoxWidget m_EnfScriptEdit
Определения ScriptConsoleEnfScriptTab.c:275
void EnscriptHistoryForward()
Определения ScriptConsoleEnfScriptTab.c:457
Widget m_Root
Определения SizeToChild.c:91
static ref Param1< bool > PARAM1_BOOL
Определения UtilityClasses.c:12
static ref Param1< string > PARAM1_STRING
Определения UtilityClasses.c:14
static void ClearLogs()
Определения 3_Game/DayZ/tools/Debug.c:666
Определения 3_Game/DayZ/tools/Debug.c:2
Определения ObjectTyped.c:2
Определения PlayerBaseClient.c:2
override void OnSelected()
Определения ScriptConsoleEnfScriptTab.c:40
override bool OnClick(Widget w, int x, int y, int button)
Определения ScriptConsoleEnfScriptTab.c:225
proto bool Read(void value_in)
Определения EnWidgets.c:190
string ToString()
Определения EnConvert.c:3
proto string ToString(bool simple=true)
proto string ToString(bool beautify=true)
Vector to string.
Определения EnConvert.c:119
Serializer ParamsReadContext
Определения gameplay.c:15
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 "...
Определения EnScript.c:339
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.
const int CALL_CATEGORY_SYSTEM
Определения 3_Game/DayZ/tools/tools.c:8
proto native void SetFocus(Widget w)
WorkspaceWidget Widget
Defined in code.
int ARGB(int a, int r, int g, int b)
Определения proto.c:322