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

◆ EnscriptHistoryBack()

void EnscriptHistoryBack ( )
protected

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

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