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

◆ Show()

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

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

512{
513 protected static ScriptConsoleEnfScriptTab m_Instance;
514 protected int m_EnscriptHistoryRow;
515 protected int m_EnscriptHistoryRowServer;
518 protected PluginLocalEnscriptHistory m_ModuleLocalEnscriptHistory;
519 protected PluginLocalEnscriptHistoryServer m_ModuleLocalEnscriptHistoryServer;
520 protected MultilineEditBoxWidget m_EnfScriptEdit;
521 protected ButtonWidget m_EnfScriptRun;
522 protected ButtonWidget m_EnfScriptClear;
523 protected TextListboxWidget m_ScriptOutputListbox;
524 protected bool m_AllowScriptOutput;
525 protected int m_RunColor;
526
528
529 void ScriptConsoleEnfScriptTab(Widget root, ScriptConsole console, Widget button, ScriptConsoleTabBase parent = null)
530 {
531 m_Instance = this;
532 m_ModuleLocalEnscriptHistory = PluginLocalEnscriptHistory.Cast(GetPlugin(PluginLocalEnscriptHistory));
533 m_ModuleLocalEnscriptHistoryServer = PluginLocalEnscriptHistoryServer.Cast(GetPlugin(PluginLocalEnscriptHistoryServer));
536 m_EnfScriptEdit = MultilineEditBoxWidget.Cast(root.FindAnyWidget("MultilineEditBoxWidget0"));
537 m_EnfScriptRun = ButtonWidget.Cast(root.FindAnyWidget("RunButton"));
538 m_EnfScriptClear = ButtonWidget.Cast(root.FindAnyWidget("ClearButton"));
539 m_ScriptOutputListbox = TextListboxWidget.Cast(root.FindAnyWidget("ScriptOutputListbox"));
540 m_RunColor = m_EnfScriptRun.GetColor();
541 }
542
544 {
545 m_Instance = null;
546 }
547
548 override void OnSelected()
549 {
550 int index = m_EnscriptConsoleHistory.Count() - m_EnscriptHistoryRow - 1;
551 if (m_EnscriptConsoleHistory.IsValidIndex(index))
552 {
553 string text = m_EnscriptConsoleHistory.Get(index);
554 m_EnfScriptEdit.SetText(text);
555 }
557 }
558
559 static void PrintS(string message)
560 {
561 Print(message);
562 if (m_Instance)
563 m_Instance.Add(message);
564 }
565
566 static void PrintS(bool message)
567 {
568 PrintS(message.ToString());
569 }
570
571 static void PrintS(int message)
572 {
573 PrintS(message.ToString());
574 }
575
576 static void PrintS(float message)
577 {
578 PrintS(message.ToString());
579 }
580
581 static void PrintS(vector message)
582 {
583 PrintS(message.ToString());
584 }
585
586 static void PrintS(Object message)
587 {
588 PrintS(message.ToString());
589 }
590
591
592 void Add(string message, bool isReload = false)
593 {
594 if (message != string.Empty)
595 {
597 {
598 if (!isReload)
599 m_ScriptOutputHistory.Insert(message);
600 m_ScriptOutputListbox.AddItem(String(message), NULL, 0);
601 m_ScriptOutputListbox.EnsureVisible(m_ScriptOutputListbox.GetNumItems());
602 }
603 }
604 }
605
606 protected void Clear(bool clearFile = false)
607 {
608 if(clearFile)
610 m_ScriptOutputListbox.ClearItems();
611 }
612
613
614
615 protected void ReloadScriptOutput()
616 {
617 m_ScriptOutputListbox.ClearItems();
618 m_AllowScriptOutput = true;
619 foreach ( string s: m_ScriptOutputHistory)
620 {
621 Add(s, true);
622 }
623 m_AllowScriptOutput = false;
624 }
625
626 void HistoryBack()
627 {
628
630 }
631
632 void HistoryForward()
633 {
635 }
636
637 protected void RunEnscript()
638 {
639 #ifdef DEVELOPER
640 string code;
641 m_EnfScriptEdit.GetText(code);
642 string codeNoReplace = code;
644 m_AllowScriptOutput = true;
645 code.Replace("Print(","ScriptConsoleEnfScriptTab.PrintS(");
646 code.Replace("Print (","ScriptConsoleEnfScriptTab.PrintS(");
647 bool success = GetGame().ExecuteEnforceScript("void scConsMain() \n{\n" + code + "\n}\n", "scConsMain");
648 m_AllowScriptOutput = false;
649 ColorRunButton(success);
650
651 m_EnscriptConsoleHistory.Insert(codeNoReplace);
652 m_ModuleLocalEnscriptHistory.AddNewLine(codeNoReplace);
653 #endif
654 }
655
656 protected void ColorRunButton(bool success)
657 {
658 if (success)
659 {
660 m_EnfScriptRun.SetColor(ARGB(255,0,255,0));
661 }
662 else
663 {
664 m_EnfScriptRun.SetColor(ARGB(255,255,0,0));
665 }
667 }
668
669 protected void ResetRunButtonColor()
670 {
671 m_EnfScriptRun.SetColor(m_RunColor);
672 }
673
674 protected void RunEnscriptServer()
675 {
676 string code;
677 m_EnfScriptEdit.GetText(code);
679 m_ModuleLocalEnscriptHistoryServer.AddNewLine(code);
681 GetGame().RPCSingleParam(GetGame().GetPlayer(), ERPCs.DEV_RPC_SERVER_SCRIPT, CachedObjectsParams.PARAM1_STRING, true, GetGame().GetPlayer().GetIdentity());
682 }
683
684 protected void EnscriptHistoryBack()
685 {
686 int history_index;
687 if (m_EnfScriptEdit)
688 {
690 history_index = m_EnscriptConsoleHistory.Count() - m_EnscriptHistoryRow - 1;
691 if (history_index > -1)
692 {
693 m_EnfScriptEdit.SetText(m_EnscriptConsoleHistory.Get(history_index));
694 }
696 }
697 }
698
699
700 protected void EnscriptHistoryForward()
701 {
702 if (m_EnfScriptEdit)
703 {
704 int history_index;
706 history_index = m_EnscriptConsoleHistory.Count() - m_EnscriptHistoryRow - 1;
707 if (history_index < m_EnscriptConsoleHistory.Count())
708 {
709 m_EnfScriptEdit.SetText(m_EnscriptConsoleHistory.Get(history_index));
710 }
712 }
713 }
714
715 override void OnRPCEx(int rpc_type, ParamsReadContext ctx)
716 {
717 super.OnRPCEx(rpc_type, ctx);
718 #ifdef DIAG_DEVELOPER
719 switch (rpc_type)
720 {
721 case ERPCs.DEV_RPC_SERVER_SCRIPT_RESULT:
722 {
724 {
726 }
727 break;
728 }
729 }
730 #endif
731 }
732
733 override bool OnClick(Widget w, int x, int y, int button)
734 {
735 super.OnClick(w,x,y,button);
736 if (w == m_EnfScriptRun)
737 {
738 RunEnscript();
739 return true;
740 }
741 else if (w == m_EnfScriptClear)
742 {
743 m_ScriptOutputListbox.ClearItems();
744 m_ScriptOutputHistory.Clear();
745 return true;
746 }
747
748 return false;
749 }
750
751 override bool OnChange(Widget w, int x, int y, bool finished)
752 {
753 super.OnChange(w, x, y, finished);
754 return false;
755 }
756
757
758 override void Show(bool show, ScriptConsoleTabBase selectedHandler)
759 {
760 if (!show && (selectedHandler.Type() == ScriptConsoleEnfScriptTab || selectedHandler.Type() == ScriptConsoleEnfScriptServerTab))
761 {
762 //do nothing
763 }
764 else
765 {
766 m_Root.Show(show);
767 m_Root.Enable(show);
768 }
769 }
770
771}
772
773class ScriptConsoleEnfScriptServerTab : ScriptConsoleEnfScriptTab
774{
775 override void OnSelected()
776 {
778 if (m_EnscriptConsoleHistoryServer.IsValidIndex(index))
779 {
780 string text = m_EnscriptConsoleHistoryServer.Get(index);
781 m_EnfScriptEdit.SetText(text);
782 }
784 }
785
786 override protected void EnscriptHistoryBack()
787 {
788 int history_index;
789 if (m_EnfScriptEdit)
790 {
793 if (history_index > -1)
794 {
795 m_EnfScriptEdit.SetText(m_EnscriptConsoleHistoryServer.Get(history_index));
796 }
798 }
799 }
800
801 override protected void EnscriptHistoryForward()
802 {
803 if (m_EnfScriptEdit)
804 {
805 int history_index;
806
809 if (history_index < m_EnscriptConsoleHistoryServer.Count())
810 {
811 m_EnfScriptEdit.SetText(m_EnscriptConsoleHistoryServer.Get(history_index));
812 }
814 }
815 }
816
817 override bool OnClick(Widget w, int x, int y, int button)
818 {
819 if (w == m_EnfScriptRun)
820 {
822 return true;
823 }
824 else if (w == m_EnfScriptClear)
825 {
826 m_ScriptOutputListbox.ClearItems();
827 m_ScriptOutputHistory.Clear();
828 return true;
829 }
830
831 return false;
832 }
833
834}
void Show()
Определения DayZGame.c:162
ERPCs
Определения ERPCs.c:2
Empty
Определения Hand_States.c:14
Icon x
Icon y
PlayerBase GetPlayer()
Определения ModifierBase.c:51
PluginBase GetPlugin(typename plugin_type)
Определения PluginManager.c:316
PlayerBase _player
Определения QuickBarBase.c:18
static ref RadialMenu m_Instance
Определения RadialMenu.c:55
ref TStringArray m_EnscriptConsoleHistoryServer
Определения ScriptConsoleEnfScriptTab.c:270
int m_EnscriptHistoryRowServer
Определения ScriptConsoleEnfScriptTab.c:268
override void OnRPCEx(int rpc_type, ParamsReadContext ctx)
Определения ScriptConsoleEnfScriptTab.c:468
ButtonWidget m_EnfScriptClear
Определения ScriptConsoleEnfScriptTab.c:275
ScriptConsoleEnfScriptTab ScriptConsoleTabBase OnSelected()
Определения ScriptConsoleEnfScriptTab.c:265
void ResetRunButtonColor()
Определения ScriptConsoleEnfScriptTab.c:422
void Add(string message, bool isReload=false)
Определения ScriptConsoleEnfScriptTab.c:345
void HistoryForward()
Определения ScriptConsoleEnfScriptTab.c:385
TextListboxWidget m_ScriptOutputListbox
Определения ScriptConsoleEnfScriptTab.c:276
void ScriptConsoleEnfScriptTab(Widget root, ScriptConsole console, Widget button, ScriptConsoleTabBase parent=null)
Определения ScriptConsoleEnfScriptTab.c:282
bool m_AllowScriptOutput
Определения ScriptConsoleEnfScriptTab.c:277
static ref TStringArray m_ScriptOutputHistory
Определения ScriptConsoleEnfScriptTab.c:280
int m_RunColor
Определения ScriptConsoleEnfScriptTab.c:278
static void PrintS(string message)
Определения ScriptConsoleEnfScriptTab.c:312
void RunEnscriptServer()
Определения ScriptConsoleEnfScriptTab.c:427
void ~ScriptConsoleEnfScriptTab()
Определения ScriptConsoleEnfScriptTab.c:296
override bool OnClick(Widget w, int x, int y, int button)
Определения ScriptConsoleEnfScriptTab.c:486
PluginLocalEnscriptHistoryServer m_ModuleLocalEnscriptHistoryServer
Определения ScriptConsoleEnfScriptTab.c:272
void Clear(bool clearFile=false)
Определения ScriptConsoleEnfScriptTab.c:359
void ReloadScriptOutput()
Определения ScriptConsoleEnfScriptTab.c:368
ButtonWidget m_EnfScriptRun
Определения ScriptConsoleEnfScriptTab.c:274
void EnscriptHistoryBack()
Определения ScriptConsoleEnfScriptTab.c:437
override bool OnChange(Widget w, int x, int y, bool finished)
Определения ScriptConsoleEnfScriptTab.c:504
void RunEnscript()
Определения ScriptConsoleEnfScriptTab.c:390
int m_EnscriptHistoryRow
Определения ScriptConsoleEnfScriptTab.c:267
void HistoryBack()
Определения ScriptConsoleEnfScriptTab.c:379
PluginLocalEnscriptHistory m_ModuleLocalEnscriptHistory
Определения ScriptConsoleEnfScriptTab.c:271
ref TStringArray m_EnscriptConsoleHistory
Определения ScriptConsoleEnfScriptTab.c:269
void ColorRunButton(bool success)
Определения ScriptConsoleEnfScriptTab.c:409
MultilineEditBoxWidget m_EnfScriptEdit
Определения ScriptConsoleEnfScriptTab.c:273
void EnscriptHistoryForward()
Определения ScriptConsoleEnfScriptTab.c:453
Widget m_Root
Определения SizeToChild.c:91
proto native void RPCSingleParam(Object target, int rpc_type, Param param, bool guaranteed, PlayerIdentity recipient=null)
see CGame.RPC
override ScriptCallQueue GetCallQueue(int call_category)
Определения DayZGame.c:1187
proto native bool ExecuteEnforceScript(string expression, string mainFnName)
Delevoper only: Executes Enforce Script expression, if there is an error, is printed into the script ...
static ref Param1< bool > PARAM1_BOOL
Определения UtilityClasses.c:12
static ref Param1< string > PARAM1_STRING
Определения UtilityClasses.c:14
static void ClearLogs()
Определения Debug.c:557
Определения Debug.c:2
Определения ObjectTyped.c:2
Определения PlayerBaseClient.c:2
proto void CallLater(func fn, int delay=0, bool repeat=false, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
adds call into the queue with given parameters and arguments (arguments are held in memory until the ...
override void OnSelected()
Определения ScriptConsoleEnfScriptTab.c:38
override bool OnClick(Widget w, int x, int y, int button)
Определения ScriptConsoleEnfScriptTab.c:223
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:106
Serializer ParamsReadContext
Определения gameplay.c:15
proto native CGame GetGame()
proto void Print(void var)
Prints content of variable to console/log.
array< string > TStringArray
Определения EnScript.c:685
string String(string s)
Helper for passing string expression to functions with void parameter. Example: Print(String("Hello "...
Определения EnScript.c:339
proto int Replace(string sample, string replace)
Replace all occurrances of 'sample' in 'str' by 'replace'.
const int CALL_CATEGORY_SYSTEM
Определения tools.c:8
WorkspaceWidget Widget
Defined in code.
int ARGB(int a, int r, int g, int b)
Определения proto.c:322