DayZ 1.24
Loading...
Searching...
No Matches
ScriptConsoleEnfScriptTab Class Reference
Inheritance diagram for ScriptConsoleEnfScriptTab:
[legend]
Collaboration diagram for ScriptConsoleEnfScriptTab:
[legend]

Protected Member Functions

void ScriptConsoleEnfScriptTab (Widget root, ScriptConsole console, Widget button, ScriptConsoleTabBase parent=null)
 
void ~ScriptConsoleEnfScriptTab ()
 
override void OnSelected ()
 
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)
 

Static Protected Member Functions

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)
 

Protected Attributes

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 Protected Attributes

static ScriptConsoleEnfScriptTab m_Instance
 
static ref TStringArray m_ScriptOutputHistory = new TStringArray()
 

Additional Inherited Members

- Private Member Functions inherited from ScriptConsoleTabBase
void ScriptConsoleTabBase (Widget root, ScriptConsole console, Widget button, ScriptConsoleTabBase parent=null)
 
void Init (int id)
 
int GetID ()
 
Widget GetRoot ()
 
bool IsSelected ()
 
void Select (bool select, ScriptConsoleTabBase selectedHandler)
 
void OnSelected ()
 
void Show (bool show, ScriptConsoleTabBase selectedHandler)
 
Widget GetButton ()
 
void Update (float timeslice)
 
bool OnChange (Widget w, int x, int y, bool finished)
 
bool OnClick (Widget w, int x, int y, int button)
 
bool OnItemSelected (Widget w, int x, int y, int row, int column, int oldRow, int oldColumn)
 
bool OnKeyDown (Widget w, int x, int y, int key)
 
bool OnDoubleClick (Widget w, int x, int y, int button)
 
void OnRPCEx (int rpc_type, ParamsReadContext ctx)
 
bool OnMouseButtonDown (Widget w, int x, int y, int button)
 
bool OnKeyPress (Widget w, int x, int y, int key)
 
void AddItemToClipboard (TextListboxWidget text_listbox_widget)
 
- Private Attributes inherited from ScriptConsoleTabBase
int m_Id
 
bool m_IsSelected
 
Widget m_ParentRoot
 
Widget m_Root
 
Widget m_Button
 
ScriptConsole m_ScriptConsole
 
ScriptConsoleTabBase m_Parent
 
PluginConfigDebugProfile m_ConfigDebugProfile
 
PluginConfigDebugProfileFixed m_ConfigDebugProfileFixed
 

Detailed Description

Definition at line 1 of file ScriptConsoleEnfScriptTab.c.

Constructor & Destructor Documentation

◆ ScriptConsoleEnfScriptTab()

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

Definition at line 19 of file ScriptConsoleEnfScriptTab.c.

20 {
21 m_Instance = this;
26 m_EnfScriptEdit = MultilineEditBoxWidget.Cast(root.FindAnyWidget("MultilineEditBoxWidget0"));
27 m_EnfScriptRun = ButtonWidget.Cast(root.FindAnyWidget("RunButton"));
28 m_EnfScriptClear = ButtonWidget.Cast(root.FindAnyWidget("ClearButton"));
29 m_ScriptOutputListbox = TextListboxWidget.Cast(root.FindAnyWidget("ScriptOutputListbox"));
30 m_RunColor = m_EnfScriptRun.GetColor();
31 }
PluginBase GetPlugin(typename plugin_type)
PluginLocalEnscriptHistoryServer m_ModuleLocalEnscriptHistoryServer
static ScriptConsoleEnfScriptTab m_Instance
MultilineEditBoxWidget m_EnfScriptEdit
ref TStringArray m_EnscriptConsoleHistoryServer
PluginLocalEnscriptHistory m_ModuleLocalEnscriptHistory

References GetPlugin(), m_EnfScriptClear, m_EnfScriptEdit, m_EnfScriptRun, m_EnscriptConsoleHistory, m_EnscriptConsoleHistoryServer, m_Instance, m_ModuleLocalEnscriptHistory, m_ModuleLocalEnscriptHistoryServer, m_RunColor, and m_ScriptOutputListbox.

◆ ~ScriptConsoleEnfScriptTab()

void ScriptConsoleEnfScriptTab::~ScriptConsoleEnfScriptTab ( )
inlineprotected

Definition at line 33 of file ScriptConsoleEnfScriptTab.c.

34 {
36 }

References m_Instance.

Member Function Documentation

◆ Add()

