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

Protected Member Functions

void ScriptConsoleSoundsTab (Widget root, ScriptConsole console, Widget button, ScriptConsoleTabBase parent=null)
 
void ~ScriptConsoleSoundsTab (Widget root)
 
override bool OnChange (Widget w, int x, int y, bool finished)
 
void UpdateMousePos ()
 
void PrepareFilters (string filter, out TStringArray filters)
 
void ChangeFilter (TStringArray classes, TextListboxWidget widget, EditBoxWidget filterWidget, int categoryMask=-1, bool ignoreScope=false)
 
override void Update (float timeslice)
 
void HandleKeys ()
 
void SetMapPos (vector pos)
 
vector GetMapPos ()
 
override bool OnMouseButtonDown (Widget w, int x, int y, int button)
 
override bool OnClick (Widget w, int x, int y, int button)
 
TStringArray GetSoundClasses ()
 
void ChangeFilterSound ()
 

Protected Attributes

bool m_PlayerPosRefreshBlocked
 
vector m_MapPos
 
ButtonWidget m_CopySoundset
 
ButtonWidget m_PlaySoundset
 
ButtonWidget m_PlaySoundsetLooped
 
ButtonWidget m_StopSoundset
 
EditBoxWidget m_SoundFilter
 
TextListboxWidget m_SoundsTextListbox
 
ref Timer m_RefreshFilterTimer = new Timer()
 
MapWidget m_DebugMapWidget
 
TextWidget m_MapDistWidget
 
TextWidget m_MouseCurPos
 
TextWidget m_MapHeadingWidget
 

Static Protected Attributes

static float DEBUG_MAP_ZOOM = 1
 
static EffectSound m_SoundSet
 

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 ScriptConsoleSoundsTab.c.

Constructor & Destructor Documentation

◆ ScriptConsoleSoundsTab()

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

Definition at line 22 of file ScriptConsoleSoundsTab.c.

23 {
24 m_MouseCurPos = TextWidget.Cast(root.FindAnyWidget("MapSoundsPos"));
25 m_MapDistWidget = TextWidget.Cast(root.FindAnyWidget("MapSoundsDistance"));
26 m_MapHeadingWidget = TextWidget.Cast(root.FindAnyWidget("MapHeadingSounds"));
27
28 m_CopySoundset = ButtonWidget.Cast(root.FindAnyWidget("SoundsetCopy"));
29 m_PlaySoundset = ButtonWidget.Cast(root.FindAnyWidget("PlaySoundset"));
30 m_PlaySoundsetLooped = ButtonWidget.Cast(root.FindAnyWidget("PlaySoundsetLooped"));
31 m_StopSoundset = ButtonWidget.Cast(root.FindAnyWidget("StopSoundset"));
32 m_DebugMapWidget = MapWidget.Cast(root.FindAnyWidget("MapSounds"));
33
34 m_SoundFilter = EditBoxWidget.Cast(root.FindAnyWidget("SoundsFilter"));
35 m_SoundsTextListbox = TextListboxWidget.Cast(root.FindAnyWidget("SoundsList"));
36
37 m_SoundFilter.SetText(m_ConfigDebugProfile.GetSoundsetFilter());
38
39
41
42 if (GetGame().GetPlayer())
43 {
45 m_DebugMapWidget.SetMapPos(GetGame().GetPlayer().GetWorldPosition());
46 SetMapPos(GetGame().GetPlayer().GetWorldPosition());
47 }
48 }
PlayerBase GetPlayer()
proto native void SetScale(float scale)
proto native void SetMapPos(vector worldPos)
TextListboxWidget m_SoundsTextListbox
PluginConfigDebugProfile m_ConfigDebugProfile
proto native CGame GetGame()

