DayZ 1.30
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
ModsMenuDetailedEntry.c
См. документацию.
1class ModsMenuDetailedEntry extends ScriptedWidgetEventHandler
2{
3 protected Widget m_Root;
4 protected Widget m_Detail;
5
6 //Header
7 protected ImageWidget m_IconSmall;
8 protected ImageWidget m_IconCollapse;
9 protected TextWidget m_Name;
10
11 //Left Side Panel
12 protected ImageWidget m_IconBig;
13 protected MultilineTextWidget m_Author;
17
18 //Description Panel
20
21 protected ModInfo m_Data;
23 protected bool m_IsOpen;
24
25 void ModsMenuDetailedEntry(ModInfo data, Widget parent, ModsMenuDetailed parent_menu)
26 {
27 m_Root = g_Game.GetWorkspace().CreateWidgets("gui/layouts/new_ui/mods_menu/mods_menu_detailed_entry.layout", parent);
28 m_Detail = m_Root.FindAnyWidget("DetailContainer");
29
30 m_IconSmall = ImageWidget.Cast(m_Root.FindAnyWidget("IconSmall"));
31 m_IconCollapse = ImageWidget.Cast(m_Root.FindAnyWidget("collapse_button"));
32 m_IconCollapse.LoadImageFile( 1, "set:dayz_gui image:icon_open" );
33 m_Name = TextWidget.Cast(m_Root.FindAnyWidget("Name"));
34
35 m_IconBig = ImageWidget.Cast(m_Root.FindAnyWidget("IconBig"));
36 m_Author = MultilineTextWidget.Cast(m_Root.FindAnyWidget("Author"));
37 m_Author.SetLineBreakingOverride(LinebreakOverrideMode.LINEBREAK_WESTERN);
38
39 m_Version = TextWidget.Cast(m_Root.FindAnyWidget("Version"));
40 m_ActionWebsite = RichTextWidget.Cast(m_Root.FindAnyWidget("Link"));
41 m_ActionPurchase = RichTextWidget.Cast(m_Root.FindAnyWidget("Purchase"));
42 #ifdef PLATFORM_PS4
43 m_ActionPurchase.SetText("#mod_detail_info_store_PS");
44 #endif
45 #ifdef PLATFORM_XBOX
46 m_ActionPurchase.SetText("#mod_detail_info_store_Xbox");
47 #endif
48
49 m_Description = RichTextWidget.Cast(m_Root.FindAnyWidget("Description"));
50
51 m_Data = data;
52 m_ParentMenu = parent_menu;
53
54 m_Root.SetHandler(this);
55
56 LoadData();
57 }
58
60 {
61 delete m_Root;
62
63 if (GetGame() && GetGame().GetContentDLCService())
64 {
65 g_Game.GetContentDLCService().Unsubscribe(OnDLCChange);
66 }
67 }
68
69 void OnDLCChange(EDLCId dlcId)
70 {
71 bool isOwned = m_Data.GetIsOwned();
72 m_Root.FindAnyWidget("Owned").Show( isOwned );
73 m_Root.FindAnyWidget("Unowned").Show( !isOwned );
74 }
75
77 {
78 return m_Root;
79 }
80
81 void Select()
82 {
83 m_Root.SetColor( ARGBF( m_Root.GetAlpha(), 0.3, 0, 0 ) );
84
85 m_Detail.Show(true);
86 m_IconBig.Show( true );
87 m_IconSmall.Show( false );
88 m_IconCollapse.SetImage( 1 );
89 m_Detail.Update();
90 m_Root.Update();
91 m_IsOpen = true;
92 }
93
94 void Deselect()
95 {
96 m_Root.SetColor( ARGBF( m_Root.GetAlpha(), 0.2, 0.2, 0.2 ) );
97
98 m_Detail.Show(false);
99 m_IconBig.Show( false );
100 m_IconSmall.Show( true );
101 m_IconCollapse.SetImage( 0 );
102 m_Detail.Update();
103 m_Root.Update();
104 m_IsOpen = false;
105 }
106
107 void LoadData()
108 {
109 string picture = m_Data.GetPicture();
110 string logo = m_Data.GetLogoSmall();
111 string name = m_Data.GetName();
112 string description = m_Data.GetOverview();
113 string author = m_Data.GetAuthor();
114 string version = m_Data.GetVersion();
115 string action = m_Data.GetAction();
116
117 //Load Large Icon
118 if (picture != "")
119 {
120 m_IconBig.LoadImageFile(0, picture);
121 }
122 else if (logo != "")
123 {
124 m_IconBig.LoadImageFile(0, logo);
125 }
126 else
127 {
128 m_IconBig.LoadImageFile(0, ModInfo.DEFAULT_PICTURE);
129 }
130
131 //Load Small Icon
132 if (logo != "")
133 {
134 m_IconSmall.LoadImageFile(0, logo);
135 }
136 else if (picture != "")
137 {
138 m_IconSmall.LoadImageFile(0, picture);
139 }
140 else
141 {
142 m_IconSmall.LoadImageFile(0, ModInfo.DEFAULT_LOGO_SMALL);
143 }
144
145 if (name != "")
146 {
147 m_Name.SetText(name);
148 }
149
150 if (description != "")
151 {
152 m_Description.SetText(description);
153 }
154 else
155 {
157 }
158 m_Description.Update();
159 m_Detail.Update();
160
161 if (author != "")
162 {
163 m_Author.Show( true );
164 m_Author.SetText(author);
165 }
166
167 if (version != "")
168 {
169 m_Version.Show( true );
170 m_Version.SetText(version);
171 }
172
173 #ifdef PLATFORM_WINDOWS
174 if (action != "")
175 {
176 m_ActionWebsite.Show( true );
177 }
178 #endif
179
180 if ( m_Data.GetIsDLC() )
181 {
182 bool isOwned = m_Data.GetIsOwned();
183 m_Root.FindAnyWidget("ModOwnership").Show( true );
184 m_Root.FindAnyWidget("Owned").Show( isOwned );
185 m_Root.FindAnyWidget("Unowned").Show( !isOwned );
186 m_ActionPurchase.Show( true );
187 m_Version.Show( false );
188
189 g_Game.GetContentDLCService().Subscribe(OnDLCChange);
190 }
191 }
192
193 override bool OnMouseButtonUp(Widget w, int x, int y, int button)
194 {
195 if (w == m_IconCollapse)
196 {
197 m_ParentMenu.Select(m_Data, !m_IsOpen);
198 return true;
199 }
200 else if (w == m_ActionWebsite)
201 {
202 g_Game.OpenURL(m_Data.GetAction());
203 }
204 else if (w == m_ActionPurchase)
205 {
206 m_Data.GoToStore();
207 }
208
209 return false;
210 }
211
212 override bool OnMouseEnter(Widget w, int x, int y)
213 {
214 if (w == m_ActionWebsite)
215 m_ActionWebsite.SetBold(true);
216
217 if (w == m_ActionPurchase)
218 m_ActionPurchase.SetBold(true);
219
220 if (w == m_Root)
221 {
222 if (m_Data.GetTooltip() != "")
223 m_ParentMenu.PrepareTooltip(m_Data);
224
225 return true;
226 }
227
228 return false;
229 }
230
231 override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
232 {
233 if (w == m_ActionWebsite)
234 m_ActionWebsite.SetBold(false);
235
236 if (w == m_ActionPurchase)
237 m_ActionPurchase.SetBold( false );
238
239 if (enterW != m_Root)
240 {
241 m_ParentMenu.HideTooltip();
242 return true;
243 }
244
245 return false;
246 }
247}
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
EDLCId
Определения ContentDLC.c:4
DayZGame g_Game
Определения DayZGame.c:4074
Icon x
Icon y
Widget m_Root
Определения SizeToChild.c:91
static const string DEFAULT_PICTURE
Определения ModInfo.c:19
static const string DEFAULT_OVERVIEW
Определения ModInfo.c:23
static const string DEFAULT_LOGO_SMALL
Определения ModInfo.c:21
Определения ModInfo.c:2
Определения gameplay.c:317
void OnDLCChange(EDLCId dlcId)
Определения ModsMenuDetailedEntry.c:69
ImageWidget m_IconCollapse
Определения ModsMenuDetailedEntry.c:8
RichTextWidget m_ActionPurchase
Определения ModsMenuDetailedEntry.c:16
RichTextWidget m_Description
Определения ModsMenuDetailedEntry.c:19
RichTextWidget m_ActionWebsite
Определения ModsMenuDetailedEntry.c:15
override bool OnMouseButtonUp(Widget w, int x, int y, int button)
Определения ModsMenuDetailedEntry.c:193
Widget m_Root
Определения SizeToChild.c:9
void ModsMenuDetailedEntry(ModInfo data, Widget parent, ModsMenuDetailed parent_menu)
Определения ModsMenuDetailedEntry.c:25
ImageWidget m_IconSmall
Определения ModsMenuDetailedEntry.c:7
void ~ModsMenuDetailedEntry()
Определения ModsMenuDetailedEntry.c:59
TextWidget m_Version
Определения ModsMenuDetailedEntry.c:14
MultilineTextWidget m_Author
Определения ModsMenuDetailedEntry.c:13
override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
Определения ModsMenuDetailedEntry.c:231
void OnDLCChange()
Определения MainMenuPromo.c:163
override bool OnMouseEnter(Widget w, int x, int y)
Определения ModsMenuDetailedEntry.c:212
ref map< ref ModInfo, ref ModsMenuDetailedEntry > m_Data
Определения ModsMenuDetailed.c:7
void ModsMenuDetailed(array< ref ModInfo > data, Widget parent, ModsMenuTooltip tooltip, UIScriptedMenu menu_parent)
Определения ModsMenuDetailed.c:17
ModsMenuDetailed m_ParentMenu
Определения ModsMenuDetailedEntry.c:22
ImageWidget m_IconBig
Определения ModsMenuDetailedEntry.c:12
Deprecated.
Определения EnWidgets.c:657
Определения EnWidgets.c:220
Определения EnWidgets.c:190
DayZGame GetGame()
Определения gameplay.c:636
WorkspaceWidget Widget
Defined in code.
int ARGBF(float fa, float fr, float fg, float fb)
Converts <0.0, 1.0> ARGB into color.
Определения proto.c:332