DayZ Scripts
v1.21.156300 ยท Jun 20, 2023
 
Loading...
Searching...
No Matches
InventoryMenu.c
Go to the documentation of this file.
2{
5 WIDE
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 {
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 {
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();
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().SetSelectedItem( null, 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().SetSelectedItem( null, null, null, null );
158 }
159
161 {
163 }
164
166 {
167 return g_Game.GetCurrentDisplayLanguageIdx() != m_LastDisplayLanguage;
168 }
169}
void Inventory(LayoutHolder parent)
Definition Inventory.c:75
bool IsOpened()
DayZGame g_Game
Definition DayZGame.c:3654
Mission mission
protected bool m_OnlyFirstTime
override ContextMenu GetContextMenu()
static protected int m_Height
void InitContainers(EntityAI target)
protected bool m_IsOpened
static protected ScreenWidthType m_WidthType
void CheckWidth()
protected int m_LastDisplayLanguage
int GetLastDisplayLanguage()
ScreenWidthType
@ MEDIUM
@ WIDE
@ NARROW
private ref ContextMenu m_context_menu
static protected int m_Width
bool LanguageChanged()
void RefreshQuickbar()
static ScreenWidthType GetWidthType()
static float GetHeightMultiplied(float value)
void InventoryMenu()
static int GetWidth()
enum ScreenWidthType m_Inventory
void SetItemMicromanagmentMode(bool item_micromanagment_mode)
Definition ItemManager.c:62
void SetSelectedItem(EntityAI selected_item, Container selected_container, Widget selected_widget, SlotsIcon selected_icon)
void HideTooltip()
static ItemManager GetInstance()
override void Refresh()
override void OnShow()
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()