DayZ 1.27
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 = GetGame().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
65 {
66 return m_Root;
67 }
68
69 void Select()
70 {
71 m_Root.SetColor( ARGBF( m_Root.GetAlpha(), 0.3, 0, 0 ) );
72
73 m_Detail.Show(true);
74 m_IconBig.Show( true );
75 m_IconSmall.Show( false );
76 m_IconCollapse.SetImage( 1 );
77 m_Detail.Update();
78 m_Root.Update();
79 m_IsOpen = true;
80 }
81
82 void Deselect()
83 {
84 m_Root.SetColor( ARGBF( m_Root.GetAlpha(), 0.2, 0.2, 0.2 ) );
85
86 m_Detail.Show(false);
87 m_IconBig.Show( false );
88 m_IconSmall.Show( true );
89 m_IconCollapse.SetImage( 0 );
90 m_Detail.Update();
91 m_Root.Update();
92 m_IsOpen = false;
93 }
94
95 void LoadData()
96 {
97 string picture = m_Data.GetPicture();
98 string logo = m_Data.GetLogoSmall();
99 string name = m_Data.GetName();
100 string description = m_Data.GetOverview();
101 string author = m_Data.GetAuthor();
102 string version = m_Data.GetVersion();
103 string action = m_Data.GetAction();
104
105 //Load Large Icon
106 if (picture != "")
107 {
108 m_IconBig.LoadImageFile(0, picture);
109 }
110 else if (logo != "")
111 {
112 m_IconBig.LoadImageFile(0, logo);
113 }
114 else
115 {
116 m_IconBig.LoadImageFile(0, ModInfo.DEFAULT_PICTURE);
117 }
118
119 //Load Small Icon
120 if (logo != "")
121 {
122 m_IconSmall.LoadImageFile(0, logo);
123 }
124 else if (picture != "")
125 {
126 m_IconSmall.LoadImageFile(0, picture);
127 }
128 else
129 {
130 m_IconSmall.LoadImageFile(0, ModInfo.DEFAULT_LOGO_SMALL);
131 }
132
133 if (name != "")
134 {
135 m_Name.SetText(name);
136 }
137
138 if (description != "")
139 {
140 m_Description.SetText(description);
141 }
142 else
143 {
145 }
146 m_Description.Update();
147 m_Detail.Update();
148
149 if (author != "")
150 {
151 m_Author.Show( true );
152 m_Author.SetText(author);
153 }
154
155 if (version != "")
156 {
157 m_Version.Show( true );
158 m_Version.SetText(version);
159 }
160
161 #ifdef PLATFORM_WINDOWS
162 if (action != "")
163 {
164 m_ActionWebsite.Show( true );
165 }
166 #endif
167
168 if ( m_Data.GetIsDLC() )
169 {
170 bool isOwned = m_Data.GetIsOwned();
171 m_Root.FindAnyWidget("ModOwnership").Show( true );
172 m_Root.FindAnyWidget("Owned").Show( isOwned );
173 m_Root.FindAnyWidget("Unowned").Show( !isOwned );
174 m_ActionPurchase.Show( true );
175 m_Version.Show( false );
176 }
177 }
178
179 override bool OnMouseButtonUp(Widget w, int x, int y, int button)
180 {
181 if (w == m_IconCollapse)
182 {
183 m_ParentMenu.Select(m_Data, !m_IsOpen);
184 return true;
185 }
186 else if (w == m_ActionWebsite)
187 {
188 GetGame().OpenURL(m_Data.GetAction());
189 }
190 else if (w == m_ActionPurchase)
191 {
192 m_Data.GoToStore();
193 }
194
195 return false;
196 }
197
198 override bool OnMouseEnter(Widget w, int x, int y)
199 {
200 if (w == m_ActionWebsite)
201 m_ActionWebsite.SetBold(true);
202
203 if (w == m_ActionPurchase)
204 m_ActionPurchase.SetBold(true);
205
206 if (w == m_Root)
207 {
208 if (m_Data.GetTooltip() != "")
209 m_ParentMenu.PrepareTooltip(m_Data);
210
211 return true;
212 }
213
214 return false;
215 }
216
217 override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
218 {
219 if (w == m_ActionWebsite)
220 m_ActionWebsite.SetBold(false);
221
222 if (w == m_ActionPurchase)
223 m_ActionPurchase.SetBold( false );
224
225 if (enterW != m_Root)
226 {
227 m_ParentMenu.HideTooltip();
228 return true;
229 }
230
231 return false;
232 }
233}
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
Icon x
Icon y
Widget m_Root
Определения SizeToChild.c:91
proto native WorkspaceWidget GetWorkspace()
proto native void OpenURL(string url)
static const string DEFAULT_PICTURE
Определения ModInfo.c:18
static const string DEFAULT_OVERVIEW
Определения ModInfo.c:22
static const string DEFAULT_LOGO_SMALL
Определения ModInfo.c:20
Определения ModInfo.c:2
Определения gameplay.c:317
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:179
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:217
override bool OnMouseEnter(Widget w, int x, int y)
Определения ModsMenuDetailedEntry.c:198
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
map: item x vector(index, width, height)
Определения EnWidgets.c:651
Определения EnWidgets.c:220
Определения EnWidgets.c:190
proto native CGame GetGame()
proto native external Widget CreateWidgets(string layout, Widget parentWidget=NULL, bool immedUpdate=true)
Create widgets from *.layout file.
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