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

◆ ColorRunButton()

void OnSelected::ColorRunButton ( bool success)
protected

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

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