void ScriptConsoleEnfScriptTab::Add ( string message,
bool isReload = false )
inlineprotected

Definition at line 82 of file ScriptConsoleEnfScriptTab.c.

83 {
84 if (message != string.Empty)
85 {
87 {
88 if (!isReload)
91 m_ScriptOutputListbox.EnsureVisible(m_ScriptOutputListbox.GetNumItems());
92 }
93 }
94 }
Empty
Definition Hand_States.c:14
static ref TStringArray m_ScriptOutputHistory
string String(string s)
Helper for passing string expression to functions with void parameter. Example: Print(String("Hello "...
Definition EnScript.c:338

References Empty, m_AllowScriptOutput, m_ScriptOutputHistory, m_ScriptOutputListbox, and String().

Referenced by ReloadScriptOutput().

◆ Clear()

void ScriptConsoleEnfScriptTab::Clear ( bool clearFile = false)
inlineprotected

Definition at line 96 of file ScriptConsoleEnfScriptTab.c.

97 {
98 if (clearFile)
100 m_ScriptOutputListbox.ClearItems();
101 }
Definition Debug.c:14
static void ClearLogs()
Definition Debug.c:638

References Debug::ClearLogs(), and m_ScriptOutputListbox.

◆ ColorRunButton()

void ScriptConsoleEnfScriptTab::ColorRunButton ( bool success)
inlineprotected

Definition at line 143 of file ScriptConsoleEnfScriptTab.c.

144 {
145 if (success)
146 m_EnfScriptRun.SetColor(ARGB(255, 0, 255, 0));
147 else
148 m_EnfScriptRun.SetColor(ARGB(255, 255, 0, 0));
149 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(ResetRunButtonColor, 600);
150 }
proto native CGame GetGame()
const int CALL_CATEGORY_SYSTEM
Definition tools.c:8
int ARGB(int a, int r, int g, int b)
Definition proto.c:322

References ARGB(), CALL_CATEGORY_SYSTEM, GetGame(), m_EnfScriptRun, and ResetRunButtonColor().

Referenced by OnRPCEx(), and RunEnscript().

◆ EnscriptHistoryBack()

void ScriptConsoleEnfScriptTab::EnscriptHistoryBack ( )
inlineprotected

◆ EnscriptHistoryForward()

void ScriptConsoleEnfScriptTab::EnscriptHistoryForward ( )
inlineprotected

◆ HistoryBack()

void ScriptConsoleEnfScriptTab::HistoryBack ( )
inlineprotected

Definition at line 113 of file ScriptConsoleEnfScriptTab.c.

References EnscriptHistoryBack().

◆ HistoryForward()

void ScriptConsoleEnfScriptTab::HistoryForward ( )
inlineprotected

Definition at line 119 of file ScriptConsoleEnfScriptTab.c.

References EnscriptHistoryForward().

◆ OnChange()

override bool ScriptConsoleEnfScriptTab::OnChange ( Widget w,
int x,
int y,
bool finished )
inlineprotected

Definition at line 228 of file ScriptConsoleEnfScriptTab.c.

229 {
230 super.OnChange(w, x, y, finished);
231 return false;
232 }
Icon x
Icon y

References x, and y.

◆ OnClick()

override bool ScriptConsoleEnfScriptTab::OnClick ( Widget w,
int x,
int y,
int button )
inlineprotected

Definition at line 210 of file ScriptConsoleEnfScriptTab.c.

211 {
212 super.OnClick(w, x, y, button);
213 if (w == m_EnfScriptRun)
214 {
215 RunEnscript();
216 return true;
217 }
218 else if (w == m_EnfScriptClear)
219 {
220 m_ScriptOutputListbox.ClearItems();
221 m_ScriptOutputHistory.Clear();
222 return true;
223 }
224
225 return false;
226 }

References m_EnfScriptClear, m_EnfScriptRun, m_ScriptOutputHistory, m_ScriptOutputListbox, RunEnscript(), x, and y.

◆ OnRPCEx()

override void ScriptConsoleEnfScriptTab::OnRPCEx ( int rpc_type,
ParamsReadContext ctx )
inlineprotected

Definition at line 194 of file ScriptConsoleEnfScriptTab.c.

195 {
196 super.OnRPCEx(rpc_type, ctx);
197#ifdef DIAG_DEVELOPER
198 switch (rpc_type)
199 {
200 case ERPCs.DEV_RPC_SERVER_SCRIPT_RESULT:
201 {
204 break;
205 }
206 }
207#endif
208 }
ERPCs
Definition ERPCs.c:2
static ref Param1< bool > PARAM1_BOOL

References ColorRunButton(), and CachedObjectsParams::PARAM1_BOOL.

◆ OnSelected()

override void ScriptConsoleEnfScriptTab::OnSelected ( )
inlineprotected

◆ PrintS() [1/6]

static void ScriptConsoleEnfScriptTab::PrintS ( bool message)
inlinestaticprotected

Definition at line 56 of file ScriptConsoleEnfScriptTab.c.

57 {
58 PrintS(message.ToString());
59 }
static void PrintS(string message)

References PrintS().

◆ PrintS() [2/6]

static void ScriptConsoleEnfScriptTab::PrintS ( float message)
inlinestaticprotected

Definition at line 66 of file ScriptConsoleEnfScriptTab.c.

67 {
68 PrintS(message.ToString());
69 }

References PrintS().

◆ PrintS() [3/6]

static void ScriptConsoleEnfScriptTab::PrintS ( int message)
inlinestaticprotected

Definition at line 61 of file ScriptConsoleEnfScriptTab.c.

62 {
63 PrintS(message.ToString());
64 }

References PrintS().

◆ PrintS() [4/6]

static void ScriptConsoleEnfScriptTab::PrintS ( Object message)
inlinestaticprotected

Definition at line 76 of file ScriptConsoleEnfScriptTab.c.

77 {
78 PrintS(message.ToString());
79 }

References PrintS().

◆ PrintS() [5/6]

static void ScriptConsoleEnfScriptTab::PrintS ( string message)
inlinestaticprotected

Definition at line 49 of file ScriptConsoleEnfScriptTab.c.

50 {
52 if (m_Instance)
54 }
proto void Print(void var)
Prints content of variable to console/log.

References m_Instance, and Print().

Referenced by PrintS(), PrintS(), PrintS(), PrintS(), and PrintS().

◆ PrintS() [6/6]

static void ScriptConsoleEnfScriptTab::PrintS ( vector message)
inlinestaticprotected

Definition at line 71 of file ScriptConsoleEnfScriptTab.c.

72 {
73 PrintS(message.ToString());
74 }

References PrintS().

◆ ReloadScriptOutput()

void ScriptConsoleEnfScriptTab::ReloadScriptOutput ( )
inlineprotected

Definition at line 104 of file ScriptConsoleEnfScriptTab.c.

105 {
106 m_ScriptOutputListbox.ClearItems();
107 m_AllowScriptOutput = true;
108 foreach (string s: m_ScriptOutputHistory)
109 Add(s, true);
110 m_AllowScriptOutput = false;
111 }
void Add(string message, bool isReload=false)

References Add(), m_AllowScriptOutput, m_ScriptOutputHistory, and m_ScriptOutputListbox.

Referenced by OnSelected().

◆ ResetRunButtonColor()

void ScriptConsoleEnfScriptTab::ResetRunButtonColor ( )
inlineprotected

Definition at line 152 of file ScriptConsoleEnfScriptTab.c.

153 {
154 m_EnfScriptRun.SetColor(m_RunColor);
155 }

References m_EnfScriptRun, and m_RunColor.

Referenced by ColorRunButton().

◆ RunEnscript()

void ScriptConsoleEnfScriptTab::RunEnscript ( )
inlineprotected

Definition at line 124 of file ScriptConsoleEnfScriptTab.c.

125 {
126#ifdef DEVELOPER
127 string code;
128 m_EnfScriptEdit.GetText(code);
129 string codeNoReplace = code;
131 m_AllowScriptOutput = true;
132 code.Replace("Print(", "ScriptConsoleEnfScriptTab.PrintS(");
133 code.Replace("Print (", "ScriptConsoleEnfScriptTab.PrintS(");
134 bool success = GetGame().ExecuteEnforceScript("void scConsMain() \n{\n" + code + "\n}\n", "scConsMain");
135 m_AllowScriptOutput = false;
137
140#endif
141 }
PlayerBase GetPlayer()
PlayerBase _player

References _player, ColorRunButton(), GetGame(), GetPlayer(), m_AllowScriptOutput, m_EnfScriptEdit, m_EnscriptConsoleHistory, and m_ModuleLocalEnscriptHistory.

Referenced by OnClick().

◆ RunEnscriptServer()

void ScriptConsoleEnfScriptTab::RunEnscriptServer ( )
inlineprotected

Definition at line 157 of file ScriptConsoleEnfScriptTab.c.

158 {
159 string code;
160 m_EnfScriptEdit.GetText(code);
164 GetGame().RPCSingleParam(GetGame().GetPlayer(), ERPCs.DEV_RPC_SERVER_SCRIPT, CachedObjectsParams.PARAM1_STRING, true, GetGame().GetPlayer().GetIdentity());
165 }
static ref Param1< string > PARAM1_STRING

References GetGame(), GetPlayer(), m_EnfScriptEdit, m_EnscriptConsoleHistoryServer, m_ModuleLocalEnscriptHistoryServer, and CachedObjectsParams::PARAM1_STRING.

◆ Show()

override void ScriptConsoleEnfScriptTab::Show ( bool show,
ScriptConsoleTabBase selectedHandler )
inlineprotected

Definition at line 235 of file ScriptConsoleEnfScriptTab.c.

236 {
238 {
239 //do nothing
240 }
241 else
242 {
243 m_Root.Show(show);
244 m_Root.Enable(show);
245 }
246 }

References ScriptConsoleTabBase::m_Root.

Member Data Documentation

◆ m_AllowScriptOutput

bool ScriptConsoleEnfScriptTab::m_AllowScriptOutput
protected

Definition at line 14 of file ScriptConsoleEnfScriptTab.c.

Referenced by Add(), ReloadScriptOutput(), and RunEnscript().

◆ m_EnfScriptClear

ButtonWidget ScriptConsoleEnfScriptTab::m_EnfScriptClear
protected

Definition at line 12 of file ScriptConsoleEnfScriptTab.c.

Referenced by OnClick(), and ScriptConsoleEnfScriptTab().

◆ m_EnfScriptEdit

MultilineEditBoxWidget ScriptConsoleEnfScriptTab::m_EnfScriptEdit
protected

◆ m_EnfScriptRun

ButtonWidget ScriptConsoleEnfScriptTab::m_EnfScriptRun
protected

◆ m_EnscriptConsoleHistory

ref TStringArray ScriptConsoleEnfScriptTab::m_EnscriptConsoleHistory
protected

◆ m_EnscriptConsoleHistoryServer

ref TStringArray ScriptConsoleEnfScriptTab::m_EnscriptConsoleHistoryServer
protected

Definition at line 7 of file ScriptConsoleEnfScriptTab.c.

Referenced by RunEnscriptServer(), and ScriptConsoleEnfScriptTab().

◆ m_EnscriptHistoryRow

int ScriptConsoleEnfScriptTab::m_EnscriptHistoryRow
protected

◆ m_EnscriptHistoryRowServer

int ScriptConsoleEnfScriptTab::m_EnscriptHistoryRowServer
protected

Definition at line 5 of file ScriptConsoleEnfScriptTab.c.

◆ m_Instance

ScriptConsoleEnfScriptTab ScriptConsoleEnfScriptTab::m_Instance
staticprotected

◆ m_ModuleLocalEnscriptHistory

PluginLocalEnscriptHistory ScriptConsoleEnfScriptTab::m_ModuleLocalEnscriptHistory
protected

Definition at line 8 of file ScriptConsoleEnfScriptTab.c.

Referenced by RunEnscript(), and ScriptConsoleEnfScriptTab().

◆ m_ModuleLocalEnscriptHistoryServer

PluginLocalEnscriptHistoryServer ScriptConsoleEnfScriptTab::m_ModuleLocalEnscriptHistoryServer
protected

Definition at line 9 of file ScriptConsoleEnfScriptTab.c.

Referenced by RunEnscriptServer(), and ScriptConsoleEnfScriptTab().

◆ m_RunColor

int ScriptConsoleEnfScriptTab::m_RunColor
protected

Definition at line 15 of file ScriptConsoleEnfScriptTab.c.

Referenced by ResetRunButtonColor(), and ScriptConsoleEnfScriptTab().

◆ m_ScriptOutputHistory

ref TStringArray ScriptConsoleEnfScriptTab::m_ScriptOutputHistory = new TStringArray()
staticprotected

Definition at line 17 of file ScriptConsoleEnfScriptTab.c.

Referenced by Add(), OnClick(), and ReloadScriptOutput().

◆ m_ScriptOutputListbox

TextListboxWidget ScriptConsoleEnfScriptTab::m_ScriptOutputListbox
protected

The documentation for this class was generated from the following file: