DayZ 1.24
Loading...
Searching...
No Matches
ScriptConsoleEnfScriptTab.c File Reference

Go to the source code of this file.

Classes

class  ScriptConsoleEnfScriptTab
 

Functions

ScriptConsoleEnfScriptTab ScriptConsoleTabBase OnSelected ()
 
void ScriptConsoleEnfScriptTab (Widget root, ScriptConsole console, Widget button, ScriptConsoleTabBase parent=null)
 
void ~ScriptConsoleEnfScriptTab ()
 
static void PrintS (string message)
 
static void PrintS (bool message)
 
static void PrintS (int message)
 
static void PrintS (float message)
 
static void PrintS (vector message)
 
static void PrintS (Object message)
 
void Add (string message, bool isReload=false)
 
void Clear (bool clearFile=false)
 
void ReloadScriptOutput ()
 
void HistoryBack ()
 
void HistoryForward ()
 
void RunEnscript ()
 
void ColorRunButton (bool success)
 
void ResetRunButtonColor ()
 
void RunEnscriptServer ()
 
void EnscriptHistoryBack ()
 
void EnscriptHistoryForward ()
 
override void OnRPCEx (int rpc_type, ParamsReadContext ctx)
 
override bool OnClick (Widget w, int x, int y, int button)
 
override bool OnChange (Widget w, int x, int y, bool finished)
 
override void Show (bool show, ScriptConsoleTabBase selectedHandler)
 

Variables

static ScriptConsoleEnfScriptTab m_Instance
 
int m_EnscriptHistoryRow
 
int m_EnscriptHistoryRowServer
 
ref TStringArray m_EnscriptConsoleHistory
 
ref TStringArray m_EnscriptConsoleHistoryServer
 
PluginLocalEnscriptHistory m_ModuleLocalEnscriptHistory
 
PluginLocalEnscriptHistoryServer m_ModuleLocalEnscriptHistoryServer
 
MultilineEditBoxWidget m_EnfScriptEdit
 
ButtonWidget m_EnfScriptRun
 
ButtonWidget m_EnfScriptClear
 
TextListboxWidget m_ScriptOutputListbox
 
bool m_AllowScriptOutput
 
int m_RunColor
 
static ref TStringArray m_ScriptOutputHistory = new TStringArray()
 

Function Documentation

◆ Add()

void OnSelected::Add ( string message,
bool isReload = false )
protected

Definition at line 332 of file ScriptConsoleEnfScriptTab.c.

◆ Clear()

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

Definition at line 346 of file ScriptConsoleEnfScriptTab.c.

