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 "..\..\..\MultiplayerLevel.h"
3#include "..\..\..\Minecraft.World\SignTileEntity.h"
4#include "..\..\..\Minecraft.World\Entity.h"
5#include "..\..\..\Minecraft.World\Level.h"
6#include "..\..\..\Minecraft.Client\LocalPlayer.h"
7#include "..\..\..\Minecraft.Client\ClientConnection.h"
8#include "..\..\..\Minecraft.Client\MultiPlayerLocalPlayer.h"
9#include "XUI_SignEntry.h"
10
11HRESULT CScene_SignEntry::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
12{
13 MapChildControls();
14
15 XuiControlSetText(m_ButtonDone,app.GetString(IDS_DONE));
16 XuiControlSetText(m_labelEditSign,app.GetString(IDS_EDIT_SIGN_MESSAGE));
17
18 SignEntryScreenInput* initData = (SignEntryScreenInput*)pInitData->pvInitData;
19 m_sign = initData->sign;
20
21 CXuiSceneBase::ShowDarkOverlay( initData->iPad, TRUE );
22 CXuiSceneBase::ShowLogo( initData->iPad, FALSE);
23 ui.SetTooltips( initData->iPad, IDS_TOOLTIPS_SELECT,IDS_TOOLTIPS_BACK);
24
25 if(app.GetLocalPlayerCount()>1)
26 {
27 app.AdjustSplitscreenScene(m_hObj,&m_OriginalPosition,initData->iPad);
28 }
29
30
31 for(unsigned int i = 0; i<SIGN_ENTRY_ROWS_MAX; ++i)
32 {
33 // Have to have the Latin alphabet here, since that's what we have on the sign in-game
34 // but because the JAP/KOR/CHN fonts don't have extended European characters, let's restrict those languages to not having the extended character set, since they can't see what they are typing
35 switch(XGetLanguage())
36 {
37 case XC_LANGUAGE_JAPANESE:
38 case XC_LANGUAGE_TCHINESE:
39 case XC_LANGUAGE_KOREAN:
40 m_signRows[i].SetKeyboardType(C_4JInput::EKeyboardMode_Alphabet);
41 break;
42 default:
43 m_signRows[i].SetKeyboardType(C_4JInput::EKeyboardMode_Full);
44 break;
45 }
46
47 m_signRows[i].SetText( m_sign->GetMessage(i).c_str() );
48 m_signRows[i].SetTextLimit(15);
49 // Set the title and desc for the edit keyboard popup
50 m_signRows[i].SetTitleAndText(IDS_SIGN_TITLE,IDS_SIGN_TITLE_TEXT);
51 }
52
53
54 return S_OK;
55}
56
57HRESULT CScene_SignEntry::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* pNotifyPressData, BOOL& rfHandled)
58{
59 // This assumes all buttons can only be pressed with the A button
60 ui.AnimateKeyPress(pNotifyPressData->UserIndex, VK_PAD_A);
61
62 if(hObjPressed==m_ButtonDone)
63 {
64 // Set the sign text here so we on;y call the verify once it has been set, not while we're typing in to it
65 for(int i=0;i<4;i++)
66 {
67 wstring temp=m_signRows[i].GetText();
68 m_sign->SetMessage(i,temp);
69 }
70
71 m_sign->setChanged();
72
73 Minecraft *pMinecraft=Minecraft::GetInstance();
74 // need to send the new data
75 if (pMinecraft->level->isClientSide)
76 {
77 shared_ptr<MultiplayerLocalPlayer> player = pMinecraft->localplayers[pNotifyPressData->UserIndex];
78 if(player != NULL && player->connection && player->connection->isStarted())
79 {
80 player->connection->send( shared_ptr<SignUpdatePacket>( new SignUpdatePacket(m_sign->x, m_sign->y, m_sign->z, m_sign->IsVerified(), m_sign->IsCensored(), m_sign->GetMessages()) ) );
81 }
82 }
83 app.CloseXuiScenes(pNotifyPressData->UserIndex);
84 }
85 return S_OK;
86}
87
88HRESULT CScene_SignEntry::OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandled)
89{
90 ui.AnimateKeyPress(pInputData->UserIndex, pInputData->dwKeyCode);
91
92 switch(pInputData->dwKeyCode)
93 {
94 case VK_PAD_B:
95 case VK_ESCAPE:
96 // user backed out, so wipe the sign
97 wstring temp=L"";
98
99 for(int i=0;i<4;i++)
100 {
101 m_sign->SetMessage(i,temp);
102 }
103
104 app.CloseXuiScenes(pInputData->UserIndex);
105 rfHandled = TRUE;
106
107 CXuiSceneBase::PlayUISFX(eSFX_Back);
108 break;
109 }
110
111
112 return S_OK;
113}