File size: 6,939 Bytes
b6a38d7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
-- ========== GENERATED BY XTemplate Editor (Alt-F3) DO NOT EDIT MANUALLY! ==========

PlaceObj('XTemplate', {
	group = "ModManager",
	id = "ModManagerDialog",
	save_in = "Common",
	PlaceObj('XTemplateWindow', {
		'__context', function (parent, context) return ModsUIObjectCreateAndLoad() end,
		'__class', "XDialog",
		'Id', "idModsUIDialog",
		'Background', RGBA(255, 255, 255, 255),
		'HandleMouse', true,
		'InitialMode', "installed",
		'InternalModes', "browse, installed, details",
	}, {
		PlaceObj('XTemplateFunc', {
			'name', "UpdateActionViews(self, win)",
			'func', function (self, win)
				XDialog.UpdateActionViews(self, win)
				self:InvalidateMeasure()
			end,
		}),
		PlaceObj('XTemplateFunc', {
			'name', "Open",
			'func', function (self, ...)
				XDialog.Open(self, ...)
				if not IsUserCreatedContentAllowed() then
					self:SetMode("installed")
				end
				ModsUIDialogStart()
			end,
		}),
		PlaceObj('XTemplateFunc', {
			'name', "OnDelete",
			'func', function (self, ...)
				ModsUIClosePopup(self)
				XDialog.OnDelete(self, ...)
				g_ModsUIContextObj = false
			end,
		}),
		PlaceObj('XTemplateFunc', {
			'name', "OnShortcut(self, shortcut, source, ...)",
			'func', function (self, shortcut, source, ...)
				if not self.context.popup_shown and self.Mode ~= "details" and IsUserCreatedContentAllowed() then
					if shortcut == "LeftTrigger" then
						self:ResolveId("idBrowse"):Press()
						return "break"
					elseif shortcut == "RightTrigger" then
						self:ResolveId("idInstalled"):Press()
						return "break"
					end
				end
				return XDialog.OnShortcut(self, shortcut, source, ...)
			end,
		}),
		PlaceObj('XTemplateWindow', {
			'__class', "XContentTemplate",
		}, {
			PlaceObj('XTemplateGroup', {
				'__condition', function (parent, context) return GetUIStyleGamepad() end,
			}, {
				PlaceObj('XTemplateMode', nil, {
					PlaceObj('XTemplateAction', {
						'ActionId', "select",
						'ActionName', T(764001006052, --[[XTemplate ModManagerDialog ActionName]] "Select"),
						'ActionToolbar', "ActionBarLeft",
						'ActionGamepad', "ButtonA",
						'ActionState', function (self, host)
							return not ModsUIIsPopupShown(host) or "hidden"
						end,
					}),
					}),
				PlaceObj('XTemplateAction', {
					'ActionId', "search",
					'ActionName', T(459090792822, --[[XTemplate ModManagerDialog ActionName]] "Search"),
					'ActionToolbar', "ActionBarLeft",
					'ActionShortcut', "Enter",
					'ActionGamepad', "ButtonY",
					'ActionState', function (self, host)
						local popup = ModsUIIsPopupShown(host)
						return popup ~= "search" and "hidden"
					end,
					'OnAction', function (self, host, source, ...)
						local context = host.context
						if host.Mode == "browse" then
							if context.query ~= context.temp_query then
								context.query = context.temp_query
								context:GetMods()
							end
						else
							if context.installed_query ~= context.temp_query then
								context.installed_query = context.temp_query
								context:GetInstalledMods()
							end
						end
						ModsUIClosePopup(host)
					end,
				}),
				PlaceObj('XTemplateAction', {
					'ActionId', "popupcancel",
					'ActionName', T(494914306689, --[[XTemplate ModManagerDialog ActionName]] "Cancel"),
					'ActionToolbar', "ActionBarRight",
					'ActionShortcut', "Escape",
					'ActionGamepad', "ButtonB",
					'ActionState', function (self, host)
						local popup = ModsUIIsPopupShown(host)
						return (not popup or popup == "login") and "hidden"
					end,
					'OnAction', function (self, host, source, ...)
						ModsUIClosePopup(host)
					end,
				}),
				PlaceObj('XTemplateAction', {
					'ActionId', "popupsortsave",
					'ActionName', T(638926077884, --[[XTemplate ModManagerDialog ActionName]] "Apply"),
					'ActionToolbar', "ActionBarLeft",
					'ActionGamepad', "ButtonA",
					'ActionState', function (self, host)
						local popup = ModsUIIsPopupShown(host)
						return popup ~= "sort" and "hidden"
					end,
					'OnAction', function (self, host, source, ...)
						ModsUIClosePopup(host)
					end,
				}),
				PlaceObj('XTemplateAction', {
					'ActionId', "popupfiltersave",
					'ActionName', T(638926077884, --[[XTemplate ModManagerDialog ActionName]] "Apply"),
					'ActionToolbar', "ActionBarLeft",
					'ActionGamepad', "ButtonY",
					'ActionState', function (self, host)
						local popup = ModsUIIsPopupShown(host)
						return popup ~= "filter" and "hidden"
					end,
					'OnAction', function (self, host, source, ...)
						if host.Mode == "installed" then
							ModsUISetInstalledTags()
							ModsUIClosePopup(host)
							host.context:GetInstalledMods()
						else
							ModsUISetTags()
							ModsUIClosePopup(host)
							host.context:GetMods()
						end
					end,
				}),
				PlaceObj('XTemplateAction', {
					'ActionId', "popupfilterclear",
					'ActionName', T(761178986756, --[[XTemplate ModManagerDialog ActionName]] "Clear Filters"),
					'ActionToolbar', "ActionBarLeft",
					'ActionGamepad', "ButtonX",
					'ActionState', function (self, host)
						local popup = ModsUIIsPopupShown(host)
						return popup ~= "filter" and "hidden"
					end,
					'OnAction', function (self, host, source, ...)
						ModsUIClearFilter(GetDialog(host):GetMode())
					end,
				}),
				}),
			}),
		PlaceObj('XTemplateWindow', {
			'__class', "XContentTemplate",
			'IdNode', false,
			'OnContextUpdate', function (self, context, ...)
				local list = self:ResolveId("idList")
				if list then
					local mode = GetDialogMode(self)
					local obj = ResolvePropObj(context)
					if mode == "browse" and obj.last_browse_y then
						obj.last_browse_y = list.OffsetY
						obj.last_browse_item = list.focused_item
					elseif mode == "installed" and obj.last_installed_y then
						obj.last_installed_y = list.OffsetY
						obj.last_installed_item = list.focused_item
					end
				end
				XContentTemplate.OnContextUpdate(self, context, ...)
			end,
		}, {
			PlaceObj('XTemplateWindow', {
				'Id', "idBottomBar",
				'Dock', "bottom",
			}),
			PlaceObj('XTemplateMode', {
				'mode', "browse",
			}, {
				PlaceObj('XTemplateTemplate', {
					'__template', "ModManagerMainContent",
				}),
				}),
			PlaceObj('XTemplateMode', {
				'mode', "installed",
			}, {
				PlaceObj('XTemplateTemplate', {
					'__template', "ModManagerMainContent",
				}),
				}),
			PlaceObj('XTemplateMode', {
				'mode', "details",
			}, {
				PlaceObj('XTemplateTemplate', {
					'__template', "ModManagerModDetails",
				}),
				}),
			PlaceObj('XTemplateWindow', {
				'__parent', function (parent, context) return parent:ResolveId("idBottomBar") end,
				'__class', "XToolBar",
				'HAlign', "left",
				'Toolbar', "bottommenu",
			}),
			PlaceObj('XTemplateWindow', {
				'__parent', function (parent, context) return parent:ResolveId("idBottomBar") end,
				'__class', "XToolBar",
				'HAlign', "right",
				'Toolbar', "bottommenu_right",
			}),
			}),
		}),
})