DayZ 1.24
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();
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 {
41
42 if (m_Height > 0)
43 {
44 float ratio = m_Width / m_Height;
45 if (ratio > 1.75)
47 else if (ratio > 1.5)
49 else
51 }
52 }
53
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 m_Inventory.Update(timeslice);
94 }
95
96 override void Refresh()
97 {
98 super.Refresh();
99
100 m_Inventory.UpdateConsoleToolbar();
101 }
102
103 override void OnShow()
104 {
105 super.OnShow();
106 m_IsOpened = true;
107 PPERequesterBank.GetRequester(PPERequesterBank.REQ_INVENTORYBLUR).Start();
108 VicinityItemManager.GetInstance().RefreshVicinityItems();
109
110 if (m_Inventory)
111 m_Inventory.OnShow();
112
113 SetFocus(layoutRoot);
114
115 MissionGameplay mission = MissionGameplay.Cast(GetGame().GetMission());
116 if (mission)
117 mission.MoveHudForInventory(true);
118
119 ItemManager.GetInstance().SetItemMicromanagmentMode(false);
120 ItemManager.GetInstance().SetSelectedItemEx(null, null, null);
121
122 m_Inventory.Refresh();
123 }
124
125 override bool OnController(Widget w, int control, int value)
126 {
127 if (m_IsOpened)
128 return m_Inventory.Controller(w, control, value);
129 return false;
130 }
131
132 bool IsOpened()
133 {
134 return m_IsOpened;
135 }
136
137 override void OnHide()
138 {
139 super.OnHide();
140 m_context_menu.Hide();
141 m_IsOpened = false;
142 PPERequesterBank.GetRequester(PPERequesterBank.REQ_INVENTORYBLUR).Stop();
143 if (m_Inventory)
144 m_Inventory.OnHide();
145 MissionGameplay mission = MissionGameplay.Cast(GetGame().GetMission());
146 if (mission)
147 mission.MoveHudForInventory(false);
148
149 ItemManager.GetInstance().SetItemMicromanagmentMode(false);
150 ItemManager.GetInstance().SetSelectedItemEx(null, null, null);
151 ItemManager.GetInstance().HideTooltip();
152 }
153
155 {
157 }
158
160 {
161 return g_Game.GetCurrentDisplayLanguageIdx() != m_LastDisplayLanguage;
162 }
163}
void Inventory(LayoutHolder parent)
Definition Inventory.c:76
bool IsOpened()
DayZGame g_Game
Definition DayZGame.c:3528
Mission mission
static ScreenWidthType m_WidthType
override ContextMenu GetContextMenu()
bool m_OnlyFirstTime
int m_LastDisplayLanguage
void InitContainers(EntityAI target)
bool m_IsOpened
void CheckWidth()
static int m_Width
int GetLastDisplayLanguage()
ScreenWidthType
@ MEDIUM
@ WIDE
@ NARROW
bool LanguageChanged()
void RefreshQuickbar()
ref ContextMenu m_context_menu
static ScreenWidthType GetWidthType()
static int m_Height
static float GetHeightMultiplied(float value)
void InventoryMenu()
static int GetWidth()
enum ScreenWidthType m_Inventory
static ItemManager GetInstance()
override void OnShow()
override void Refresh()
override void OnHide()
override Widget Init()
Definition BookMenu.c:11
override bool OnController(Widget w, int control, int value)
static VicinityItemManager GetInstance()
proto native CGame GetGame()
proto void GetScreenSize(out int x, out int y)
proto native void SetFocus(Widget w)
proto native volatile void Update()