References ChangeFilterSound(), DEBUG_MAP_ZOOM, GetGame(), GetPlayer(), ScriptConsoleTabBase::m_ConfigDebugProfile, m_CopySoundset, m_DebugMapWidget, m_MapDistWidget, m_MapHeadingWidget, m_MouseCurPos, m_PlaySoundset, m_PlaySoundsetLooped, m_SoundFilter, m_SoundsTextListbox, m_StopSoundset, SetMapPos(), MapWidget::SetMapPos(), and MapWidget::SetScale().

◆ ~ScriptConsoleSoundsTab()

void ScriptConsoleSoundsTab::~ScriptConsoleSoundsTab ( Widget root)
inlineprotected

Definition at line 50 of file ScriptConsoleSoundsTab.c.

51 {
53 }
proto native float GetScale()

References DEBUG_MAP_ZOOM, MapWidget::GetScale(), and m_DebugMapWidget.

Member Function Documentation

◆ ChangeFilter()

void ScriptConsoleSoundsTab::ChangeFilter ( TStringArray classes,
TextListboxWidget widget,
EditBoxWidget filterWidget,
int categoryMask = -1,
bool ignoreScope = false )
inlineprotected

Definition at line 113 of file ScriptConsoleSoundsTab.c.

114 {
115 widget.ClearItems();
116
119
121
123
124 for (int i = 0; i < classes.Count(); i++)
125 {
126 string config_path = classes.Get(i);
127
128 int objects_count = GetGame().ConfigGetChildrenCount(config_path);
129 for (int j = 0; j < objects_count; j++)
130 {
131 string child_name;
132 bool add = false;
133 GetGame().ConfigGetChildName(config_path, j, child_name);
134
135 if (!filters.Count())
136 add = true;
137 else
138 {
139 foreach (int indx, string filter: filters)
140 {
142 child_name_lower.ToLower();
143
144 if (child_name_lower.Contains(filter))
145 {
146 add = true;
147 break;
148 }
149 }
150 }
151 if (add)
152 itemsArray.Insert(child_name);
153 }
154 }
155
156 if (itemsArray)
157 {
158 itemsArray.Sort();
159 foreach (string it: itemsArray)
160 widget.AddItem(it, NULL, 0);
161 }
162
163 if (filters)
164 {
165 /*
166 if (m_FilterOrderReversed)
167 filters.Invert();
168 */
169 foreach (string f: filters)
170 {
172 if (arr2)
173 {
174 arr2.Sort();
175 foreach (string itm: arr2)
176 int row = widget.AddItem(itm, NULL, 0);
177 }
178 }
179 }
180
181
182 }
void PrepareFilters(string filter, out TStringArray filters)
array< string > TStringArray
Definition EnScript.c:666

References GetGame(), and PrepareFilters().

Referenced by ChangeFilterSound().

◆ ChangeFilterSound()

void ScriptConsoleSoundsTab::ChangeFilterSound ( )
inlineprotected

Definition at line 305 of file ScriptConsoleSoundsTab.c.

306 {
307 m_ConfigDebugProfile.SetSoundsetFilter(m_SoundFilter.GetText());
309 }
void ChangeFilter(TStringArray classes, TextListboxWidget widget, EditBoxWidget filterWidget, int categoryMask=-1, bool ignoreScope=false)

References ChangeFilter(), GetSoundClasses(), ScriptConsoleTabBase::m_ConfigDebugProfile, m_SoundFilter, and m_SoundsTextListbox.

Referenced by OnClick(), and ScriptConsoleSoundsTab().

◆ GetMapPos()

vector ScriptConsoleSoundsTab::GetMapPos ( )
inlineprotected

Definition at line 229 of file ScriptConsoleSoundsTab.c.

230 {
231 return m_MapPos;
232 }

References m_MapPos.

Referenced by HandleKeys(), OnClick(), Update(), and UpdateMousePos().

◆ GetSoundClasses()

TStringArray ScriptConsoleSoundsTab::GetSoundClasses ( )
inlineprotected

Definition at line 300 of file ScriptConsoleSoundsTab.c.

