DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
SlotsContainer.c
См. документацию.
2{
5
6 void SlotsContainer( LayoutHolder parent, EntityAI slot_parent )
7 {
9 for ( int i = 0; i < ITEMS_IN_ROW; i++ )
10 {
11 if ( GetRootWidget().FindAnyWidget( "Icon" + i ) )
12 m_Icons.Insert( new SlotsIcon( this, GetRootWidget().FindAnyWidget( "Icon" + i ), i , slot_parent) );
13 /*else
14 {
15 Widget child = GetRootWidget().GetChildren();
16 while ( child )
17 {
18 child = child.GetSibling();
19 }
20 }*/
21 }
22 }
23
24 override void SetDefaultFocus( bool while_micromanagment_mode = false )
25 {
26 m_FocusedColumn = 0;
27 for (int i = 0; i < GetColumnCount(); i++)
28 {
29 SlotsIcon icon = m_Icons[i];
30 if (icon.IsVisible())
31 {
32 m_FocusedColumn = i;
33 break;
34 }
35 }
36
37 SetFocus( m_FocusedColumn );
38 }
39
40 override void SetLastFocus()
41 {
43 }
44
45 void SetFocus( int index )
46 {
47 if ( index >= 0 && index < m_Icons.Count() )
48 {
49 m_Icons.Get( index ).GetSelectedPanel().Show( true );
50 }
51 UpdateIcon();
52 }
53
54 void SetVisibleFocus( int index )
55 {
56 Unfocus();
57 int visible_icons_count = 0;
58
59 m_FocusedColumn = 0;
60 for (int i = 0; i < GetColumnCount(); i++)
61 {
62 SlotsIcon icon = m_Icons[i];
63 if (icon.IsVisible())
64 {
65 m_FocusedColumn = i;
66 if (visible_icons_count == index)
67 break;
68 visible_icons_count++;
69 }
70 }
71
72 SetFocus( m_FocusedColumn );
73 }
74
76 {
77 int visible_icons_count = 0;
78 for (int i = 0; i < GetColumnCount(); i++)
79 {
80 if (m_FocusedColumn == i)
81 {
82 return visible_icons_count;
83 }
84 SlotsIcon icon = m_Icons[i];
85 if (icon.IsVisible())
86 {
87 visible_icons_count++;
88 }
89 }
90 return visible_icons_count - 1;
91 }
92
93 override void SetNextRightActive()
94 {
95 Unfocus();
96
97 int index = m_FocusedColumn + 1;
98 for (int i = 0; i < GetColumnCount(); i++ )
99 {
100 if (index >= GetColumnCount())
101 {
102 index = 0;
103 }
104 SlotsIcon icon = m_Icons[index];
105 if (icon.IsVisible())
106 {
107 m_FocusedColumn = index;
108 break;
109 }
110 index++;
111 }
112
113 UpdateIcon();
114 }
115
116 override void SetNextLeftActive()
117 {
118 Unfocus();
119
120 int index = m_FocusedColumn - 1;
121 for (int i = 0; i < GetColumnCount(); i++ )
122 {
123 if (index < 0)
124 {
125 index = GetColumnCount() - 1;
126 }
127 SlotsIcon icon = m_Icons[index];
128 if (icon.IsVisible())
129 {
130 m_FocusedColumn = index;
131 break;
132 }
133 index--;
134 }
135
136 UpdateIcon();
137 }
138
140 {
141 float x, y;
142 SlotsIcon icon = GetSlotIcon( m_FocusedColumn );
143
144 icon.GetSelectedPanel().Show( true );
145 icon.GetSelectedPanel().GetScreenPos( x, y );
146
147 EntityAI focused_item = GetFocusedItem();
148 if ( focused_item )
149 {
150 PrepareOwnedTooltip( focused_item, -1, y ); //custom positioning for the controller
151 }
152 else
153 {
154 PrepareOwnedSlotsTooltip( icon.GetSelectedPanel(), icon.GetSlotDisplayName(), icon.GetSlotDesc(), x, y );
155 }
156 }
157
158 override void UnfocusAll()
159 {
160 for (int i = 0; i < m_Icons.Count(); i++)
161 {
162 m_Icons.Get( i ).GetSelectedPanel().Show( false );
163 }
164 }
165
166 override void Unfocus()
167 {
168 Widget w = m_Icons.Get( m_FocusedColumn ).GetSelectedPanel();
169 if ( w )
170 {
171 w.Show( false );
172 }
173 }
174
175 override bool SelectItem()
176 {
177 ItemBase item = ItemBase.Cast( GetFocusedItem() );
179
180 if( item && !item.IsLockedInSlot() && !icon.IsOutOfReach() && !icon.IsReserved() && item.IsTakeable() && item.CanPutIntoHands(null))
181 {
182 ItemManager.GetInstance().SetSelectedItemEx(item, null, icon);
183 return true;
184 }
185 return false;
186 }
187
188 override bool IsEmpty()
189 {
190 return false;
191 }
192
193 override bool IsDisplayable()
194 {
195 if (m_ForcedShow)
196 return true;
197 for (int i = 0; i < m_ColumnCount; i++)
198 {
199 if ( GetSlotIcon(i).IsVisible() )
200 {
201 return true;
202 }
203 }
204 return false;
205 }
206
208 {
209 if ( m_Icons.IsValidIndex( index ) )
210 {
211 return m_Icons.Get( index );
212 }
213
214 return null;
215 }
216
218 {
219 if (m_Icons.Count())
220 {
221 return m_Icons.Get(m_FocusedColumn);
222 }
223 return null;
224 }
225
227 {
228 SlotsIcon focus_icon = GetFocusedSlotsIcon();
229
230 if(focus_icon && !focus_icon.IsReserved())
231 {
232 return EntityAI.Cast(focus_icon.GetObject());
233 }
234
235 return null;
236 }
237
238 override void SetLayoutName()
239 {
240 #ifdef PLATFORM_CONSOLE
242 #else
243 switch ( InventoryMenu.GetWidthType() )
244 {
245 case ScreenWidthType.NARROW:
246 {
248 break;
249 }
250 case ScreenWidthType.MEDIUM:
251 {
253 break;
254 }
255 case ScreenWidthType.WIDE:
256 {
258 break;
259 }
260 }
261 #endif
262
263 }
264
266 bool VerifySlotsIconVisibility(int idx = -1)
267 {
268 if (idx != -1)
269 {
270 return m_Icons[idx].IsVisible() && m_Icons[idx].GetRadialIconPanel().IsVisible() && m_Icons[idx].GetRadialIcon().IsVisible();
271 }
272 else
273 {
274 int count = m_Icons.Count();
275 for (int i = 0; i < count; i++)
276 {
277 if (m_Icons[i].IsVisible() && m_Icons[i].GetRadialIconPanel().IsVisible() && m_Icons[i].GetRadialIcon().IsVisible())
278 {
279 return true;
280 }
281 }
282 }
283 return false;
284 }
285}
const int ITEMS_IN_ROW
Определения Attachments.c:1
Icon x
Icon y
ScreenWidthType
Определения InventoryMenu.c:2
void InventoryMenu()
Определения InventoryMenu.c:20
Определения CargoContainer.c:3
Определения Building.c:6
override bool CanPutIntoHands(EntityAI parent)
Определения GardenBase.c:275
override bool IsTakeable()
Определения BaseBuildingBase.c:988
Определения InventoryItem.c:731
void SetSelectedItemEx(EntityAI selected_item, Container selected_container, LayoutHolder selected_icon)
Определения ItemManager.c:113
static ItemManager GetInstance()
Определения ItemManager.c:282
Определения ItemManager.c:2
Определения Container.c:2
override void SetNextRightActive()
Определения SlotsContainer.c:93
override void SetDefaultFocus(bool while_micromanagment_mode=false)
Определения SlotsContainer.c:24
override EntityAI GetFocusedItem()
Определения SlotsContainer.c:226
override void SetLastFocus()
Определения SlotsContainer.c:40
override SlotsIcon GetFocusedSlotsIcon()
Определения SlotsContainer.c:217
override bool IsEmpty()
Определения SlotsContainer.c:188
override bool IsDisplayable()
Определения SlotsContainer.c:193
void SlotsContainer(LayoutHolder parent, EntityAI slot_parent)
Определения SlotsContainer.c:6
override void Unfocus()
Определения SlotsContainer.c:166
SlotsIcon GetSlotIcon(int index)
Определения SlotsContainer.c:207
override bool SelectItem()
Определения SlotsContainer.c:175
int m_VisibleColumnCount
Определения SlotsContainer.c:4
override void UnfocusAll()
Определения SlotsContainer.c:158
override void SetLayoutName()
Определения SlotsContainer.c:238
ref array< ref SlotsIcon > m_Icons
Определения SlotsContainer.c:3
void UpdateIcon()
Определения SlotsContainer.c:139
override void SetNextLeftActive()
Определения SlotsContainer.c:116
void SetFocus(int index)
Определения SlotsContainer.c:45
int GetVisibleFocus()
Определения SlotsContainer.c:75
bool VerifySlotsIconVisibility(int idx=-1)
Returns 'true' if radial icon is VISIBLE and also OPEN (individual icon or any icon,...
Определения SlotsContainer.c:266
void SetVisibleFocus(int index)
Определения SlotsContainer.c:54
Object GetObject()
Определения SlotsIcon.c:360
Widget GetSelectedPanel()
Определения SlotsIcon.c:245
string GetSlotDisplayName()
Определения SlotsIcon.c:154
bool IsOutOfReach()
Определения SlotsIcon.c:729
override bool IsVisible()
Определения SlotsIcon.c:129
bool IsReserved()
Определения SlotsIcon.c:200
string GetSlotDesc()
Определения SlotsIcon.c:164
Определения SlotsIcon.c:2
Определения EnWidgets.c:190
const string InventorySlotsContainerWide
Определения WidgetLayoutName.c:15
const string InventorySlotsContainerMedium
Определения WidgetLayoutName.c:14
const string InventorySlotsContainerXbox
Определения WidgetLayoutName.c:16
const string InventorySlotsContainerNarrow
Определения WidgetLayoutName.c:13
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
proto native Widget FindAnyWidget(string pathname)
proto native bool IsVisible()