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 "UIComponent_PressStartToPlay.h"
4#include "..\..\..\Minecraft.World\StringHelpers.h"
5
6UIComponent_PressStartToPlay::UIComponent_PressStartToPlay(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_showingSaveIcon = false;
12 m_showingAutosaveTimer = false;
13 m_showingTrialTimer = false;
14 for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i)
15 {
16 m_showingPressStart[i] = false;
17 }
18 m_trialTimer = L"";
19 m_autosaveTimer = L"";
20
21 m_labelTrialTimer.init(L"");
22 m_labelTrialTimer.setVisible(false);
23
24 // 4J-JEV: This object is persistent, so this string needs to be able to handle language changes.
25#ifdef __ORBIS__
26 m_labelPressStart.init( (UIString) [] { return replaceAll(app.GetString(IDS_PRESS_X_TO_JOIN), L"{*CONTROLLER_VK_A*}", app.GetVKReplacement(VK_PAD_A) ); });
27#elif defined _XBOX_ONE
28 m_labelPressStart.init( (UIString) [] { return replaceAll(app.GetString(IDS_PRESS_START_TO_JOIN), L"{*CONTROLLER_VK_START*}", app.GetVKReplacement(VK_PAD_START) ); });
29#else
30 m_labelPressStart.init(IDS_PRESS_START_TO_JOIN);
31#endif
32
33 m_controlSaveIcon.setVisible(false);
34 m_controlPressStartPanel.setVisible(false);
35 m_playerDisplayName.setVisible(false);
36}
37
38wstring UIComponent_PressStartToPlay::getMoviePath()
39{
40 return L"PressStartToPlay";
41}
42
43void UIComponent_PressStartToPlay::handleReload()
44{
45 // 4J Stu - It's possible these could change during the reload, so can't use the normal controls refresh of it's state
46 m_controlSaveIcon.setVisible(m_showingSaveIcon);
47 m_labelTrialTimer.setVisible(m_showingAutosaveTimer);
48 m_labelTrialTimer.setLabel(m_autosaveTimer);
49 m_labelTrialTimer.setVisible(m_showingTrialTimer);
50 m_labelTrialTimer.setLabel(m_trialTimer);
51
52 bool showPressStart = false;
53 for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i)
54 {
55 bool show = m_showingPressStart[i];
56 showPressStart |= show;
57
58 if(show)
59 {
60 addTimer(0,3000);
61
62 IggyDataValue result;
63 IggyDataValue value[1];
64 value[0].type = IGGY_DATATYPE_number;
65 value[0].number = i;
66
67 IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcShowController , 1 , value );
68 }
69 }
70 m_controlPressStartPanel.setVisible(showPressStart);
71}
72
73void UIComponent_PressStartToPlay::handleTimerComplete(int id)
74{
75 m_controlPressStartPanel.setVisible(false);
76 for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i)
77 {
78 m_showingPressStart[i] = false;
79 }
80 ui.ClearPressStart();
81}
82
83void UIComponent_PressStartToPlay::showPressStart(int iPad, bool show)
84{
85 m_showingPressStart[iPad] = show;
86 if(!ui.IsExpectingOrReloadingSkin() && hasMovie())
87 {
88 m_controlPressStartPanel.setVisible(show);
89
90 if(show)
91 {
92 addTimer(0,3000);
93
94 IggyDataValue result;
95 IggyDataValue value[1];
96 value[0].type = IGGY_DATATYPE_number;
97 value[0].number = iPad;
98
99 IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcShowController , 1 , value );
100 }
101 }
102}
103
104void UIComponent_PressStartToPlay::setTrialTimer(const wstring &label)
105{
106 m_trialTimer = label;
107 if(!ui.IsExpectingOrReloadingSkin() && hasMovie())
108 {
109 m_labelTrialTimer.setLabel(label);
110 }
111}
112
113void UIComponent_PressStartToPlay::showTrialTimer(bool show)
114{
115 m_showingTrialTimer = show;
116 if(!ui.IsExpectingOrReloadingSkin() && hasMovie())
117 {
118 m_labelTrialTimer.setVisible(show);
119 }
120}
121
122void UIComponent_PressStartToPlay::setAutosaveTimer(const wstring &label)
123{
124 m_autosaveTimer = label;
125 if(!ui.IsExpectingOrReloadingSkin() && hasMovie())
126 {
127 m_labelTrialTimer.setLabel(label);
128 }
129}
130
131void UIComponent_PressStartToPlay::showAutosaveTimer(bool show)
132{
133 m_showingAutosaveTimer = show;
134 if(!ui.IsExpectingOrReloadingSkin() && hasMovie())
135 {
136 m_labelTrialTimer.setVisible(show);
137 }
138}
139
140void UIComponent_PressStartToPlay::showSaveIcon(bool show)
141{
142 m_showingSaveIcon = show;
143 if(!ui.IsExpectingOrReloadingSkin() && hasMovie())
144 {
145 m_controlSaveIcon.setVisible(show);
146 }
147 else
148 {
149 if(show) app.DebugPrintf("Tried to show save icon while texture pack reload was in progress\n");
150 }
151}
152
153void UIComponent_PressStartToPlay::showPlayerDisplayName(bool show)
154{
155#ifdef _XBOX_ONE
156 if(show)
157 {
158 m_playerDisplayName.setLabel(ProfileManager.GetDisplayName(ProfileManager.GetPrimaryPad()));
159 }
160 m_playerDisplayName.setVisible(show);
161#else
162 m_playerDisplayName.setVisible(false);
163#endif
164}