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

◆ ReloadScriptOutput()

void OnSelected::ReloadScriptOutput ( )
protected

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

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