the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
1#include "stdafx.h"
2#include "UI.h"
3#include "UIScene_Intro.h"
4
5
6UIScene_Intro::UIScene_Intro(int iPad, void *initData, UILayer *parentLayer) : UIScene(iPad, parentLayer)
7{
8 // Setup all the Iggy references we need for this scene
9 initialiseMovie();
10 m_bIgnoreNavigate = false;
11 m_bAnimationEnded = false;
12
13 bool bSkipESRB = false;
14 bool bChina = false;
15#if defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__)
16 bSkipESRB = app.GetProductSKU() != e_sku_SCEA;
17#elif defined(_XBOX) || defined(_DURANGO)
18 bSkipESRB = !ProfileManager.LocaleIsUSorCanada();
19#endif
20
21#ifdef _DURANGO
22 bChina = ProfileManager.LocaleIsChina();
23#endif
24 // 4J Stu - These map to values in the Actionscript
25#ifdef _WINDOWS64
26 int platformIdx = 0;
27#elif defined(_XBOX)
28 int platformIdx = 1;
29#elif defined(_DURANGO)
30 int platformIdx = 2;
31#elif defined(__PS3__)
32 int platformIdx = 3;
33#elif defined(__ORBIS__)
34 int platformIdx = 4;
35#elif defined(__PSVITA__)
36 int platformIdx = 5;
37#endif
38
39 IggyDataValue result;
40 IggyDataValue value[3];
41 value[0].type = IGGY_DATATYPE_number;
42 value[0].number = platformIdx;
43
44 value[1].type = IGGY_DATATYPE_boolean;
45 value[1].boolval = bChina?true:bSkipESRB;
46
47 value[2].type = IGGY_DATATYPE_boolean;
48 value[2].boolval = bChina;
49
50 IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcSetIntroPlatform , 3 , value );
51
52#ifdef __PSVITA__
53 // initialise vita touch controls with ids
54 m_TouchToSkip.init(0);
55#endif
56}
57
58wstring UIScene_Intro::getMoviePath()
59{
60 return L"Intro";
61}
62
63void UIScene_Intro::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled)
64{
65 ui.AnimateKeyPress(m_iPad, key, repeat, pressed, released);
66
67 switch(key)
68 {
69 case ACTION_MENU_OK:
70#ifdef __ORBIS__
71 case ACTION_MENU_TOUCHPAD_PRESS:
72#endif
73 if(!m_bIgnoreNavigate)
74 {
75 m_bIgnoreNavigate = true;
76 //ui.NavigateToHomeMenu();
77#if defined(__PS3__) || defined(__ORBIS__) || defined (__PSVITA__)
78
79 // has the user seen the EULA already ? We need their options file loaded for this
80 C4JStorage::eOptionsCallback eStatus=app.GetOptionsCallbackStatus(0);
81 switch(eStatus)
82 {
83 case C4JStorage::eOptions_Callback_Read:
84 case C4JStorage::eOptions_Callback_Read_FileNotFound:
85 // we've either read it, or it wasn't found
86 if(app.GetGameSettings(0,eGameSetting_PS3_EULA_Read)==0)
87 {
88 ui.NavigateToScene(0,eUIScene_EULA);
89 }
90 else
91 {
92 ui.NavigateToScene(0,eUIScene_SaveMessage);
93 }
94 break;
95 default:
96 ui.NavigateToScene(0,eUIScene_EULA);
97 break;
98 }
99#elif defined _XBOX_ONE
100 ui.NavigateToScene(0,eUIScene_MainMenu);
101#else
102 ui.NavigateToScene(0,eUIScene_SaveMessage);
103#endif
104 }
105 break;
106 }
107}
108
109#ifdef __PSVITA__
110void UIScene_Intro::handleTouchInput(unsigned int iPad, S32 x, S32 y, int iId, bool bPressed, bool bRepeat, bool bReleased)
111{
112 if(bReleased)
113 {
114 bool handled = false;
115 handleInput(iPad, ACTION_MENU_OK, false, true, false, handled);
116 }
117}
118#endif
119
120void UIScene_Intro::handleAnimationEnd()
121{
122 if(!m_bIgnoreNavigate)
123 {
124 m_bIgnoreNavigate = true;
125 //ui.NavigateToHomeMenu();
126#if defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__)
127 // has the user seen the EULA already ? We need their options file loaded for this
128 C4JStorage::eOptionsCallback eStatus=app.GetOptionsCallbackStatus(0);
129 switch(eStatus)
130 {
131 case C4JStorage::eOptions_Callback_Read:
132 case C4JStorage::eOptions_Callback_Read_FileNotFound:
133 // we've either read it, or it wasn't found
134 if(app.GetGameSettings(0,eGameSetting_PS3_EULA_Read)==0)
135 {
136 ui.NavigateToScene(0,eUIScene_EULA);
137 }
138 else
139 {
140 ui.NavigateToScene(0,eUIScene_SaveMessage);
141 }
142 break;
143 default:
144 ui.NavigateToScene(0,eUIScene_EULA);
145 break;
146 }
147
148
149#elif defined _XBOX_ONE
150 // Don't navigate to the main menu if we don't have focus, as we could have the quadrant sign-in or a join game timer screen running, and then when Those finish they'll
151 // give the main menu focus which clears the signed in players and therefore breaks transitioning into the game
152 if( hasFocus( m_iPad ) )
153 {
154 ui.NavigateToScene(0,eUIScene_MainMenu);
155 }
156 else
157 {
158 m_bAnimationEnded = true;
159 }
160#else
161 ui.NavigateToScene(0,eUIScene_SaveMessage);
162#endif
163 }
164}
165
166void UIScene_Intro::handleGainFocus(bool navBack)
167{
168 // Only relevant on xbox one - if we didn't navigate to the main menu at animation end due to the timer or quadrant sign-in being up, then we'll need to
169 // do it now in case the user has cancelled or joining a game failed
170 if( m_bAnimationEnded )
171 {
172 ui.NavigateToScene(0,eUIScene_MainMenu);
173 }
174}