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_HowToPlayMenu.h"
4
5// strings for buttons in the list
6unsigned int UIScene_HowToPlayMenu::m_uiHTPButtonNameA[]=
7{
8 IDS_HOW_TO_PLAY_MENU_WHATSNEW, // eHTPButton_WhatsNew
9 IDS_HOW_TO_PLAY_MENU_BASICS, // eHTPButton_Basics,
10 IDS_HOW_TO_PLAY_MENU_MULTIPLAYER, // eHTPButton_Multiplayer
11 IDS_HOW_TO_PLAY_MENU_HUD, // eHTPButton_Hud,
12 IDS_HOW_TO_PLAY_MENU_CREATIVE, // eHTPButton_Creative,
13 IDS_HOW_TO_PLAY_MENU_INVENTORY, // eHTPButton_Inventory,
14 IDS_HOW_TO_PLAY_MENU_CHESTS, // eHTPButton_Chest,
15 IDS_HOW_TO_PLAY_MENU_CRAFTING, // eHTPButton_Crafting,
16 IDS_HOW_TO_PLAY_MENU_FURNACE, // eHTPButton_Furnace,
17 IDS_HOW_TO_PLAY_MENU_DISPENSER, // eHTPButton_Dispenser,
18
19 IDS_HOW_TO_PLAY_MENU_BREWING, // eHTPButton_Brewing,
20 IDS_HOW_TO_PLAY_MENU_ENCHANTMENT, // eHTPButton_Enchantment,
21 IDS_HOW_TO_PLAY_MENU_ANVIL,
22 IDS_HOW_TO_PLAY_MENU_FARMANIMALS, // eHTPButton_Breeding,
23 IDS_HOW_TO_PLAY_MENU_BREEDANIMALS, // eHTPButton_Breeding,
24 IDS_HOW_TO_PLAY_MENU_TRADING,
25
26 IDS_HOW_TO_PLAY_MENU_HORSES,
27 IDS_HOW_TO_PLAY_MENU_BEACONS,
28 IDS_HOW_TO_PLAY_MENU_FIREWORKS,
29 IDS_HOW_TO_PLAY_MENU_HOPPERS,
30 IDS_HOW_TO_PLAY_MENU_DROPPERS,
31
32 IDS_HOW_TO_PLAY_MENU_NETHERPORTAL, // eHTPButton_NetherPortal,
33 IDS_HOW_TO_PLAY_MENU_THEEND, // eHTPButton_TheEnd,
34#ifdef _XBOX
35 IDS_HOW_TO_PLAY_MENU_SOCIALMEDIA, // eHTPButton_SocialMedia,
36 IDS_HOW_TO_PLAY_MENU_BANLIST, // eHTPButton_BanningLevels,
37#endif
38 IDS_HOW_TO_PLAY_MENU_HOSTOPTIONS, // eHTPButton_HostOptions,
39};
40
41// mapping the buttons to a scene value
42unsigned int UIScene_HowToPlayMenu::m_uiHTPSceneA[]=
43{
44 eHowToPlay_WhatsNew,
45 eHowToPlay_Basics,
46 eHowToPlay_Multiplayer,
47 eHowToPlay_HUD,
48 eHowToPlay_Creative,
49 eHowToPlay_Inventory,
50 eHowToPlay_Chest,
51 eHowToPlay_InventoryCrafting,
52 eHowToPlay_Furnace,
53 eHowToPlay_Dispenser,
54
55 eHowToPlay_Brewing,
56 eHowToPlay_Enchantment,
57 eHowToPlay_Anvil,
58 eHowToPlay_FarmingAnimals,
59 eHowToPlay_Breeding,
60 eHowToPlay_Trading,
61
62 eHowToPlay_Horses,
63 eHowToPlay_Beacons,
64 eHowToPlay_Fireworks,
65 eHowToPlay_Hoppers,
66 eHowToPlay_Droppers,
67
68 eHowToPlay_NetherPortal,
69 eHowToPlay_TheEnd,
70#ifdef _XBOX
71 eHowToPlay_SocialMedia,
72 eHowToPlay_BanList,
73#endif
74 eHowToPlay_HostOptions,
75};
76
77UIScene_HowToPlayMenu::UIScene_HowToPlayMenu(int iPad, void *initData, UILayer *parentLayer) : UIScene(iPad, parentLayer)
78{
79 // Setup all the Iggy references we need for this scene
80 initialiseMovie();
81
82 m_buttonListHowTo.init(eControl_Buttons);
83
84 for(unsigned int i = 0; i < eHTPButton_Max; ++i)
85 {
86 // 4J Stu - Re-add for future platforms
87#if 0
88 // No What's New
89 if(true)
90 {
91 if(!(i==eHTPButton_WhatsNew) )
92 {
93 m_buttonListHowTo.addItem( app.GetString(m_uiHTPButtonNameA[i]) , i);//iCount++);
94 }
95 }
96 else
97#endif
98 {
99 m_buttonListHowTo.addItem( app.GetString(m_uiHTPButtonNameA[i]) , i);//iCount++);
100 }
101 }
102
103 doHorizontalResizeCheck();
104}
105
106wstring UIScene_HowToPlayMenu::getMoviePath()
107{
108 if(app.GetLocalPlayerCount() > 1)
109 {
110 return L"HowToPlayMenuSplit";
111 }
112 else
113 {
114 return L"HowToPlayMenu";
115 }
116}
117
118void UIScene_HowToPlayMenu::updateTooltips()
119{
120 ui.SetTooltips( m_iPad, IDS_TOOLTIPS_SELECT,IDS_TOOLTIPS_BACK);
121}
122
123void UIScene_HowToPlayMenu::updateComponents()
124{
125 bool bNotInGame=(Minecraft::GetInstance()->level==NULL);
126 if(bNotInGame)
127 {
128 m_parentLayer->showComponent(m_iPad,eUIComponent_Panorama,true);
129 m_parentLayer->showComponent(m_iPad,eUIComponent_Logo,true);
130 }
131 else
132 {
133 m_parentLayer->showComponent(m_iPad,eUIComponent_Panorama,false);
134
135 if( app.GetLocalPlayerCount() == 1 ) m_parentLayer->showComponent(m_iPad,eUIComponent_Logo,true);
136 else m_parentLayer->showComponent(m_iPad,eUIComponent_Logo,false);
137 }
138}
139
140void UIScene_HowToPlayMenu::handleReload()
141{
142 for(unsigned int i = 0; i < eHTPButton_Max; ++i)
143 {
144 // 4J Stu - Re-add for future platforms
145#if 0
146 // No What's New
147 if(true)
148 {
149 if(!(i==eHTPButton_WhatsNew) )
150 {
151 m_buttonListHowTo.addItem( app.GetString(m_uiHTPButtonNameA[i]) , i);
152 }
153 }
154 else
155#endif
156 {
157 m_buttonListHowTo.addItem( app.GetString(m_uiHTPButtonNameA[i]) , i);
158 }
159 }
160
161 doHorizontalResizeCheck();
162}
163
164void UIScene_HowToPlayMenu::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled)
165{
166 //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");
167 ui.AnimateKeyPress(m_iPad, key, repeat, pressed, released);
168
169 switch(key)
170 {
171 case ACTION_MENU_CANCEL:
172 if(pressed)
173 {
174 navigateBack();
175 }
176 break;
177 case ACTION_MENU_OK:
178#ifdef __ORBIS__
179 case ACTION_MENU_TOUCHPAD_PRESS:
180#endif
181 sendInputToMovie(key, repeat, pressed, released);
182 break;
183 case ACTION_MENU_UP:
184 case ACTION_MENU_DOWN:
185 case ACTION_MENU_PAGEUP:
186 case ACTION_MENU_PAGEDOWN:
187 sendInputToMovie(key, repeat, pressed, released);
188 break;
189 }
190}
191
192void UIScene_HowToPlayMenu::handlePress(F64 controlId, F64 childId)
193{
194 if( (int)controlId == eControl_Buttons)
195 {
196 //CD - Added for audio
197 ui.PlayUISFX(eSFX_Press);
198
199 unsigned int uiInitData;
200 uiInitData = ( ( 1 << 31 ) | ( m_uiHTPSceneA[(int)childId] << 16 ) | ( short )( m_iPad ) );
201 ui.NavigateToScene(m_iPad, eUIScene_HowToPlay, ( void* )( uiInitData ) );
202 }
203}