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_HelpAndOptionsMenu.h"
4#include "..\..\Minecraft.h"
5
6UIScene_HelpAndOptionsMenu::UIScene_HelpAndOptionsMenu(int iPad, void *initData, UILayer *parentLayer) : UIScene(iPad, parentLayer)
7{
8 // Setup all the Iggy references we need for this scene
9 initialiseMovie();
10
11 m_bNotInGame=(Minecraft::GetInstance()->level==NULL);
12
13 m_buttons[BUTTON_HAO_CHANGESKIN].init(IDS_CHANGE_SKIN,BUTTON_HAO_CHANGESKIN);
14 m_buttons[BUTTON_HAO_HOWTOPLAY].init(IDS_HOW_TO_PLAY,BUTTON_HAO_HOWTOPLAY);
15 m_buttons[BUTTON_HAO_CONTROLS].init(IDS_CONTROLS,BUTTON_HAO_CONTROLS);
16 m_buttons[BUTTON_HAO_SETTINGS].init(IDS_SETTINGS,BUTTON_HAO_SETTINGS);
17 m_buttons[BUTTON_HAO_CREDITS].init(IDS_CREDITS,BUTTON_HAO_CREDITS);
18 //m_buttons[BUTTON_HAO_REINSTALL].init(app.GetString(IDS_REINSTALL_CONTENT),BUTTON_HAO_REINSTALL);
19 m_buttons[BUTTON_HAO_DEBUG].init(IDS_DEBUG_SETTINGS,BUTTON_HAO_DEBUG);
20
21 /* 4J-TomK - we should never remove a control before the other buttons controls are initialised!
22 (because vita touchboxes are rebuilt on remove since the remaining positions might change) */
23 // We don't have a reinstall content, so remove the button
24 removeControl( &m_buttons[BUTTON_HAO_REINSTALL], false );
25
26#ifdef _FINAL_BUILD
27 removeControl( &m_buttons[BUTTON_HAO_DEBUG], false);
28#else
29 if(!app.DebugSettingsOn()) removeControl( &m_buttons[BUTTON_HAO_DEBUG], false);
30#endif
31
32#ifdef _XBOX_ONE
33 // 4J-PB - in order to buy the skin packs, we need the signed offer ids for them, which we get in the availability info
34 // we need to retrieve this info though, so do it here
35 app.AddDLCRequest(e_Marketplace_Content); // content is skin packs, texture packs and mash-up packs
36
37 // we also need to mount the local DLC so we can tell what's been purchased
38 app.StartInstallDLCProcess(iPad);
39#endif
40
41
42
43 // 4J-PB - do not need a storage device to see this menu - just need one when you choose to re-install them
44 bool bNotInGame=(Minecraft::GetInstance()->level==NULL);
45
46 // any content to be re-installed?
47 if(m_iPad==ProfileManager.GetPrimaryPad() && bNotInGame)
48 {
49 // We should show the reinstall menu
50 app.DebugPrintf("Reinstall Menu required...\n");
51 }
52 else
53 {
54 removeControl( &m_buttons[BUTTON_HAO_REINSTALL], false);
55 }
56
57 if(app.GetLocalPlayerCount()>1)
58 {
59 // no credits in splitscreen
60 removeControl( &m_buttons[BUTTON_HAO_CREDITS], false);
61
62#if TO_BE_IMPLEMENTED
63 app.AdjustSplitscreenScene(m_hObj,&m_OriginalPosition,m_iPad,false);
64#endif
65 if(ProfileManager.GetPrimaryPad()!=m_iPad)
66 {
67 removeControl( &m_buttons[BUTTON_HAO_REINSTALL], false);
68 }
69 }
70
71 if(!ProfileManager.IsFullVersion() )//|| ProfileManager.IsGuest(m_iPad))
72 {
73 removeControl( &m_buttons[BUTTON_HAO_CHANGESKIN], false);
74 }
75
76 // 4J-TomK Moved horizontal resize check to the end to prevent horizontal scaling for buttons that might get removed anyways (debug options for example)
77 doHorizontalResizeCheck();
78
79 //StorageManager.TMSPP_GetUserQuotaInfo(C4JStorage::eGlobalStorage_TitleUser,iPad);
80 //StorageManager.WebServiceRequestGetFriends(iPad);
81}
82
83UIScene_HelpAndOptionsMenu::~UIScene_HelpAndOptionsMenu()
84{
85}
86
87wstring UIScene_HelpAndOptionsMenu::getMoviePath()
88{
89 if(app.GetLocalPlayerCount() > 1)
90 {
91 return L"HelpAndOptionsMenuSplit";
92 }
93 else
94 {
95 return L"HelpAndOptionsMenu";
96 }
97}
98
99void UIScene_HelpAndOptionsMenu::updateTooltips()
100{
101 ui.SetTooltips( m_iPad, IDS_TOOLTIPS_SELECT,IDS_TOOLTIPS_BACK);
102}
103
104void UIScene_HelpAndOptionsMenu::updateComponents()
105{
106 bool bNotInGame=(Minecraft::GetInstance()->level==NULL);
107 if(bNotInGame)
108 {
109 m_parentLayer->showComponent(m_iPad,eUIComponent_Panorama,true);
110 m_parentLayer->showComponent(m_iPad,eUIComponent_Logo,true);
111 }
112 else
113 {
114 m_parentLayer->showComponent(m_iPad,eUIComponent_Panorama,false);
115
116 if( app.GetLocalPlayerCount() == 1 ) m_parentLayer->showComponent(m_iPad,eUIComponent_Logo,true);
117 else m_parentLayer->showComponent(m_iPad,eUIComponent_Logo,false);
118
119 }
120}
121
122void UIScene_HelpAndOptionsMenu::handleReload()
123{
124#ifdef _FINAL_BUILD
125 removeControl( &m_buttons[BUTTON_HAO_DEBUG], false);
126#else
127 if(!app.DebugSettingsOn()) removeControl( &m_buttons[BUTTON_HAO_DEBUG], false);
128#endif
129
130 // 4J-PB - do not need a storage device to see this menu - just need one when you choose to re-install them
131 bool bNotInGame=(Minecraft::GetInstance()->level==NULL);
132
133 // any content to be re-installed?
134 if(m_iPad==ProfileManager.GetPrimaryPad() && bNotInGame)
135 {
136 // We should show the reinstall menu
137 app.DebugPrintf("Reinstall Menu required...\n");
138 }
139 else
140 {
141 removeControl( &m_buttons[BUTTON_HAO_REINSTALL], false);
142 }
143
144 if(app.GetLocalPlayerCount()>1)
145 {
146 // no credits in splitscreen
147 removeControl( &m_buttons[BUTTON_HAO_CREDITS], false);
148
149#if TO_BE_IMPLEMENTED
150 app.AdjustSplitscreenScene(m_hObj,&m_OriginalPosition,m_iPad,false);
151#endif
152 if(ProfileManager.GetPrimaryPad()!=m_iPad)
153 {
154 removeControl( &m_buttons[BUTTON_HAO_REINSTALL], false);
155 }
156 }
157
158 if(!ProfileManager.IsFullVersion() )//|| ProfileManager.IsGuest(m_iPad))
159 {
160#if TO_BE_IMPLEMENTED
161 m_Buttons[BUTTON_HAO_CHANGESKIN].SetEnable(FALSE);
162 m_Buttons[BUTTON_HAO_CHANGESKIN].EnableInput(FALSE);
163 // set the focus to the second button
164
165 XuiElementSetUserFocus(m_Buttons[BUTTON_HAO_HOWTOPLAY].m_hObj, m_iPad);
166#endif
167 }
168
169 if(!ProfileManager.IsFullVersion() )//|| ProfileManager.IsGuest(m_iPad))
170 {
171 removeControl( &m_buttons[BUTTON_HAO_CHANGESKIN], false);
172 }
173
174 doHorizontalResizeCheck();
175}
176
177void UIScene_HelpAndOptionsMenu::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled)
178{
179 //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");
180
181 ui.AnimateKeyPress(m_iPad, key, repeat, pressed, released);
182
183 switch(key)
184 {
185 case ACTION_MENU_CANCEL:
186 if(pressed && !repeat)
187 {
188 navigateBack();
189 }
190 break;
191 case ACTION_MENU_OK:
192#ifdef __ORBIS__
193 case ACTION_MENU_TOUCHPAD_PRESS:
194#endif
195 //CD - Added for audio
196 if(pressed)
197 {
198 ui.PlayUISFX(eSFX_Press);
199 }
200
201 case ACTION_MENU_UP:
202 case ACTION_MENU_DOWN:
203 sendInputToMovie(key, repeat, pressed, released);
204 break;
205 }
206}
207
208void UIScene_HelpAndOptionsMenu::handlePress(F64 controlId, F64 childId)
209{
210 switch((int)controlId)
211 {
212 case BUTTON_HAO_CHANGESKIN:
213 ui.NavigateToScene(m_iPad, eUIScene_SkinSelectMenu);
214 break;
215 case BUTTON_HAO_HOWTOPLAY:
216 ui.NavigateToScene(m_iPad, eUIScene_HowToPlayMenu);
217 break;
218 case BUTTON_HAO_CONTROLS:
219 ui.NavigateToScene(m_iPad, eUIScene_ControlsMenu);
220 break;
221 case BUTTON_HAO_SETTINGS:
222 ui.NavigateToScene(m_iPad, eUIScene_SettingsMenu);
223 break;
224 case BUTTON_HAO_CREDITS:
225 ui.NavigateToScene(m_iPad, eUIScene_Credits);
226 break;
227 case BUTTON_HAO_REINSTALL:
228 ui.NavigateToScene(m_iPad, eUIScene_ReinstallMenu);
229 break;
230 case BUTTON_HAO_DEBUG:
231 ui.NavigateToScene(m_iPad, eUIScene_DebugOptions);
232 break;
233 }
234}