1// ==================
2// WON MENU
3// ==================
4
5window won {
6	{
7		preventtypingescape	true
8	}
9
10	// ==================
11	// background
12	// ==================
13
14	image background {
15		src	"background/won_bg"
16	}
17
18	// ==================
19	// text
20	// ==================
21
22	text results {
23		pos			"500 150"
24		size		"480 460"
25		lineheight	20
26		tabwidth	350
27		rows		"23"
28		dataid		TEXT_LIST2
29	}
30
31	// ==================
32	// buttons
33	// ==================
34
35	button bt_continue {
36		string		"_Continue"
37		background		"ui/button_blue"
38		invis		true
39		pos			"865 700"
40		size		"128 53"
41		color		"1 1 1 0.8"
42		selectcolor "1 1 1 1"
43		font		"f_big"
44		onClick		{
45			cmd "ui_pop;"
46		}
47	}
48
49	func onWindowOpened {
50		if ( *cvar:sv_maxclients == 1 ) {
51			*node:root.bt_continue@invis = false
52		} else {
53			*node:root.bt_continue@invis = true
54		}
55	}
56
57	func onWindowClosed {
58		if ( *cvar:sv_maxclients == 1 ) {
59			cmd "cp_results 1;"
60		}
61	}
62}
63
64// ==================
65// LOST MENU
66// ==================
67
68window lost {
69	{
70		preventtypingescape	true
71	}
72
73	// ==================
74	// background
75	// ==================
76
77	image background {
78		src	"background/lost_bg"
79	}
80
81	data tryagain {
82		integer		0
83	}
84
85	// ==================
86	// text
87	// ==================
88
89	text results {
90		pos			"500 150"
91		size		"480 460"
92		lineheight	20
93		tabwidth	350
94		rows		"23"
95		dataid		TEXT_LIST2
96	}
97
98	// ==================
99	// buttons
100	// ==================
101
102	button bt_tryagain {
103		string		"_Try again"
104		tooltip		"_Retry this mission"
105		invis		true
106		background	"ui/button_blue"
107		pos			"480 700"
108		size		"128 53"
109		color		"1 1 1 0.8"
110		selectcolor "1 1 1 1"
111		font		"f_big"
112		onClick		{
113			*node:root.tryagain@integer = 1
114			cmd "ui_pop;"
115		}
116	}
117
118	button bt_continue {
119		string		"_Continue"
120		invis		true
121		background	"ui/button_blue"
122		pos			"865 700"
123		size		"128 53"
124		color		"1 1 1 0.8"
125		selectcolor "1 1 1 1"
126		font		"f_big"
127		onClick		{
128			cmd "ui_pop;"
129		}
130	}
131
132	confunc enable_retry {
133		*node:root.bt_tryagain@invis = false
134	}
135
136	func onWindowOpened
137	{
138		*node:root.tryagain@integer = 0
139		*node:root.bt_tryagain@invis = true
140		if ( *cvar:sv_maxclients == 1 ) {
141			*node:root.bt_continue@invis = false
142		} else {
143			*node:root.bt_continue@invis = true
144		}
145	}
146
147	func onWindowClosed
148	{
149		call *node:root.executeClose
150	}
151
152	func executeClose
153	{
154		if ( *cvar:sv_maxclients == 1 ) {
155			cmd "cp_results 0 <node:root.tryagain@integer>;"
156		}
157	}
158}
159
160// ==================
161// DRAW MENU
162// ==================
163
164window draw extends lost
165{
166	{
167		preventtypingescape	true
168	}
169
170	// ==================
171	// background
172	// ==================
173
174	image background
175	{
176		src	"background/lost_bg"
177	}
178
179	func executeClose
180	{
181		if ( *cvar:sv_maxclients == 1 ) {
182			// a draw counts as lost
183			cmd "cp_results 0;"
184		}
185	}
186}
187
188// ==================================
189// POPUP FOR UFO RECOVERY (Base/sell)
190// ==================================
191window uforecovery
192{
193	{
194		pos			"100 150"
195		size		"700 435"
196		dragbutton	true
197		modal		true
198		preventtypingescape true		// we can't use ESC
199		background		"ui/popup_alpha_tile"
200		string		"_UFO recovery"
201	}
202
203	tab uforecovery_navigation {
204		{
205			pos		"17 125"
206			size	"667 38"
207			cvar	*cvar:mn_uforecovery_tab
208			onChange {
209				cmd "uforecovery_tabselect <cvar:mn_uforecovery_tab> ;"
210			}
211		}
212		option store {
213			label	"_Store UFO"
214			value	"store"
215		}
216		option sell {
217			label	"_Sell UFO"
218			value	"sell"
219		}
220	}
221
222	string actualufo
223	{
224		string		*cvar:mn_uforecovery_actualufo
225		pos			"30 70"
226		size		"610 40"
227		font		"f_small"
228		contentalign	ALIGN_UL
229	}
230
231	//
232	// store panel
233	//
234	panel store_panel {
235		{
236			pos		"20 165"
237			size	"660 255"
238		}
239		rows lines {
240			pos			"25 50"
241			size		"590 128"
242			color1		"0 0.08 0 1"
243			color2		"0 0.16 0 1"
244			lineheight	16
245		}
246
247		string ur_yards_title
248		{
249			string		"_UFO Yard"
250			pos			"25 30"
251			size		"300 20"
252			font		"f_small_bold"
253		}
254		string ur_capacity_title
255		{
256			string		"_Capacity (free/all)"
257			pos			"325 30"
258			size		"290 20"
259			font		"f_small_bold"
260			contentalign	ALIGN_UR
261		}
262
263		textlist ur_ufoyards
264		{
265			dataid		TEXT_UFORECOVERY_UFOYARDS
266			pos			"30 50"
267			size		"395 128"
268			color		"0.60 0.60 0.60 1"
269			selectcolor	"1 1 1 1"
270			lineheight	16
271			tabwidth	100
272			rows		"8"
273			onClick		{
274				*node:root.store_panel.ur_capacities@lineselected = <lineselected>
275			}
276			onViewChange	{
277				*node:root.store_panel.ur_ufoyards_scroll@fullsize = <fullsize>
278				*node:root.store_panel.ur_ufoyards_scroll@current = <viewpos>
279				*node:root.store_panel.ur_ufoyards_scroll@viewsize = <viewsize>
280				*node:root.store_panel.ur_capacities@viewpos = <viewpos>
281			}
282		}
283		textlist ur_capacities
284		{
285			dataid		TEXT_UFORECOVERY_CAPACITIES
286			pos			"425 50"
287			size		"185 128"
288			color		"0.60 0.60 0.60 1"
289			selectcolor	"1 1 1 1"
290			lineheight	16
291			rows		"8"
292			contentalign	ALIGN_UR
293			onClick		{
294				*node:root.store_panel.ur_ufoyards@lineselected = <lineselected>
295			}
296			onViewChange	{
297				*node:root.store_panel.ur_ufoyards_scroll@fullsize = <fullsize>
298				*node:root.store_panel.ur_ufoyards_scroll@current = <viewpos>
299				*node:root.store_panel.ur_ufoyards_scroll@viewsize = <viewsize>
300				*node:root.store_panel.ur_ufoyards@viewpos = <viewpos>
301			}
302		}
303		vscrollbar ur_ufoyards_scroll {
304			image		"ui/scrollbar_v_green"
305			pos			"620 50"
306			height		"128"
307			current		0
308			viewsize	8
309			fullsize	8
310			hidewhenunused true
311			onChange	{
312				*node:root.store_panel.ur_ufoyards@viewpos = <current>
313				*node:root.store_panel.ur_capacities@viewpos = <current>
314			}
315		}
316
317		cmpPopupButton bt_basesel
318		{
319			string		"_Recover"
320			tooltip		"_Begin UFO recovery process"
321			pos			"242 210"
322			onClick		{ cmd "cp_uforecovery_store_start <node:root.store_panel.ur_ufoyards@lineselected>; ui_pop;" }
323		}
324	}
325
326	//
327	// sell panel
328	//
329	panel sell_panel
330	{
331		{
332			pos		"20 165"
333			size	"660 255"
334		}
335
336		button name_label
337		{
338			string		"_Nation:"
339			tooltip		"_Sort nations by name"
340			pos			"25 30"
341			size		"250 20"
342			font		"f_small_bold"
343			color		"0 0.5 0 1"
344			onClick		{ cmd "cp_uforecovery_sort nation;" }
345		}
346
347		button bt_price
348		{
349			string		"_Price:"
350			tooltip		"_Sort nations by price"
351			pos			"275 30"
352			size		"125 20"
353			font		"f_small_bold"
354			color		"0 0.5 0 1"
355			onClick		{ cmd "cp_uforecovery_sort price;" }
356		}
357
358		button bt_relation
359		{
360			string		"_Relations:"
361			tooltip		"_Sort nations by relation"
362			pos			"450 30"
363			size		"175 20"
364			font		"f_small_bold"
365			color		"0 0.5 0 1"
366			onClick		{ cmd "cp_uforecovery_sort happiness;" }
367		}
368
369		rows lines {
370			pos			"25 50"
371			size		"590 128"
372			color1		"0 0.08 0 1"
373			color2		"0 0.16 0 1"
374			lineheight	16
375		}
376
377		/* tabbed textlist */
378		text cp_uforecovery_nationlist
379		{
380			dataid		TEXT_UFORECOVERY_NATIONS
381			pos			"25 50"
382			size		"590 128"
383			lineheight	16
384			tabwidth	100
385			color		"0.60 0.60 0.60 1"
386			selectcolor	"1 1 1 1"
387			rows		"8"
388			mousefx		true
389			longlines	LONGLINES_PRETTYCHOP
390			onClick		{ cmd "cp_uforecovery_nationlist_click <lineselected>;" }
391			onViewChange	{
392				*node:root.sell_panel.cp_ur_nationlist_scroll@fullsize = <fullsize>
393				*node:root.sell_panel.cp_ur_nationlist_scroll@current = <viewpos>
394				*node:root.sell_panel.cp_ur_nationlist_scroll@viewsize = <viewsize>
395			}
396		}
397		vscrollbar cp_ur_nationlist_scroll {
398			image		"ui/scrollbar_v_green"
399			pos			"620 50"
400			height		"128"
401			current		0
402			viewsize	8
403			fullsize	8
404			hidewhenunused true
405			onChange	{ *node:root.sell_panel.cp_uforecovery_nationlist@viewpos = <current> }
406		}
407
408		string selected_nation_str
409		{
410			string		"_Selected nation:"
411			pos			"30 186"
412			size		"210 20"
413		}
414
415		string selected_nation_val
416		{
417			string		*cvar:mission_recoverynation
418			pos			"250 186"
419			size		"360 20"
420		}
421
422		cmpPopupButton bt_natsel
423		{
424			string		"_Sell"
425			tooltip		"_Begin UFO sell process"
426			pos			"242 210"
427			onClick		{ cmd "cp_uforecovery_sell_start; ui_pop;" }
428		}
429	}
430
431	/*
432	 * function to manage tab
433	 */
434	confunc uforecovery_tabselect {
435		*cvar:mn_uforecovery_tab = <1>
436		if ( *cvar:mn_uforecovery_tab eq "store" ) {
437			*node:root.store_panel@invis = false
438			*node:root.sell_panel@invis = true
439		}
440		if ( *cvar:mn_uforecovery_tab eq "sell" ) {
441			*node:root.sell_panel@invis = false
442			*node:root.store_panel@invis = true
443		}
444	}
445
446	confunc btnatsel {
447		*cvar:tmp = "<1>"
448		if ( *cvar:tmp eq "enable" ) {
449			*node:root.sell_panel.bt_natsel@disabled = false
450		} else {
451			*node:root.sell_panel.bt_natsel@disabled = true
452		}
453		delete *cvar:tmp
454	}
455
456	confunc cp_nationsel_select {
457		*node:root.sell_panel.cp_uforecovery_nationlist@lineselected = <1>
458	}
459
460	confunc btbasesel {
461		*cvar:tmp = "<1>"
462		if ( *cvar:tmp eq "enable" ) {
463			*node:root.store_panel.bt_basesel@disabled = false
464		} else {
465			*node:root.store_panel.bt_basesel@disabled = true
466		}
467		delete *cvar:tmp
468	}
469
470	confunc cp_basesel_select {
471		*node:root.store_panel.ur_ufoyards@lineselected = <1>
472		*node:root.store_panel.ur_capacities@lineselected = <1>
473	}
474
475	func onWindowOpened {
476		cmd "uforecovery_tabselect store"
477		*node:root.store_panel.ur_ufoyards@lineselected = -1
478		*node:root.store_panel.ur_capacities@lineselected = -1
479		*node:root.sell_panel.cp_uforecovery_nationlist@lineselected = -1
480		*cvar:mission_recoverynation = ""
481
482		cmd "cp_uforecovery_sell_init; cp_uforecovery_store_init;"
483	}
484
485	func onWindowClosed {
486		delete *cvar:mn_uforecovery_tab
487		delete *cvar:mn_uforecovery_actualufo
488	}
489}
490