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

◆ HistoryForward()

void OnSelected::HistoryForward ( )
protected

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

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