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

◆ Clear()

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

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

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