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

◆ HistoryBack()

void OnSelected::HistoryBack ( )
protected

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

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