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

◆ Clear()

void OnSelected::Clear ( bool clearFile = false)
protected

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

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

Используется в CallQueue::Tick(), multiMap< Class K, Class V >::~multiMap() и array< TimerBase >::~TimerQueue().