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

◆ HistoryBack()

void OnSelected::HistoryBack ( )
protected

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

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