the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
1#pragma once
2#include "..\..\..\Minecraft.World\Definitions.h"
3#include "UIScene.h"
4#include "UIControl_PlayerSkinPreview.h"
5
6class UIScene_SkinSelectMenu : public UIScene
7{
8private:
9 static WCHAR *wchDefaultNamesA[eDefaultSkins_Count];
10
11 // 4J Stu - How many to show on each side of the main control
12 static const BYTE sidePreviewControls = 4;
13
14#ifdef __PSVITA__
15 enum ETouchInput
16 {
17 ETouchInput_TabLeft = 10,
18 ETouchInput_TabRight,
19 ETouchInput_TabCenter,
20 ETouchInput_IggyCharacters,
21
22 ETouchInput_Count,
23 };
24#endif
25
26 enum ESkinSelectNavigation
27 {
28 eSkinNavigation_Pack,
29 eSkinNavigation_Skin,
30
31 eSkinNavigation_Count,
32 };
33
34 enum ECharacters
35 {
36 eCharacter_Current,
37 eCharacter_Next1,
38 eCharacter_Next2,
39 eCharacter_Next3,
40 eCharacter_Next4,
41 eCharacter_Previous1,
42 eCharacter_Previous2,
43 eCharacter_Previous3,
44 eCharacter_Previous4,
45
46 eCharacter_COUNT,
47 };
48
49 UIControl_PlayerSkinPreview m_characters[eCharacter_COUNT];
50 UIControl_Label m_labelSkinName, m_labelSkinOrigin;
51 UIControl_Label m_labelSelected;
52 UIControl m_controlSkinNamePlate, m_controlSelectedPanel, m_controlIggyCharacters, m_controlTimer;
53#ifdef __PSVITA__
54 UIControl_Touch m_TouchTabLeft, m_TouchTabRight, m_TouchTabCenter, m_TouchIggyCharacters;
55#endif
56 IggyName m_funcSetPlayerCharacterSelected, m_funcSetCharacterLocked;
57 IggyName m_funcSetLeftLabel, m_funcSetRightLabel, m_funcSetCentreLabel;
58 UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene)
59#ifdef __PSVITA__
60 UI_MAP_ELEMENT( m_TouchTabLeft, "TouchTabLeft" )
61 UI_MAP_ELEMENT( m_TouchTabRight, "TouchTabRight" )
62 UI_MAP_ELEMENT( m_TouchTabCenter, "TouchTabCenter" )
63 UI_MAP_ELEMENT( m_TouchIggyCharacters, "TouchIggyCharacters" )
64#endif
65 UI_MAP_ELEMENT( m_controlSkinNamePlate, "SkinNamePlate")
66 UI_BEGIN_MAP_CHILD_ELEMENTS( m_controlSkinNamePlate )
67 UI_MAP_ELEMENT( m_labelSkinName, "SkinTitle1")
68 UI_MAP_ELEMENT( m_labelSkinOrigin, "SkinTitle2")
69 UI_END_MAP_CHILD_ELEMENTS()
70
71 UI_MAP_ELEMENT( m_controlSelectedPanel, "SelectedPanel" )
72 UI_BEGIN_MAP_CHILD_ELEMENTS( m_controlSelectedPanel )
73 UI_MAP_ELEMENT( m_labelSelected, "SelectedPanelLabel" )
74 UI_END_MAP_CHILD_ELEMENTS()
75
76 UI_MAP_ELEMENT( m_controlTimer, "Timer" )
77
78 // 4J Stu - These aren't really used a AS3 controls, but adding here means that they get ticked by the scene
79 UI_MAP_ELEMENT( m_controlIggyCharacters, "IggyCharacters" )
80 UI_BEGIN_MAP_CHILD_ELEMENTS( m_controlIggyCharacters )
81 UI_MAP_ELEMENT( m_characters[eCharacter_Current], "iggy_Character0" )
82
83 UI_MAP_ELEMENT( m_characters[eCharacter_Next1], "iggy_Character1" )
84 UI_MAP_ELEMENT( m_characters[eCharacter_Next2], "iggy_Character2" )
85 UI_MAP_ELEMENT( m_characters[eCharacter_Next3], "iggy_Character3" )
86 UI_MAP_ELEMENT( m_characters[eCharacter_Next4], "iggy_Character4" )
87
88 UI_MAP_ELEMENT( m_characters[eCharacter_Previous1], "iggy_Character5" )
89 UI_MAP_ELEMENT( m_characters[eCharacter_Previous2], "iggy_Character6" )
90 UI_MAP_ELEMENT( m_characters[eCharacter_Previous3], "iggy_Character7" )
91 UI_MAP_ELEMENT( m_characters[eCharacter_Previous4], "iggy_Character8" )
92 UI_END_MAP_CHILD_ELEMENTS()
93
94 UI_MAP_NAME( m_funcSetPlayerCharacterSelected, L"SetPlayerCharacterSelected" )
95 UI_MAP_NAME( m_funcSetCharacterLocked, L"SetCharacterLocked" )
96
97 UI_MAP_NAME( m_funcSetLeftLabel, L"SetLeftLabel" )
98 UI_MAP_NAME( m_funcSetCentreLabel, L"SetCenterLabel" )
99 UI_MAP_NAME( m_funcSetRightLabel, L"SetRightLabel" )
100 UI_END_MAP_ELEMENTS_AND_NAMES()
101
102 DLCPack *m_currentPack;
103 DWORD m_packIndex, m_skinIndex;
104 DWORD m_originalSkinId;
105 wstring m_currentSkinPath, m_selectedSkinPath, m_selectedCapePath;
106 vector<SKIN_BOX *> *m_vAdditionalSkinBoxes;
107
108 bool m_bSlidingSkins, m_bAnimatingMove;
109 ESkinSelectNavigation m_currentNavigation;
110
111 bool m_bNoSkinsToShow;
112 DWORD m_currentPackCount;
113 bool m_bIgnoreInput;
114 bool m_bSkinIndexChanged;
115 wstring m_leftLabel, m_centreLabel, m_rightLabel;
116
117 S32 m_iTouchXStart;
118 bool m_bTouchScrolled;
119public:
120 UIScene_SkinSelectMenu(int iPad, void *initData, UILayer *parentLayer);
121#ifdef __PSVITA__
122 virtual ~UIScene_SkinSelectMenu() { DeleteCriticalSection(&m_DLCInstallCS); }
123#endif
124
125 virtual void tick();
126
127 virtual void updateTooltips();
128 virtual void updateComponents();
129
130 virtual EUIScene getSceneType() { return eUIScene_SkinSelectMenu;}
131
132 virtual void handleAnimationEnd();
133
134
135protected:
136 // TODO: This should be pure virtual in this class
137 virtual wstring getMoviePath();
138
139public:
140 // INPUT
141 virtual void handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled);
142
143 virtual void customDraw(IggyCustomDrawCallbackRegion *region);
144
145private:
146 void handleSkinIndexChanged();
147 int getNextSkinIndex(DWORD sourceIndex);
148 int getPreviousSkinIndex(DWORD sourceIndex);
149
150 TEXTURE_NAME getTextureId(int skinIndex);
151
152 void handlePackIndexChanged();
153 void updatePackDisplay();
154 int getNextPackIndex(DWORD sourceIndex);
155 int getPreviousPackIndex(DWORD sourceIndex);
156
157 void setCharacterSelected(bool selected);
158 void setCharacterLocked(bool locked);
159
160 void setLeftLabel(const wstring &label);
161 void setCentreLabel(const wstring &label);
162 void setRightLabel(const wstring &label);
163
164 virtual void HandleDLCMountingComplete();
165 virtual void HandleDLCInstalled();
166#ifdef _XBOX_ONE
167 virtual void HandleDLCLicenseChange();
168#endif
169
170 void showNotOnlineDialog(int iPad);
171
172 static int UnlockSkinReturned(void *pParam,int iPad,C4JStorage::EMessageResult result);
173 static int RenableInput(LPVOID lpVoid, int, int);
174 void AddFavoriteSkin(int iPad,int iSkinID);
175
176 void InputActionOK(unsigned int iPad);
177#ifdef __PSVITA__
178 virtual void handleTouchInput(unsigned int iPad, S32 x, S32 y, int iId, bool bPressed, bool bRepeat, bool bReleased);
179#endif //__PSVITA__
180 virtual void handleReload();
181
182#ifdef __ORBIS__
183 bool m_bErrorDialogRunning;
184#endif
185
186#ifdef __PSVITA__
187 static int MustSignInReturned(void *pParam,int iPad,C4JStorage::EMessageResult result);
188 static int PSNSignInReturned(void* pParam, bool bContinue, int iPad);
189#endif
190
191
192#ifdef __PSVITA__
193 CRITICAL_SECTION m_DLCInstallCS; // to prevent a race condition between the install and the mounted callback
194#endif
195};