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

Private Member Functions

void UIPropertyAttachment (Widget root)
 
void ~UIPropertyAttachment ()
 
bool OnClick (Widget w, int x, int y, int button)
 
void SetPos (float x, float y)
 
void SetSize (float width, float height)
 
void Show (EntityAI e, string slot_name, TStringArray att_items)
 
void Hide ()
 
bool IsVisible ()
 

Private Attributes

Widget m_WgtRoot
 
Widget m_WgtThis
 
XComboBoxWidget m_WgtComboBox
 
TextWidget m_WgtSlotName
 
ref TStringArray m_ComboItems
 
int m_PrevIndex
 
EntityAI m_Obj
 
int m_SlotID
 

Detailed Description

Definition at line 1 of file UIPropertyAttachment.c.

Constructor & Destructor Documentation

◆ UIPropertyAttachment()

void UIPropertyAttachment::UIPropertyAttachment ( Widget root)
inlineprivate

Definition at line 13 of file UIPropertyAttachment.c.

14 {
16
18
19 m_WgtThis = GetGame().GetWorkspace().CreateWidgets("gui/layouts/scene_editor/day_z_scene_editor_attachment.layout", m_WgtRoot);
20 m_WgtComboBox = XComboBoxWidget.Cast(m_WgtThis.FindAnyWidget("combo_box"));
21 m_WgtSlotName = TextWidget.Cast(m_WgtThis.FindAnyWidget("txt_slot_name"));
22 }
ref TStringArray m_ComboItems
XComboBoxWidget m_WgtComboBox
proto native CGame GetGame()
array< string > TStringArray
Definition EnScript.c:666

References GetGame(), m_ComboItems, m_WgtComboBox, m_WgtRoot, m_WgtSlotName, and m_WgtThis.

◆ ~UIPropertyAttachment()

void UIPropertyAttachment::~UIPropertyAttachment ( )
inlineprivate

Definition at line 24 of file UIPropertyAttachment.c.

25 {
28
29 delete m_WgtThis;
30 }

References m_WgtComboBox, m_WgtRoot, and m_WgtThis.

Member Function Documentation

◆ Hide()

void UIPropertyAttachment::Hide ( )
inlineprivate

Definition at line 100 of file UIPropertyAttachment.c.

101 {
102 m_WgtThis.Show(false);
103
104 m_Obj = NULL;
105 m_SlotID = -1;
106 }

References m_Obj, m_SlotID, and m_WgtThis.

◆ IsVisible()

bool UIPropertyAttachment::IsVisible ( )
inlineprivate

Definition at line 108 of file UIPropertyAttachment.c.

109 {
110 return m_WgtThis.IsVisible();
111 }

References m_WgtThis.

◆ OnClick()

bool UIPropertyAttachment::OnClick ( Widget w,
int x,
int y,
int button )
inlineprivate

Definition at line 32 of file UIPropertyAttachment.c.

33 {
34 if (w == m_WgtComboBox)
35 {
36 if (m_PrevIndex != 0)
37 {
38 EntityAI attachment = m_Obj.GetInventory().FindAttachment(m_SlotID);
39 GetGame().ObjectDelete(attachment);
40 }
41
42 int curr_index = m_WgtComboBox.GetCurrentItem();
43
44 if (curr_index != 0)
45 {
46 PluginDeveloper module_dev = PluginDeveloper.Cast(GetPlugin(PluginDeveloper));
47
48 EntityAI e = module_dev.SpawnEntityAsAttachment(PluginSceneManager.PLAYER, m_Obj, m_ComboItems.Get(curr_index), 1, -1);
49 }
50
52
53 return true;
54 }
55
56 return false;
57 }
PluginBase GetPlugin(typename plugin_type)

References GetGame(), GetPlugin(), m_ComboItems, m_Obj, m_PrevIndex, m_SlotID, and m_WgtComboBox.

◆ SetPos()

void UIPropertyAttachment::SetPos ( float x,
float y )
inlineprivate

Definition at line 59 of file UIPropertyAttachment.c.

60 {
61 m_WgtThis.SetPos(x, y);
62 }
Icon x
Icon y

References m_WgtThis, x, and y.

◆ SetSize()

void UIPropertyAttachment::SetSize ( float width,
float height )
inlineprivate

Definition at line 64 of file UIPropertyAttachment.c.

65 {
66 m_WgtThis.SetSize(width, height);
67 }

References m_WgtThis.

◆ Show()

void UIPropertyAttachment::Show ( EntityAI e,
string slot_name,
TStringArray att_items )
inlineprivate

Definition at line 69 of file UIPropertyAttachment.c.

70 {
71 m_WgtThis.Show(true);
72
73 m_Obj = e;
74 m_ComboItems.Clear();
75 m_ComboItems.Insert("none");
76 m_ComboItems.InsertAll(att_items);
77
78 m_WgtSlotName.SetText(slot_name);
79
80 m_WgtComboBox.ClearAll();
81
83 EntityAI attachment = e.GetInventory().FindAttachment(m_SlotID);
84 int selected_index = 0;
85
86 for (int i = 0; i < m_ComboItems.Count(); ++i)
87 {
88 string item_name = m_ComboItems.Get(i);
89
90 m_WgtComboBox.AddItem(item_name);
91
92 if (attachment != NULL && attachment.GetType() == item_name)
94 }
95
96 m_WgtComboBox.SetCurrentItem(selected_index);
98 }
provides access to slot configuration
static proto native int GetSlotIdFromString(string slot_name)
converts string to slot_id

References InventorySlots::GetSlotIdFromString(), m_ComboItems, m_Obj, m_PrevIndex, m_SlotID, m_WgtComboBox, m_WgtSlotName, and m_WgtThis.

Member Data Documentation

◆ m_ComboItems

ref TStringArray UIPropertyAttachment::m_ComboItems
private

Definition at line 7 of file UIPropertyAttachment.c.

Referenced by OnClick(), Show(), and UIPropertyAttachment().

◆ m_Obj

EntityAI UIPropertyAttachment::m_Obj
private

Definition at line 9 of file UIPropertyAttachment.c.

Referenced by Hide(), OnClick(), and Show().

◆ m_PrevIndex

int UIPropertyAttachment::m_PrevIndex
private

Definition at line 8 of file UIPropertyAttachment.c.

Referenced by OnClick(), and Show().

◆ m_SlotID

int UIPropertyAttachment::m_SlotID
private

Definition at line 10 of file UIPropertyAttachment.c.

Referenced by Hide(), OnClick(), and Show().

◆ m_WgtComboBox

XComboBoxWidget UIPropertyAttachment::m_WgtComboBox
private

Definition at line 5 of file UIPropertyAttachment.c.

Referenced by OnClick(), Show(), UIPropertyAttachment(), and ~UIPropertyAttachment().

◆ m_WgtRoot

Widget UIPropertyAttachment::m_WgtRoot
private

Definition at line 3 of file UIPropertyAttachment.c.

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

◆ m_WgtSlotName

TextWidget UIPropertyAttachment::m_WgtSlotName
private

Definition at line 6 of file UIPropertyAttachment.c.

Referenced by Show(), and UIPropertyAttachment().

◆ m_WgtThis

Widget UIPropertyAttachment::m_WgtThis
private

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