301 {
302 return {CFG_SOUND_SETS};
303 }
const string CFG_SOUND_SETS
Definition constants.c:217

References CFG_SOUND_SETS.

Referenced by ChangeFilterSound().

◆ HandleKeys()

void ScriptConsoleSoundsTab::HandleKeys ( )
inlineprotected

Definition at line 204 of file ScriptConsoleSoundsTab.c.

205 {
206 bool playRequested = KeyState(KeyCode.KC_P) != 0;
207 if (playRequested)
208 {
209 int selected_row_index = m_SoundsTextListbox.GetSelectedRow();
210
211 if (m_SoundSet)
212 m_SoundSet.Stop();
213 if (selected_row_index != -1)
214 {
215 string soundSetName;
217
219 m_SoundSet.SetAutodestroy(true);
220 }
221 }
222 }
Manager class for managing Effect (EffectParticle, EffectSound)
static EffectSound PlaySoundEnviroment(string sound_set, vector position, float play_fade_in=0, float stop_fade_out=0, bool loop=false)
Create and play an EffectSound, updating environment variables.
KeyCode
Definition EnSystem.c:157
proto native int KeyState(KeyCode key)

References GetMapPos(), KeyState(), m_SoundSet, m_SoundsTextListbox, and SEffectManager::PlaySoundEnviroment().

Referenced by Update().

◆ OnChange()

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

Definition at line 55 of file ScriptConsoleSoundsTab.c.

56 {
57 super.OnChange(w, x, y, finished);
58
59 if (w == m_SoundFilter)
60 {
61 m_RefreshFilterTimer.Run(0.85, this, "ChangeFilterSound", null, false);
62 return true;
63 }
64 return false;
65 }
Icon x
Icon y

References m_RefreshFilterTimer, m_SoundFilter, x, and y.

◆ OnClick()

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

Definition at line 259 of file ScriptConsoleSoundsTab.c.

260 {
261 super.OnClick(w, x, y, button);
262
263 if (w == m_CopySoundset)
264 {
266 return true;
267 }
268 else if (w == m_PlaySoundset || w == m_PlaySoundsetLooped)
269 {
270 int selected_row_index = m_SoundsTextListbox.GetSelectedRow();
271 string soundSetName;
272 if (m_SoundSet)
273 m_SoundSet.Stop();
274 if (selected_row_index != -1)
275 {
277
278 bool looped = (w == m_PlaySoundsetLooped);
280
281 }
282 return true;
283 }
284 else if (w == m_StopSoundset)
285 {
286 if (m_SoundSet)
287 m_SoundSet.Stop();
288 return true;
289 }
290 else if (w == m_SoundFilter)
291 {
293 return true;
294 }
295
296 return false;
297 }
void AddItemToClipboard(TextListboxWidget text_listbox_widget)

References ScriptConsoleTabBase::AddItemToClipboard(), ChangeFilterSound(), GetMapPos(), m_CopySoundset, m_PlaySoundset, m_PlaySoundsetLooped, m_SoundFilter, m_SoundSet, m_SoundsTextListbox, m_StopSoundset, SEffectManager::PlaySoundEnviroment(), x, and y.

◆ OnMouseButtonDown()

override bool ScriptConsoleSoundsTab::OnMouseButtonDown ( Widget w,
int x,
int y,
int button )
inlineprotected

Definition at line 234 of file ScriptConsoleSoundsTab.c.

235 {
236 super.OnMouseButtonDown(w, x, y, button);
237
238 if (w == m_DebugMapWidget)
239 {
240 if (button == 0)
241 {
243 int mouseX, mouseY;
246 mousePos[0] = mouseX;
247 mousePos[1] = mouseY;
249 worldPos[1] = GetGame().SurfaceY(worldPos[0], worldPos[2]);
250
252 }
253 else if (button == 1 && GetGame().GetPlayer())
254 SetMapPos(GetGame().GetPlayer().GetWorldPosition());
255 }
256 return true;
257 }
proto native vector ScreenToMap(vector screenPos)
proto void GetMousePos(out int x, out int y)

