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

Protected Member Functions

void ScriptConsoleVicinityTab (Widget root, ScriptConsole console, Widget button, ScriptConsoleTabBase parent=null)
 
override void OnSelected ()
 
void RenderList ()
 
void UpdateSelected ()
 
override bool OnClick (Widget w, int x, int y, int button)
 
override bool OnChange (Widget w, int x, int y, bool finished)
 
void OnSelectAction (EntityAI ent, int actionId)
 

Protected Attributes

TextListboxWidget m_VicinityListbox
 
ButtonWidget m_WatchItem
 
EditBoxWidget m_DistanceWidget
 
ref array< Objectm_VicinityItems = new array<Object>
 
ref ContextMenu m_ContextMenu
 

Static Protected Attributes

static float m_Distance = 30
 
static Object m_Selected = null
 

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

Constructor & Destructor Documentation

◆ ScriptConsoleVicinityTab()

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

Definition at line 13 of file ScriptConsoleVicinityTab.c.

14 {
15 m_VicinityListbox = TextListboxWidget.Cast(root.FindAnyWidget("VicinityListbox"));
16 m_WatchItem = ButtonWidget.Cast(root.FindAnyWidget("WatchItemButton"));
17 m_DistanceWidget = EditBoxWidget.Cast(root.FindAnyWidget("DistanceInput"));
18
19 m_DistanceWidget.SetText(m_Distance.ToString());
20
21 m_ContextMenu = new ContextMenu();
22 m_ContextMenu.Init(root.FindAnyWidget("VicinityContextMenu"), true);
23
24 m_ContextMenu.SetSize(1, 1);
25 m_ContextMenu.Show(0, 0);
26
27 RenderList();
28 }

References m_ContextMenu, m_Distance, m_DistanceWidget, m_VicinityListbox, m_WatchItem, and RenderList().

Member Function Documentation

◆ OnChange()

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

Definition at line 130 of file ScriptConsoleVicinityTab.c.

131 {
132 super.OnChange(w, x, y, finished);
133
135
136 if (w == m_DistanceWidget)
137 {
138 RenderList();
139 m_Distance = m_DistanceWidget.GetText().ToFloat();
140 }
141 return false;
142 }
Icon x
Icon y

References m_Distance, m_DistanceWidget, RenderList(), UpdateSelected(), x, and y.

◆ OnClick()

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

Definition at line 108 of file ScriptConsoleVicinityTab.c.

109 {
110 super.OnClick(w, x, y, button);
111
113
114 int row = m_VicinityListbox.GetSelectedRow();
115 if (w == m_WatchItem)
116 {
117 if (m_VicinityItems.IsValidIndex(row))
118 {
119 if (m_Selected)
120 {
121 PluginDeveloper.SetDeveloperItemClientEx(m_Selected);
122 return true;
123 }
124 }
125 }
126
127 return false;
128 }
ref array< Object > m_VicinityItems

References m_Selected, m_VicinityItems, m_VicinityListbox, m_WatchItem, UpdateSelected(), x, and y.

◆ OnSelectAction()

void ScriptConsoleVicinityTab::OnSelectAction ( EntityAI ent,
int actionId )
inlineprotected

Definition at line 144 of file ScriptConsoleVicinityTab.c.

145 {
146#ifdef DIAG_DEVELOPER
148 player.GetActionManager().OnInstantAction(ActionDebug, new Param2<EntityAI, int>(ent, actionId));
149#endif
150 }
PlayerBase GetPlayer()
proto native CGame GetGame()

References GetGame(), and GetPlayer().

◆ OnSelected()

override void ScriptConsoleVicinityTab::OnSelected ( )
inlineprotected

Definition at line 30 of file ScriptConsoleVicinityTab.c.

31 {
33 }

References UpdateSelected().

◆ RenderList()

void ScriptConsoleVicinityTab::RenderList ( )
inlineprotected

Definition at line 35 of file ScriptConsoleVicinityTab.c.

