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

◆ ColorRunButton()

void OnSelected::ColorRunButton ( bool success)
protected

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

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