References GetGame(), GetMousePos(), GetPlayer(), m_DebugMapWidget, m_PlayerPosRefreshBlocked, MapWidget::ScreenToMap(), SetMapPos(), x, and y.

◆ PrepareFilters()

void ScriptConsoleSoundsTab::PrepareFilters ( string filter,
out TStringArray filters )
inlineprotected

Definition at line 98 of file ScriptConsoleSoundsTab.c.

99 {
100 filter.Trim();
101 filter.ToLower();
102
103 filters = new TStringArray;
105 filter.Split(" ", rawFilters);
106
107 foreach (int i, string f: rawFilters)
108 filters.Insert(f);
109
110 }

Referenced by ChangeFilter().

◆ SetMapPos()

void ScriptConsoleSoundsTab::SetMapPos ( vector pos)
inlineprotected

Definition at line 224 of file ScriptConsoleSoundsTab.c.

225 {
226 m_MapPos = pos;
227 }

References m_MapPos.

Referenced by OnMouseButtonDown(), and ScriptConsoleSoundsTab().

◆ Update()

override void ScriptConsoleSoundsTab::Update ( float timeslice)
inlineprotected

Definition at line 184 of file ScriptConsoleSoundsTab.c.

185 {
186 super.Update(timeslice);
187
188 HandleKeys();
190
192
193 if (player)
194 {
195 vector playerPos = player.GetWorldPosition();
196 m_DebugMapWidget.AddUserMark(playerPos, "You", COLOR_RED, "\\dz\\gear\\navigation\\data\\map_tree_ca.paa");
197
198 if (playerPos != GetMapPos())
199 m_DebugMapWidget.AddUserMark(GetMapPos(), "Source", COLOR_GREEN, "\\dz\\gear\\navigation\\data\\map_tree_ca.paa");
200 }
202 }
proto native void ClearUserMarks()
proto native void AddUserMark(vector pos, string text, int color, string texturePath)
const int COLOR_RED
Definition constants.c:64
const int COLOR_GREEN
Definition constants.c:65

References MapWidget::AddUserMark(), MapWidget::ClearUserMarks(), COLOR_GREEN, COLOR_RED, GetGame(), GetMapPos(), GetPlayer(), HandleKeys(), m_DebugMapWidget, and UpdateMousePos().

◆ UpdateMousePos()

void ScriptConsoleSoundsTab::UpdateMousePos ( )
inlineprotected

Definition at line 67 of file ScriptConsoleSoundsTab.c.

68 {
69 if (!GetGame().GetPlayer())
70 return;
71 int x, y;
72 GetMousePos(x, y);
74 mousePos[0] = x;
75 mousePos[1] = y;
77 vector playerPos = GetGame().GetPlayer().GetWorldPosition();
78 if (GetMapPos() != playerPos)
80 worldPos[1] = GetGame().SurfaceY(worldPos[0], worldPos[2]);
81
82 if (m_MouseCurPos)
83 m_MouseCurPos.SetText("Mouse: " + MiscGameplayFunctions.TruncateToS(worldPos[0]) + ", " + MiscGameplayFunctions.TruncateToS(worldPos[1]) + ", " + MiscGameplayFunctions.TruncateToS(worldPos[2]));
85 {
86 float dst = (worldPos - playerPos).Length();
87
88 m_MapDistWidget.SetText("Distance: " + MiscGameplayFunctions.TruncateToS(dst));
89 }
91 {
92 vector playerCamDir = GetGame().GetCurrentCameraDirection();
94 m_MapHeadingWidget.SetText("Heading:" + heading.ToString());
95 }
96 }
Definition EnMath.c:7
static proto float AngleFromPosition(vector origin, vector originDir, vector target)
Angle that a target is from the direction of an origin.
static const float RAD2DEG
Definition EnMath.c:16