347{
348 protected static ScriptConsoleEnfScriptTab m_Instance;
349 protected int m_EnscriptHistoryRow;
350 protected int m_EnscriptHistoryRowServer;
359 protected bool m_AllowScriptOutput;
360 protected int m_RunColor;
361
363
365 {
366 m_Instance = this;
371 m_EnfScriptEdit = MultilineEditBoxWidget.Cast(root.FindAnyWidget("MultilineEditBoxWidget0"));
372 m_EnfScriptRun = ButtonWidget.Cast(root.FindAnyWidget("RunButton"));
373 m_EnfScriptClear = ButtonWidget.Cast(root.FindAnyWidget("ClearButton"));
374 m_ScriptOutputListbox = TextListboxWidget.Cast(root.FindAnyWidget("ScriptOutputListbox"));
375 m_RunColor = m_EnfScriptRun.GetColor();
376 }
377
379 {
381 }
382
383 override void OnSelected()
384 {
386 if (m_EnscriptConsoleHistory.IsValidIndex(index))
387 {
388 string text = m_EnscriptConsoleHistory.Get(index);
389 m_EnfScriptEdit.SetText(text);
390 }
392 }
393
394 static void PrintS(string message)
395 {
396 Print(message);
397 if (m_Instance)
398 m_Instance.Add(message);
399 }
400
401 static void PrintS(bool message)
402 {
403 PrintS(message.ToString());
404 }
405
406 static void PrintS(int message)
407 {
408 PrintS(message.ToString());
409 }
410
411 static void PrintS(float message)
412 {
413 PrintS(message.ToString());
414 }
415
416 static void PrintS(vector message)
417 {
418 PrintS(message.ToString());
419 }
420
421 static void PrintS(Object message)
422 {
423 PrintS(message.ToString());
424 }
425
426
427 void Add(string message, bool isReload = false)
428 {
429 if (message != string.Empty)
430 {
432 {
433 if (!isReload)
436 m_ScriptOutputListbox.EnsureVisible(m_ScriptOutputListbox.GetNumItems());
437 }
438 }
439 }
440
441 protected void Clear(bool clearFile = false)
442 {
443 if (clearFile)
445 m_ScriptOutputListbox.ClearItems();
446 }
447
448
449 protected void ReloadScriptOutput()
450 {
451 m_ScriptOutputListbox.ClearItems();
452 m_AllowScriptOutput = true;
453 foreach (string s: m_ScriptOutputHistory)
454 Add(s, true);
455 m_AllowScriptOutput = false;
456 }
457
458 void HistoryBack()
459 {
460
462 }
463
464 void HistoryForward()
465 {
467 }
468
469 protected void RunEnscript()
470 {
471#ifdef DEVELOPER
472 string code;
473 m_EnfScriptEdit.GetText(code);
474 string codeNoReplace = code;
476 m_AllowScriptOutput = true;
477 code.Replace("Print(", "ScriptConsoleEnfScriptTab.PrintS(");
478 code.Replace("Print (", "ScriptConsoleEnfScriptTab.PrintS(");
479 bool success = GetGame().ExecuteEnforceScript("void scConsMain() \n{\n" + code + "\n}\n", "scConsMain");
480 m_AllowScriptOutput = false;
482
485#endif
486 }
487
488 protected void ColorRunButton(bool success)
489 {
490 if (success)
491 m_EnfScriptRun.SetColor(ARGB(255, 0, 255, 0));
492 else
493 m_EnfScriptRun.SetColor(ARGB(255, 255, 0, 0));
494 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(ResetRunButtonColor, 600);
495 }
496
497 protected void ResetRunButtonColor()
498 {
499 m_EnfScriptRun.SetColor(m_RunColor);
500 }
501
502 protected void RunEnscriptServer()
503 {
504 string code;
505 m_EnfScriptEdit.GetText(code);
509 GetGame().RPCSingleParam(GetGame().GetPlayer(), ERPCs.DEV_RPC_SERVER_SCRIPT, CachedObjectsParams.PARAM1_STRING, true, GetGame().GetPlayer().GetIdentity());
510 }
511
512 protected void EnscriptHistoryBack()
513 {
514 int history_index;
515 if (m_EnfScriptEdit)
516 {
519 if (history_index > -1)
522 }
523 }
524
525
526 protected void EnscriptHistoryForward()
527 {
528 if (m_EnfScriptEdit)
529 {
530 int history_index;
536 }
537 }
538
539 override void OnRPCEx(int rpc_type, ParamsReadContext ctx)
540 {
541 super.OnRPCEx(rpc_type, ctx);
542#ifdef DIAG_DEVELOPER
543 switch (rpc_type)
544 {
545 case ERPCs.DEV_RPC_SERVER_SCRIPT_RESULT:
546 {
549 break;
550 }
551 }
552#endif
553 }
554
555 override bool OnClick(Widget w, int x, int y, int button)
556 {
557 super.OnClick(w, x, y, button);
558 if (w == m_EnfScriptRun)
559 {
560 RunEnscript();
561 return true;
562 }
563 else if (w == m_EnfScriptClear)
564 {
565 m_ScriptOutputListbox.ClearItems();
566 m_ScriptOutputHistory.Clear();
567 return true;
568 }
569
570 return false;
571 }
572
573 override bool OnChange(Widget w, int x, int y, bool finished)
574 {
575 super.OnChange(w, x, y, finished);
576 return false;
577 }
578
579
580 override void Show(bool show, ScriptConsoleTabBase selectedHandler)
581 {
583 {
584 //do nothing
585 }
586 else
587 {
588 m_Root.Show(show);
589 m_Root.Enable(show);
590 }
591 }
592
593}
594
596{
597 override void OnSelected()
598 {
600 if (m_EnscriptConsoleHistoryServer.IsValidIndex(index))
601 {
603 m_EnfScriptEdit.SetText(text);
604 }
606 }
607
608 override protected void EnscriptHistoryBack()
609 {
610 int history_index;
611 if (m_EnfScriptEdit)
612 {
615 if (history_index > -1)
618 }
619 }
620
621 override protected void EnscriptHistoryForward()
622 {
623 if (m_EnfScriptEdit)
624 {
625 int history_index;
626
632 }
633 }
634
635 override bool OnClick(Widget w, int x, int y, int button)
636 {
637 if (w == m_EnfScriptRun)
638 {
640 return true;
641 }
642 else if (w == m_EnfScriptClear)
643 {
644 m_ScriptOutputListbox.ClearItems();
645 m_ScriptOutputHistory.Clear();
646 return true;
647 }
648
649 return false;
650 }
651
652}
void Show()
Definition DayZGame.c:155
override bool OnClick(Widget w, int x, int y, int button)
buttons clicks
Definition DayZGame.c:144
ERPCs
Definition ERPCs.c:2
Empty
Definition Hand_States.c:14
Icon x
Icon y
PlayerBase GetPlayer()
PluginBase GetPlugin(typename plugin_type)
PlayerBase _player
ref TStringArray m_EnscriptConsoleHistoryServer
int m_EnscriptHistoryRowServer
override void OnRPCEx(int rpc_type, ParamsReadContext ctx)
ButtonWidget m_EnfScriptClear
ScriptConsoleEnfScriptTab ScriptConsoleTabBase OnSelected()
void ResetRunButtonColor()
void Add(string message, bool isReload=false)
void HistoryForward()
TextListboxWidget m_ScriptOutputListbox
void ScriptConsoleEnfScriptTab(Widget root, ScriptConsole console, Widget button, ScriptConsoleTabBase parent=null)
bool m_AllowScriptOutput
static ref TStringArray m_ScriptOutputHistory
static void PrintS(string message)
void RunEnscriptServer()
void ~ScriptConsoleEnfScriptTab()
override bool OnClick(Widget w, int x, int y, int button)
PluginLocalEnscriptHistoryServer m_ModuleLocalEnscriptHistoryServer
void Clear(bool clearFile=false)
void ReloadScriptOutput()
ButtonWidget m_EnfScriptRun
void EnscriptHistoryBack()
override bool OnChange(Widget w, int x, int y, bool finished)
void RunEnscript()
int m_EnscriptHistoryRow
void HistoryBack()
PluginLocalEnscriptHistory m_ModuleLocalEnscriptHistory
ref TStringArray m_EnscriptConsoleHistory
static ScriptConsoleEnfScriptTab m_Instance
void ColorRunButton(bool success)
MultilineEditBoxWidget m_EnfScriptEdit
void EnscriptHistoryForward()
Widget m_Root
Definition SizeToChild.c:85
static ref Param1< bool > PARAM1_BOOL
static ref Param1< string > PARAM1_STRING
Definition Debug.c:14
static void ClearLogs()
Definition Debug.c:638
Serialization general interface. Serializer API works with:
Definition Serializer.c:56
proto native CGame GetGame()
proto void Print(void var)
Prints content of variable to console/log.
array< string > TStringArray
Definition EnScript.c:666
string String(string s)
Helper for passing string expression to functions with void parameter. Example: Print(String("Hello "...
Definition EnScript.c:338
const int CALL_CATEGORY_SYSTEM
Definition tools.c:8
int ARGB(int a, int r, int g, int b)
Definition proto.c:322

Referenced by CallQueue::Tick(), multiMap< Class K, Class V >::~multiMap(), and array< TimerBase >::~TimerQueue().

◆ ColorRunButton()

void OnSelected::ColorRunButton ( bool success)
protected

Definition at line 393 of file ScriptConsoleEnfScriptTab.c.

394{
395 protected static ScriptConsoleEnfScriptTab m_Instance;
396 protected int m_EnscriptHistoryRow;
397 protected int m_EnscriptHistoryRowServer;
406 protected bool m_AllowScriptOutput;
407 protected int m_RunColor;
408
410
412 {
413 m_Instance = this;
418 m_EnfScriptEdit = MultilineEditBoxWidget.Cast(root.FindAnyWidget("MultilineEditBoxWidget0"));
419 m_EnfScriptRun = ButtonWidget.Cast(root.FindAnyWidget("RunButton"));
420 m_EnfScriptClear = ButtonWidget.Cast(root.FindAnyWidget("ClearButton"));
421 m_ScriptOutputListbox = TextListboxWidget.Cast(root.FindAnyWidget("ScriptOutputListbox"));
422 m_RunColor = m_EnfScriptRun.GetColor();
423 }
424
426 {
428 }
429
430 override void OnSelected()
431 {
433 if (m_EnscriptConsoleHistory.IsValidIndex(index))
434 {
435 string text = m_EnscriptConsoleHistory.Get(index);
436 m_EnfScriptEdit.SetText(text);
437 }
439 }
440
441 static void PrintS(string message)
442 {
443 Print(message);
444 if (m_Instance)
445 m_Instance.Add(message);
446 }
447
448 static void PrintS(bool message)
449 {
450 PrintS(message.ToString());
451 }
452
453 static void PrintS(int message)
454 {
455 PrintS(message.ToString());
456 }
457
458 static void PrintS(float message)
459 {
460 PrintS(message.ToString());
461 }
462
463 static void PrintS(vector message)
464 {
465 PrintS(message.ToString());
466 }
467
468 static void PrintS(Object message)
469 {
470 PrintS(message.ToString());
471 }
472
473
474 void Add(string message, bool isReload = false)
475 {
476 if (message != string.Empty)
477 {
479 {
480 if (!isReload)
483 m_ScriptOutputListbox.EnsureVisible(m_ScriptOutputListbox.GetNumItems());
484 }
485 }
486 }
487
488 protected void Clear(bool clearFile = false)
489 {
490 if (clearFile)
492 m_ScriptOutputListbox.ClearItems();
493 }
494
495
496 protected void ReloadScriptOutput()
497 {
498 m_ScriptOutputListbox.ClearItems();
499 m_AllowScriptOutput = true;
500 foreach (string s: m_ScriptOutputHistory)
501 Add(s, true);
502 m_AllowScriptOutput = false;
503 }
504
505 void HistoryBack()
506 {
507
509 }
510
511 void HistoryForward()
512 {
514 }
515
516 protected void RunEnscript()
517 {
518#ifdef DEVELOPER
519 string code;
520 m_EnfScriptEdit.GetText(code);
521 string codeNoReplace = code;
523 m_AllowScriptOutput = true;
524 code.Replace("Print(", "ScriptConsoleEnfScriptTab.PrintS(");
525 code.Replace("Print (", "ScriptConsoleEnfScriptTab.PrintS(");
526 bool success = GetGame().ExecuteEnforceScript("void scConsMain() \n{\n" + code + "\n}\n", "scConsMain");
527 m_AllowScriptOutput = false;
529
532#endif
533 }
534
535 protected void ColorRunButton(bool success)
536 {
537 if (success)
538 m_EnfScriptRun.SetColor(ARGB(255, 0, 255, 0));
539 else
540 m_EnfScriptRun.SetColor(ARGB(255, 255, 0, 0));
541 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(ResetRunButtonColor, 600);
542 }
543
544 protected void ResetRunButtonColor()
545 {
546 m_EnfScriptRun.SetColor(m_RunColor);
547 }
548
549 protected void RunEnscriptServer()
550 {
551 string code;
552 m_EnfScriptEdit.GetText(code);
556 GetGame().RPCSingleParam(GetGame().GetPlayer(), ERPCs.DEV_RPC_SERVER_SCRIPT, CachedObjectsParams.PARAM1_STRING, true, GetGame().GetPlayer().GetIdentity());
557 }
558
559 protected void EnscriptHistoryBack()
560 {
561 int history_index;
562 if (m_EnfScriptEdit)
563 {
566 if (history_index > -1)
569 }
570 }
571
572
573 protected void EnscriptHistoryForward()
574 {
575 if (m_EnfScriptEdit)
576 {
577 int history_index;
583 }
584 }
585
586 override void OnRPCEx(int rpc_type, ParamsReadContext ctx)
587 {
588 super.OnRPCEx(rpc_type, ctx);
589#ifdef DIAG_DEVELOPER
590 switch (rpc_type)
591 {
592 case ERPCs.DEV_RPC_SERVER_SCRIPT_RESULT:
593 {
596 break;
597 }
598 }
599#endif
600 }
601
602 override bool OnClick(Widget w, int x, int y, int button)
603 {
604 super.OnClick(w, x, y, button);
605 if (w == m_EnfScriptRun)
606 {
607 RunEnscript();
608 return true;
609 }
610 else if (w == m_EnfScriptClear)
611 {
612 m_ScriptOutputListbox.ClearItems();
613 m_ScriptOutputHistory.Clear();
614 return true;
615 }
616
617 return false;
618 }
619
620 override bool OnChange(Widget w, int x, int y, bool finished)
621 {
622 super.OnChange(w, x, y, finished);
623 return false;
624 }
625
626
627 override void Show(bool show, ScriptConsoleTabBase selectedHandler)
628 {
630 {
631 //do nothing
632 }
633 else
634 {
635 m_Root.Show(show);
636 m_Root.Enable(show);
637 }
638 }
639
640}
641
643{
644 override void OnSelected()
645 {
647 if (m_EnscriptConsoleHistoryServer.IsValidIndex(index))
648 {
650 m_EnfScriptEdit.SetText(text);
651 }
653 }
654
655 override protected void EnscriptHistoryBack()
656 {
657 int history_index;
658 if (m_EnfScriptEdit)
659 {
662 if (history_index > -1)
665 }
666 }
667
668 override protected void EnscriptHistoryForward()
669 {
670 if (m_EnfScriptEdit)
671 {
672 int history_index;
673
679 }
680 }
681
682 override bool OnClick(Widget w, int x, int y, int button)
683 {
684 if (w == m_EnfScriptRun)
685 {
687 return true;
688 }
689 else if (w == m_EnfScriptClear)
690 {
691 m_ScriptOutputListbox.ClearItems();
692 m_ScriptOutputHistory.Clear();
693 return true;
694 }
695
696 return false;
697 }
698
699}

◆ EnscriptHistoryBack()

void EnscriptHistoryBack ( )
protected

Definition at line 417 of file ScriptConsoleEnfScriptTab.c.

418{
419 protected static ScriptConsoleEnfScriptTab m_Instance;
420 protected int m_EnscriptHistoryRow;
421 protected int m_EnscriptHistoryRowServer;
430 protected bool m_AllowScriptOutput;
431 protected int m_RunColor;
432
434
436 {
437 m_Instance = this;
442 m_EnfScriptEdit = MultilineEditBoxWidget.Cast(root.FindAnyWidget("MultilineEditBoxWidget0"));
443 m_EnfScriptRun = ButtonWidget.Cast(root.FindAnyWidget("RunButton"));
444 m_EnfScriptClear = ButtonWidget.Cast(root.FindAnyWidget("ClearButton"));
445 m_ScriptOutputListbox = TextListboxWidget.Cast(root.FindAnyWidget("ScriptOutputListbox"));
446 m_RunColor = m_EnfScriptRun.GetColor();
447 }
448
450 {
452 }
453
454 override void OnSelected()
455 {
457 if (m_EnscriptConsoleHistory.IsValidIndex(index))
458 {
459 string text = m_EnscriptConsoleHistory.Get(index);
460 m_EnfScriptEdit.SetText(text);
461 }
463 }
464
465 static void PrintS(string message)
466 {
467 Print(message);
468 if (m_Instance)
469 m_Instance.Add(message);
470 }
471
472 static void PrintS(bool message)
473 {
474 PrintS(message.ToString());
475 }
476
477 static void PrintS(int message)
478 {
479 PrintS(message.ToString());
480 }
481
482 static void PrintS(float message)
483 {
484 PrintS(message.ToString());
485 }
486
487 static void PrintS(vector message)
488 {
489 PrintS(message.ToString());
490 }
491
492 static void PrintS(Object message)
493 {
494 PrintS(message.ToString());
495 }
496
497
498 void Add(string message, bool isReload = false)
499 {
500 if (message != string.Empty)
501 {
503 {
504 if (!isReload)
507 m_ScriptOutputListbox.EnsureVisible(m_ScriptOutputListbox.GetNumItems());
508 }
509 }
510 }
511
512 protected void Clear(bool clearFile = false)
513 {
514 if (clearFile)
516 m_ScriptOutputListbox.ClearItems();
517 }
518
519
520 protected void ReloadScriptOutput()
521 {
522 m_ScriptOutputListbox.ClearItems();
523 m_AllowScriptOutput = true;
524 foreach (string s: m_ScriptOutputHistory)
525 Add(s, true);
526 m_AllowScriptOutput = false;
527 }
528
529 void HistoryBack()
530 {
531
533 }
534
535 void HistoryForward()
536 {
538 }
539
540 protected void RunEnscript()
541 {
542#ifdef DEVELOPER
543 string code;
544 m_EnfScriptEdit.GetText(code);
545 string codeNoReplace = code;
547 m_AllowScriptOutput = true;
548 code.Replace("Print(", "ScriptConsoleEnfScriptTab.PrintS(");
549 code.Replace("Print (", "ScriptConsoleEnfScriptTab.PrintS(");
550 bool success = GetGame().ExecuteEnforceScript("void scConsMain() \n{\n" + code + "\n}\n", "scConsMain");
551 m_AllowScriptOutput = false;
553
556#endif
557 }
558
559 protected void ColorRunButton(bool success)
560 {
561 if (success)
562 m_EnfScriptRun.SetColor(ARGB(255, 0, 255, 0));
563 else
564 m_EnfScriptRun.SetColor(ARGB(255, 255, 0, 0));
565 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(ResetRunButtonColor, 600);
566 }
567
568 protected void ResetRunButtonColor()
569 {
570 m_EnfScriptRun.SetColor(m_RunColor);
571 }
572
573 protected void RunEnscriptServer()
574 {
575 string code;
576 m_EnfScriptEdit.GetText(code);
580 GetGame().RPCSingleParam(GetGame().GetPlayer(), ERPCs.DEV_RPC_SERVER_SCRIPT, CachedObjectsParams.PARAM1_STRING, true, GetGame().GetPlayer().GetIdentity());
581 }
582
583 protected void EnscriptHistoryBack()
584 {
585 int history_index;
586 if (m_EnfScriptEdit)
587 {
590 if (history_index > -1)
593 }
594 }
595
596
597 protected void EnscriptHistoryForward()
598 {
599 if (m_EnfScriptEdit)
600 {
601 int history_index;
607 }
608 }
609
610 override void OnRPCEx(int rpc_type, ParamsReadContext ctx)
611 {
612 super.OnRPCEx(rpc_type, ctx);
613#ifdef DIAG_DEVELOPER
614 switch (rpc_type)
615 {
616 case ERPCs.DEV_RPC_SERVER_SCRIPT_RESULT:
617 {
620 break;
621 }
622 }
623#endif
624 }
625
626 override bool OnClick(Widget w, int x, int y, int button)
627 {
628 super.OnClick(w, x, y, button);
629 if (w == m_EnfScriptRun)
630 {
631 RunEnscript();
632 return true;
633 }
634 else if (w == m_EnfScriptClear)
635 {
636 m_ScriptOutputListbox.ClearItems();
637 m_ScriptOutputHistory.Clear();
638 return true;
639 }
640
641 return false;
642 }
643
644 override bool OnChange(Widget w, int x, int y, bool finished)
645 {
646 super.OnChange(w, x, y, finished);
647 return false;
648 }
649
650
651 override void Show(bool show, ScriptConsoleTabBase selectedHandler)
652 {
654 {
655 //do nothing
656 }
657 else
658 {
659 m_Root.Show(show);
660 m_Root.Enable(show);
661 }
662 }
663
664}
665
667{
668 override void OnSelected()
669 {
671 if (m_EnscriptConsoleHistoryServer.IsValidIndex(index))
672 {
674 m_EnfScriptEdit.SetText(text);
675 }
677 }
678
679 override protected void EnscriptHistoryBack()
680 {
681 int history_index;
682 if (m_EnfScriptEdit)
683 {
686 if (history_index > -1)
689 }
690 }
691
692 override protected void EnscriptHistoryForward()
693 {
694 if (m_EnfScriptEdit)
695 {
696 int history_index;
697
703 }
704 }
705
706 override bool OnClick(Widget w, int x, int y, int button)
707 {
708 if (w == m_EnfScriptRun)
709 {
711 return true;
712 }
713 else if (w == m_EnfScriptClear)
714 {
715 m_ScriptOutputListbox.ClearItems();
716 m_ScriptOutputHistory.Clear();
717 return true;
718 }
719
720 return false;
721 }
722
723}

◆ EnscriptHistoryForward()

void EnscriptHistoryForward ( )
protected

Definition at line 431 of file ScriptConsoleEnfScriptTab.c.

432{
433 protected static ScriptConsoleEnfScriptTab m_Instance;
434 protected int m_EnscriptHistoryRow;
435 protected int m_EnscriptHistoryRowServer;
444 protected bool m_AllowScriptOutput;
445 protected int m_RunColor;
446
448
450 {
451 m_Instance = this;
456 m_EnfScriptEdit = MultilineEditBoxWidget.Cast(root.FindAnyWidget("MultilineEditBoxWidget0"));
457 m_EnfScriptRun = ButtonWidget.Cast(root.FindAnyWidget("RunButton"));
458 m_EnfScriptClear = ButtonWidget.Cast(root.FindAnyWidget("ClearButton"));
459 m_ScriptOutputListbox = TextListboxWidget.Cast(root.FindAnyWidget("ScriptOutputListbox"));
460 m_RunColor = m_EnfScriptRun.GetColor();
461 }
462
464 {
466 }
467
468 override void OnSelected()
469 {
471 if (m_EnscriptConsoleHistory.IsValidIndex(index))
472 {
473 string text = m_EnscriptConsoleHistory.Get(index);
474 m_EnfScriptEdit.SetText(text);
475 }
477 }
478
479 static void PrintS(string message)
480 {
481 Print(message);
482 if (m_Instance)
483 m_Instance.Add(message);
484 }
485
486 static void PrintS(bool message)
487 {
488 PrintS(message.ToString());
489 }
490
491 static void PrintS(int message)
492 {
493 PrintS(message.ToString());
494 }
495
496 static void PrintS(float message)
497 {
498 PrintS(message.ToString());
499 }
500
501 static void PrintS(vector message)
502 {
503 PrintS(message.ToString());
504 }
505
506 static void PrintS(Object message)
507 {
508 PrintS(message.ToString());
509 }
510
511
512 void Add(string message, bool isReload = false)
513 {
514 if (message != string.Empty)
515 {
517 {
518 if (!isReload)
521 m_ScriptOutputListbox.EnsureVisible(m_ScriptOutputListbox.GetNumItems());
522 }
523 }
524 }
525
526 protected void Clear(bool clearFile = false)
527 {
528 if (clearFile)
530 m_ScriptOutputListbox.ClearItems();
531 }
532
533
534 protected void ReloadScriptOutput()
535 {
536 m_ScriptOutputListbox.ClearItems();
537 m_AllowScriptOutput = true;
538 foreach (string s: m_ScriptOutputHistory)
539 Add(s, true);
540 m_AllowScriptOutput = false;
541 }
542
543 void HistoryBack()
544 {
545
547 }
548
549 void HistoryForward()
550 {
552 }
553
554 protected void RunEnscript()
555 {
556#ifdef DEVELOPER
557 string code;
558 m_EnfScriptEdit.GetText(code);
559 string codeNoReplace = code;
561 m_AllowScriptOutput = true;
562 code.Replace("Print(", "ScriptConsoleEnfScriptTab.PrintS(");
563 code.Replace("Print (", "ScriptConsoleEnfScriptTab.PrintS(");
564 bool success = GetGame().ExecuteEnforceScript("void scConsMain() \n{\n" + code + "\n}\n", "scConsMain");
565 m_AllowScriptOutput = false;
567
570#endif
571 }
572
573 protected void ColorRunButton(bool success)
574 {
575 if (success)
576 m_EnfScriptRun.SetColor(ARGB(255, 0, 255, 0));
577 else
578 m_EnfScriptRun.SetColor(ARGB(255, 255, 0, 0));
579 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(ResetRunButtonColor, 600);
580 }
581
582 protected void ResetRunButtonColor()
583 {
584 m_EnfScriptRun.SetColor(m_RunColor);
585 }
586
587 protected void RunEnscriptServer()
588 {
589 string code;
590 m_EnfScriptEdit.GetText(code);
594 GetGame().RPCSingleParam(GetGame().GetPlayer(), ERPCs.DEV_RPC_SERVER_SCRIPT, CachedObjectsParams.PARAM1_STRING, true, GetGame().GetPlayer().GetIdentity());
595 }
596
597 protected void EnscriptHistoryBack()
598 {
599 int history_index;
600 if (m_EnfScriptEdit)
601 {
604 if (history_index > -1)
607 }
608 }
609
610
611 protected void EnscriptHistoryForward()
612 {
613 if (m_EnfScriptEdit)
614 {
615 int history_index;
621 }
622 }
623
624 override void OnRPCEx(int rpc_type, ParamsReadContext ctx)
625 {
626 super.OnRPCEx(rpc_type, ctx);
627#ifdef DIAG_DEVELOPER
628 switch (rpc_type)
629 {
630 case ERPCs.DEV_RPC_SERVER_SCRIPT_RESULT:
631 {
634 break;
635 }
636 }
637#endif
638 }
639
640 override bool OnClick(Widget w, int x, int y, int button)
641 {
642 super.OnClick(w, x, y, button);
643 if (w == m_EnfScriptRun)
644 {
645 RunEnscript();
646 return true;
647 }
648 else if (w == m_EnfScriptClear)
649 {
650 m_ScriptOutputListbox.ClearItems();
651 m_ScriptOutputHistory.Clear();
652 return true;
653 }
654
655 return false;
656 }
657
658 override bool OnChange(Widget w, int x, int y, bool finished)
659 {
660 super.OnChange(w, x, y, finished);
661 return false;
662 }
663
664
665 override void Show(bool show, ScriptConsoleTabBase selectedHandler)
666 {
668 {
669 //do nothing
670 }
671 else
672 {
673 m_Root.Show(show);
674 m_Root.Enable(show);
675 }
676 }
677
678}
679
681{
682 override void OnSelected()
683 {
685 if (m_EnscriptConsoleHistoryServer.IsValidIndex(index))
686 {
688 m_EnfScriptEdit.SetText(text);
689 }
691 }
692
693 override protected void EnscriptHistoryBack()
694 {
695 int history_index;
696 if (m_EnfScriptEdit)
697 {
700 if (history_index > -1)
703 }
704 }
705
706 override protected void EnscriptHistoryForward()
707 {
708 if (m_EnfScriptEdit)
709 {
710 int history_index;
711
717 }
718 }
719
720 override bool OnClick(Widget w, int x, int y, int button)
721 {
722 if (w == m_EnfScriptRun)
723 {
725 return true;
726 }
727 else if (w == m_EnfScriptClear)
728 {
729 m_ScriptOutputListbox.ClearItems();
730 m_ScriptOutputHistory.Clear();
731 return true;
732 }
733
734 return false;
735 }
736
737}

◆ HistoryBack()

void OnSelected::HistoryBack ( )
protected

Definition at line 363 of file ScriptConsoleEnfScriptTab.c.

364{
365 protected static ScriptConsoleEnfScriptTab m_Instance;
366 protected int m_EnscriptHistoryRow;
367 protected int m_EnscriptHistoryRowServer;
376 protected bool m_AllowScriptOutput;
377 protected int m_RunColor;
378
380
382 {
383 m_Instance = this;
388 m_EnfScriptEdit = MultilineEditBoxWidget.Cast(root.FindAnyWidget("MultilineEditBoxWidget0"));
389 m_EnfScriptRun = ButtonWidget.Cast(root.FindAnyWidget("RunButton"));
390 m_EnfScriptClear = ButtonWidget.Cast(root.FindAnyWidget("ClearButton"));
391 m_ScriptOutputListbox = TextListboxWidget.Cast(root.FindAnyWidget("ScriptOutputListbox"));
392 m_RunColor = m_EnfScriptRun.GetColor();
393 }
394
396 {
398 }
399
400 override void OnSelected()
401 {
403 if (m_EnscriptConsoleHistory.IsValidIndex(index))
404 {
405 string text = m_EnscriptConsoleHistory.Get(index);
406 m_EnfScriptEdit.SetText(text);
407 }
409 }
410
411 static void PrintS(string message)
412 {
413 Print(message);
414 if (m_Instance)
415 m_Instance.Add(message);
416 }
417
418 static void PrintS(bool message)
419 {
420 PrintS(message.ToString());
421 }
422
423 static void PrintS(int message)
424 {
425 PrintS(message.ToString());
426 }
427
428 static void PrintS(float message)
429 {
430 PrintS(message.ToString());
431 }
432
433 static void PrintS(vector message)
434 {
435 PrintS(message.ToString());
436 }
437
438 static void PrintS(Object message)
439 {
440 PrintS(message.ToString());
441 }
442
443
444 void Add(string message, bool isReload = false)
445 {
446 if (message != string.Empty)
447 {
449 {
450 if (!isReload)
453 m_ScriptOutputListbox.EnsureVisible(m_ScriptOutputListbox.GetNumItems());
454 }
455 }
456 }
457
458 protected void Clear(bool clearFile = false)
459 {
460 if (clearFile)
462 m_ScriptOutputListbox.ClearItems();
463 }
464
465
466 protected void ReloadScriptOutput()
467 {
468 m_ScriptOutputListbox.ClearItems();
469 m_AllowScriptOutput = true;
470 foreach (string s: m_ScriptOutputHistory)
471 Add(s, true);
472 m_AllowScriptOutput = false;
473 }
474
475 void HistoryBack()
476 {
477
479 }
480
481 void HistoryForward()
482 {
484 }
485
486 protected void RunEnscript()
487 {
488#ifdef DEVELOPER
489 string code;
490 m_EnfScriptEdit.GetText(code);
491 string codeNoReplace = code;
493 m_AllowScriptOutput = true;
494 code.Replace("Print(", "ScriptConsoleEnfScriptTab.PrintS(");
495 code.Replace("Print (", "ScriptConsoleEnfScriptTab.PrintS(");
496 bool success = GetGame().ExecuteEnforceScript("void scConsMain() \n{\n" + code + "\n}\n", "scConsMain");
497 m_AllowScriptOutput = false;
499
502#endif
503 }
504
505 protected void ColorRunButton(bool success)
506 {
507 if (success)
508 m_EnfScriptRun.SetColor(ARGB(255, 0, 255, 0));
509 else
510 m_EnfScriptRun.SetColor(ARGB(255, 255, 0, 0));
511 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(ResetRunButtonColor, 600);
512 }
513
514 protected void ResetRunButtonColor()
515 {
516 m_EnfScriptRun.SetColor(m_RunColor);
517 }
518
519 protected void RunEnscriptServer()
520 {
521 string code;
522 m_EnfScriptEdit.GetText(code);
526 GetGame().RPCSingleParam(GetGame().GetPlayer(), ERPCs.DEV_RPC_SERVER_SCRIPT, CachedObjectsParams.PARAM1_STRING, true, GetGame().GetPlayer().GetIdentity());
527 }
528
529 protected void EnscriptHistoryBack()
530 {
531 int history_index;
532 if (m_EnfScriptEdit)
533 {
536 if (history_index > -1)
539 }
540 }
541
542
543 protected void EnscriptHistoryForward()
544 {
545 if (m_EnfScriptEdit)
546 {
547 int history_index;
553 }
554 }
555
556 override void OnRPCEx(int rpc_type, ParamsReadContext ctx)
557 {
558 super.OnRPCEx(rpc_type, ctx);
559#ifdef DIAG_DEVELOPER
560 switch (rpc_type)
561 {
562 case ERPCs.DEV_RPC_SERVER_SCRIPT_RESULT:
563 {
566 break;
567 }
568 }
569#endif
570 }
571
572 override bool OnClick(Widget w, int x, int y, int button)
573 {
574 super.OnClick(w, x, y, button);
575 if (w == m_EnfScriptRun)
576 {
577 RunEnscript();
578 return true;
579 }
580 else if (w == m_EnfScriptClear)
581 {
582 m_ScriptOutputListbox.ClearItems();
583 m_ScriptOutputHistory.Clear();
584 return true;
585 }
586
587 return false;
588 }
589
590 override bool OnChange(Widget w, int x, int y, bool finished)
591 {
592 super.OnChange(w, x, y, finished);
593 return false;
594 }
595
596
597 override void Show(bool show, ScriptConsoleTabBase selectedHandler)
598 {
600 {
601 //do nothing
602 }
603 else
604 {
605 m_Root.Show(show);
606 m_Root.Enable(show);
607 }
608 }
609
610}
611
613{
614 override void OnSelected()
615 {
617 if (m_EnscriptConsoleHistoryServer.IsValidIndex(index))
618 {
620 m_EnfScriptEdit.SetText(text);
621 }
623 }
624
625 override protected void EnscriptHistoryBack()
626 {
627 int history_index;
628 if (m_EnfScriptEdit)
629 {
632 if (history_index > -1)
635 }
636 }
637
638 override protected void EnscriptHistoryForward()
639 {
640 if (m_EnfScriptEdit)
641 {
642 int history_index;
643
649 }
650 }
651
652 override bool OnClick(Widget w, int x, int y, int button)
653 {
654 if (w == m_EnfScriptRun)
655 {
657 return true;
658 }
659 else if (w == m_EnfScriptClear)
660 {
661 m_ScriptOutputListbox.ClearItems();
662 m_ScriptOutputHistory.Clear();
663 return true;
664 }
665
666 return false;
667 }
668
669}

◆ HistoryForward()

void OnSelected::HistoryForward ( )
protected

Definition at line 369 of file ScriptConsoleEnfScriptTab.c.

370{
371 protected static ScriptConsoleEnfScriptTab m_Instance;
372 protected int m_EnscriptHistoryRow;
373 protected int m_EnscriptHistoryRowServer;
382 protected bool m_AllowScriptOutput;
383 protected int m_RunColor;
384
386
388 {
389 m_Instance = this;
394 m_EnfScriptEdit = MultilineEditBoxWidget.Cast(root.FindAnyWidget("MultilineEditBoxWidget0"));
395 m_EnfScriptRun = ButtonWidget.Cast(root.FindAnyWidget("RunButton"));
396 m_EnfScriptClear = ButtonWidget.Cast(root.FindAnyWidget("ClearButton"));
397 m_ScriptOutputListbox = TextListboxWidget.Cast(root.FindAnyWidget("ScriptOutputListbox"));
398 m_RunColor = m_EnfScriptRun.GetColor();
399 }
400
402 {
404 }
405
406 override void OnSelected()
407 {
409 if (m_EnscriptConsoleHistory.IsValidIndex(index))
410 {
411 string text = m_EnscriptConsoleHistory.Get(index);
412 m_EnfScriptEdit.SetText(text);
413 }
415 }
416
417 static void PrintS(string message)
418 {
419 Print(message);
420 if (m_Instance)
421 m_Instance.Add(message);
422 }
423
424 static void PrintS(bool message)
425 {
426 PrintS(message.ToString());
427 }
428
429 static void PrintS(int message)
430 {
431 PrintS(message.ToString());
432 }
433
434 static void PrintS(float message)
435 {
436 PrintS(message.ToString());
437 }
438
439 static void PrintS(vector message)
440 {
441 PrintS(message.ToString());
442 }
443
444 static void PrintS(Object message)
445 {
446 PrintS(message.ToString());
447 }
448
449
450 void Add(string message, bool isReload = false)
451 {
452 if (message != string.Empty)
453 {
455 {
456 if (!isReload)
459 m_ScriptOutputListbox.EnsureVisible(m_ScriptOutputListbox.GetNumItems());
460 }
461 }
462 }
463
464 protected void Clear(bool clearFile = false)
465 {
466 if (clearFile)
468 m_ScriptOutputListbox.ClearItems();
469 }
470
471
472 protected void ReloadScriptOutput()
473 {
474 m_ScriptOutputListbox.ClearItems();
475 m_AllowScriptOutput = true;
476 foreach (string s: m_ScriptOutputHistory)
477 Add(s, true);
478 m_AllowScriptOutput = false;
479 }
480
481 void HistoryBack()
482 {
483
485 }
486
487 void HistoryForward()
488 {
490 }
491
492 protected void RunEnscript()
493 {
494#ifdef DEVELOPER
495 string code;
496 m_EnfScriptEdit.GetText(code);
497 string codeNoReplace = code;
499 m_AllowScriptOutput = true;
500 code.Replace("Print(", "ScriptConsoleEnfScriptTab.PrintS(");
501 code.Replace("Print (", "ScriptConsoleEnfScriptTab.PrintS(");
502 bool success = GetGame().ExecuteEnforceScript("void scConsMain() \n{\n" + code + "\n}\n", "scConsMain");
503 m_AllowScriptOutput = false;
505
508#endif
509 }
510
511 protected void ColorRunButton(bool success)
512 {
513 if (success)
514 m_EnfScriptRun.SetColor(ARGB(255, 0, 255, 0));
515 else
516 m_EnfScriptRun.SetColor(ARGB(255, 255, 0, 0));
517 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(ResetRunButtonColor, 600);
518 }
519
520 protected void ResetRunButtonColor()
521 {
522 m_EnfScriptRun.SetColor(m_RunColor);
523 }
524
525 protected void RunEnscriptServer()
526 {
527 string code;
528 m_EnfScriptEdit.GetText(code);
532 GetGame().RPCSingleParam(GetGame().GetPlayer(), ERPCs.DEV_RPC_SERVER_SCRIPT, CachedObjectsParams.PARAM1_STRING, true, GetGame().GetPlayer().GetIdentity());
533 }
534
535 protected void EnscriptHistoryBack()
536 {
537 int history_index;
538 if (m_EnfScriptEdit)
539 {
542 if (history_index > -1)
545 }
546 }
547
548
549 protected void EnscriptHistoryForward()
550 {
551 if (m_EnfScriptEdit)
552 {
553 int history_index;
559 }
560 }
561
562 override void OnRPCEx(int rpc_type, ParamsReadContext ctx)
563 {
564 super.OnRPCEx(rpc_type, ctx);
565#ifdef DIAG_DEVELOPER
566 switch (rpc_type)
567 {
568 case ERPCs.DEV_RPC_SERVER_SCRIPT_RESULT:
569 {
572 break;
573 }
574 }
575#endif
576 }
577
578 override bool OnClick(Widget w, int x, int y, int button)
579 {
580 super.OnClick(w, x, y, button);
581 if (w == m_EnfScriptRun)
582 {
583 RunEnscript();
584 return true;
585 }
586 else if (w == m_EnfScriptClear)
587 {
588 m_ScriptOutputListbox.ClearItems();
589 m_ScriptOutputHistory.Clear();
590 return true;
591 }
592
593 return false;
594 }
595
596 override bool OnChange(Widget w, int x, int y, bool finished)
597 {
598 super.OnChange(w, x, y, finished);
599 return false;
600 }
601
602
603 override void Show(bool show, ScriptConsoleTabBase selectedHandler)
604 {
606 {
607 //do nothing
608 }
609 else
610 {
611 m_Root.Show(show);
612 m_Root.Enable(show);
613 }
614 }
615
616}
617
619{
620 override void OnSelected()
621 {
623 if (m_EnscriptConsoleHistoryServer.IsValidIndex(index))
624 {
626 m_EnfScriptEdit.SetText(text);
627 }
629 }
630
631 override protected void EnscriptHistoryBack()
632 {
633 int history_index;
634 if (m_EnfScriptEdit)
635 {
638 if (history_index > -1)
641 }
642 }
643
644 override protected void EnscriptHistoryForward()
645 {
646 if (m_EnfScriptEdit)
647 {
648 int history_index;
649
655 }
656 }
657
658 override bool OnClick(Widget w, int x, int y, int button)
659 {
660 if (w == m_EnfScriptRun)
661 {
663 return true;
664 }
665 else if (w == m_EnfScriptClear)
666 {
667 m_ScriptOutputListbox.ClearItems();
668 m_ScriptOutputHistory.Clear();
669 return true;
670 }
671
672 return false;
673 }
674
675}

◆ OnChange()

override bool OnSelected::OnChange ( Widget w,
int x,
int y,
bool finished )
protected

Definition at line 478 of file ScriptConsoleEnfScriptTab.c.

479{
480 protected static ScriptConsoleEnfScriptTab m_Instance;
481 protected int m_EnscriptHistoryRow;
482 protected int m_EnscriptHistoryRowServer;
491 protected bool m_AllowScriptOutput;
492 protected int m_RunColor;
493
495
497 {
498 m_Instance = this;
503 m_EnfScriptEdit = MultilineEditBoxWidget.Cast(root.FindAnyWidget("MultilineEditBoxWidget0"));
504 m_EnfScriptRun = ButtonWidget.Cast(root.FindAnyWidget("RunButton"));
505 m_EnfScriptClear = ButtonWidget.Cast(root.FindAnyWidget("ClearButton"));
506 m_ScriptOutputListbox = TextListboxWidget.Cast(root.FindAnyWidget("ScriptOutputListbox"));
507 m_RunColor = m_EnfScriptRun.GetColor();
508 }
509
511 {
513 }
514
515 override void OnSelected()
516 {
518 if (m_EnscriptConsoleHistory.IsValidIndex(index))
519 {
520 string text = m_EnscriptConsoleHistory.Get(index);
521 m_EnfScriptEdit.SetText(text);
522 }
524 }
525
526 static void PrintS(string message)
527 {
528 Print(message);
529 if (m_Instance)
530 m_Instance.Add(message);
531 }
532
533 static void PrintS(bool message)
534 {
535 PrintS(message.ToString());
536 }
537
538 static void PrintS(int message)
539 {
540 PrintS(message.ToString());
541 }
542
543 static void PrintS(float message)
544 {
545 PrintS(message.ToString());
546 }
547
548 static void PrintS(vector message)
549 {
550 PrintS(message.ToString());
551 }
552
553 static void PrintS(Object message)
554 {
555 PrintS(message.ToString());
556 }
557
558
559 void Add(string message, bool isReload = false)
560 {
561 if (message != string.Empty)
562 {
564 {
565 if (!isReload)
568 m_ScriptOutputListbox.EnsureVisible(m_ScriptOutputListbox.GetNumItems());
569 }
570 }
571 }
572
573 protected void Clear(bool clearFile = false)
574 {
575 if (clearFile)
577 m_ScriptOutputListbox.ClearItems();
578 }
579
580
581 protected void ReloadScriptOutput()
582 {
583 m_ScriptOutputListbox.ClearItems();
584 m_AllowScriptOutput = true;
585 foreach (string s: m_ScriptOutputHistory)
586 Add(s, true);
587 m_AllowScriptOutput = false;
588 }
589
590 void HistoryBack()
591 {
592
594 }
595
596 void HistoryForward()
597 {
599 }
600
601 protected void RunEnscript()
602 {
603#ifdef DEVELOPER
604 string code;
605 m_EnfScriptEdit.GetText(code);
606 string codeNoReplace = code;
608 m_AllowScriptOutput = true;
609 code.Replace("Print(", "ScriptConsoleEnfScriptTab.PrintS(");
610 code.Replace("Print (", "ScriptConsoleEnfScriptTab.PrintS(");
611 bool success = GetGame().ExecuteEnforceScript("void scConsMain() \n{\n" + code + "\n}\n", "scConsMain");
612 m_AllowScriptOutput = false;
614
617#endif
618 }
619
620 protected void ColorRunButton(bool success)
621 {
622 if (success)
623 m_EnfScriptRun.SetColor(ARGB(255, 0, 255, 0));
624 else
625 m_EnfScriptRun.SetColor(ARGB(255, 255, 0, 0));
626 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(ResetRunButtonColor, 600);
627 }
628
629 protected void ResetRunButtonColor()
630 {
631 m_EnfScriptRun.SetColor(m_RunColor);
632 }
633
634 protected void RunEnscriptServer()
635 {
636 string code;
637 m_EnfScriptEdit.GetText(code);
641 GetGame().RPCSingleParam(GetGame().GetPlayer(), ERPCs.DEV_RPC_SERVER_SCRIPT, CachedObjectsParams.PARAM1_STRING, true, GetGame().GetPlayer().GetIdentity());
642 }
643
644 protected void EnscriptHistoryBack()
645 {
646 int history_index;
647 if (m_EnfScriptEdit)
648 {
651 if (history_index > -1)
654 }
655 }
656
657
658 protected void EnscriptHistoryForward()
659 {
660 if (m_EnfScriptEdit)
661 {
662 int history_index;
668 }
669 }
670
671 override void OnRPCEx(int rpc_type, ParamsReadContext ctx)
672 {
673 super.OnRPCEx(rpc_type, ctx);
674#ifdef DIAG_DEVELOPER
675 switch (rpc_type)
676 {
677 case ERPCs.DEV_RPC_SERVER_SCRIPT_RESULT:
678 {
681 break;
682 }
683 }
684#endif
685 }
686
687 override bool OnClick(Widget w, int x, int y, int button)
688 {
689 super.OnClick(w, x, y, button);
690 if (w == m_EnfScriptRun)
691 {
692 RunEnscript();
693 return true;
694 }
695 else if (w == m_EnfScriptClear)
696 {
697 m_ScriptOutputListbox.ClearItems();
698 m_ScriptOutputHistory.Clear();
699 return true;
700 }
701
702 return false;
703 }
704
705 override bool OnChange(Widget w, int x, int y, bool finished)
706 {
707 super.OnChange(w, x, y, finished);
708 return false;
709 }
710
711
712 override void Show(bool show, ScriptConsoleTabBase selectedHandler)
713 {
715 {
716 //do nothing
717 }
718 else
719 {
720 m_Root.Show(show);
721 m_Root.Enable(show);
722 }
723 }
724
725}
726
728{
729 override void OnSelected()
730 {
732 if (m_EnscriptConsoleHistoryServer.IsValidIndex(index))
733 {
735 m_EnfScriptEdit.SetText(text);
736 }
738 }
739
740 override protected void EnscriptHistoryBack()
741 {
742 int history_index;
743 if (m_EnfScriptEdit)
744 {
747 if (history_index > -1)
750 }
751 }
752
753 override protected void EnscriptHistoryForward()
754 {
755 if (m_EnfScriptEdit)
756 {
757 int history_index;
758
764 }
765 }
766
767 override bool OnClick(Widget w, int x, int y, int button)
768 {
769 if (w == m_EnfScriptRun)
770 {
772 return true;
773 }
774 else if (w == m_EnfScriptClear)
775 {
776 m_ScriptOutputListbox.ClearItems();
777 m_ScriptOutputHistory.Clear();
778 return true;
779 }
780
781 return false;
782 }
783
784}

◆ OnClick()

override bool OnSelected::OnClick ( Widget w,
int x,
int y,
int button )
protected

Definition at line 460 of file ScriptConsoleEnfScriptTab.c.

461{
462 protected static ScriptConsoleEnfScriptTab m_Instance;
463 protected int m_EnscriptHistoryRow;
464 protected int m_EnscriptHistoryRowServer;
473 protected bool m_AllowScriptOutput;
474 protected int m_RunColor;
475
477
479 {
480 m_Instance = this;
485 m_EnfScriptEdit = MultilineEditBoxWidget.Cast(root.FindAnyWidget("MultilineEditBoxWidget0"));
486 m_EnfScriptRun = ButtonWidget.Cast(root.FindAnyWidget("RunButton"));
487 m_EnfScriptClear = ButtonWidget.Cast(root.FindAnyWidget("ClearButton"));
488 m_ScriptOutputListbox = TextListboxWidget.Cast(root.FindAnyWidget("ScriptOutputListbox"));
489 m_RunColor = m_EnfScriptRun.GetColor();
490 }
491
493 {
495 }
496
497 override void OnSelected()
498 {
500 if (m_EnscriptConsoleHistory.IsValidIndex(index))
501 {
502 string text = m_EnscriptConsoleHistory.Get(index);
503 m_EnfScriptEdit.SetText(text);
504 }
506 }
507
508 static void PrintS(string message)
509 {
510 Print(message);
511 if (m_Instance)
512 m_Instance.Add(message);
513 }
514
515 static void PrintS(bool message)
516 {
517 PrintS(message.ToString());
518 }
519
520 static void PrintS(int message)
521 {
522 PrintS(message.ToString());
523 }
524
525 static void PrintS(float message)
526 {
527 PrintS(message.ToString());
528 }
529
530 static void PrintS(vector message)
531 {
532 PrintS(message.ToString());
533 }
534
535 static void PrintS(Object message)
536 {
537 PrintS(message.ToString());
538 }
539
540
541 void Add(string message, bool isReload = false)
542 {
543 if (message != string.Empty)
544 {
546 {
547 if (!isReload)
550 m_ScriptOutputListbox.EnsureVisible(m_ScriptOutputListbox.GetNumItems());
551 }
552 }
553 }
554
555 protected void Clear(bool clearFile = false)
556 {
557 if (clearFile)
559 m_ScriptOutputListbox.ClearItems();
560 }
561
562
563 protected void ReloadScriptOutput()
564 {
565 m_ScriptOutputListbox.ClearItems();
566 m_AllowScriptOutput = true;
567 foreach (string s: m_ScriptOutputHistory)
568 Add(s, true);
569 m_AllowScriptOutput = false;
570 }
571
572 void HistoryBack()
573 {
574
576 }
577
578 void HistoryForward()
579 {
581 }
582
583 protected void RunEnscript()
584 {
585#ifdef DEVELOPER
586 string code;
587 m_EnfScriptEdit.GetText(code);
588 string codeNoReplace = code;
590 m_AllowScriptOutput = true;
591 code.Replace("Print(", "ScriptConsoleEnfScriptTab.PrintS(");
592 code.Replace("Print (", "ScriptConsoleEnfScriptTab.PrintS(");
593 bool success = GetGame().ExecuteEnforceScript("void scConsMain() \n{\n" + code + "\n}\n", "scConsMain");
594 m_AllowScriptOutput = false;
596
599#endif
600 }
601
602 protected void ColorRunButton(bool success)
603 {
604 if (success)
605 m_EnfScriptRun.SetColor(ARGB(255, 0, 255, 0));
606 else
607 m_EnfScriptRun.SetColor(ARGB(255, 255, 0, 0));
608 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(ResetRunButtonColor, 600);
609 }
610
611 protected void ResetRunButtonColor()
612 {
613 m_EnfScriptRun.SetColor(m_RunColor);
614 }
615
616 protected void RunEnscriptServer()
617 {
618 string code;
619 m_EnfScriptEdit.GetText(code);
623 GetGame().RPCSingleParam(GetGame().GetPlayer(), ERPCs.DEV_RPC_SERVER_SCRIPT, CachedObjectsParams.PARAM1_STRING, true, GetGame().GetPlayer().GetIdentity());
624 }
625
626 protected void EnscriptHistoryBack()
627 {
628 int history_index;
629 if (m_EnfScriptEdit)
630 {
633 if (history_index > -1)
636 }
637 }
638
639
640 protected void EnscriptHistoryForward()
641 {
642 if (m_EnfScriptEdit)
643 {
644 int history_index;
650 }
651 }
652
653 override void OnRPCEx(int rpc_type, ParamsReadContext ctx)
654 {
655 super.OnRPCEx(rpc_type, ctx);
656#ifdef DIAG_DEVELOPER
657 switch (rpc_type)
658 {
659 case ERPCs.DEV_RPC_SERVER_SCRIPT_RESULT:
660 {
663 break;
664 }
665 }
666#endif
667 }
668
669 override bool OnClick(Widget w, int x, int y, int button)
670 {
671 super.OnClick(w, x, y, button);
672 if (w == m_EnfScriptRun)
673 {
674 RunEnscript();
675 return true;
676 }
677 else if (w == m_EnfScriptClear)
678 {
679 m_ScriptOutputListbox.ClearItems();
680 m_ScriptOutputHistory.Clear();
681 return true;
682 }
683
684 return false;
685 }
686
687 override bool OnChange(Widget w, int x, int y, bool finished)
688 {
689 super.OnChange(w, x, y, finished);
690 return false;
691 }
692
693
694 override void Show(bool show, ScriptConsoleTabBase selectedHandler)
695 {
697 {
698 //do nothing
699 }
700 else
701 {
702 m_Root.Show(show);
703 m_Root.Enable(show);
704 }
705 }
706
707}
708
710{
711 override void OnSelected()
712 {
714 if (m_EnscriptConsoleHistoryServer.IsValidIndex(index))
715 {
717 m_EnfScriptEdit.SetText(text);
718 }
720 }
721
722 override protected void EnscriptHistoryBack()
723 {
724 int history_index;
725 if (m_EnfScriptEdit)
726 {
729 if (history_index > -1)
732 }
733 }
734
735 override protected void EnscriptHistoryForward()
736 {
737 if (m_EnfScriptEdit)
738 {
739 int history_index;
740
746 }
747 }
748
749 override bool OnClick(Widget w, int x, int y, int button)
750 {
751 if (w == m_EnfScriptRun)
752 {
754 return true;
755 }
756 else if (w == m_EnfScriptClear)
757 {
758 m_ScriptOutputListbox.ClearItems();
759 m_ScriptOutputHistory.Clear();
760 return true;
761 }
762
763 return false;
764 }
765
766}

◆ OnRPCEx()

override void OnSelected::OnRPCEx ( int rpc_type,
ParamsReadContext ctx )
protected

Definition at line 444 of file ScriptConsoleEnfScriptTab.c.

445{
446 protected static ScriptConsoleEnfScriptTab m_Instance;
447 protected int m_EnscriptHistoryRow;
448 protected int m_EnscriptHistoryRowServer;
457 protected bool m_AllowScriptOutput;
458 protected int m_RunColor;
459
461
463 {
464 m_Instance = this;
469 m_EnfScriptEdit = MultilineEditBoxWidget.Cast(root.FindAnyWidget("MultilineEditBoxWidget0"));
470 m_EnfScriptRun = ButtonWidget.Cast(root.FindAnyWidget("RunButton"));
471 m_EnfScriptClear = ButtonWidget.Cast(root.FindAnyWidget("ClearButton"));
472 m_ScriptOutputListbox = TextListboxWidget.Cast(root.FindAnyWidget("ScriptOutputListbox"));
473 m_RunColor = m_EnfScriptRun.GetColor();
474 }
475
477 {
479 }
480
481 override void OnSelected()
482 {
484 if (m_EnscriptConsoleHistory.IsValidIndex(index))
485 {
486 string text = m_EnscriptConsoleHistory.Get(index);
487 m_EnfScriptEdit.SetText(text);
488 }
490 }
491
492 static void PrintS(string message)
493 {
494 Print(message);
495 if (m_Instance)
496 m_Instance.Add(message);
497 }
498
499 static void PrintS(bool message)
500 {
501 PrintS(message.ToString());
502 }
503
504 static void PrintS(int message)
505 {
506 PrintS(message.ToString());
507 }
508
509 static void PrintS(float message)
510 {
511 PrintS(message.ToString());
512 }
513
514 static void PrintS(vector message)
515 {
516 PrintS(message.ToString());
517 }
518
519 static void PrintS(Object message)
520 {
521 PrintS(message.ToString());
522 }
523
524
525 void Add(string message, bool isReload = false)
526 {
527 if (message != string.Empty)
528 {
530 {
531 if (!isReload)
534 m_ScriptOutputListbox.EnsureVisible(m_ScriptOutputListbox.GetNumItems());
535 }
536 }
537 }
538
539 protected void Clear(bool clearFile = false)
540 {
541 if (clearFile)
543 m_ScriptOutputListbox.ClearItems();
544 }
545
546
547 protected void ReloadScriptOutput()
548 {
549 m_ScriptOutputListbox.ClearItems();
550 m_AllowScriptOutput = true;
551 foreach (string s: m_ScriptOutputHistory)
552 Add(s, true);
553 m_AllowScriptOutput = false;
554 }
555
556 void HistoryBack()
557 {
558
560 }
561
562 void HistoryForward()
563 {
565 }
566
567 protected void RunEnscript()
568 {
569#ifdef DEVELOPER
570 string code;
571 m_EnfScriptEdit.GetText(code);
572 string codeNoReplace = code;
574 m_AllowScriptOutput = true;
575 code.Replace("Print(", "ScriptConsoleEnfScriptTab.PrintS(");
576 code.Replace("Print (", "ScriptConsoleEnfScriptTab.PrintS(");
577 bool success = GetGame().ExecuteEnforceScript("void scConsMain() \n{\n" + code + "\n}\n", "scConsMain");
578 m_AllowScriptOutput = false;
580
583#endif
584 }
585
586 protected void ColorRunButton(bool success)
587 {
588 if (success)
589 m_EnfScriptRun.SetColor(ARGB(255, 0, 255, 0));
590 else
591 m_EnfScriptRun.SetColor(ARGB(255, 255, 0, 0));
592 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(ResetRunButtonColor, 600);
593 }
594
595 protected void ResetRunButtonColor()
596 {
597 m_EnfScriptRun.SetColor(m_RunColor);
598 }
599
600 protected void RunEnscriptServer()
601 {
602 string code;
603 m_EnfScriptEdit.GetText(code);
607 GetGame().RPCSingleParam(GetGame().GetPlayer(), ERPCs.DEV_RPC_SERVER_SCRIPT, CachedObjectsParams.PARAM1_STRING, true, GetGame().GetPlayer().GetIdentity());
608 }
609
610 protected void EnscriptHistoryBack()
611 {
612 int history_index;
613 if (m_EnfScriptEdit)
614 {
617 if (history_index > -1)
620 }
621 }
622
623
624 protected void EnscriptHistoryForward()
625 {
626 if (m_EnfScriptEdit)
627 {
628 int history_index;
634 }
635 }
636
637 override void OnRPCEx(int rpc_type, ParamsReadContext ctx)
638 {
639 super.OnRPCEx(rpc_type, ctx);
640#ifdef DIAG_DEVELOPER
641 switch (rpc_type)
642 {
643 case ERPCs.DEV_RPC_SERVER_SCRIPT_RESULT:
644 {
647 break;
648 }
649 }
650#endif
651 }
652
653 override bool OnClick(Widget w, int x, int y, int button)
654 {
655 super.OnClick(w, x, y, button);
656 if (w == m_EnfScriptRun)
657 {
658 RunEnscript();
659 return true;
660 }
661 else if (w == m_EnfScriptClear)
662 {
663 m_ScriptOutputListbox.ClearItems();
664 m_ScriptOutputHistory.Clear();
665 return true;
666 }
667
668 return false;
669 }
670
671 override bool OnChange(Widget w, int x, int y, bool finished)
672 {
673 super.OnChange(w, x, y, finished);
674 return false;
675 }
676
677
678 override void Show(bool show, ScriptConsoleTabBase selectedHandler)
679 {
681 {
682 //do nothing
683 }
684 else
685 {
686 m_Root.Show(show);
687 m_Root.Enable(show);
688 }
689 }
690
691}
692
694{
695 override void OnSelected()
696 {
698 if (m_EnscriptConsoleHistoryServer.IsValidIndex(index))
699 {
701 m_EnfScriptEdit.SetText(text);
702 }
704 }
705
706 override protected void EnscriptHistoryBack()
707 {
708 int history_index;
709 if (m_EnfScriptEdit)
710 {
713 if (history_index > -1)
716 }
717 }
718
719 override protected void EnscriptHistoryForward()
720 {
721 if (m_EnfScriptEdit)
722 {
723 int history_index;
724
730 }
731 }
732
733 override bool OnClick(Widget w, int x, int y, int button)
734 {
735 if (w == m_EnfScriptRun)
736 {
738 return true;
739 }
740 else if (w == m_EnfScriptClear)
741 {
742 m_ScriptOutputListbox.ClearItems();
743 m_ScriptOutputHistory.Clear();
744 return true;
745 }
746
747 return false;
748 }
749
750}

◆ OnSelected()

override void OnSelected ( )

Definition at line 1 of file ScriptConsoleEnfScriptTab.c.

253 {
255 if (m_EnscriptConsoleHistoryServer.IsValidIndex(index))
256 {
258 m_EnfScriptEdit.SetText(text);
259 }
261 }

Referenced by RecipeBase::OnSelectedRecipe().

◆ PrintS() [1/6]

static void OnSelected::PrintS ( bool message)
staticprotected

Definition at line 306 of file ScriptConsoleEnfScriptTab.c.

◆ PrintS() [2/6]

static void OnSelected::PrintS ( float message)
staticprotected

Definition at line 316 of file ScriptConsoleEnfScriptTab.c.

317{
318 protected static ScriptConsoleEnfScriptTab m_Instance;
319 protected int m_EnscriptHistoryRow;
320 protected int m_EnscriptHistoryRowServer;
329 protected bool m_AllowScriptOutput;
330 protected int m_RunColor;
331
333
335 {
336 m_Instance = this;
341 m_EnfScriptEdit = MultilineEditBoxWidget.Cast(root.FindAnyWidget("MultilineEditBoxWidget0"));
342 m_EnfScriptRun = ButtonWidget.Cast(root.FindAnyWidget("RunButton"));
343 m_EnfScriptClear = ButtonWidget.Cast(root.FindAnyWidget("ClearButton"));
344 m_ScriptOutputListbox = TextListboxWidget.Cast(root.FindAnyWidget("ScriptOutputListbox"));
345 m_RunColor = m_EnfScriptRun.GetColor();
346 }
347
349 {
351 }
352
353 override void OnSelected()
354 {
356 if (m_EnscriptConsoleHistory.IsValidIndex(index))
357 {
358 string text = m_EnscriptConsoleHistory.Get(index);
359 m_EnfScriptEdit.SetText(text);
360 }
362 }
363
364 static void PrintS(string message)
365 {
366 Print(message);
367 if (m_Instance)
368 m_Instance.Add(message);
369 }
370
371 static void PrintS(bool message)
372 {
373 PrintS(message.ToString());
374 }
375
376 static void PrintS(int message)
377 {
378 PrintS(message.ToString());
379 }
380
381 static void PrintS(float message)
382 {
383 PrintS(message.ToString());
384 }
385
386 static void PrintS(vector message)
387 {
388 PrintS(message.ToString());
389 }
390
391 static void PrintS(Object message)
392 {
393 PrintS(message.ToString());
394 }
395
396
397 void Add(string message, bool isReload = false)
398 {
399 if (message != string.Empty)
400 {
402 {
403 if (!isReload)
406 m_ScriptOutputListbox.EnsureVisible(m_ScriptOutputListbox.GetNumItems());
407 }
408 }
409 }
410
411 protected void Clear(bool clearFile = false)
412 {
413 if (clearFile)
415 m_ScriptOutputListbox.ClearItems();
416 }
417
418
419 protected void ReloadScriptOutput()
420 {
421 m_ScriptOutputListbox.ClearItems();
422 m_AllowScriptOutput = true;
423 foreach (string s: m_ScriptOutputHistory)
424 Add(s, true);
425 m_AllowScriptOutput = false;
426 }
427
428 void HistoryBack()
429 {
430
432 }
433
434 void HistoryForward()
435 {
437 }
438
439 protected void RunEnscript()
440 {
441#ifdef DEVELOPER
442 string code;
443 m_EnfScriptEdit.GetText(code);
444 string codeNoReplace = code;
446 m_AllowScriptOutput = true;
447 code.Replace("Print(", "ScriptConsoleEnfScriptTab.PrintS(");
448 code.Replace("Print (", "ScriptConsoleEnfScriptTab.PrintS(");
449 bool success = GetGame().ExecuteEnforceScript("void scConsMain() \n{\n" + code + "\n}\n", "scConsMain");
450 m_AllowScriptOutput = false;
452
455#endif
456 }
457
458 protected void ColorRunButton(bool success)
459 {
460 if (success)
461 m_EnfScriptRun.SetColor(ARGB(255, 0, 255, 0));
462 else
463 m_EnfScriptRun.SetColor(ARGB(255, 255, 0, 0));
464 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(ResetRunButtonColor, 600);
465 }
466
467 protected void ResetRunButtonColor()
468 {
469 m_EnfScriptRun.SetColor(m_RunColor);
470 }
471
472 protected void RunEnscriptServer()
473 {
474 string code;
475 m_EnfScriptEdit.GetText(code);
479 GetGame().RPCSingleParam(GetGame().GetPlayer(), ERPCs.DEV_RPC_SERVER_SCRIPT, CachedObjectsParams.PARAM1_STRING, true, GetGame().GetPlayer().GetIdentity());
480 }
481
482 protected void EnscriptHistoryBack()
483 {
484 int history_index;
485 if (m_EnfScriptEdit)
486 {
489 if (history_index > -1)
492 }
493 }
494
495
496 protected void EnscriptHistoryForward()
497 {
498 if (m_EnfScriptEdit)
499 {
500 int history_index;
506 }
507 }
508
509 override void OnRPCEx(int rpc_type, ParamsReadContext ctx)
510 {
511 super.OnRPCEx(rpc_type, ctx);
512#ifdef DIAG_DEVELOPER
513 switch (rpc_type)
514 {
515 case ERPCs.DEV_RPC_SERVER_SCRIPT_RESULT:
516 {
519 break;
520 }
521 }
522#endif
523 }
524
525 override bool OnClick(Widget w, int x, int y, int button)
526 {
527 super.OnClick(w, x, y, button);
528 if (w == m_EnfScriptRun)
529 {
530 RunEnscript();
531 return true;
532 }
533 else if (w == m_EnfScriptClear)
534 {
535 m_ScriptOutputListbox.ClearItems();
536 m_ScriptOutputHistory.Clear();
537 return true;
538 }
539
540 return false;
541 }
542
543 override bool OnChange(Widget w, int x, int y, bool finished)
544 {
545 super.OnChange(w, x, y, finished);
546 return false;
547 }
548
549
550 override void Show(bool show, ScriptConsoleTabBase selectedHandler)
551 {
553 {
554 //do nothing
555 }
556 else
557 {
558 m_Root.Show(show);
559 m_Root.Enable(show);
560 }
561 }
562
563}
564
566{
567 override void OnSelected()
568 {
570 if (m_EnscriptConsoleHistoryServer.IsValidIndex(index))
571 {
573 m_EnfScriptEdit.SetText(text);
574 }
576 }
577
578 override protected void EnscriptHistoryBack()
579 {
580 int history_index;
581 if (m_EnfScriptEdit)
582 {
585 if (history_index > -1)
588 }
589 }
590
591 override protected void EnscriptHistoryForward()
592 {
593 if (m_EnfScriptEdit)
594 {
595 int history_index;
596
602 }
603 }
604
605 override bool OnClick(Widget w, int x, int y, int button)
606 {
607 if (w == m_EnfScriptRun)
608 {
610 return true;
611 }
612 else if (w == m_EnfScriptClear)
613 {
614 m_ScriptOutputListbox.ClearItems();
615 m_ScriptOutputHistory.Clear();
616 return true;
617 }
618
619 return false;
620 }
621
622}

◆ PrintS() [3/6]

static void OnSelected::PrintS ( int message)
staticprotected

Definition at line 311 of file ScriptConsoleEnfScriptTab.c.

312{
313 protected static ScriptConsoleEnfScriptTab m_Instance;
314 protected int m_EnscriptHistoryRow;
315 protected int m_EnscriptHistoryRowServer;
324 protected bool m_AllowScriptOutput;
325 protected int m_RunColor;
326
328
330 {
331 m_Instance = this;
336 m_EnfScriptEdit = MultilineEditBoxWidget.Cast(root.FindAnyWidget("MultilineEditBoxWidget0"));
337 m_EnfScriptRun = ButtonWidget.Cast(root.FindAnyWidget("RunButton"));
338 m_EnfScriptClear = ButtonWidget.Cast(root.FindAnyWidget("ClearButton"));
339 m_ScriptOutputListbox = TextListboxWidget.Cast(root.FindAnyWidget("ScriptOutputListbox"));
340 m_RunColor = m_EnfScriptRun.GetColor();
341 }
342
344 {
346 }
347
348 override void OnSelected()
349 {
351 if (m_EnscriptConsoleHistory.IsValidIndex(index))
352 {
353 string text = m_EnscriptConsoleHistory.Get(index);
354 m_EnfScriptEdit.SetText(text);
355 }
357 }
358
359 static void PrintS(string message)
360 {
361 Print(message);
362 if (m_Instance)
363 m_Instance.Add(message);
364 }
365
366 static void PrintS(bool message)
367 {
368 PrintS(message.ToString());
369 }
370
371 static void PrintS(int message)
372 {
373 PrintS(message.ToString());
374 }
375
376 static void PrintS(float message)
377 {
378 PrintS(message.ToString());
379 }
380
381 static void PrintS(vector message)
382 {
383 PrintS(message.ToString());
384 }
385
386 static void PrintS(Object message)
387 {
388 PrintS(message.ToString());
389 }
390
391
392 void Add(string message, bool isReload = false)
393 {
394 if (message != string.Empty)
395 {
397 {
398 if (!isReload)
401 m_ScriptOutputListbox.EnsureVisible(m_ScriptOutputListbox.GetNumItems());
402 }
403 }
404 }
405
406 protected void Clear(bool clearFile = false)
407 {
408 if (clearFile)
410 m_ScriptOutputListbox.ClearItems();
411 }
412
413
414 protected void ReloadScriptOutput()
415 {
416 m_ScriptOutputListbox.ClearItems();
417 m_AllowScriptOutput = true;
418 foreach (string s: m_ScriptOutputHistory)
419 Add(s, true);
420 m_AllowScriptOutput = false;
421 }
422
423 void HistoryBack()
424 {
425
427 }
428
429 void HistoryForward()
430 {
432 }
433
434 protected void RunEnscript()
435 {
436#ifdef DEVELOPER
437 string code;
438 m_EnfScriptEdit.GetText(code);
439 string codeNoReplace = code;
441 m_AllowScriptOutput = true;
442 code.Replace("Print(", "ScriptConsoleEnfScriptTab.PrintS(");
443 code.Replace("Print (", "ScriptConsoleEnfScriptTab.PrintS(");
444 bool success = GetGame().ExecuteEnforceScript("void scConsMain() \n{\n" + code + "\n}\n", "scConsMain");
445 m_AllowScriptOutput = false;
447
450#endif
451 }
452
453 protected void ColorRunButton(bool success)
454 {
455 if (success)
456 m_EnfScriptRun.SetColor(ARGB(255, 0, 255, 0));
457 else
458 m_EnfScriptRun.SetColor(ARGB(255, 255, 0, 0));
459 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(ResetRunButtonColor, 600);
460 }
461
462 protected void ResetRunButtonColor()
463 {
464 m_EnfScriptRun.SetColor(m_RunColor);
465 }
466
467 protected void RunEnscriptServer()
468 {
469 string code;
470 m_EnfScriptEdit.GetText(code);
474 GetGame().RPCSingleParam(GetGame().GetPlayer(), ERPCs.DEV_RPC_SERVER_SCRIPT, CachedObjectsParams.PARAM1_STRING, true, GetGame().GetPlayer().GetIdentity());
475 }
476
477 protected void EnscriptHistoryBack()
478 {
479 int history_index;
480 if (m_EnfScriptEdit)
481 {
484 if (history_index > -1)
487 }
488 }
489
490
491 protected void EnscriptHistoryForward()
492 {
493 if (m_EnfScriptEdit)
494 {
495 int history_index;
501 }
502 }
503
504 override void OnRPCEx(int rpc_type, ParamsReadContext ctx)
505 {
506 super.OnRPCEx(rpc_type, ctx);
507#ifdef DIAG_DEVELOPER
508 switch (rpc_type)
509 {
510 case ERPCs.DEV_RPC_SERVER_SCRIPT_RESULT:
511 {
514 break;
515 }
516 }
517#endif
518 }
519
520 override bool OnClick(Widget w, int x, int y, int button)
521 {
522 super.OnClick(w, x, y, button);
523 if (w == m_EnfScriptRun)
524 {
525 RunEnscript();
526 return true;
527 }
528 else if (w == m_EnfScriptClear)
529 {
530 m_ScriptOutputListbox.ClearItems();
531 m_ScriptOutputHistory.Clear();
532 return true;
533 }
534
535 return false;
536 }
537
538 override bool OnChange(Widget w, int x, int y, bool finished)
539 {
540 super.OnChange(w, x, y, finished);
541 return false;
542 }
543
544
545 override void Show(bool show, ScriptConsoleTabBase selectedHandler)
546 {
548 {
549 //do nothing
550 }
551 else
552 {
553 m_Root.Show(show);
554 m_Root.Enable(show);
555 }
556 }
557
558}
559
561{
562 override void OnSelected()
563 {
565 if (m_EnscriptConsoleHistoryServer.IsValidIndex(index))
566 {
568 m_EnfScriptEdit.SetText(text);
569 }
571 }
572
573 override protected void EnscriptHistoryBack()
574 {
575 int history_index;
576 if (m_EnfScriptEdit)
577 {
580 if (history_index > -1)
583 }
584 }
585
586 override protected void EnscriptHistoryForward()
587 {
588 if (m_EnfScriptEdit)
589 {
590 int history_index;
591
597 }
598 }
599
600 override bool OnClick(Widget w, int x, int y, int button)
601 {
602 if (w == m_EnfScriptRun)
603 {
605 return true;
606 }
607 else if (w == m_EnfScriptClear)
608 {
609 m_ScriptOutputListbox.ClearItems();
610 m_ScriptOutputHistory.Clear();
611 return true;
612 }
613
614 return false;
615 }
616
617}

◆ PrintS() [4/6]

static void OnSelected::PrintS ( Object message)
staticprotected

Definition at line 326 of file ScriptConsoleEnfScriptTab.c.

327{
328 protected static ScriptConsoleEnfScriptTab m_Instance;
329 protected int m_EnscriptHistoryRow;
330 protected int m_EnscriptHistoryRowServer;
339 protected bool m_AllowScriptOutput;
340 protected int m_RunColor;
341
343
345 {
346 m_Instance = this;
351 m_EnfScriptEdit = MultilineEditBoxWidget.Cast(root.FindAnyWidget("MultilineEditBoxWidget0"));
352 m_EnfScriptRun = ButtonWidget.Cast(root.FindAnyWidget("RunButton"));
353 m_EnfScriptClear = ButtonWidget.Cast(root.FindAnyWidget("ClearButton"));
354 m_ScriptOutputListbox = TextListboxWidget.Cast(root.FindAnyWidget("ScriptOutputListbox"));
355 m_RunColor = m_EnfScriptRun.GetColor();
356 }
357
359 {
361 }
362
363 override void OnSelected()
364 {
366 if (m_EnscriptConsoleHistory.IsValidIndex(index))
367 {
368 string text = m_EnscriptConsoleHistory.Get(index);
369 m_EnfScriptEdit.SetText(text);
370 }
372 }
373
374 static void PrintS(string message)
375 {
376 Print(message);
377 if (m_Instance)
378 m_Instance.Add(message);
379 }
380
381 static void PrintS(bool message)
382 {
383 PrintS(message.ToString());
384 }
385
386 static void PrintS(int message)
387 {
388 PrintS(message.ToString());
389 }
390
391 static void PrintS(float message)
392 {
393 PrintS(message.ToString());
394 }
395
396 static void PrintS(vector message)
397 {
398 PrintS(message.ToString());
399 }
400
401 static void PrintS(Object message)
402 {
403 PrintS(message.ToString());
404 }
405
406
407 void Add(string message, bool isReload = false)
408 {
409 if (message != string.Empty)
410 {
412 {
413 if (!isReload)
416 m_ScriptOutputListbox.EnsureVisible(m_ScriptOutputListbox.GetNumItems());
417 }
418 }
419 }
420
421 protected void Clear(bool clearFile = false)
422 {
423 if (clearFile)
425 m_ScriptOutputListbox.ClearItems();
426 }
427
428
429 protected void ReloadScriptOutput()
430 {
431 m_ScriptOutputListbox.ClearItems();
432 m_AllowScriptOutput = true;
433 foreach (string s: m_ScriptOutputHistory)
434 Add(s, true);
435 m_AllowScriptOutput = false;
436 }
437
438 void HistoryBack()
439 {
440
442 }
443
444 void HistoryForward()
445 {
447 }
448
449 protected void RunEnscript()
450 {
451#ifdef DEVELOPER
452 string code;
453 m_EnfScriptEdit.GetText(code);
454 string codeNoReplace = code;
456 m_AllowScriptOutput = true;
457 code.Replace("Print(", "ScriptConsoleEnfScriptTab.PrintS(");
458 code.Replace("Print (", "ScriptConsoleEnfScriptTab.PrintS(");
459 bool success = GetGame().ExecuteEnforceScript("void scConsMain() \n{\n" + code + "\n}\n", "scConsMain");
460 m_AllowScriptOutput = false;
462
465#endif
466 }
467
468 protected void ColorRunButton(bool success)
469 {
470 if (success)
471 m_EnfScriptRun.SetColor(ARGB(255, 0, 255, 0));
472 else
473 m_EnfScriptRun.SetColor(ARGB(255, 255, 0, 0));
474 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(ResetRunButtonColor, 600);
475 }
476
477 protected void ResetRunButtonColor()
478 {
479 m_EnfScriptRun.SetColor(m_RunColor);
480 }
481
482 protected void RunEnscriptServer()
483 {
484 string code;
485 m_EnfScriptEdit.GetText(code);
489 GetGame().RPCSingleParam(GetGame().GetPlayer(), ERPCs.DEV_RPC_SERVER_SCRIPT, CachedObjectsParams.PARAM1_STRING, true, GetGame().GetPlayer().GetIdentity());
490 }
491
492 protected void EnscriptHistoryBack()
493 {
494 int history_index;
495 if (m_EnfScriptEdit)
496 {
499 if (history_index > -1)
502 }
503 }
504
505
506 protected void EnscriptHistoryForward()
507 {
508 if (m_EnfScriptEdit)
509 {
510 int history_index;
516 }
517 }
518
519 override void OnRPCEx(int rpc_type, ParamsReadContext ctx)
520 {
521 super.OnRPCEx(rpc_type, ctx);
522#ifdef DIAG_DEVELOPER
523 switch (rpc_type)
524 {
525 case ERPCs.DEV_RPC_SERVER_SCRIPT_RESULT:
526 {
529 break;
530 }
531 }
532#endif
533 }
534
535 override bool OnClick(Widget w, int x, int y, int button)
536 {
537 super.OnClick(w, x, y, button);
538 if (w == m_EnfScriptRun)
539 {
540 RunEnscript();
541 return true;
542 }
543 else if (w == m_EnfScriptClear)
544 {
545 m_ScriptOutputListbox.ClearItems();
546 m_ScriptOutputHistory.Clear();
547 return true;
548 }
549
550 return false;
551 }
552
553 override bool OnChange(Widget w, int x, int y, bool finished)
554 {
555 super.OnChange(w, x, y, finished);
556 return false;
557 }
558
559
560 override void Show(bool show, ScriptConsoleTabBase selectedHandler)
561 {
563 {
564 //do nothing
565 }
566 else
567 {
568 m_Root.Show(show);
569 m_Root.Enable(show);
570 }
571 }
572
573}
574
576{
577 override void OnSelected()
578 {
580 if (m_EnscriptConsoleHistoryServer.IsValidIndex(index))
581 {
583 m_EnfScriptEdit.SetText(text);
584 }
586 }
587
588 override protected void EnscriptHistoryBack()
589 {
590 int history_index;
591 if (m_EnfScriptEdit)
592 {
595 if (history_index > -1)
598 }
599 }
600
601 override protected void EnscriptHistoryForward()
602 {
603 if (m_EnfScriptEdit)
604 {
605 int history_index;
606
612 }
613 }
614
615 override bool OnClick(Widget w, int x, int y, int button)
616 {
617 if (w == m_EnfScriptRun)
618 {
620 return true;
621 }
622 else if (w == m_EnfScriptClear)
623 {
624 m_ScriptOutputListbox.ClearItems();
625 m_ScriptOutputHistory.Clear();
626 return true;
627 }
628
629 return false;
630 }
631
632}

◆ PrintS() [5/6]

static void OnSelected::PrintS ( string message)
staticprotected

Definition at line 299 of file ScriptConsoleEnfScriptTab.c.

◆ PrintS() [6/6]

static void OnSelected::PrintS ( vector message)
staticprotected

Definition at line 321 of file ScriptConsoleEnfScriptTab.c.

322{
323 protected static ScriptConsoleEnfScriptTab m_Instance;
324 protected int m_EnscriptHistoryRow;
325 protected int m_EnscriptHistoryRowServer;
334 protected bool m_AllowScriptOutput;
335 protected int m_RunColor;
336
338
340 {
341 m_Instance = this;
346 m_EnfScriptEdit = MultilineEditBoxWidget.Cast(root.FindAnyWidget("MultilineEditBoxWidget0"));
347 m_EnfScriptRun = ButtonWidget.Cast(root.FindAnyWidget("RunButton"));
348 m_EnfScriptClear = ButtonWidget.Cast(root.FindAnyWidget("ClearButton"));
349 m_ScriptOutputListbox = TextListboxWidget.Cast(root.FindAnyWidget("ScriptOutputListbox"));
350 m_RunColor = m_EnfScriptRun.GetColor();
351 }
352
354 {
356 }
357
358 override void OnSelected()
359 {
361 if (m_EnscriptConsoleHistory.IsValidIndex(index))
362 {
363 string text = m_EnscriptConsoleHistory.Get(index);
364 m_EnfScriptEdit.SetText(text);
365 }
367 }
368
369 static void PrintS(string message)
370 {
371 Print(message);
372 if (m_Instance)
373 m_Instance.Add(message);
374 }
375
376 static void PrintS(bool message)
377 {
378 PrintS(message.ToString());
379 }
380
381 static void PrintS(int message)
382 {
383 PrintS(message.ToString());
384 }
385
386 static void PrintS(float message)
387 {
388 PrintS(message.ToString());
389 }
390
391 static void PrintS(vector message)
392 {
393 PrintS(message.ToString());
394 }
395
396 static void PrintS(Object message)
397 {
398 PrintS(message.ToString());
399 }
400
401
402 void Add(string message, bool isReload = false)
403 {
404 if (message != string.Empty)
405 {
407 {
408 if (!isReload)
411 m_ScriptOutputListbox.EnsureVisible(m_ScriptOutputListbox.GetNumItems());
412 }
413 }
414 }
415
416 protected void Clear(bool clearFile = false)
417 {
418 if (clearFile)
420 m_ScriptOutputListbox.ClearItems();
421 }
422
423
424 protected void ReloadScriptOutput()
425 {
426 m_ScriptOutputListbox.ClearItems();
427 m_AllowScriptOutput = true;
428 foreach (string s: m_ScriptOutputHistory)
429 Add(s, true);
430 m_AllowScriptOutput = false;
431 }
432
433 void HistoryBack()
434 {
435
437 }
438
439 void HistoryForward()
440 {
442 }
443
444 protected void RunEnscript()
445 {
446#ifdef DEVELOPER
447 string code;
448 m_EnfScriptEdit.GetText(code);
449 string codeNoReplace = code;
451 m_AllowScriptOutput = true;
452 code.Replace("Print(", "ScriptConsoleEnfScriptTab.PrintS(");
453 code.Replace("Print (", "ScriptConsoleEnfScriptTab.PrintS(");
454 bool success = GetGame().ExecuteEnforceScript("void scConsMain() \n{\n" + code + "\n}\n", "scConsMain");
455 m_AllowScriptOutput = false;
457
460#endif
461 }
462
463 protected void ColorRunButton(bool success)
464 {
465 if (success)
466 m_EnfScriptRun.SetColor(ARGB(255, 0, 255, 0));
467 else
468 m_EnfScriptRun.SetColor(ARGB(255, 255, 0, 0));
469 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(ResetRunButtonColor, 600);
470 }
471
472 protected void ResetRunButtonColor()
473 {
474 m_EnfScriptRun.SetColor(m_RunColor);
475 }
476
477 protected void RunEnscriptServer()
478 {
479 string code;
480 m_EnfScriptEdit.GetText(code);
484 GetGame().RPCSingleParam(GetGame().GetPlayer(), ERPCs.DEV_RPC_SERVER_SCRIPT, CachedObjectsParams.PARAM1_STRING, true, GetGame().GetPlayer().GetIdentity());
485 }
486
487 protected void EnscriptHistoryBack()
488 {
489 int history_index;
490 if (m_EnfScriptEdit)
491 {
494 if (history_index > -1)
497 }
498 }
499
500
501 protected void EnscriptHistoryForward()
502 {
503 if (m_EnfScriptEdit)
504 {
505 int history_index;
511 }
512 }
513
514 override void OnRPCEx(int rpc_type, ParamsReadContext ctx)
515 {
516 super.OnRPCEx(rpc_type, ctx);
517#ifdef DIAG_DEVELOPER
518 switch (rpc_type)
519 {
520 case ERPCs.DEV_RPC_SERVER_SCRIPT_RESULT:
521 {
524 break;
525 }
526 }
527#endif
528 }
529
530 override bool OnClick(Widget w, int x, int y, int button)
531 {
532 super.OnClick(w, x, y, button);
533 if (w == m_EnfScriptRun)
534 {
535 RunEnscript();
536 return true;
537 }
538 else if (w == m_EnfScriptClear)
539 {
540 m_ScriptOutputListbox.ClearItems();
541 m_ScriptOutputHistory.Clear();
542 return true;
543 }
544
545 return false;
546 }
547
548 override bool OnChange(Widget w, int x, int y, bool finished)
549 {
550 super.OnChange(w, x, y, finished);
551 return false;
552 }
553
554
555 override void Show(bool show, ScriptConsoleTabBase selectedHandler)
556 {
558 {
559 //do nothing
560 }
561 else
562 {
563 m_Root.Show(show);
564 m_Root.Enable(show);
565 }
566 }
567
568}
569
571{
572 override void OnSelected()
573 {
575 if (m_EnscriptConsoleHistoryServer.IsValidIndex(index))
576 {
578 m_EnfScriptEdit.SetText(text);
579 }
581 }
582
583 override protected void EnscriptHistoryBack()
584 {
585 int history_index;
586 if (m_EnfScriptEdit)
587 {
590 if (history_index > -1)
593 }
594 }
595
596 override protected void EnscriptHistoryForward()
597 {
598 if (m_EnfScriptEdit)
599 {
600 int history_index;
601
607 }
608 }
609
610 override bool OnClick(Widget w, int x, int y, int button)
611 {
612 if (w == m_EnfScriptRun)
613 {
615 return true;
616 }
617 else if (w == m_EnfScriptClear)
618 {
619 m_ScriptOutputListbox.ClearItems();
620 m_ScriptOutputHistory.Clear();
621 return true;
622 }
623
624 return false;
625 }
626
627}

◆ ReloadScriptOutput()

void OnSelected::ReloadScriptOutput ( )
protected

Definition at line 354 of file ScriptConsoleEnfScriptTab.c.

355{
356 protected static ScriptConsoleEnfScriptTab m_Instance;
357 protected int m_EnscriptHistoryRow;
358 protected int m_EnscriptHistoryRowServer;
367 protected bool m_AllowScriptOutput;
368 protected int m_RunColor;
369
371
373 {
374 m_Instance = this;
379 m_EnfScriptEdit = MultilineEditBoxWidget.Cast(root.FindAnyWidget("MultilineEditBoxWidget0"));
380 m_EnfScriptRun = ButtonWidget.Cast(root.FindAnyWidget("RunButton"));
381 m_EnfScriptClear = ButtonWidget.Cast(root.FindAnyWidget("ClearButton"));
382 m_ScriptOutputListbox = TextListboxWidget.Cast(root.FindAnyWidget("ScriptOutputListbox"));
383 m_RunColor = m_EnfScriptRun.GetColor();
384 }
385
387 {
389 }
390
391 override void OnSelected()
392 {
394 if (m_EnscriptConsoleHistory.IsValidIndex(index))
395 {
396 string text = m_EnscriptConsoleHistory.Get(index);
397 m_EnfScriptEdit.SetText(text);
398 }
400 }
401
402 static void PrintS(string message)
403 {
404 Print(message);
405 if (m_Instance)
406 m_Instance.Add(message);
407 }
408
409 static void PrintS(bool message)
410 {
411 PrintS(message.ToString());
412 }
413
414 static void PrintS(int message)
415 {
416 PrintS(message.ToString());
417 }
418
419 static void PrintS(float message)
420 {
421 PrintS(message.ToString());
422 }
423
424 static void PrintS(vector message)
425 {
426 PrintS(message.ToString());
427 }
428
429 static void PrintS(Object message)
430 {
431 PrintS(message.ToString());
432 }
433
434
435 void Add(string message, bool isReload = false)
436 {
437 if (message != string.Empty)
438 {
440 {
441 if (!isReload)
444 m_ScriptOutputListbox.EnsureVisible(m_ScriptOutputListbox.GetNumItems());
445 }
446 }
447 }
448
449 protected void Clear(bool clearFile = false)
450 {
451 if (clearFile)
453 m_ScriptOutputListbox.ClearItems();
454 }
455
456
457 protected void ReloadScriptOutput()
458 {
459 m_ScriptOutputListbox.ClearItems();
460 m_AllowScriptOutput = true;
461 foreach (string s: m_ScriptOutputHistory)
462 Add(s, true);
463 m_AllowScriptOutput = false;
464 }
465
466 void HistoryBack()
467 {
468
470 }
471
472 void HistoryForward()
473 {
475 }
476
477 protected void RunEnscript()
478 {
479#ifdef DEVELOPER
480 string code;
481 m_EnfScriptEdit.GetText(code);
482 string codeNoReplace = code;
484 m_AllowScriptOutput = true;
485 code.Replace("Print(", "ScriptConsoleEnfScriptTab.PrintS(");
486 code.Replace("Print (", "ScriptConsoleEnfScriptTab.PrintS(");
487 bool success = GetGame().ExecuteEnforceScript("void scConsMain() \n{\n" + code + "\n}\n", "scConsMain");
488 m_AllowScriptOutput = false;
490
493#endif
494 }
495
496 protected void ColorRunButton(bool success)
497 {
498 if (success)
499 m_EnfScriptRun.SetColor(ARGB(255, 0, 255, 0));
500 else
501 m_EnfScriptRun.SetColor(ARGB(255, 255, 0, 0));
502 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(ResetRunButtonColor, 600);
503 }
504
505 protected void ResetRunButtonColor()
506 {
507 m_EnfScriptRun.SetColor(m_RunColor);
508 }
509
510 protected void RunEnscriptServer()
511 {
512 string code;
513 m_EnfScriptEdit.GetText(code);
517 GetGame().RPCSingleParam(GetGame().GetPlayer(), ERPCs.DEV_RPC_SERVER_SCRIPT, CachedObjectsParams.PARAM1_STRING, true, GetGame().GetPlayer().GetIdentity());
518 }
519
520 protected void EnscriptHistoryBack()
521 {
522 int history_index;
523 if (m_EnfScriptEdit)
524 {
527 if (history_index > -1)
530 }
531 }
532
533
534 protected void EnscriptHistoryForward()
535 {
536 if (m_EnfScriptEdit)
537 {
538 int history_index;
544 }
545 }
546
547 override void OnRPCEx(int rpc_type, ParamsReadContext ctx)
548 {
549 super.OnRPCEx(rpc_type, ctx);
550#ifdef DIAG_DEVELOPER
551 switch (rpc_type)
552 {
553 case ERPCs.DEV_RPC_SERVER_SCRIPT_RESULT:
554 {
557 break;
558 }
559 }
560#endif
561 }
562
563 override bool OnClick(Widget w, int x, int y, int button)
564 {
565 super.OnClick(w, x, y, button);
566 if (w == m_EnfScriptRun)
567 {
568 RunEnscript();
569 return true;
570 }
571 else if (w == m_EnfScriptClear)
572 {
573 m_ScriptOutputListbox.ClearItems();
574 m_ScriptOutputHistory.Clear();
575 return true;
576 }
577
578 return false;
579 }
580
581 override bool OnChange(Widget w, int x, int y, bool finished)
582 {
583 super.OnChange(w, x, y, finished);
584 return false;
585 }
586
587
588 override void Show(bool show, ScriptConsoleTabBase selectedHandler)
589 {
591 {
592 //do nothing
593 }
594 else
595 {
596 m_Root.Show(show);
597 m_Root.Enable(show);
598 }
599 }
600
601}
602
604{
605 override void OnSelected()
606 {
608 if (m_EnscriptConsoleHistoryServer.IsValidIndex(index))
609 {
611 m_EnfScriptEdit.SetText(text);
612 }
614 }
615
616 override protected void EnscriptHistoryBack()
617 {
618 int history_index;
619 if (m_EnfScriptEdit)
620 {
623 if (history_index > -1)
626 }
627 }
628
629 override protected void EnscriptHistoryForward()
630 {
631 if (m_EnfScriptEdit)
632 {
633 int history_index;
634
640 }
641 }
642
643 override bool OnClick(Widget w, int x, int y, int button)
644 {
645 if (w == m_EnfScriptRun)
646 {
648 return true;
649 }
650 else if (w == m_EnfScriptClear)
651 {
652 m_ScriptOutputListbox.ClearItems();
653 m_ScriptOutputHistory.Clear();
654 return true;
655 }
656
657 return false;
658 }
659
660}

◆ ResetRunButtonColor()

void OnSelected::ResetRunButtonColor ( )
protected

Definition at line 402 of file ScriptConsoleEnfScriptTab.c.

403{
404 protected static ScriptConsoleEnfScriptTab m_Instance;
405 protected int m_EnscriptHistoryRow;
406 protected int m_EnscriptHistoryRowServer;
415 protected bool m_AllowScriptOutput;
416 protected int m_RunColor;
417
419
421 {
422 m_Instance = this;
427 m_EnfScriptEdit = MultilineEditBoxWidget.Cast(root.FindAnyWidget("MultilineEditBoxWidget0"));
428 m_EnfScriptRun = ButtonWidget.Cast(root.FindAnyWidget("RunButton"));
429 m_EnfScriptClear = ButtonWidget.Cast(root.FindAnyWidget("ClearButton"));
430 m_ScriptOutputListbox = TextListboxWidget.Cast(root.FindAnyWidget("ScriptOutputListbox"));
431 m_RunColor = m_EnfScriptRun.GetColor();
432 }
433
435 {
437 }
438
439 override void OnSelected()
440 {
442 if (m_EnscriptConsoleHistory.IsValidIndex(index))
443 {
444 string text = m_EnscriptConsoleHistory.Get(index);
445 m_EnfScriptEdit.SetText(text);
446 }
448 }
449
450 static void PrintS(string message)
451 {
452 Print(message);
453 if (m_Instance)
454 m_Instance.Add(message);
455 }
456
457 static void PrintS(bool message)
458 {
459 PrintS(message.ToString());
460 }
461
462 static void PrintS(int message)
463 {
464 PrintS(message.ToString());
465 }
466
467 static void PrintS(float message)
468 {
469 PrintS(message.ToString());
470 }
471
472 static void PrintS(vector message)
473 {
474 PrintS(message.ToString());
475 }
476
477 static void PrintS(Object message)
478 {
479 PrintS(message.ToString());
480 }
481
482
483 void Add(string message, bool isReload = false)
484 {
485 if (message != string.Empty)
486 {
488 {
489 if (!isReload)
492 m_ScriptOutputListbox.EnsureVisible(m_ScriptOutputListbox.GetNumItems());
493 }
494 }
495 }
496
497 protected void Clear(bool clearFile = false)
498 {
499 if (clearFile)
501 m_ScriptOutputListbox.ClearItems();
502 }
503
504
505 protected void ReloadScriptOutput()
506 {
507 m_ScriptOutputListbox.ClearItems();
508 m_AllowScriptOutput = true;
509 foreach (string s: m_ScriptOutputHistory)
510 Add(s, true);
511 m_AllowScriptOutput = false;
512 }
513
514 void HistoryBack()
515 {
516
518 }
519
520 void HistoryForward()
521 {
523 }
524
525 protected void RunEnscript()
526 {
527#ifdef DEVELOPER
528 string code;
529 m_EnfScriptEdit.GetText(code);
530 string codeNoReplace = code;
532 m_AllowScriptOutput = true;
533 code.Replace("Print(", "ScriptConsoleEnfScriptTab.PrintS(");
534 code.Replace("Print (", "ScriptConsoleEnfScriptTab.PrintS(");
535 bool success = GetGame().ExecuteEnforceScript("void scConsMain() \n{\n" + code + "\n}\n", "scConsMain");
536 m_AllowScriptOutput = false;
538
541#endif
542 }
543
544 protected void ColorRunButton(bool success)
545 {
546 if (success)
547 m_EnfScriptRun.SetColor(ARGB(255, 0, 255, 0));
548 else
549 m_EnfScriptRun.SetColor(ARGB(255, 255, 0, 0));
550 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(ResetRunButtonColor, 600);
551 }
552
553 protected void ResetRunButtonColor()
554 {
555 m_EnfScriptRun.SetColor(m_RunColor);
556 }
557
558 protected void RunEnscriptServer()
559 {
560 string code;
561 m_EnfScriptEdit.GetText(code);
565 GetGame().RPCSingleParam(GetGame().GetPlayer(), ERPCs.DEV_RPC_SERVER_SCRIPT, CachedObjectsParams.PARAM1_STRING, true, GetGame().GetPlayer().GetIdentity());
566 }
567
568 protected void EnscriptHistoryBack()
569 {
570 int history_index;
571 if (m_EnfScriptEdit)
572 {
575 if (history_index > -1)
578 }
579 }
580
581
582 protected void EnscriptHistoryForward()
583 {
584 if (m_EnfScriptEdit)
585 {
586 int history_index;
592 }
593 }
594
595 override void OnRPCEx(int rpc_type, ParamsReadContext ctx)
596 {
597 super.OnRPCEx(rpc_type, ctx);
598#ifdef DIAG_DEVELOPER
599 switch (rpc_type)
600 {
601 case ERPCs.DEV_RPC_SERVER_SCRIPT_RESULT:
602 {
605 break;
606 }
607 }
608#endif
609 }
610
611 override bool OnClick(Widget w, int x, int y, int button)
612 {
613 super.OnClick(w, x, y, button);
614 if (w == m_EnfScriptRun)
615 {
616 RunEnscript();
617 return true;
618 }
619 else if (w == m_EnfScriptClear)
620 {
621 m_ScriptOutputListbox.ClearItems();
622 m_ScriptOutputHistory.Clear();
623 return true;
624 }
625
626 return false;
627 }
628
629 override bool OnChange(Widget w, int x, int y, bool finished)
630 {
631 super.OnChange(w, x, y, finished);
632 return false;
633 }
634
635
636 override void Show(bool show, ScriptConsoleTabBase selectedHandler)
637 {
639 {
640 //do nothing
641 }
642 else
643 {
644 m_Root.Show(show);
645 m_Root.Enable(show);
646 }
647 }
648
649}
650
652{
653 override void OnSelected()
654 {
656 if (m_EnscriptConsoleHistoryServer.IsValidIndex(index))
657 {
659 m_EnfScriptEdit.SetText(text);
660 }
662 }
663
664 override protected void EnscriptHistoryBack()
665 {
666 int history_index;
667 if (m_EnfScriptEdit)
668 {
671 if (history_index > -1)
674 }
675 }
676
677 override protected void EnscriptHistoryForward()
678 {
679 if (m_EnfScriptEdit)
680 {
681 int history_index;
682
688 }
689 }
690
691 override bool OnClick(Widget w, int x, int y, int button)
692 {
693 if (w == m_EnfScriptRun)
694 {
696 return true;
697 }
698 else if (w == m_EnfScriptClear)
699 {
700 m_ScriptOutputListbox.ClearItems();
701 m_ScriptOutputHistory.Clear();
702 return true;
703 }
704
705 return false;
706 }
707
708}

◆ RunEnscript()

void OnSelected::RunEnscript ( )
protected

Definition at line 374 of file ScriptConsoleEnfScriptTab.c.

375{
376 protected static ScriptConsoleEnfScriptTab m_Instance;
377 protected int m_EnscriptHistoryRow;
378 protected int m_EnscriptHistoryRowServer;
387 protected bool m_AllowScriptOutput;
388 protected int m_RunColor;
389
391
393 {
394 m_Instance = this;
399 m_EnfScriptEdit = MultilineEditBoxWidget.Cast(root.FindAnyWidget("MultilineEditBoxWidget0"));
400 m_EnfScriptRun = ButtonWidget.Cast(root.FindAnyWidget("RunButton"));
401 m_EnfScriptClear = ButtonWidget.Cast(root.FindAnyWidget("ClearButton"));
402 m_ScriptOutputListbox = TextListboxWidget.Cast(root.FindAnyWidget("ScriptOutputListbox"));
403 m_RunColor = m_EnfScriptRun.GetColor();
404 }
405
407 {
409 }
410
411 override void OnSelected()
412 {
414 if (m_EnscriptConsoleHistory.IsValidIndex(index))
415 {
416 string text = m_EnscriptConsoleHistory.Get(index);
417 m_EnfScriptEdit.SetText(text);
418 }
420 }
421
422 static void PrintS(string message)
423 {
424 Print(message);
425 if (m_Instance)
426 m_Instance.Add(message);
427 }
428
429 static void PrintS(bool message)
430 {
431 PrintS(message.ToString());
432 }
433
434 static void PrintS(int message)
435 {
436 PrintS(message.ToString());
437 }
438
439 static void PrintS(float message)
440 {
441 PrintS(message.ToString());
442 }
443
444 static void PrintS(vector message)
445 {
446 PrintS(message.ToString());
447 }
448
449 static void PrintS(Object message)
450 {
451 PrintS(message.ToString());
452 }
453
454
455 void Add(string message, bool isReload = false)
456 {
457 if (message != string.Empty)
458 {
460 {
461 if (!isReload)
464 m_ScriptOutputListbox.EnsureVisible(m_ScriptOutputListbox.GetNumItems());
465 }
466 }
467 }
468
469 protected void Clear(bool clearFile = false)
470 {
471 if (clearFile)
473 m_ScriptOutputListbox.ClearItems();
474 }
475
476
477 protected void ReloadScriptOutput()
478 {
479 m_ScriptOutputListbox.ClearItems();
480 m_AllowScriptOutput = true;
481 foreach (string s: m_ScriptOutputHistory)
482 Add(s, true);
483 m_AllowScriptOutput = false;
484 }
485
486 void HistoryBack()
487 {
488
490 }
491
492 void HistoryForward()
493 {
495 }
496
497 protected void RunEnscript()
498 {
499#ifdef DEVELOPER
500 string code;
501 m_EnfScriptEdit.GetText(code);
502 string codeNoReplace = code;
504 m_AllowScriptOutput = true;
505 code.Replace("Print(", "ScriptConsoleEnfScriptTab.PrintS(");
506 code.Replace("Print (", "ScriptConsoleEnfScriptTab.PrintS(");
507 bool success = GetGame().ExecuteEnforceScript("void scConsMain() \n{\n" + code + "\n}\n", "scConsMain");
508 m_AllowScriptOutput = false;
510
513#endif
514 }
515
516 protected void ColorRunButton(bool success)
517 {
518 if (success)
519 m_EnfScriptRun.SetColor(ARGB(255, 0, 255, 0));
520 else
521 m_EnfScriptRun.SetColor(ARGB(255, 255, 0, 0));
522 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(ResetRunButtonColor, 600);
523 }
524
525 protected void ResetRunButtonColor()
526 {
527 m_EnfScriptRun.SetColor(m_RunColor);
528 }
529
530 protected void RunEnscriptServer()
531 {
532 string code;
533 m_EnfScriptEdit.GetText(code);
537 GetGame().RPCSingleParam(GetGame().GetPlayer(), ERPCs.DEV_RPC_SERVER_SCRIPT, CachedObjectsParams.PARAM1_STRING, true, GetGame().GetPlayer().GetIdentity());
538 }
539
540 protected void EnscriptHistoryBack()
541 {
542 int history_index;
543 if (m_EnfScriptEdit)
544 {
547 if (history_index > -1)
550 }
551 }
552
553
554 protected void EnscriptHistoryForward()
555 {
556 if (m_EnfScriptEdit)
557 {
558 int history_index;
564 }
565 }
566
567 override void OnRPCEx(int rpc_type, ParamsReadContext ctx)
568 {
569 super.OnRPCEx(rpc_type, ctx);
570#ifdef DIAG_DEVELOPER
571 switch (rpc_type)
572 {
573 case ERPCs.DEV_RPC_SERVER_SCRIPT_RESULT:
574 {
577 break;
578 }
579 }
580#endif
581 }
582
583 override bool OnClick(Widget w, int x, int y, int button)
584 {
585 super.OnClick(w, x, y, button);
586 if (w == m_EnfScriptRun)
587 {
588 RunEnscript();
589 return true;
590 }
591 else if (w == m_EnfScriptClear)
592 {
593 m_ScriptOutputListbox.ClearItems();
594 m_ScriptOutputHistory.Clear();
595 return true;
596 }
597
598 return false;
599 }
600
601 override bool OnChange(Widget w, int x, int y, bool finished)
602 {
603 super.OnChange(w, x, y, finished);
604 return false;
605 }
606
607
608 override void Show(bool show, ScriptConsoleTabBase selectedHandler)
609 {
611 {
612 //do nothing
613 }
614 else
615 {
616 m_Root.Show(show);
617 m_Root.Enable(show);
618 }
619 }
620
621}
622
624{
625 override void OnSelected()
626 {
628 if (m_EnscriptConsoleHistoryServer.IsValidIndex(index))
629 {
631 m_EnfScriptEdit.SetText(text);
632 }
634 }
635
636 override protected void EnscriptHistoryBack()
637 {
638 int history_index;
639 if (m_EnfScriptEdit)
640 {
643 if (history_index > -1)
646 }
647 }
648
649 override protected void EnscriptHistoryForward()
650 {
651 if (m_EnfScriptEdit)
652 {
653 int history_index;
654
660 }
661 }
662
663 override bool OnClick(Widget w, int x, int y, int button)
664 {
665 if (w == m_EnfScriptRun)
666 {
668 return true;
669 }
670 else if (w == m_EnfScriptClear)
671 {
672 m_ScriptOutputListbox.ClearItems();
673 m_ScriptOutputHistory.Clear();
674 return true;
675 }
676
677 return false;
678 }
679
680}

◆ RunEnscriptServer()

void OnSelected::RunEnscriptServer ( )
protected

Definition at line 407 of file ScriptConsoleEnfScriptTab.c.

408{
409 protected static ScriptConsoleEnfScriptTab m_Instance;
410 protected int m_EnscriptHistoryRow;
411 protected int m_EnscriptHistoryRowServer;
420 protected bool m_AllowScriptOutput;
421 protected int m_RunColor;
422
424
426 {
427 m_Instance = this;
432 m_EnfScriptEdit = MultilineEditBoxWidget.Cast(root.FindAnyWidget("MultilineEditBoxWidget0"));
433 m_EnfScriptRun = ButtonWidget.Cast(root.FindAnyWidget("RunButton"));
434 m_EnfScriptClear = ButtonWidget.Cast(root.FindAnyWidget("ClearButton"));
435 m_ScriptOutputListbox = TextListboxWidget.Cast(root.FindAnyWidget("ScriptOutputListbox"));
436 m_RunColor = m_EnfScriptRun.GetColor();
437 }
438
440 {
442 }
443
444 override void OnSelected()
445 {
447 if (m_EnscriptConsoleHistory.IsValidIndex(index))
448 {
449 string text = m_EnscriptConsoleHistory.Get(index);
450 m_EnfScriptEdit.SetText(text);
451 }
453 }
454
455 static void PrintS(string message)
456 {
457 Print(message);
458 if (m_Instance)
459 m_Instance.Add(message);
460 }
461
462 static void PrintS(bool message)
463 {
464 PrintS(message.ToString());
465 }
466
467 static void PrintS(int message)
468 {
469 PrintS(message.ToString());
470 }
471
472 static void PrintS(float message)
473 {
474 PrintS(message.ToString());
475 }
476
477 static void PrintS(vector message)
478 {
479 PrintS(message.ToString());
480 }
481
482 static void PrintS(Object message)
483 {
484 PrintS(message.ToString());
485 }
486
487
488 void Add(string message, bool isReload = false)
489 {
490 if (message != string.Empty)
491 {
493 {
494 if (!isReload)
497 m_ScriptOutputListbox.EnsureVisible(m_ScriptOutputListbox.GetNumItems());
498 }
499 }
500 }
501
502 protected void Clear(bool clearFile = false)
503 {
504 if (clearFile)
506 m_ScriptOutputListbox.ClearItems();
507 }
508
509
510 protected void ReloadScriptOutput()
511 {
512 m_ScriptOutputListbox.ClearItems();
513 m_AllowScriptOutput = true;
514 foreach (string s: m_ScriptOutputHistory)
515 Add(s, true);
516 m_AllowScriptOutput = false;
517 }
518
519 void HistoryBack()
520 {
521
523 }
524
525 void HistoryForward()
526 {
528 }
529
530 protected void RunEnscript()
531 {
532#ifdef DEVELOPER
533 string code;
534 m_EnfScriptEdit.GetText(code);
535 string codeNoReplace = code;
537 m_AllowScriptOutput = true;
538 code.Replace("Print(", "ScriptConsoleEnfScriptTab.PrintS(");
539 code.Replace("Print (", "ScriptConsoleEnfScriptTab.PrintS(");
540 bool success = GetGame().ExecuteEnforceScript("void scConsMain() \n{\n" + code + "\n}\n", "scConsMain");
541 m_AllowScriptOutput = false;
543
546#endif
547 }
548
549 protected void ColorRunButton(bool success)
550 {
551 if (success)
552 m_EnfScriptRun.SetColor(ARGB(255, 0, 255, 0));
553 else
554 m_EnfScriptRun.SetColor(ARGB(255, 255, 0, 0));
555 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(ResetRunButtonColor, 600);
556 }
557
558 protected void ResetRunButtonColor()
559 {
560 m_EnfScriptRun.SetColor(m_RunColor);
561 }
562
563 protected void RunEnscriptServer()
564 {
565 string code;
566 m_EnfScriptEdit.GetText(code);
570 GetGame().RPCSingleParam(GetGame().GetPlayer(), ERPCs.DEV_RPC_SERVER_SCRIPT, CachedObjectsParams.PARAM1_STRING, true, GetGame().GetPlayer().GetIdentity());
571 }
572
573 protected void EnscriptHistoryBack()
574 {
575 int history_index;
576 if (m_EnfScriptEdit)
577 {
580 if (history_index > -1)
583 }
584 }
585
586
587 protected void EnscriptHistoryForward()
588 {
589 if (m_EnfScriptEdit)
590 {
591 int history_index;
597 }
598 }
599
600 override void OnRPCEx(int rpc_type, ParamsReadContext ctx)
601 {
602 super.OnRPCEx(rpc_type, ctx);
603#ifdef DIAG_DEVELOPER
604 switch (rpc_type)
605 {
606 case ERPCs.DEV_RPC_SERVER_SCRIPT_RESULT:
607 {
610 break;
611 }
612 }
613#endif
614 }
615
616 override bool OnClick(Widget w, int x, int y, int button)
617 {
618 super.OnClick(w, x, y, button);
619 if (w == m_EnfScriptRun)
620 {
621 RunEnscript();
622 return true;
623 }
624 else if (w == m_EnfScriptClear)
625 {
626 m_ScriptOutputListbox.ClearItems();
627 m_ScriptOutputHistory.Clear();
628 return true;
629 }
630
631 return false;
632 }
633
634 override bool OnChange(Widget w, int x, int y, bool finished)
635 {
636 super.OnChange(w, x, y, finished);
637 return false;
638 }
639
640
641 override void Show(bool show, ScriptConsoleTabBase selectedHandler)
642 {
644 {
645 //do nothing
646 }
647 else
648 {
649 m_Root.Show(show);
650 m_Root.Enable(show);
651 }
652 }
653
654}
655
657{
658 override void OnSelected()
659 {
661 if (m_EnscriptConsoleHistoryServer.IsValidIndex(index))
662 {
664 m_EnfScriptEdit.SetText(text);
665 }
667 }
668
669 override protected void EnscriptHistoryBack()
670 {
671 int history_index;
672 if (m_EnfScriptEdit)
673 {
676 if (history_index > -1)
679 }
680 }
681
682 override protected void EnscriptHistoryForward()
683 {
684 if (m_EnfScriptEdit)
685 {
686 int history_index;
687
693 }
694 }
695
696 override bool OnClick(Widget w, int x, int y, int button)
697 {
698 if (w == m_EnfScriptRun)
699 {
701 return true;
702 }
703 else if (w == m_EnfScriptClear)
704 {
705 m_ScriptOutputListbox.ClearItems();
706 m_ScriptOutputHistory.Clear();
707 return true;
708 }
709
710 return false;
711 }
712
713}

◆ ScriptConsoleEnfScriptTab()

void OnSelected::ScriptConsoleEnfScriptTab ( Widget root,
ScriptConsole console,
Widget button,
ScriptConsoleTabBase parent = null )
protected

Definition at line 269 of file ScriptConsoleEnfScriptTab.c.

277 {
278 if (m_EnfScriptEdit)
279 {
280 int history_index;
281

Referenced by UIScriptedMenu::Init().

◆ Show()

override void OnSelected::Show ( bool show,
ScriptConsoleTabBase selectedHandler )
protected

Definition at line 485 of file ScriptConsoleEnfScriptTab.c.

486{
487 protected static ScriptConsoleEnfScriptTab m_Instance;
488 protected int m_EnscriptHistoryRow;
489 protected int m_EnscriptHistoryRowServer;
498 protected bool m_AllowScriptOutput;
499 protected int m_RunColor;
500
502
504 {
505 m_Instance = this;
510 m_EnfScriptEdit = MultilineEditBoxWidget.Cast(root.FindAnyWidget("MultilineEditBoxWidget0"));
511 m_EnfScriptRun = ButtonWidget.Cast(root.FindAnyWidget("RunButton"));
512 m_EnfScriptClear = ButtonWidget.Cast(root.FindAnyWidget("ClearButton"));
513 m_ScriptOutputListbox = TextListboxWidget.Cast(root.FindAnyWidget("ScriptOutputListbox"));
514 m_RunColor = m_EnfScriptRun.GetColor();
515 }
516
518 {
520 }
521
522 override void OnSelected()
523 {
525 if (m_EnscriptConsoleHistory.IsValidIndex(index))
526 {
527 string text = m_EnscriptConsoleHistory.Get(index);
528 m_EnfScriptEdit.SetText(text);
529 }
531 }
532
533 static void PrintS(string message)
534 {
535 Print(message);
536 if (m_Instance)
537 m_Instance.Add(message);
538 }
539
540 static void PrintS(bool message)
541 {
542 PrintS(message.ToString());
543 }
544
545 static void PrintS(int message)
546 {
547 PrintS(message.ToString());
548 }
549
550 static void PrintS(float message)
551 {
552 PrintS(message.ToString());
553 }
554
555 static void PrintS(vector message)
556 {
557 PrintS(message.ToString());
558 }
559
560 static void PrintS(Object message)
561 {
562 PrintS(message.ToString());
563 }
564
565
566 void Add(string message, bool isReload = false)
567 {
568 if (message != string.Empty)
569 {
571 {
572 if (!isReload)
575 m_ScriptOutputListbox.EnsureVisible(m_ScriptOutputListbox.GetNumItems());
576 }
577 }
578 }
579
580 protected void Clear(bool clearFile = false)
581 {
582 if (clearFile)
584 m_ScriptOutputListbox.ClearItems();
585 }
586
587
588 protected void ReloadScriptOutput()
589 {
590 m_ScriptOutputListbox.ClearItems();
591 m_AllowScriptOutput = true;
592 foreach (string s: m_ScriptOutputHistory)
593 Add(s, true);
594 m_AllowScriptOutput = false;
595 }
596
597 void HistoryBack()
598 {
599
601 }
602
603 void HistoryForward()
604 {
606 }
607
608 protected void RunEnscript()
609 {
610#ifdef DEVELOPER
611 string code;
612 m_EnfScriptEdit.GetText(code);
613 string codeNoReplace = code;
615 m_AllowScriptOutput = true;
616 code.Replace("Print(", "ScriptConsoleEnfScriptTab.PrintS(");
617 code.Replace("Print (", "ScriptConsoleEnfScriptTab.PrintS(");
618 bool success = GetGame().ExecuteEnforceScript("void scConsMain() \n{\n" + code + "\n}\n", "scConsMain");
619 m_AllowScriptOutput = false;
621
624#endif
625 }
626
627 protected void ColorRunButton(bool success)
628 {
629 if (success)
630 m_EnfScriptRun.SetColor(ARGB(255, 0, 255, 0));
631 else
632 m_EnfScriptRun.SetColor(ARGB(255, 255, 0, 0));
633 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(ResetRunButtonColor, 600);
634 }
635
636 protected void ResetRunButtonColor()
637 {
638 m_EnfScriptRun.SetColor(m_RunColor);
639 }
640
641 protected void RunEnscriptServer()
642 {
643 string code;
644 m_EnfScriptEdit.GetText(code);
648 GetGame().RPCSingleParam(GetGame().GetPlayer(), ERPCs.DEV_RPC_SERVER_SCRIPT, CachedObjectsParams.PARAM1_STRING, true, GetGame().GetPlayer().GetIdentity());
649 }
650
651 protected void EnscriptHistoryBack()
652 {
653 int history_index;
654 if (m_EnfScriptEdit)
655 {
658 if (history_index > -1)
661 }
662 }
663
664
665 protected void EnscriptHistoryForward()
666 {
667 if (m_EnfScriptEdit)
668 {
669 int history_index;
675 }
676 }
677
678 override void OnRPCEx(int rpc_type, ParamsReadContext ctx)
679 {
680 super.OnRPCEx(rpc_type, ctx);
681#ifdef DIAG_DEVELOPER
682 switch (rpc_type)
683 {
684 case ERPCs.DEV_RPC_SERVER_SCRIPT_RESULT:
685 {
688 break;
689 }
690 }
691#endif
692 }
693
694 override bool OnClick(Widget w, int x, int y, int button)
695 {
696 super.OnClick(w, x, y, button);
697 if (w == m_EnfScriptRun)
698 {
699 RunEnscript();
700 return true;
701 }
702 else if (w == m_EnfScriptClear)
703 {
704 m_ScriptOutputListbox.ClearItems();
705 m_ScriptOutputHistory.Clear();
706 return true;
707 }
708
709 return false;
710 }
711
712 override bool OnChange(Widget w, int x, int y, bool finished)
713 {
714 super.OnChange(w, x, y, finished);
715 return false;
716 }
717
718
719 override void Show(bool show, ScriptConsoleTabBase selectedHandler)
720 {
722 {
723 //do nothing
724 }
725 else
726 {
727 m_Root.Show(show);
728 m_Root.Enable(show);
729 }
730 }
731
732}
733
735{
736 override void OnSelected()
737 {
739 if (m_EnscriptConsoleHistoryServer.IsValidIndex(index))
740 {
742 m_EnfScriptEdit.SetText(text);
743 }
745 }
746
747 override protected void EnscriptHistoryBack()
748 {
749 int history_index;
750 if (m_EnfScriptEdit)
751 {
754 if (history_index > -1)
757 }
758 }
759
760 override protected void EnscriptHistoryForward()
761 {
762 if (m_EnfScriptEdit)
763 {
764 int history_index;
765
771 }
772 }
773
774 override bool OnClick(Widget w, int x, int y, int button)
775 {
776 if (w == m_EnfScriptRun)
777 {
779 return true;
780 }
781 else if (w == m_EnfScriptClear)
782 {
783 m_ScriptOutputListbox.ClearItems();
784 m_ScriptOutputHistory.Clear();
785 return true;
786 }
787
788 return false;
789 }
790
791}

◆ ~ScriptConsoleEnfScriptTab()

void OnSelected::~ScriptConsoleEnfScriptTab ( )
protected

Definition at line 283 of file ScriptConsoleEnfScriptTab.c.

Variable Documentation

◆ m_AllowScriptOutput

bool m_AllowScriptOutput
protected

Definition at line 264 of file ScriptConsoleEnfScriptTab.c.

◆ m_EnfScriptClear

ButtonWidget m_EnfScriptClear
protected

Definition at line 262 of file ScriptConsoleEnfScriptTab.c.

◆ m_EnfScriptEdit

MultilineEditBoxWidget m_EnfScriptEdit
protected

Definition at line 260 of file ScriptConsoleEnfScriptTab.c.

◆ m_EnfScriptRun

ButtonWidget m_EnfScriptRun
protected

Definition at line 261 of file ScriptConsoleEnfScriptTab.c.

◆ m_EnscriptConsoleHistory

ref TStringArray m_EnscriptConsoleHistory
protected

Definition at line 256 of file ScriptConsoleEnfScriptTab.c.

◆ m_EnscriptConsoleHistoryServer

ref TStringArray m_EnscriptConsoleHistoryServer
protected

Definition at line 257 of file ScriptConsoleEnfScriptTab.c.

◆ m_EnscriptHistoryRow

int m_EnscriptHistoryRow
protected

Definition at line 254 of file ScriptConsoleEnfScriptTab.c.

◆ m_EnscriptHistoryRowServer

int m_EnscriptHistoryRowServer
protected

Definition at line 255 of file ScriptConsoleEnfScriptTab.c.

◆ m_Instance

ScriptConsoleEnfScriptTab m_Instance
staticprotected

Definition at line 253 of file ScriptConsoleEnfScriptTab.c.

◆ m_ModuleLocalEnscriptHistory

PluginLocalEnscriptHistory m_ModuleLocalEnscriptHistory
protected

Definition at line 258 of file ScriptConsoleEnfScriptTab.c.

◆ m_ModuleLocalEnscriptHistoryServer

PluginLocalEnscriptHistoryServer m_ModuleLocalEnscriptHistoryServer
protected

Definition at line 259 of file ScriptConsoleEnfScriptTab.c.

◆ m_RunColor

int m_RunColor
protected

Definition at line 265 of file ScriptConsoleEnfScriptTab.c.

◆ m_ScriptOutputHistory

ref TStringArray m_ScriptOutputHistory = new TStringArray()
staticprotected

Definition at line 267 of file ScriptConsoleEnfScriptTab.c.

◆ m_ScriptOutputListbox

TextListboxWidget m_ScriptOutputListbox
protected

Definition at line 263 of file ScriptConsoleEnfScriptTab.c.