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

◆ EnscriptHistoryBack()

void EnscriptHistoryBack ( )
protected

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

438{
439 protected static ScriptConsoleEnfScriptTab m_Instance;
440 protected int m_EnscriptHistoryRow;
441 protected int m_EnscriptHistoryRowServer;
444 protected PluginLocalEnscriptHistory m_ModuleLocalEnscriptHistory;
445 protected PluginLocalEnscriptHistoryServer m_ModuleLocalEnscriptHistoryServer;
446 protected MultilineEditBoxWidget m_EnfScriptEdit;
447 protected ButtonWidget m_EnfScriptRun;
448 protected ButtonWidget m_EnfScriptClear;
449 protected TextListboxWidget m_ScriptOutputListbox;
450 protected bool m_AllowScriptOutput;
451 protected int m_RunColor;
452
454
455 void ScriptConsoleEnfScriptTab(Widget root, ScriptConsole console, Widget button, ScriptConsoleTabBase parent = null)
456 {
457 m_Instance = this;
458 m_ModuleLocalEnscriptHistory = PluginLocalEnscriptHistory.Cast(GetPlugin(PluginLocalEnscriptHistory));
459 m_ModuleLocalEnscriptHistoryServer = PluginLocalEnscriptHistoryServer.Cast(GetPlugin(PluginLocalEnscriptHistoryServer));
462 m_EnfScriptEdit = MultilineEditBoxWidget.Cast(root.FindAnyWidget("MultilineEditBoxWidget0"));
463 m_EnfScriptRun = ButtonWidget.Cast(root.FindAnyWidget("RunButton"));
464 m_EnfScriptClear = ButtonWidget.Cast(root.FindAnyWidget("ClearButton"));
465 m_ScriptOutputListbox = TextListboxWidget.Cast(root.FindAnyWidget("ScriptOutputListbox"));
466 m_RunColor = m_EnfScriptRun.GetColor();
467 }
468
470 {
471 m_Instance = null;
472 }
473
474 override void OnSelected()
475 {
476 int index = m_EnscriptConsoleHistory.Count() - m_EnscriptHistoryRow - 1;
477 if (m_EnscriptConsoleHistory.IsValidIndex(index))
478 {
479 string text = m_EnscriptConsoleHistory.Get(index);
480 m_EnfScriptEdit.SetText(text);
481 }
483 }
484
485 static void PrintS(string message)
486 {
487 Print(message);
488 if (m_Instance)
489 m_Instance.Add(message);
490 }
491
492 static void PrintS(bool message)
493 {
494 PrintS(message.ToString());
495 }
496
497 static void PrintS(int message)
498 {
499 PrintS(message.ToString());
500 }
501
502 static void PrintS(float message)
503 {
504 PrintS(message.ToString());
505 }
506
507 static void PrintS(vector message)
508 {
509 PrintS(message.ToString());
510 }
511
512 static void PrintS(Object message)
513 {
514 PrintS(message.ToString());
515 }
516
517
518 void Add(string message, bool isReload = false)
519 {
520 if (message != string.Empty)
521 {
523 {
524 if (!isReload)
525 m_ScriptOutputHistory.Insert(message);
526 m_ScriptOutputListbox.AddItem(String(message), NULL, 0);
527 m_ScriptOutputListbox.EnsureVisible(m_ScriptOutputListbox.GetNumItems());
528 }
529 }
530 }
531
532 protected void Clear(bool clearFile = false)
533 {
534 if(clearFile)
536 m_ScriptOutputListbox.ClearItems();
537 }
538
539
540
541 protected void ReloadScriptOutput()
542 {
543 m_ScriptOutputListbox.ClearItems();
544 m_AllowScriptOutput = true;
545 foreach ( string s: m_ScriptOutputHistory)
546 {
547 Add(s, true);
548 }
549 m_AllowScriptOutput = false;
550 }
551
552 void HistoryBack()
553 {
554
556 }
557
558 void HistoryForward()
559 {
561 }
562
563 protected void RunEnscript()
564 {
565 #ifdef DEVELOPER
566 string code;
567 m_EnfScriptEdit.GetText(code);
568 string codeNoReplace = code;
570 m_AllowScriptOutput = true;
571 code.Replace("Print(","ScriptConsoleEnfScriptTab.PrintS(");
572 code.Replace("Print (","ScriptConsoleEnfScriptTab.PrintS(");
573 bool success = GetGame().ExecuteEnforceScript("void scConsMain() \n{\n" + code + "\n}\n", "scConsMain");
574 m_AllowScriptOutput = false;
575 ColorRunButton(success);
576
577 m_EnscriptConsoleHistory.Insert(codeNoReplace);
578 m_ModuleLocalEnscriptHistory.AddNewLine(codeNoReplace);
579 #endif
580 }
581
582 protected void ColorRunButton(bool success)
583 {
584 if (success)
585 {
586 m_EnfScriptRun.SetColor(ARGB(255,0,255,0));
587 }
588 else
589 {
590 m_EnfScriptRun.SetColor(ARGB(255,255,0,0));
591 }
593 }
594
595 protected void ResetRunButtonColor()
596 {
597 m_EnfScriptRun.SetColor(m_RunColor);
598 }
599
600 protected void RunEnscriptServer()
601 {
602 string code;
603 m_EnfScriptEdit.GetText(code);
605 m_ModuleLocalEnscriptHistoryServer.AddNewLine(code);
607 GetGame().RPCSingleParam(GetGame().GetPlayer(), ERPCs.DEV_RPC_SERVER_SCRIPT, CachedObjectsParams.PARAM1_STRING, true, GetGame().GetPlayer().GetIdentity());
608 }
609
610 protected void EnscriptHistoryBack()
611 {
612 int history_index;
613 if (m_EnfScriptEdit)
614 {
616 history_index = m_EnscriptConsoleHistory.Count() - m_EnscriptHistoryRow - 1;
617 if (history_index > -1)
618 {
619 m_EnfScriptEdit.SetText(m_EnscriptConsoleHistory.Get(history_index));
620 }
622 }
623 }
624
625
626 protected void EnscriptHistoryForward()
627 {
628 if (m_EnfScriptEdit)
629 {
630 int history_index;
632 history_index = m_EnscriptConsoleHistory.Count() - m_EnscriptHistoryRow - 1;
633 if (history_index < m_EnscriptConsoleHistory.Count())
634 {
635 m_EnfScriptEdit.SetText(m_EnscriptConsoleHistory.Get(history_index));
636 }
638 }
639 }
640
641 override void OnRPCEx(int rpc_type, ParamsReadContext ctx)
642 {
643 super.OnRPCEx(rpc_type, ctx);
644 #ifdef DIAG_DEVELOPER
645 switch (rpc_type)
646 {
647 case ERPCs.DEV_RPC_SERVER_SCRIPT_RESULT:
648 {
650 {
652 }
653 break;
654 }
655 }
656 #endif
657 }
658
659 override bool OnClick(Widget w, int x, int y, int button)
660 {
661 super.OnClick(w,x,y,button);
662 if (w == m_EnfScriptRun)
663 {
664 RunEnscript();
665 return true;
666 }
667 else if (w == m_EnfScriptClear)
668 {
669 m_ScriptOutputListbox.ClearItems();
670 m_ScriptOutputHistory.Clear();
671 return true;
672 }
673
674 return false;
675 }
676
677 override bool OnChange(Widget w, int x, int y, bool finished)
678 {
679 super.OnChange(w, x, y, finished);
680 return false;
681 }
682
683
684 override void Show(bool show, ScriptConsoleTabBase selectedHandler)
685 {
686 if (!show && (selectedHandler.Type() == ScriptConsoleEnfScriptTab || selectedHandler.Type() == ScriptConsoleEnfScriptServerTab))
687 {
688 //do nothing
689 }
690 else
691 {
692 m_Root.Show(show);
693 m_Root.Enable(show);
694 }
695 }
696
697}
698
699class ScriptConsoleEnfScriptServerTab : ScriptConsoleEnfScriptTab
700{
701 override void OnSelected()
702 {
704 if (m_EnscriptConsoleHistoryServer.IsValidIndex(index))
705 {
706 string text = m_EnscriptConsoleHistoryServer.Get(index);
707 m_EnfScriptEdit.SetText(text);
708 }
710 }
711
712 override protected void EnscriptHistoryBack()
713 {
714 int history_index;
715 if (m_EnfScriptEdit)
716 {
719 if (history_index > -1)
720 {
721 m_EnfScriptEdit.SetText(m_EnscriptConsoleHistoryServer.Get(history_index));
722 }
724 }
725 }
726
727 override protected void EnscriptHistoryForward()
728 {
729 if (m_EnfScriptEdit)
730 {
731 int history_index;
732
735 if (history_index < m_EnscriptConsoleHistoryServer.Count())
736 {
737 m_EnfScriptEdit.SetText(m_EnscriptConsoleHistoryServer.Get(history_index));
738 }
740 }
741 }
742
743 override bool OnClick(Widget w, int x, int y, int button)
744 {
745 if (w == m_EnfScriptRun)
746 {
748 return true;
749 }
750 else if (w == m_EnfScriptClear)
751 {
752 m_ScriptOutputListbox.ClearItems();
753 m_ScriptOutputHistory.Clear();
754 return true;
755 }
756
757 return false;
758 }
759
760}
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