References Math3D::AngleFromPosition(), GetGame(), GetMapPos(), GetMousePos(), GetPlayer(), m_DebugMapWidget, m_MapDistWidget, m_MapHeadingWidget, m_MouseCurPos, Math::RAD2DEG, MapWidget::ScreenToMap(), x, and y.

Referenced by Update().

Member Data Documentation

◆ DEBUG_MAP_ZOOM

float ScriptConsoleSoundsTab::DEBUG_MAP_ZOOM = 1
staticprotected

Definition at line 4 of file ScriptConsoleSoundsTab.c.

Referenced by ScriptConsoleSoundsTab(), and ~ScriptConsoleSoundsTab().

◆ m_CopySoundset

ButtonWidget ScriptConsoleSoundsTab::m_CopySoundset
protected

Definition at line 6 of file ScriptConsoleSoundsTab.c.

Referenced by OnClick(), and ScriptConsoleSoundsTab().

◆ m_DebugMapWidget

MapWidget ScriptConsoleSoundsTab::m_DebugMapWidget
protected

◆ m_MapDistWidget

TextWidget ScriptConsoleSoundsTab::m_MapDistWidget
protected

Definition at line 18 of file ScriptConsoleSoundsTab.c.

Referenced by ScriptConsoleSoundsTab(), and UpdateMousePos().

◆ m_MapHeadingWidget

TextWidget ScriptConsoleSoundsTab::m_MapHeadingWidget
protected

Definition at line 20 of file ScriptConsoleSoundsTab.c.

Referenced by ScriptConsoleSoundsTab(), and UpdateMousePos().

◆ m_MapPos

vector ScriptConsoleSoundsTab::m_MapPos
protected

Definition at line 5 of file ScriptConsoleSoundsTab.c.

Referenced by GetMapPos(), and SetMapPos().

◆ m_MouseCurPos

TextWidget ScriptConsoleSoundsTab::m_MouseCurPos
protected

Definition at line 19 of file ScriptConsoleSoundsTab.c.

Referenced by ScriptConsoleSoundsTab(), and UpdateMousePos().

◆ m_PlayerPosRefreshBlocked

bool ScriptConsoleSoundsTab::m_PlayerPosRefreshBlocked
protected

Definition at line 3 of file ScriptConsoleSoundsTab.c.

Referenced by OnMouseButtonDown().

◆ m_PlaySoundset

ButtonWidget ScriptConsoleSoundsTab::m_PlaySoundset
protected

Definition at line 7 of file ScriptConsoleSoundsTab.c.

Referenced by OnClick(), and ScriptConsoleSoundsTab().

◆ m_PlaySoundsetLooped

ButtonWidget ScriptConsoleSoundsTab::m_PlaySoundsetLooped
protected

Definition at line 8 of file ScriptConsoleSoundsTab.c.

Referenced by OnClick(), and ScriptConsoleSoundsTab().

◆ m_RefreshFilterTimer

ref Timer ScriptConsoleSoundsTab::m_RefreshFilterTimer = new Timer()
protected

Definition at line 15 of file ScriptConsoleSoundsTab.c.

Referenced by OnChange().

◆ m_SoundFilter

EditBoxWidget ScriptConsoleSoundsTab::m_SoundFilter
protected

◆ m_SoundSet

EffectSound ScriptConsoleSoundsTab::m_SoundSet
staticprotected

Definition at line 14 of file ScriptConsoleSoundsTab.c.

Referenced by HandleKeys(), and OnClick().

◆ m_SoundsTextListbox

TextListboxWidget ScriptConsoleSoundsTab::m_SoundsTextListbox
protected

◆ m_StopSoundset

ButtonWidget ScriptConsoleSoundsTab::m_StopSoundset
protected

Definition at line 9 of file ScriptConsoleSoundsTab.c.

Referenced by OnClick(), and ScriptConsoleSoundsTab().


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