36 {
37 float radius = m_DistanceWidget.GetText().ToFloat();
38 if (!radius)
39 return;
42
43 vector playerPos = GetGame().GetCurrentCameraPosition();
44 GetGame().GetObjectsAtPosition3D(playerPos, radius, objects, cargo);
45 m_VicinityListbox.ClearItems();
46 m_VicinityItems.Clear();
47
48 if (m_Selected && objects.Find(m_Selected) == -1)
49 objects.Insert(m_Selected);
50
53
54 foreach (int x, Object obj: objects)
55 {
56 int dist = vector.Distance(playerPos, obj.GetPosition()) * 1000;
57
58 while (objectsMap.Contains(dist))//hacking for when multiple objects are at the same distance from the player, otherwise sorting using map will fail
59 dist++;
60 objectsMap.Insert(dist, obj);
61 distances.Insert(dist);
62 }
63
64 distances.Sort();
65
66 foreach (int dst: distances)
67 {
68 Object o = objectsMap.Get(dst);
69 if (!o)
70 continue;
71 int i = 0;
72 if (o.Type() != Object)
73 {
74 m_VicinityItems.Insert(o);//insert at the end
75 int indx = m_VicinityListbox.AddItem(o.GetType(), null, 0, -1);
76 float distanceMeters = dst / 1000;
77 m_VicinityListbox.SetItem(indx, distanceMeters.ToString(), null, 1);
78 i++;
79
80 if (m_Selected == o)
81 m_VicinityListbox.SelectRow(indx);
82 }
83 }
84
86 }
static proto native float Distance(vector v1, vector v2)
Returns the distance between tips of two 3D vectors.

References vector::Distance(), GetGame(), m_DistanceWidget, m_Selected, m_VicinityItems, m_VicinityListbox, Object, UpdateSelected(), and x.

Referenced by OnChange(), and ScriptConsoleVicinityTab().

◆ UpdateSelected()

void ScriptConsoleVicinityTab::UpdateSelected ( )
inlineprotected

Definition at line 88 of file ScriptConsoleVicinityTab.c.

89 {
90 int row = m_VicinityListbox.GetSelectedRow();
91
93 if (m_VicinityItems.IsValidIndex(row))
95
97 if (entity)
98 {
99 m_ContextMenu.BuildContextMenu(entity, m_VicinityListbox, this);
100
101 m_ContextMenu.SetSize(1, 1);
102 m_ContextMenu.Show(0, 0);
103 }
104 else
105 m_ContextMenu.Hide();
106 }

References m_ContextMenu, m_Selected, m_VicinityItems, and m_VicinityListbox.

Referenced by OnChange(), OnClick(), OnSelected(), and RenderList().

Member Data Documentation

◆ m_ContextMenu

ref ContextMenu ScriptConsoleVicinityTab::m_ContextMenu
protected

Definition at line 11 of file ScriptConsoleVicinityTab.c.

Referenced by ScriptConsoleVicinityTab(), and UpdateSelected().

◆ m_Distance

float ScriptConsoleVicinityTab::m_Distance = 30
staticprotected

Definition at line 3 of file ScriptConsoleVicinityTab.c.

Referenced by OnChange(), and ScriptConsoleVicinityTab().

◆ m_DistanceWidget

EditBoxWidget ScriptConsoleVicinityTab::m_DistanceWidget
protected

Definition at line 8 of file ScriptConsoleVicinityTab.c.

Referenced by OnChange(), RenderList(), and ScriptConsoleVicinityTab().

◆ m_Selected

Object ScriptConsoleVicinityTab::m_Selected = null
staticprotected

Definition at line 4 of file ScriptConsoleVicinityTab.c.

Referenced by OnClick(), RenderList(), and UpdateSelected().

◆ m_VicinityItems

ref array<Object> ScriptConsoleVicinityTab::m_VicinityItems = new array<Object>
protected

Definition at line 9 of file ScriptConsoleVicinityTab.c.

Referenced by OnClick(), RenderList(), and UpdateSelected().

◆ m_VicinityListbox

TextListboxWidget ScriptConsoleVicinityTab::m_VicinityListbox
protected

◆ m_WatchItem

ButtonWidget ScriptConsoleVicinityTab::m_WatchItem
protected

Definition at line 7 of file ScriptConsoleVicinityTab.c.

Referenced by OnClick(), and ScriptConsoleVicinityTab().


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