-
Notifications
You must be signed in to change notification settings - Fork 1
/
error_popup.lua
208 lines (177 loc) · 6.39 KB
/
error_popup.lua
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
--
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
--
-- General handler for a "Error" dialog.
-- Does any work to activate this. Vis is nil if off, or a float in
-- the following list (out of FLGuiManager.h)
-- enum eErrorSeverity {
-- ERROR_NONE = 0, // no error
-- OLD_ERROR_PAD_MISSING = 1, // Pauses SP, dialog in MP
-- ERROR_WARNING = 2, // no ui steps required
-- ERROR_DELAY = 3, // no ui steps required, but add a delay to return
-- ERROR_SUBSCREEN = 4, // error in subscreen, bail one screen
-- ERROR_IGNORE_OR_REBOOT = 5, // optional reboot to dashboard
-- ERROR_LEAVE_SESSION = 6, // must leave the current session
-- ERROR_LOGOFF_SECONDARY, // 7 - must disconnect secondary player only (XLive)
-- ERROR_LOGOFF, // 8 - must disconnect all players
-- ERROR_LOGOFF_CABLE, // 9 - cable out, must disconnect
-- ERROR_LOGOFF_OR_REBOOT, // 10 - must logoff, optional reboot to dashboard
-- ERROR_REBOOT, // 11 - must reboot to dashboard
-- ERROR_MISSING_DC, // 12 - client missing a downloadable content map in MP
-- ERROR_PAD_MISSING, // 13 - Pauses SP, dialog in MP [new one, bumped priority above net - NM 7/1/04]
-- };
-- The OK button is shown for anything ERROR_SUBSCREEN or higher
function gPopup_Error_fnActivate(this,vis)
print("Error_fnActivate. vis = ", vis)
if(vis) then
-- Hack for bug 7600 - ifs_mp_lobby_quick's fnPostError gets no error
-- reported, as it's been cleared by then. So, store a copy of the
-- last error, as long as it's not a controller-pulled error.
if(vis < 13) then
this.iLastNetError = vis
end
-- Hide busy popup if present by making it transparent.
-- [Artists want everything transparent, which makes showing both
-- at once very visually confusing]
if(Popup_Busy) then
IFObj_fnSetAlpha(Popup_Busy,0.0)
end
-- HACK for 3774, 6326 - hide DNAS stuff if present (only in PS2 shell)
-- Thou shalt have no bitmaps before the DNAS logo.
if(ifs_mpps2_dnas and ifs_mpps2_dnas.dnasImg) then
IFObj_fnSetVis(ifs_mpps2_dnas.dnasImg, nil)
IFObj_fnSetVis(ifs_mpps2_dnas.dnasTM, nil)
IFObj_fnSetVis(ifs_mpps2_dnas.buttons, nil)
IFObj_fnSetVis(ifs_mpps2_dnas.errorText, nil)
end
-- Fix for 10993, 11067 - hide any popups, because the artists cannot be
-- severed from their love of transparency. Two popups in the same
-- space is unreadable. - NM 8/19/05
if(Popup_Ok) then
IFObj_fnSetVis(Popup_Ok, nil)
end
if(Popup_YesNo) then
IFObj_fnSetVis(Popup_YesNo, nil)
end
if(Popup_YesNo_Large) then
IFObj_fnSetVis(Popup_YesNo_Large, nil)
end
if(Popup_LoadSave2) then
IFObj_fnSetVis(Popup_LoadSave2, nil)
end
if(Popup_Tutorial) then
IFObj_fnSetVis(Popup_Tutorial, nil)
end
if(Popup_YesNo_Gamespy) then
IFObj_fnSetVis(Popup_YesNo_Gamespy, nil)
end
if(Popup_Ask_Historical) then
IFObj_fnSetVis(Popup_Ask_Historical, nil)
end
if(Popup_Ok_Large) then
IFObj_fnSetVis(Popup_Ok_Large, nil)
end
if(Popup_LobbyOpts and (Popup_LobbyOpts.bIsActivated)) then
Popup_LobbyOpts:fnActivate(nil)
end
this.bShowButtons = (vis > 3)
if(this.bShowButtons) then
this.bShowOk = (vis == 4) or ((vis >=6) and (vis <= 9)) or (vis == 11) or (vis == 13)
if(this.bShowOk) then
IFButton_fnSelect(this.buttons.no,nil)
this.CurButton = "yes"
IFButton_fnSelect(this.buttons.yes,1)
this.buttons.no.hidden = 1
RoundIFButtonLabel_fnSetString(this.buttons.yes,"common.ok")
else
IFButton_fnSelect(this.buttons.yes,nil)
this.CurButton = "no"
IFButton_fnSelect(this.buttons.no,1)
this.buttons.no.hidden = nil
RoundIFButtonLabel_fnSetString(this.buttons.yes,"common.yes")
end
ShowHideVerticalButtons(this.buttons, Vertical_YesNoButtons_layout)
gCurHiliteButton = this.buttons[this.CurButton]
IFObj_fnSetVis(this.buttons,(vis ~= 11))
else
this.CurButton = "no"
-- IFButton_fnSelect(this.buttons[this.CurButton],nil)
-- gCurHiliteButton = nil
IFObj_fnSetVis(this.buttons,nil)
end
end
-- Hack workaround for bug 6841 - turn off second "no controllers" message
-- if present
if((ifs_boot) and (ifs_boot.title)) then
IFObj_fnSetVis(ifs_boot.title, not vis)
end
end
-- Handle the user hitting accept (back uses defaults). Close this popup,
-- let things know who won
function gPopup_Error_fnInput_Accept(this)
if(this.bShowButtons) then
local ErrorLevel,ErrorMessage = ScriptCB_GetError()
print("In gPopup_Error_fnInput_Accept")
-- Default: hide this.
local bUserHitYes = (this.CurButton == "yes") -- or 'Ok', same thing
ScriptCB_CloseErrorBox(bUserHitYes)
-- Call callback if applicable, w/ result (nil = no, other = yes)
ScriptCB_SndPlaySound("shell_menu_ok")
if(this.fnDone) then
this.fnDone()
end
ifelem_shellscreen_fnPostControllerError()
if(gCurScreenTable and (gCurScreenTable.fnPostError)) then
gCurScreenTable.fnPostError(gCurScreenTable,bUserHitYes,ErrorLevel,ErrorMessage)
-- else
-- print("Uhoh, current screen has no post-error handler!")
end
end
end
Popup_Error = NewPopup {
ScreenRelativeX = 0.5, -- centered onscreen
ScreenRelativeY = 0.5,
height = 270,
width = 440,
ButtonHeightHint = 70,
ZPos = 0,
title = NewIFText {
font = gPopupTextFont,
textw = 415,
texth = 170,
y2 = -115,
valign = "top",
nocreatebackground = 1,
},
buttons = NewIFContainer {
y = 95,
},
fnSetMode = gPopup_Error_fnSetMode,
fnActivate = function(this,vis)
gPopup_Error_fnActivate(this,vis)
end,
fnSetTitle = function(this, MsgUStr)
gPopup_fnSetTitleUStr(this, MsgUStr)
end,
Input_Accept = function(this)
gPopup_Error_fnInput_Accept(this)
end,
Input_Back = function(this)
this.CurButton = "no"
gPopup_Error_fnInput_Accept(this)
end,
Update = function(this, fDt)
gIFShellScreenTemplate_fnUpdate(this, fDt)
ScriptCB_UpdateLobby(nil)
end,
fnPostMissingController = function(this)
if(gCurScreenTable and gCurScreenTable.fnPostMissingController) then
gCurScreenTable.fnPostMissingController(gCurScreenTable)
end
end,
}
Popup_Error.CurButton = AddVerticalButtons(Popup_Error.buttons, Vertical_YesNoButtons_layout)
Popup_Error.buttons.x2 = Popup_Error.buttons.x
gButtonWindow_fnSetTexture(Popup_Error,"opaque_rect")
CreatePopupInC(Popup_Error,"Popup_Error")
Popup_Error = DoPostDelete(Popup_Error)