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
|
#include "stdafx.h"
#include "UI.h"
#include "UIScene_MessageBox.h"
UIScene_MessageBox::UIScene_MessageBox(int iPad, void *initData, UILayer *parentLayer) : UIScene(iPad, parentLayer)
{
// Setup all the Iggy references we need for this scene
initialiseMovie();
MessageBoxInfo *param = static_cast<MessageBoxInfo *>(initData);
m_buttonCount = param->uiOptionC;
IggyDataValue result;
IggyDataValue value[2];
value[0].type = IGGY_DATATYPE_number;
value[0].number = param->uiOptionC;
value[1].type = IGGY_DATATYPE_number;
value[1].number = param->dwFocusButton;
IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcInit , 2 , value );
int buttonIndex = 0;
if(param->uiOptionC > 3)
{
m_buttonButtons[eControl_Button0].init(app.GetString(param->uiOptionA[buttonIndex]),buttonIndex);
++buttonIndex;
}
if(param->uiOptionC > 2)
{
m_buttonButtons[eControl_Button1].init(app.GetString(param->uiOptionA[buttonIndex]),buttonIndex);
++buttonIndex;
}
if(param->uiOptionC > 1)
{
m_buttonButtons[eControl_Button2].init(app.GetString(param->uiOptionA[buttonIndex]),buttonIndex);
++buttonIndex;
}
m_buttonButtons[eControl_Button3].init(app.GetString(param->uiOptionA[buttonIndex]),buttonIndex);
m_labelTitle.init(app.GetString(param->uiTitle));
m_labelContent.init(app.GetString(param->uiText));
out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcAutoResize , 0 , nullptr );
m_Func = param->Func;
m_lpParam = param->lpParam;
parentLayer->addComponent(iPad,eUIComponent_MenuBackground);
// 4J-TomK - rebuild touch after auto resize
#ifdef __PSVITA__
ui.TouchBoxRebuild(this);
#endif
}
UIScene_MessageBox::~UIScene_MessageBox()
{
m_parentLayer->removeComponent(eUIComponent_MenuBackground);
}
wstring UIScene_MessageBox::getMoviePath()
{
if(app.GetLocalPlayerCount() > 1 && !m_parentLayer->IsFullscreenGroup())
{
return L"MessageBoxSplit";
}
else
{
return L"MessageBox";
}
}
void UIScene_MessageBox::updateTooltips()
{
ui.SetTooltips( m_parentLayer->IsFullscreenGroup()?XUSER_INDEX_ANY:m_iPad, IDS_TOOLTIPS_SELECT, IDS_TOOLTIPS_CANCEL);
}
void UIScene_MessageBox::handleReload()
{
IggyDataValue result;
IggyDataValue value[2];
value[0].type = IGGY_DATATYPE_number;
value[0].number = m_buttonCount;
value[1].type = IGGY_DATATYPE_number;
value[1].number = static_cast<F64>(getControlFocus());
IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcInit , 2 , value );
out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcAutoResize , 0 , nullptr );
}
void UIScene_MessageBox::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled)
{
//app.DebugPrintf("UIScene_DebugOverlay handling input for pad %d, key %d, down- %s, pressed- %s, released- %s\n", iPad, key, down?"TRUE":"FALSE", pressed?"TRUE":"FALSE", released?"TRUE":"FALSE");
ui.AnimateKeyPress(m_iPad, key, repeat, pressed, released);
switch(key)
{
case ACTION_MENU_CANCEL:
if(pressed)
{
navigateBack();
if(m_Func) m_Func(m_lpParam, iPad, C4JStorage::EMessage_Cancelled);
}
break;
case ACTION_MENU_OK:
#ifdef __ORBIS__
case ACTION_MENU_TOUCHPAD_PRESS:
#endif
sendInputToMovie(key, repeat, pressed, released);
break;
case ACTION_MENU_UP:
case ACTION_MENU_DOWN:
sendInputToMovie(key, repeat, pressed, released);
break;
}
handled = true;
}
void UIScene_MessageBox::handlePress(F64 controlId, F64 childId)
{
C4JStorage::EMessageResult result = C4JStorage::EMessage_Cancelled;
switch(static_cast<int>(controlId))
{
case 0:
result = C4JStorage::EMessage_ResultAccept;
break;
case 1:
result = C4JStorage::EMessage_ResultDecline;
break;
case 2:
result = C4JStorage::EMessage_ResultThirdOption;
break;
case 3:
result = C4JStorage::EMessage_ResultFourthOption;
break;
}
navigateBack();
if(m_Func) m_Func(m_lpParam, m_iPad, result);
}
bool UIScene_MessageBox::hasFocus(int iPad)
{
// 4J-JEV: Fix for PS4 #5204 - [TRC][R4033] The application can be locked up by second user logging out of the system.
if (m_iPad == 255)
{
// Message box is for everyone
return bHasFocus;
}
else if (ProfileManager.IsSignedIn(m_iPad))
{
// Owner is still present
return bHasFocus && (iPad == m_iPad);
}
else
{
// Original owner has left so let everyone interact
return bHasFocus;
}
}
|