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

◆ ResetRunButtonColor()

void OnSelected::ResetRunButtonColor ( )
protected

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

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