Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
inventorymenu.c
Go to the documentation of this file.
7
9{
11 private ref ContextMenu m_context_menu;
12 protected bool m_IsOpened;
13 protected bool m_OnlyFirstTime;
14 protected int m_LastDisplayLanguage;
15
16 protected static ScreenWidthType m_WidthType;
17 protected static int m_Width;
18 protected static int m_Height;
19
21 {
22 CheckWidth();
23 m_Inventory = new Inventory(null);
24 m_Inventory.Reset();
25 m_Inventory.UpdateInterval();
26 m_context_menu = new ContextMenu();
27 m_LastDisplayLanguage = g_Game.GetCurrentDisplayLanguageIdx();
28 }
29
30 override Widget Init()
31 {
32 m_Inventory.Init();
33 m_context_menu.Init(layoutRoot);
34 layoutRoot = m_Inventory.GetMainWidget();
35 return layoutRoot;
36 }
37
39 {
40 GetScreenSize( m_Width, m_Height );
41
42 if( m_Height > 0 )
43 {
44 float ratio = m_Width / m_Height;
45 if( ratio > 1.75 )
46 m_WidthType = ScreenWidthType.WIDE;
47 else if( ratio > 1.5 )
48 m_WidthType = ScreenWidthType.MEDIUM;
49 else
50 m_WidthType = ScreenWidthType.NARROW;
51 }
52 }
53
54 static ScreenWidthType GetWidthType()
55 {
56 return m_WidthType;
57 }
58
59 static int GetWidth()
60 {
61 return m_Width;
62 }
63
64 static int GetHeight()
65 {
66 return m_Height;
67 }
68
69 static float GetHeightMultiplied( float value )
70 {
71 float height = m_Height;
72 return height / 1080 * value;
73 }
74
76 {
77 m_Inventory.RefreshQuickbar();
78 }
79
80 override ContextMenu GetContextMenu()
81 {
82 return m_context_menu;
83 }
84
86 {
87
88 }
89
90 override void Update( float timeslice )
91 {
92 if( m_Inventory )
93 {
94 m_Inventory.Update(timeslice);
95 }
96 }
97
98 override void Refresh()
99 {
100 super.Refresh();
101
102 m_Inventory.UpdateConsoleToolbar();
103 }
104
105 override void OnShow()
106 {
107 super.OnShow();
108 m_IsOpened = true;
109 PPERequesterBank.GetRequester(PPERequesterBank.REQ_INVENTORYBLUR).Start();
110 VicinityItemManager.GetInstance().RefreshVicinityItems();
111
112 if(m_Inventory)
113 m_Inventory.OnShow();
114
115 SetFocus( layoutRoot );
116
117 MissionGameplay mission = MissionGameplay.Cast( GetGame().GetMission() );
118 if( mission )
119 {
120 mission.MoveHudForInventory( true );
121 }
122
124 ItemManager.GetInstance().SetSelectedItemEx(null, null, null);
125
126 m_Inventory.Refresh();
127 }
128
129 override bool OnController( Widget w, int control, int value )
130 {
131 if( m_IsOpened )
132 return m_Inventory.Controller( w, control, value );
133 return false;
134 }
135
136 bool IsOpened()
137 {
138 return m_IsOpened;
139 }
140
141 override void OnHide()
142 {
143 super.OnHide();
144 m_context_menu.Hide();
145 m_IsOpened = false;
146 PPERequesterBank.GetRequester(PPERequesterBank.REQ_INVENTORYBLUR).Stop();
147 if(m_Inventory)
148 m_Inventory.OnHide();
149 MissionGameplay mission = MissionGameplay.Cast(GetGame().GetMission());
150 if(mission)
151 {
152 mission.MoveHudForInventory( false );
153 }
154
156 ItemManager.GetInstance().SetSelectedItemEx(null, null, null);
158 }
159
161 {
163 }
164
166 {
167 return g_Game.GetCurrentDisplayLanguageIdx() != m_LastDisplayLanguage;
168 }
169
170 override void OnPlayerDeath()
171 {
172 super.OnPlayerDeath();
173 MissionGameplay mission = MissionGameplay.Cast(GetGame().GetMission());
174 if (mission)
175 {
176 mission.HideInventory();
177 }
178 }
179}
void Inventory(LayoutHolder parent)
Definition inventory.c:74
bool IsOpened()
void SetItemMicromanagmentMode(bool item_micromanagment_mode)
Definition itemmanager.c:64
void SetSelectedItemEx(EntityAI selected_item, Container selected_container, LayoutHolder selected_icon)
void HideTooltip()
static ItemManager GetInstance()
override void OnShow()
override void OnHide()
override Widget Init()
Definition bookmenu.c:11
override bool OnController(Widget w, int control, int value)
DayZGame g_Game
Definition dayzgame.c:3868
Mission mission
proto native CGame GetGame()
proto void GetScreenSize(out int x, out int y)
override ContextMenu GetContextMenu()
bool m_OnlyFirstTime
int m_LastDisplayLanguage
void InitContainers(EntityAI target)
bool m_IsOpened
void CheckWidth()
int GetLastDisplayLanguage()
ScreenWidthType
@ MEDIUM
@ WIDE
@ NARROW
bool LanguageChanged()
void RefreshQuickbar()
override void OnPlayerDeath()
void InventoryMenu()
enum ScreenWidthType m_Inventory
void Refresh()