first commit
This commit is contained in:
88
Minecraft.Client/Common/XUI/SlotProgressControl.cpp
Normal file
88
Minecraft.Client/Common/XUI/SlotProgressControl.cpp
Normal file
@@ -0,0 +1,88 @@
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "..\..\..\Minecraft.World\Slot.h"
|
||||
#include "..\..\..\Minecraft.World\ItemInstance.h"
|
||||
|
||||
#include "SlotItemControlBase.h"
|
||||
#include "SlotProgressControl.h"
|
||||
|
||||
int SlotProgressControl::GetValue()
|
||||
{
|
||||
int value = 0;
|
||||
|
||||
HXUIOBJ hVisual, hParent;
|
||||
this->GetParent( &hVisual );
|
||||
XuiElementGetParent( hVisual, &hParent);
|
||||
|
||||
void* pvUserData;
|
||||
XuiElementGetUserData( hParent, &pvUserData );
|
||||
|
||||
if( pvUserData != NULL )
|
||||
{
|
||||
SlotControlUserDataContainer* pUserDataContainer = (SlotControlUserDataContainer*)pvUserData;
|
||||
|
||||
shared_ptr<ItemInstance> item = shared_ptr<ItemInstance>();
|
||||
|
||||
if( pUserDataContainer->slot != NULL )
|
||||
{
|
||||
item = pUserDataContainer->slot->getItem();
|
||||
}
|
||||
else
|
||||
{
|
||||
item = pUserDataContainer->item;
|
||||
}
|
||||
|
||||
if( item != NULL )
|
||||
{
|
||||
// TODO Should use getDamage instead even though it returns the same value
|
||||
if( item->isDamaged() )
|
||||
value = item->getDamageValue();
|
||||
else
|
||||
value = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LPCWSTR name;
|
||||
XuiElementGetId( hParent, &name );
|
||||
|
||||
OutputDebugStringW( name );
|
||||
OutputDebugString( "\n" );
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
void SlotProgressControl::GetRange(int *pnRangeMin, int *pnRangeMax)
|
||||
{
|
||||
*pnRangeMin = 0;
|
||||
*pnRangeMax = 0;
|
||||
|
||||
HXUIOBJ hVisual, hParent;
|
||||
this->GetParent( &hVisual );
|
||||
XuiElementGetParent( hVisual, &hParent);
|
||||
|
||||
void* pvUserData;
|
||||
XuiElementGetUserData( hParent, &pvUserData );
|
||||
|
||||
if( pvUserData != NULL )
|
||||
{
|
||||
SlotControlUserDataContainer* pUserDataContainer = (SlotControlUserDataContainer*)pvUserData;
|
||||
|
||||
shared_ptr<ItemInstance> item = shared_ptr<ItemInstance>();
|
||||
|
||||
if( pUserDataContainer->slot != NULL )
|
||||
{
|
||||
item = pUserDataContainer->slot->getItem();
|
||||
}
|
||||
else
|
||||
{
|
||||
item = pUserDataContainer->item;
|
||||
}
|
||||
|
||||
if( item != NULL )
|
||||
{
|
||||
*pnRangeMax = item->getMaxDamage();
|
||||
}
|
||||
}
|
||||
}
|
||||
18
Minecraft.Client/Common/XUI/SlotProgressControl.h
Normal file
18
Minecraft.Client/Common/XUI/SlotProgressControl.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
#include "ProgressControlBase.h"
|
||||
|
||||
class SlotProgressControl : public ProgressControlBase
|
||||
{
|
||||
public:
|
||||
// Define the class. The class name must match the ClassOverride property
|
||||
// set for the scene in the UI Authoring tool.
|
||||
XUI_IMPLEMENT_CLASS( SlotProgressControl, L"SlotProgressControl", XUI_CLASS_PROGRESSBAR )
|
||||
|
||||
XUI_BEGIN_MSG_MAP()
|
||||
XUI_ON_XM_GET_SOURCE_TEXT(OnGetSourceDataText)
|
||||
XUI_END_MSG_MAP()
|
||||
|
||||
virtual int GetValue();
|
||||
virtual void GetRange(int *pnRangeMin, int *pnRangeMax);
|
||||
};
|
||||
9
Minecraft.Client/Common/XUI/XUI_BasePlayer.cpp
Normal file
9
Minecraft.Client/Common/XUI/XUI_BasePlayer.cpp
Normal file
@@ -0,0 +1,9 @@
|
||||
#include "stdafx.h"
|
||||
#include <assert.h>
|
||||
#include "XUI_BasePlayer.h"
|
||||
|
||||
HRESULT CXuiSceneBasePlayer::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
13
Minecraft.Client/Common/XUI/XUI_BasePlayer.h
Normal file
13
Minecraft.Client/Common/XUI/XUI_BasePlayer.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
class CXuiSceneBasePlayer : public CXuiSceneImpl
|
||||
{
|
||||
|
||||
protected:
|
||||
HRESULT OnInit( XUIMessageInit* pInitData, BOOL& bHandled );
|
||||
|
||||
public:
|
||||
// Define the class. The class name must match the ClassOverride property
|
||||
// set for the scene in the UI Authoring tool.
|
||||
XUI_IMPLEMENT_CLASS( CXuiSceneBasePlayer, L"CXuiSceneBasePlayer", XUI_CLASS_SCENE )
|
||||
};
|
||||
71
Minecraft.Client/Common/XUI/XUI_Chat.cpp
Normal file
71
Minecraft.Client/Common/XUI/XUI_Chat.cpp
Normal file
@@ -0,0 +1,71 @@
|
||||
#include "stdafx.h"
|
||||
#include "XUI_Chat.h"
|
||||
#include "..\..\Minecraft.h"
|
||||
#include "..\..\Gui.h"
|
||||
|
||||
HRESULT CScene_Chat::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
|
||||
{
|
||||
m_iPad = *(int *)pInitData->pvInitData;
|
||||
|
||||
MapChildControls();
|
||||
|
||||
this->SetTimer(0,100);
|
||||
|
||||
XuiElementGetPosition(m_hObj,&m_OriginalPosition);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CScene_Chat::OnTimer( XUIMessageTimer *pXUIMessageTimer, BOOL &bHandled)
|
||||
{
|
||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||
Gui *pGui = pMinecraft->gui;
|
||||
|
||||
//DWORD messagesToDisplay = min( CHAT_LINES_COUNT, pGui->getMessagesCount(m_iPad) );
|
||||
for( unsigned int i = 0; i < CHAT_LINES_COUNT; ++i )
|
||||
{
|
||||
float opacity = pGui->getOpacity(m_iPad, i);
|
||||
if( opacity > 0 )
|
||||
{
|
||||
m_Backgrounds[i].SetOpacity(opacity);
|
||||
m_Labels[i].SetOpacity(opacity);
|
||||
m_Labels[i].SetText( pGui->getMessage(m_iPad,i).c_str() );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Backgrounds[i].SetOpacity(0);
|
||||
m_Labels[i].SetOpacity(0);
|
||||
}
|
||||
}
|
||||
if(pMinecraft->localplayers[m_iPad]!= NULL)
|
||||
{
|
||||
m_Jukebox.SetText( pGui->getJukeboxMessage(m_iPad).c_str() );
|
||||
m_Jukebox.SetOpacity( pGui->getJukeboxOpacity(m_iPad) );
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CScene_Chat::OnCustomMessage_Splitscreenplayer(bool bJoining, BOOL& bHandled)
|
||||
{
|
||||
bHandled=true;
|
||||
|
||||
app.ReloadChatScene(m_iPad, bJoining);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CScene_Chat::OffsetTextPosition( float xOffset, float yOffset /*= 0.0f*/ )
|
||||
{
|
||||
D3DXVECTOR3 vPos;
|
||||
float fWidth, fHeight;
|
||||
XuiElementGetBounds( m_Backgrounds[0], &fWidth, &fHeight );
|
||||
for(unsigned int i = 0; i < CHAT_LINES_COUNT; ++i)
|
||||
{
|
||||
XuiElementGetPosition( m_Labels[i], &vPos );
|
||||
vPos.x = xOffset;
|
||||
vPos.y += yOffset;
|
||||
XuiElementSetPosition( m_Labels[i], &vPos );
|
||||
XuiElementSetBounds( m_Labels[i], fWidth - xOffset, fHeight );
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
59
Minecraft.Client/Common/XUI/XUI_Chat.h
Normal file
59
Minecraft.Client/Common/XUI/XUI_Chat.h
Normal file
@@ -0,0 +1,59 @@
|
||||
#pragma once
|
||||
#include "../media/xuiscene_chat.h"
|
||||
#include "XUI_CustomMessages.h"
|
||||
|
||||
#define CHAT_LINES_COUNT 10
|
||||
|
||||
class CScene_Chat : public CXuiSceneImpl
|
||||
{
|
||||
|
||||
protected:
|
||||
CXuiControl m_Labels[CHAT_LINES_COUNT];
|
||||
CXuiControl m_Backgrounds[CHAT_LINES_COUNT];
|
||||
CXuiControl m_Jukebox;
|
||||
|
||||
D3DXVECTOR3 m_OriginalPosition;
|
||||
int m_iPad;
|
||||
|
||||
// Message map. Here we tie messages to message handlers.
|
||||
XUI_BEGIN_MSG_MAP()
|
||||
XUI_ON_XM_INIT( OnInit )
|
||||
XUI_ON_XM_TIMER( OnTimer )
|
||||
XUI_ON_XM_SPLITSCREENPLAYER_MESSAGE(OnCustomMessage_Splitscreenplayer)
|
||||
XUI_END_MSG_MAP()
|
||||
|
||||
BEGIN_CONTROL_MAP()
|
||||
MAP_CONTROL(IDC_XuiLabel1, m_Labels[0])
|
||||
MAP_CONTROL(IDC_XuiLabel2, m_Labels[1])
|
||||
MAP_CONTROL(IDC_XuiLabel3, m_Labels[2])
|
||||
MAP_CONTROL(IDC_XuiLabel4, m_Labels[3])
|
||||
MAP_CONTROL(IDC_XuiLabel5, m_Labels[4])
|
||||
MAP_CONTROL(IDC_XuiLabel6, m_Labels[5])
|
||||
MAP_CONTROL(IDC_XuiLabel7, m_Labels[6])
|
||||
MAP_CONTROL(IDC_XuiLabel8, m_Labels[7])
|
||||
MAP_CONTROL(IDC_XuiLabel9, m_Labels[8])
|
||||
MAP_CONTROL(IDC_XuiLabel10, m_Labels[9])
|
||||
MAP_CONTROL(IDC_XuiBack1, m_Backgrounds[0])
|
||||
MAP_CONTROL(IDC_XuiBack2, m_Backgrounds[1])
|
||||
MAP_CONTROL(IDC_XuiBack3, m_Backgrounds[2])
|
||||
MAP_CONTROL(IDC_XuiBack4, m_Backgrounds[3])
|
||||
MAP_CONTROL(IDC_XuiBack5, m_Backgrounds[4])
|
||||
MAP_CONTROL(IDC_XuiBack6, m_Backgrounds[5])
|
||||
MAP_CONTROL(IDC_XuiBack7, m_Backgrounds[6])
|
||||
MAP_CONTROL(IDC_XuiBack8, m_Backgrounds[7])
|
||||
MAP_CONTROL(IDC_XuiBack9, m_Backgrounds[8])
|
||||
MAP_CONTROL(IDC_XuiBack10, m_Backgrounds[9])
|
||||
MAP_CONTROL(IDC_XuiLabelJukebox, m_Jukebox)
|
||||
END_CONTROL_MAP()
|
||||
|
||||
HRESULT OnInit( XUIMessageInit* pInitData, BOOL& bHandled );
|
||||
HRESULT OnTimer( XUIMessageTimer *pXUIMessageTimer, BOOL &bHandled);
|
||||
HRESULT OnCustomMessage_Splitscreenplayer(bool bJoining, BOOL& bHandled);
|
||||
|
||||
public:
|
||||
// Define the class. The class name must match the ClassOverride property
|
||||
// set for the scene in the UI Authoring tool.
|
||||
XUI_IMPLEMENT_CLASS( CScene_Chat, L"CScene_Chat", XUI_CLASS_SCENE )
|
||||
|
||||
HRESULT OffsetTextPosition( float xOffset, float yOffset = 0.0f );
|
||||
};
|
||||
216
Minecraft.Client/Common/XUI/XUI_ConnectingProgress.cpp
Normal file
216
Minecraft.Client/Common/XUI/XUI_ConnectingProgress.cpp
Normal file
@@ -0,0 +1,216 @@
|
||||
// Minecraft.cpp : Defines the entry point for the application.
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include "..\..\Minecraft.h"
|
||||
#include "..\..\..\Minecraft.World\DisconnectPacket.h"
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Performs initialization tasks - retrieves controls.
|
||||
//----------------------------------------------------------------------------------
|
||||
HRESULT CScene_ConnectingProgress::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
|
||||
{
|
||||
ConnectionProgressParams *param = (ConnectionProgressParams *)pInitData->pvInitData;
|
||||
m_iPad = param->iPad;
|
||||
MapChildControls();
|
||||
|
||||
if( param->stringId >= 0 )
|
||||
{
|
||||
m_title.SetText( app.GetString( param->stringId ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_title.SetText( L"" );
|
||||
}
|
||||
|
||||
m_buttonConfirm.SetText( app.GetString( IDS_CONFIRM_OK ) );
|
||||
|
||||
if(app.GetLocalPlayerCount()>1)
|
||||
{
|
||||
app.AdjustSplitscreenScene(m_hObj,&m_OriginalPosition,m_iPad,false);
|
||||
}
|
||||
|
||||
CXuiSceneBase::ShowBackground( m_iPad, TRUE );
|
||||
CXuiSceneBase::ShowLogo( m_iPad, TRUE );
|
||||
|
||||
m_showTooltips = param->showTooltips;
|
||||
if( param->showTooltips )
|
||||
ui.SetTooltips( m_iPad, -1, IDS_TOOLTIPS_CANCEL_JOIN, -1, -1 );
|
||||
else
|
||||
ui.SetTooltips( m_iPad, -1 );
|
||||
|
||||
m_runFailTimer = param->setFailTimer;
|
||||
m_timerTime = param->timerTime;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
// The framework calls this handler when the object is to be destroyed.
|
||||
HRESULT CScene_ConnectingProgress::OnDestroy()
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Updates the UI when the list selection changes.
|
||||
//----------------------------------------------------------------------------------
|
||||
HRESULT CScene_ConnectingProgress::OnNotifySelChanged( HXUIOBJ hObjSource, XUINotifySelChanged* pNotifySelChangedData, BOOL& bHandled )
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Handler for the button press message.
|
||||
//----------------------------------------------------------------------------------
|
||||
HRESULT CScene_ConnectingProgress::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* pNotifyPressData, BOOL& rfHandled)
|
||||
{
|
||||
// This assumes all buttons can only be pressed with the A button
|
||||
ui.AnimateKeyPress(pNotifyPressData->UserIndex, VK_PAD_A);
|
||||
|
||||
if(hObjPressed == m_buttonConfirm)
|
||||
{
|
||||
if( m_iPad != ProfileManager.GetPrimaryPad() && g_NetworkManager.IsInSession() )
|
||||
{
|
||||
// The connection failed if we see the button, so the temp player should be removed and the viewports updated again
|
||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||
pMinecraft->removeLocalPlayerIdx(m_iPad);
|
||||
}
|
||||
else
|
||||
{
|
||||
app.NavigateToHomeMenu();
|
||||
//app.NavigateBack( ProfileManager.GetPrimaryPad() );
|
||||
}
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CScene_ConnectingProgress::OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandled)
|
||||
{
|
||||
if( m_showTooltips )
|
||||
{
|
||||
ui.AnimateKeyPress(pInputData->UserIndex, pInputData->dwKeyCode);
|
||||
|
||||
// Explicitly handle B button presses
|
||||
if (pInputData->dwKeyCode == VK_PAD_B)
|
||||
{
|
||||
// Cancel the join
|
||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||
pMinecraft->removeLocalPlayerIdx(m_iPad);
|
||||
rfHandled = TRUE;
|
||||
}
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CScene_ConnectingProgress::OnGetSourceDataText(XUIMessageGetSourceText *pGetSourceTextData, BOOL& bHandled)
|
||||
{
|
||||
// This gets called every frame, so use it to update our two text boxes
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CScene_ConnectingProgress::OnTransitionStart( XUIMessageTransition *pTransition, BOOL& bHandled )
|
||||
{
|
||||
//if(m_runFailTimer) XuiSetTimer(m_hObj,0,m_timerTime);
|
||||
if( pTransition->dwTransType == XUI_TRANSITION_FROM )
|
||||
{
|
||||
XuiKillTimer(m_hObj,0);
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CScene_ConnectingProgress::OnTransitionEnd( XUIMessageTransition *pTransition, BOOL& bHandled )
|
||||
{
|
||||
// are we being destroyed? If so, don't do anything
|
||||
if(pTransition->dwTransAction==XUI_TRANSITION_ACTION_DESTROY )
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
if( pTransition->dwTransType == XUI_TRANSITION_TO )
|
||||
{
|
||||
if(m_runFailTimer) XuiSetTimer(m_hObj,0,m_timerTime);
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CScene_ConnectingProgress::OnTimer( XUIMessageTimer *pTimer, BOOL& bHandled )
|
||||
{
|
||||
// Check if the connection failed
|
||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||
|
||||
if( pMinecraft->m_connectionFailed[m_iPad] || !g_NetworkManager.IsInSession() )
|
||||
{
|
||||
app.RemoveBackScene(m_iPad);
|
||||
|
||||
// 4J-PB - timers auto repeat, so kill it
|
||||
XuiKillTimer(m_hObj,0);
|
||||
|
||||
int exitReasonStringId;
|
||||
switch(pMinecraft->m_connectionFailedReason[m_iPad])
|
||||
{
|
||||
case DisconnectPacket::eDisconnect_LoginTooLong:
|
||||
exitReasonStringId = IDS_DISCONNECTED_LOGIN_TOO_LONG;
|
||||
break;
|
||||
case DisconnectPacket::eDisconnect_ServerFull:
|
||||
exitReasonStringId = IDS_DISCONNECTED_SERVER_FULL;
|
||||
break;
|
||||
case DisconnectPacket::eDisconnect_Kicked:
|
||||
exitReasonStringId = IDS_DISCONNECTED_KICKED;
|
||||
break;
|
||||
case DisconnectPacket::eDisconnect_NoUGC_AllLocal:
|
||||
exitReasonStringId = IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_ALL_LOCAL;
|
||||
break;
|
||||
case DisconnectPacket::eDisconnect_NoUGC_Single_Local:
|
||||
exitReasonStringId = IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_SINGLE_LOCAL;
|
||||
break;
|
||||
case DisconnectPacket::eDisconnect_NoUGC_Remote:
|
||||
exitReasonStringId = IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_REMOTE;
|
||||
break;
|
||||
case DisconnectPacket::eDisconnect_NoFlying:
|
||||
exitReasonStringId = IDS_DISCONNECTED_FLYING;
|
||||
break;
|
||||
case DisconnectPacket::eDisconnect_Quitting:
|
||||
exitReasonStringId = IDS_DISCONNECTED_SERVER_QUIT;
|
||||
break;
|
||||
case DisconnectPacket::eDisconnect_OutdatedServer:
|
||||
exitReasonStringId = IDS_DISCONNECTED_SERVER_OLD;
|
||||
break;
|
||||
case DisconnectPacket::eDisconnect_OutdatedClient:
|
||||
exitReasonStringId = IDS_DISCONNECTED_CLIENT_OLD;
|
||||
break;
|
||||
default:
|
||||
exitReasonStringId = IDS_CONNECTION_LOST_SERVER;
|
||||
break;
|
||||
}
|
||||
|
||||
if( m_iPad != ProfileManager.GetPrimaryPad() && g_NetworkManager.IsInSession() )
|
||||
{
|
||||
m_buttonConfirm.SetShow(TRUE);
|
||||
m_buttonConfirm.SetFocus(m_iPad);
|
||||
|
||||
// Set text
|
||||
m_title.SetText( app.GetString( IDS_CONNECTION_FAILED ) );
|
||||
m_status.SetText( app.GetString( exitReasonStringId ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
UINT uiIDA[1];
|
||||
uiIDA[0]=IDS_CONFIRM_OK;
|
||||
#ifdef _XBOX
|
||||
StorageManager.RequestMessageBox( IDS_CONNECTION_FAILED, exitReasonStringId, uiIDA,1,ProfileManager.GetPrimaryPad(),NULL,NULL, app.GetStringTable());
|
||||
#endif
|
||||
exitReasonStringId = -1;
|
||||
|
||||
//app.NavigateToHomeMenu();
|
||||
app.SetAction(ProfileManager.GetPrimaryPad(),eAppAction_ExitWorld,(void *)TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
55
Minecraft.Client/Common/XUI/XUI_ConnectingProgress.h
Normal file
55
Minecraft.Client/Common/XUI/XUI_ConnectingProgress.h
Normal file
@@ -0,0 +1,55 @@
|
||||
#pragma once
|
||||
#include "../media/xuiscene_connectingprogress.h"
|
||||
|
||||
class CScene_ConnectingProgress : public CXuiSceneImpl
|
||||
{
|
||||
private:
|
||||
int m_iPad;
|
||||
bool m_runFailTimer;
|
||||
int m_timerTime;
|
||||
bool m_showTooltips;
|
||||
protected:
|
||||
// Control and Element wrapper objects.
|
||||
CXuiControl m_title, m_status, m_buttonConfirm;
|
||||
|
||||
// Message map. Here we tie messages to message handlers.
|
||||
XUI_BEGIN_MSG_MAP()
|
||||
XUI_ON_XM_INIT( OnInit )
|
||||
XUI_ON_XM_DESTROY( OnDestroy )
|
||||
XUI_ON_XM_NOTIFY_SELCHANGED( OnNotifySelChanged )
|
||||
XUI_ON_XM_NOTIFY_PRESS_EX(OnNotifyPressEx)
|
||||
XUI_ON_XM_KEYDOWN(OnKeyDown)
|
||||
XUI_ON_XM_GET_SOURCE_TEXT(OnGetSourceDataText)
|
||||
XUI_ON_XM_TRANSITION_START( OnTransitionStart )
|
||||
XUI_ON_XM_TRANSITION_END( OnTransitionEnd )
|
||||
XUI_ON_XM_TIMER( OnTimer )
|
||||
XUI_END_MSG_MAP()
|
||||
|
||||
// Control mapping to objects
|
||||
BEGIN_CONTROL_MAP()
|
||||
MAP_CONTROL(IDC_Title, m_title)
|
||||
MAP_CONTROL(IDC_Status, m_status)
|
||||
MAP_CONTROL(IDC_ButtonConfirm, m_buttonConfirm)
|
||||
END_CONTROL_MAP()
|
||||
|
||||
|
||||
HRESULT OnInit( XUIMessageInit* pInitData, BOOL& bHandled );
|
||||
HRESULT OnDestroy();
|
||||
HRESULT OnNotifySelChanged( HXUIOBJ hObjSource, XUINotifySelChanged* pNotifySelChangedData, BOOL& bHandled );
|
||||
HRESULT OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* pNotifyPressData,BOOL& rfHandled);
|
||||
HRESULT OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandled);
|
||||
HRESULT OnGetSourceDataText(XUIMessageGetSourceText *pGetSourceTextData, BOOL& bHandled);
|
||||
HRESULT OnTransitionStart( XUIMessageTransition *pTransition, BOOL& bHandled );
|
||||
HRESULT OnTransitionEnd( XUIMessageTransition *pTransition, BOOL& bHandled );
|
||||
HRESULT OnTimer( XUIMessageTimer *pTimer, BOOL& bHandled );
|
||||
public:
|
||||
|
||||
// Define the class. The class name must match the ClassOverride property
|
||||
// set for the scene in the UI Authoring tool.
|
||||
XUI_IMPLEMENT_CLASS( CScene_ConnectingProgress, L"CScene_ConnectingProgress", XUI_CLASS_SCENE )
|
||||
|
||||
private:
|
||||
bool m_threadCompleted;
|
||||
D3DXVECTOR3 m_OriginalPosition;
|
||||
|
||||
};
|
||||
98
Minecraft.Client/Common/XUI/XUI_Control_ComboBox.cpp
Normal file
98
Minecraft.Client/Common/XUI/XUI_Control_ComboBox.cpp
Normal file
@@ -0,0 +1,98 @@
|
||||
#include "stdafx.h"
|
||||
#include "XUI_Control_ComboBox.h"
|
||||
#include "..\Xbox_App.h"
|
||||
|
||||
HRESULT CXuiControl4JComboBox::OnInit(XUIMessageInit *pInitData, BOOL& bHandled)
|
||||
{
|
||||
m_ListData.nItems=0;
|
||||
m_ListData.pItems=NULL;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void CXuiControl4JComboBox::SetData(LIST_ITEM_INFO *pItems,int iCount)
|
||||
{
|
||||
CXuiControl4JComboBox *pThis;
|
||||
HRESULT hr = XuiObjectFromHandle(m_hObj, (void **) &pThis);
|
||||
|
||||
// copy the data in
|
||||
pThis->m_ListData.pItems= new LIST_ITEM_INFO [iCount] ;
|
||||
memcpy(pThis->m_ListData.pItems,pItems,sizeof(LIST_ITEM_INFO)*iCount);
|
||||
pThis->m_ListData.nItems=iCount;
|
||||
|
||||
//InsertItems( 0, iCount );
|
||||
}
|
||||
|
||||
int CXuiControl4JComboBox::GetSelectedIndex()
|
||||
{
|
||||
return XuiListGetCurSel(GetListObject(),NULL);
|
||||
}
|
||||
|
||||
// Gets called every frame
|
||||
HRESULT CXuiControl4JComboBox::OnGetSourceDataText(XUIMessageGetSourceText *pGetSourceTextData,BOOL& bHandled)
|
||||
{
|
||||
if( ( 0 == pGetSourceTextData->iData ) && ( ( pGetSourceTextData->bItemData ) ) )
|
||||
{
|
||||
pGetSourceTextData->szText =
|
||||
m_ListData.pItems[pGetSourceTextData->iItem].pwszText;
|
||||
bHandled = TRUE;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CXuiControl4JComboBox::OnGetItemCountAll(XUIMessageGetItemCount *pGetItemCountData,BOOL& bHandled)
|
||||
{
|
||||
pGetItemCountData->cItems = m_ListData.nItems;
|
||||
bHandled = TRUE;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CXuiControl4JComboBox::OnGetSourceDataImage(XUIMessageGetSourceImage *pGetSourceImageData,BOOL& bHandled)
|
||||
{
|
||||
return S_OK;
|
||||
|
||||
//if( ( 0 == pGetSourceImageData->iData ) && ( pGetSourceImageData->bItemData ) )
|
||||
//{
|
||||
// // Check for a brush
|
||||
|
||||
// if(m_ListData.pItems[pGetSourceImageData->iItem].hXuiBrush!=NULL)
|
||||
// {
|
||||
// pGetSourceImageData->hBrush=m_ListData.pItems[pGetSourceImageData->iItem].hXuiBrush;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// pGetSourceImageData->szPath =
|
||||
// m_ListData.pItems[pGetSourceImageData->iItem].pwszImage;
|
||||
// }
|
||||
// bHandled = TRUE;
|
||||
//}
|
||||
//return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CXuiControl4JComboBox::OnGetItemEnable(XUIMessageGetItemEnable *pGetItemEnableData,BOOL& bHandled)
|
||||
{
|
||||
if(m_ListData.pItems!=NULL && m_ListData.nItems!=0)
|
||||
{
|
||||
pGetItemEnableData->bEnabled =
|
||||
m_ListData.pItems[pGetItemEnableData->iItem].fEnabled;
|
||||
}
|
||||
bHandled = TRUE;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Handler for the button press message.
|
||||
//----------------------------------------------------------------------------------
|
||||
HRESULT CXuiControl4JComboBox::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* pNotifyPressData, BOOL& rfHandled)
|
||||
{
|
||||
// This assumes all buttons can only be pressed with the A button
|
||||
CScene_Base::HandleKeyPress(pNotifyPressData->UserIndex, VK_PAD_A);
|
||||
|
||||
if(hObjPressed==GetValueObject())
|
||||
{
|
||||
XuiElementSetShow(GetListObject(),TRUE);
|
||||
XuiElementSetFocus(GetListObject());
|
||||
rfHandled = TRUE;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
53
Minecraft.Client/Common/XUI/XUI_Control_ComboBox.h
Normal file
53
Minecraft.Client/Common/XUI/XUI_Control_ComboBox.h
Normal file
@@ -0,0 +1,53 @@
|
||||
#pragma once
|
||||
|
||||
class CXuiControl4JComboBox : public CXuiComboBoxImpl
|
||||
{
|
||||
public:
|
||||
|
||||
// Information for one list item.
|
||||
typedef struct _LIST_ITEM_INFO
|
||||
{
|
||||
LPCWSTR pwszText;
|
||||
LPCWSTR pwszImage;
|
||||
HXUIBRUSH hXuiBrush;
|
||||
BOOL fChecked;
|
||||
BOOL fEnabled;
|
||||
}
|
||||
LIST_ITEM_INFO;
|
||||
|
||||
// List data.
|
||||
typedef struct _tagListData
|
||||
{
|
||||
int nItems;
|
||||
LIST_ITEM_INFO *pItems;
|
||||
}
|
||||
LIST_DATA;
|
||||
|
||||
LIST_DATA m_ListData;
|
||||
XUI_IMPLEMENT_CLASS(CXuiControl4JComboBox, L"CXuiControl4JComboBox", XUI_CLASS_COMBOBOX);
|
||||
|
||||
void SetData(_LIST_ITEM_INFO *pItems,int iCount);
|
||||
int GetSelectedIndex();
|
||||
|
||||
protected:
|
||||
|
||||
XUI_BEGIN_MSG_MAP()
|
||||
XUI_ON_XM_INIT(OnInit)
|
||||
XUI_ON_XM_GET_SOURCE_TEXT(OnGetSourceDataText)
|
||||
XUI_ON_XM_GET_ITEMCOUNT_ALL(OnGetItemCountAll)
|
||||
XUI_ON_XM_GET_SOURCE_IMAGE(OnGetSourceDataImage)
|
||||
XUI_ON_XM_GET_ITEMENABLE(OnGetItemEnable)
|
||||
XUI_ON_XM_NOTIFY_PRESS_EX(OnNotifyPressEx)
|
||||
|
||||
XUI_END_MSG_MAP()
|
||||
|
||||
|
||||
HRESULT OnInit( XUIMessageInit* pInitData, BOOL& bHandled );
|
||||
HRESULT OnGetSourceDataText(XUIMessageGetSourceText *pGetSourceTextData, BOOL& bHandled);
|
||||
HRESULT OnGetItemCountAll(XUIMessageGetItemCount *pGetItemCountData, BOOL& bHandled);
|
||||
HRESULT OnGetSourceDataImage(XUIMessageGetSourceImage *pGetSourceImageData,BOOL& bHandled);
|
||||
HRESULT OnGetItemEnable(XUIMessageGetItemEnable *pGetItemEnableData,BOOL& bHandled);
|
||||
HRESULT OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* pNotifyPressData,BOOL& rfHandled);
|
||||
|
||||
|
||||
};
|
||||
26
Minecraft.Client/Common/XUI/XUI_Controls.h
Normal file
26
Minecraft.Client/Common/XUI/XUI_Controls.h
Normal file
@@ -0,0 +1,26 @@
|
||||
#pragma once
|
||||
|
||||
#include "XUI_Ctrl_4JEdit.h"
|
||||
#include "XUI_Ctrl_4JIcon.h"
|
||||
#include "XUI_Ctrl_4JList.h"
|
||||
#include "XUI_Ctrl_BrewProgress.h"
|
||||
#include "XUI_Ctrl_BubblesProgress.h"
|
||||
#include "XUI_Ctrl_BurnProgress.h"
|
||||
#include "XUI_Ctrl_CraftIngredientSlot.h"
|
||||
#include "XUI_Ctrl_EnchantButton.h"
|
||||
#include "XUI_Ctrl_EnchantmentBook.h"
|
||||
#include "XUI_Ctrl_EnchantmentButtonText.h"
|
||||
#include "XUI_Ctrl_FireProgress.h"
|
||||
#include "XUI_Ctrl_LoadingProgress.h"
|
||||
#include "XUI_Ctrl_MinecraftPlayer.h"
|
||||
#include "XUI_Ctrl_MinecraftSkinPreview.h"
|
||||
#include "XUI_Ctrl_MinecraftSlot.h"
|
||||
#include "XUI_Ctrl_MobEffect.h"
|
||||
#include "XUI_Ctrl_PassthroughList.h"
|
||||
#include "XUI_Ctrl_ProgressCtrlBase.h"
|
||||
#include "XUI_Ctrl_SliderWrapper.h"
|
||||
#include "XUI_Ctrl_SlotItem.h"
|
||||
#include "XUI_Ctrl_SlotItemCtrlBase.h"
|
||||
#include "XUI_Ctrl_SlotItemListItem.h"
|
||||
#include "XUI_Ctrl_SlotList.h"
|
||||
#include "XUI_Ctrl_SplashPulser.h"
|
||||
200
Minecraft.Client/Common/XUI/XUI_Ctrl_4JEdit.cpp
Normal file
200
Minecraft.Client/Common/XUI/XUI_Ctrl_4JEdit.cpp
Normal file
@@ -0,0 +1,200 @@
|
||||
#include "stdafx.h"
|
||||
#include "XUI_Ctrl_4JEdit.h"
|
||||
|
||||
|
||||
|
||||
HRESULT CXuiCtrl4JEdit::OnInit(XUIMessageInit* pInitData, BOOL& rfHandled)
|
||||
{
|
||||
HRESULT hr=S_OK;
|
||||
|
||||
// set a limit for the text box
|
||||
m_uTextLimit=XUI_4JEDIT_MAX_CHARS-1;
|
||||
XuiEditSetTextLimit(m_hObj,m_uTextLimit);
|
||||
// Find the text limit. (Add one for NULL terminator)
|
||||
//m_uTextLimit = min( XuiEditGetTextLimit(m_hObj) + 1, XUI_4JEDIT_MAX_CHARS);
|
||||
|
||||
ZeroMemory( wchText , sizeof(WCHAR)*(m_uTextLimit+1) );
|
||||
|
||||
m_bReadOnly = false;
|
||||
m_uiTitle = 0;
|
||||
m_uiText =0;
|
||||
m_eKeyboardMode=C_4JInput::EKeyboardMode_Default;
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
||||
HRESULT CXuiCtrl4JEdit::SetTextLimit(int iLimit)
|
||||
{
|
||||
CXuiCtrl4JEdit *pThis;
|
||||
HRESULT hr = XuiObjectFromHandle(m_hObj, (void **) &pThis);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
if(iLimit<XUI_4JEDIT_MAX_CHARS)
|
||||
{
|
||||
pThis->m_uTextLimit=iLimit;
|
||||
XuiEditSetTextLimit(pThis->m_hObj,iLimit);
|
||||
ZeroMemory( pThis->wchText , sizeof(WCHAR)*XUI_4JEDIT_MAX_CHARS );
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
HRESULT CXuiCtrl4JEdit::SetCaretPosition(int iPos)
|
||||
{
|
||||
CXuiCtrl4JEdit *pThis;
|
||||
HRESULT hr = XuiObjectFromHandle(m_hObj, (void **) &pThis);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
XuiEditSetCaretPosition(pThis->m_hObj,iPos);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CXuiCtrl4JEdit::SetTitleAndText(unsigned int uiTitle, unsigned int uiText)
|
||||
{
|
||||
CXuiCtrl4JEdit *pThis;
|
||||
HRESULT hr = XuiObjectFromHandle(m_hObj, (void **) &pThis);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
pThis->m_uiTitle=uiTitle;
|
||||
pThis->m_uiText=uiText;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CXuiCtrl4JEdit::SetReadOnly(bool bReadOnly)
|
||||
{
|
||||
// Attempt to make the change on the actual original version of this object that XUI made itself, rather
|
||||
// than the copy we make ourselves and then map to it, which shares the same handle
|
||||
CXuiCtrl4JEdit *pThis;
|
||||
HRESULT hr = XuiObjectFromHandle(m_hObj, (void **) &pThis);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
pThis->m_bReadOnly = bReadOnly;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CXuiCtrl4JEdit::SetKeyboardType(C_4JInput::EKeyboardMode eKeyboardMode)
|
||||
{
|
||||
CXuiCtrl4JEdit *pThis;
|
||||
HRESULT hr = XuiObjectFromHandle(m_hObj, (void **) &pThis);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
pThis->m_eKeyboardMode= eKeyboardMode;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
// HRESULT CXuiCtrl4JEdit::SetIPMode(bool bIPMode)
|
||||
// {
|
||||
// // Attempt to make the change on the actual original version of this object that XUI made itself, rather
|
||||
// // than the copy we make ourselves and then map to it, which shares the same handle
|
||||
// CXuiCtrl4JEdit *pThis;
|
||||
// HRESULT hr = XuiObjectFromHandle(m_hObj, (void **) &pThis);
|
||||
// if (FAILED(hr))
|
||||
// return hr;
|
||||
// pThis->m_bIPMode= bIPMode;
|
||||
//
|
||||
// return S_OK;
|
||||
// }
|
||||
|
||||
// HRESULT CXuiCtrl4JEdit::SetExtendedMode(bool bExtendedMode)
|
||||
// {
|
||||
// // Attempt to make the change on the actual original version of this object that XUI made itself, rather
|
||||
// // than the copy we make ourselves and then map to it, which shares the same handle
|
||||
// CXuiCtrl4JEdit *pThis;
|
||||
// HRESULT hr = XuiObjectFromHandle(m_hObj, (void **) &pThis);
|
||||
// if (FAILED(hr))
|
||||
// return hr;
|
||||
// pThis->m_bExtendedMode= bExtendedMode;
|
||||
//
|
||||
// return S_OK;
|
||||
// }
|
||||
|
||||
HRESULT CXuiCtrl4JEdit::OnChar(XUIMessageChar* pInputData, BOOL& rfHandled)
|
||||
{
|
||||
CXuiCtrl4JEdit *pThis;
|
||||
HRESULT hr = XuiObjectFromHandle(m_hObj, (void **) &pThis);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
HXUIOBJ hBaseObj;
|
||||
|
||||
// need to send the key down to the base object, so that when we notify the parent, the edit control has been updated with the right text
|
||||
hr=XuiGetBaseObject(pThis->m_hObj,&hBaseObj);
|
||||
|
||||
XUIMessage xuiMsg;
|
||||
XUIMessageChar xuiMsgChar;
|
||||
XuiMessageChar( &xuiMsg, &xuiMsgChar, pInputData->wch, pInputData->dwFlags, pInputData->UserIndex );
|
||||
// Send the XM_CHAR message.
|
||||
XuiSendMessage( hBaseObj, &xuiMsg );
|
||||
|
||||
rfHandled = TRUE;
|
||||
SendNotifyValueChanged((int)pInputData->wch);
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT CXuiCtrl4JEdit::OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandled)
|
||||
{
|
||||
CXuiCtrl4JEdit *pThis;
|
||||
HRESULT hr = XuiObjectFromHandle(m_hObj, (void **) &pThis);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
ui.AnimateKeyPress(pInputData->UserIndex, pInputData->dwKeyCode);
|
||||
|
||||
//HRESULT hr = S_OK;
|
||||
|
||||
if( pThis->m_bReadOnly ) return hr;
|
||||
|
||||
// Find the text limit. (Add one for NULL terminator)
|
||||
//m_uTextLimit = min( XuiEditGetTextLimit(m_hObj) + 1, XUI_4JEDIT_MAX_CHARS);
|
||||
|
||||
if((((pInputData->dwKeyCode == VK_PAD_A) && (pInputData->wch == 0)) || (pInputData->dwKeyCode == VK_PAD_START)) && !(pInputData->dwFlags & XUI_INPUT_FLAG_REPEAT))
|
||||
{
|
||||
pThis->RequestKeyboard(pInputData->UserIndex);
|
||||
rfHandled = TRUE;
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
void CXuiCtrl4JEdit::RequestKeyboard(int iPad)
|
||||
{
|
||||
InputManager.RequestKeyboard(m_uiTitle,GetText(),m_uiText,iPad,wchText,m_uTextLimit+1,&CXuiCtrl4JEdit::KeyboardReturned,this,m_eKeyboardMode,app.GetStringTable());
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
HRESULT CXuiCtrl4JEdit::SendNotifyValueChanged(int iValue)
|
||||
{
|
||||
CXuiCtrl4JEdit *pThis;
|
||||
HRESULT hr = XuiObjectFromHandle(m_hObj, (void **) &pThis);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
HXUIOBJ hParent;
|
||||
//HRESULT hr=S_OK;
|
||||
XUIMessage msg;
|
||||
XUINotify msgNotify;
|
||||
XUINotifyValueChanged msgNotifyValueChanged;
|
||||
|
||||
XuiElementGetParent(pThis->m_hObj, &hParent);
|
||||
XuiNotifyValueChanged(&msg, &msgNotify, &msgNotifyValueChanged, XuiGetOuter(pThis->m_hObj), iValue);
|
||||
XuiBubbleMessage(XuiGetOuter(hParent), &msg);
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
int CXuiCtrl4JEdit::KeyboardReturned(void *pParam,bool bSet)
|
||||
{
|
||||
CXuiCtrl4JEdit* pClass = (CXuiCtrl4JEdit*)pParam;
|
||||
HRESULT hr = S_OK;
|
||||
|
||||
if(bSet)
|
||||
{
|
||||
pClass->SetText(pClass->wchText);
|
||||
// need to move the caret to the end of the newly set text
|
||||
XuiEditSetCaretPosition(pClass->m_hObj, (int)wcsnlen(pClass->wchText, 50));
|
||||
pClass->SendNotifyValueChanged(10); // 10 for a return
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
44
Minecraft.Client/Common/XUI/XUI_Ctrl_4JEdit.h
Normal file
44
Minecraft.Client/Common/XUI/XUI_Ctrl_4JEdit.h
Normal file
@@ -0,0 +1,44 @@
|
||||
#pragma once
|
||||
|
||||
#include <XuiApp.h>
|
||||
|
||||
#define XUI_4JEDIT_MAX_CHARS 61
|
||||
|
||||
class CXuiCtrl4JEdit : public CXuiControlImpl
|
||||
{
|
||||
public:
|
||||
XUI_IMPLEMENT_CLASS(CXuiCtrl4JEdit, L"CXuiCtrl4JEdit", XUI_CLASS_EDIT)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
XUI_BEGIN_MSG_MAP()
|
||||
XUI_ON_XM_INIT(OnInit)
|
||||
XUI_ON_XM_CHAR(OnChar)
|
||||
XUI_ON_XM_KEYDOWN(OnKeyDown)
|
||||
XUI_END_MSG_MAP()
|
||||
|
||||
HRESULT OnInit(XUIMessageInit* pInitData, BOOL& rfHandled);
|
||||
HRESULT OnChar(XUIMessageChar* pInputData, BOOL& rfHandled);
|
||||
HRESULT OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandled);
|
||||
public:
|
||||
HRESULT SetReadOnly(bool bReadOnly);
|
||||
// HRESULT SetIPMode(bool bIPMode);
|
||||
// HRESULT SetExtendedMode(bool bExtendedMode);
|
||||
HRESULT SetKeyboardType(C_4JInput::EKeyboardMode eKeyboardMode);
|
||||
HRESULT SetTextLimit(int iLimit);
|
||||
HRESULT SetCaretPosition(int iPos);
|
||||
HRESULT SetTitleAndText(unsigned int uiTitle, unsigned int uiText);
|
||||
|
||||
void RequestKeyboard(int iPad);
|
||||
protected:
|
||||
bool m_bReadOnly;
|
||||
C_4JInput::EKeyboardMode m_eKeyboardMode;
|
||||
unsigned int m_uiTitle,m_uiText;
|
||||
|
||||
private:
|
||||
static int KeyboardReturned(void *pParam,bool bSet);
|
||||
HRESULT SendNotifyValueChanged(int);
|
||||
WCHAR wchText[XUI_4JEDIT_MAX_CHARS];
|
||||
unsigned int m_uTextLimit;
|
||||
};
|
||||
61
Minecraft.Client/Common/XUI/XUI_Ctrl_4JIcon.cpp
Normal file
61
Minecraft.Client/Common/XUI/XUI_Ctrl_4JIcon.cpp
Normal file
@@ -0,0 +1,61 @@
|
||||
#include "stdafx.h"
|
||||
#include "XUI_Ctrl_4JIcon.h"
|
||||
|
||||
HRESULT CXuiCtrl4JIcon::OnInit(XUIMessageInit *pInitData, BOOL& bHandled)
|
||||
{
|
||||
m_hBrush=NULL;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CXuiCtrl4JIcon::OnGetSourceDataImage(XUIMessageGetSourceImage *pGetSourceImageData,BOOL& bHandled)
|
||||
{
|
||||
XUIMessage Message;
|
||||
XUIMessageGetSourceImage MsgGetImage;
|
||||
HRESULT hr;
|
||||
HXUIOBJ hObj;
|
||||
|
||||
if(m_hBrush)
|
||||
{
|
||||
pGetSourceImageData->hBrush = m_hBrush;
|
||||
bHandled = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
XuiMessageGetSourceImage(&Message, &MsgGetImage, pGetSourceImageData->iItem, pGetSourceImageData->iData, TRUE);
|
||||
|
||||
hr = GetParent(&hObj);
|
||||
|
||||
if (HRESULT_SUCCEEDED(hr))
|
||||
{
|
||||
hr = XuiBubbleMessage(hObj, &Message);
|
||||
|
||||
if (Message.bHandled)
|
||||
{
|
||||
pGetSourceImageData->hBrush = MsgGetImage.hBrush;
|
||||
bHandled = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CXuiCtrl4JIcon::UseBrush(HXUIBRUSH hBrush)
|
||||
{
|
||||
if( m_hBrush )
|
||||
{
|
||||
XuiDestroyBrush( m_hBrush );
|
||||
}
|
||||
m_hBrush = hBrush;
|
||||
return XuiControlSetImageBrush(m_hObj,hBrush);
|
||||
}
|
||||
|
||||
HRESULT CXuiCtrl4JIcon::OnDestroy()
|
||||
{
|
||||
|
||||
if( m_hBrush )
|
||||
{
|
||||
XuiDestroyBrush( m_hBrush );
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
25
Minecraft.Client/Common/XUI/XUI_Ctrl_4JIcon.h
Normal file
25
Minecraft.Client/Common/XUI/XUI_Ctrl_4JIcon.h
Normal file
@@ -0,0 +1,25 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
class CXuiCtrl4JIcon : public CXuiControlImpl
|
||||
{
|
||||
public:
|
||||
|
||||
XUI_IMPLEMENT_CLASS(CXuiCtrl4JIcon, L"CXuiCtrl4JIcon", XUI_CLASS_LABEL);
|
||||
HRESULT UseBrush(HXUIBRUSH hBrush);
|
||||
|
||||
protected:
|
||||
|
||||
XUI_BEGIN_MSG_MAP()
|
||||
XUI_ON_XM_INIT(OnInit)
|
||||
XUI_ON_XM_GET_SOURCE_IMAGE(OnGetSourceDataImage)
|
||||
XUI_ON_XM_DESTROY( OnDestroy )
|
||||
XUI_END_MSG_MAP()
|
||||
|
||||
|
||||
HRESULT OnInit( XUIMessageInit* pInitData, BOOL& bHandled );
|
||||
HRESULT OnGetSourceDataImage(XUIMessageGetSourceImage *pGetSourceImageData,BOOL& bHandled);
|
||||
HRESULT OnDestroy();
|
||||
|
||||
HXUIBRUSH m_hBrush;
|
||||
};
|
||||
405
Minecraft.Client/Common/XUI/XUI_Ctrl_4JList.cpp
Normal file
405
Minecraft.Client/Common/XUI/XUI_Ctrl_4JList.cpp
Normal file
@@ -0,0 +1,405 @@
|
||||
#include "stdafx.h"
|
||||
#include "XUI_Ctrl_4JList.h"
|
||||
|
||||
static bool TimeSortFn(const void *a, const void *b);
|
||||
|
||||
HRESULT CXuiCtrl4JList::OnInit(XUIMessageInit *pInitData, BOOL& bHandled)
|
||||
{
|
||||
InitializeCriticalSection(&m_AccessListData);
|
||||
|
||||
m_hSelectionChangedHandlerObj = NULL;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void CXuiCtrl4JList::AddData( const LIST_ITEM_INFO& ItemInfo , int iSortListFromIndex, int iSortFunction)
|
||||
{
|
||||
// need to allocate memory for the structure and its strings
|
||||
// and remap the string pointers
|
||||
DWORD dwBytes=0;
|
||||
DWORD dwLen1=0;
|
||||
DWORD dwLen2=0;
|
||||
|
||||
if(ItemInfo.pwszText)
|
||||
{
|
||||
dwLen1=(int)wcslen(ItemInfo.pwszText)*sizeof(WCHAR);
|
||||
dwBytes+=dwLen1+sizeof(WCHAR);
|
||||
}
|
||||
|
||||
if(ItemInfo.pwszImage)
|
||||
{
|
||||
dwLen2=(int)(wcslen(ItemInfo.pwszImage))*sizeof(WCHAR);
|
||||
dwBytes+=dwLen2+sizeof(WCHAR);
|
||||
}
|
||||
|
||||
dwBytes+=sizeof( LIST_ITEM_INFO );
|
||||
LIST_ITEM_INFO *pItemInfo = (LIST_ITEM_INFO *)new BYTE[dwBytes];
|
||||
ZeroMemory(pItemInfo,dwBytes);
|
||||
|
||||
XMemCpy( pItemInfo, &ItemInfo, sizeof( LIST_ITEM_INFO ) );
|
||||
if(dwLen1!=0)
|
||||
{
|
||||
XMemCpy( &pItemInfo[1], ItemInfo.pwszText, dwLen1 );
|
||||
pItemInfo->pwszText=(LPCWSTR)&pItemInfo[1];
|
||||
if(dwLen2!=0)
|
||||
{
|
||||
BYTE *pwszImage = ((BYTE *)&pItemInfo[1])+dwLen1+sizeof(WCHAR);
|
||||
XMemCpy( pwszImage, ItemInfo.pwszImage, dwLen2 );
|
||||
pItemInfo->pwszImage=(LPCWSTR)pwszImage;
|
||||
}
|
||||
}
|
||||
else if(dwLen2!=0)
|
||||
{
|
||||
XMemCpy( &pItemInfo[1], ItemInfo.pwszImage, dwLen2 );
|
||||
pItemInfo->pwszImage=(LPCWSTR)&pItemInfo[1];
|
||||
}
|
||||
|
||||
EnterCriticalSection(&m_AccessListData);
|
||||
|
||||
// need to remember the original index of this addition before it gets sorted - this will get used to load the game
|
||||
if(iSortListFromIndex!=-1)
|
||||
{
|
||||
pItemInfo->iIndex=(int)m_vListData.size()-iSortListFromIndex;
|
||||
}
|
||||
else
|
||||
{
|
||||
pItemInfo->iIndex=(int)m_vListData.size();
|
||||
}
|
||||
|
||||
// added to force a sort order for DLC
|
||||
//pItemInfo->iSortIndex=iSortIndex;
|
||||
|
||||
m_vListData.push_back(pItemInfo);
|
||||
|
||||
#ifdef _DEBUG
|
||||
|
||||
int iCount=0;
|
||||
for (AUTO_VAR(it, m_vListData.begin()); it != m_vListData.end(); it++)
|
||||
{
|
||||
PLIST_ITEM_INFO pInfo=(PLIST_ITEM_INFO)*it;
|
||||
app.DebugPrintf("%d. ",iCount++);
|
||||
OutputDebugStringW(pInfo->pwszText);
|
||||
app.DebugPrintf(" - %d\n",pInfo->iSortIndex);
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
if(iSortListFromIndex!=-1)
|
||||
{
|
||||
switch(iSortFunction)
|
||||
{
|
||||
case eSortList_Date:
|
||||
// sort from the index passed (to leave create world and tutorial in the saves list)
|
||||
sort(m_vListData.begin()+iSortListFromIndex, m_vListData.end(),CXuiCtrl4JList::TimeSortFn);
|
||||
break;
|
||||
case eSortList_Alphabetical:
|
||||
// alphabetical sort
|
||||
sort(m_vListData.begin()+iSortListFromIndex, m_vListData.end(),CXuiCtrl4JList::AlphabeticSortFn);
|
||||
break;
|
||||
case eSortList_Index:
|
||||
sort(m_vListData.begin()+iSortListFromIndex, m_vListData.end(),CXuiCtrl4JList::IndexSortFn);
|
||||
break;
|
||||
}
|
||||
}
|
||||
LeaveCriticalSection(&m_AccessListData);
|
||||
// #ifdef _DEBUG
|
||||
//
|
||||
// iCount=0;
|
||||
// for (AUTO_VAR(it, m_vListData.begin()); it != m_vListData.end(); it++)
|
||||
// {
|
||||
// PLIST_ITEM_INFO pInfo=(PLIST_ITEM_INFO)*it;
|
||||
// app.DebugPrintf("After Sort - %d. ",iCount++);
|
||||
// OutputDebugStringW(pInfo->pwszText);
|
||||
// app.DebugPrintf(" - %d\n",pInfo->iSortIndex);
|
||||
//
|
||||
// }
|
||||
// #endif
|
||||
InsertItems( 0, 1 );
|
||||
}
|
||||
|
||||
void CXuiCtrl4JList::RemoveAllData( )
|
||||
{
|
||||
EnterCriticalSection(&m_AccessListData);
|
||||
|
||||
int iSize=(int)m_vListData.size();
|
||||
for(int i=0;i<iSize;i++)
|
||||
{
|
||||
LIST_ITEM_INFO *pBack = m_vListData.back();
|
||||
if( pBack->hXuiBrush )
|
||||
{
|
||||
XuiDestroyBrush(pBack->hXuiBrush);
|
||||
}
|
||||
m_vListData.pop_back();
|
||||
DeleteItems( 0, 1 );
|
||||
}
|
||||
|
||||
LeaveCriticalSection(&m_AccessListData);
|
||||
}
|
||||
|
||||
void CXuiCtrl4JList::SelectByUserData(int iData)
|
||||
{
|
||||
for(unsigned int i = 0; i < m_vListData.size(); ++i)
|
||||
{
|
||||
if(m_vListData.at(i)->iData == iData)
|
||||
{
|
||||
SetCurSel(i);
|
||||
SetTopItem(i); // scroll the item into view if it's not visible
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int CXuiCtrl4JList::GetIndexByUserData(int iData)
|
||||
{
|
||||
for(unsigned int i = 0; i < m_vListData.size(); ++i)
|
||||
{
|
||||
if(m_vListData.at(i)->iData == iData)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
CXuiCtrl4JList::LIST_ITEM_INFO& CXuiCtrl4JList::GetData(DWORD dw)
|
||||
{
|
||||
return *m_vListData[dw];
|
||||
}
|
||||
|
||||
CXuiCtrl4JList::LIST_ITEM_INFO& CXuiCtrl4JList::GetDataiData(int iData)
|
||||
{
|
||||
LIST_ITEM_INFO info;
|
||||
|
||||
for(unsigned int i=0;i<m_vListData.size();i++)
|
||||
{
|
||||
info=*m_vListData[i];
|
||||
if(info.iData==iData)
|
||||
{
|
||||
return *m_vListData[i];
|
||||
}
|
||||
}
|
||||
|
||||
return *m_vListData[0];
|
||||
}
|
||||
|
||||
CXuiCtrl4JList::LIST_ITEM_INFO& CXuiCtrl4JList::GetData(FILETIME *pFileTime)
|
||||
{
|
||||
LIST_ITEM_INFO info;
|
||||
|
||||
for(unsigned int i=0;i<m_vListData.size();i++)
|
||||
{
|
||||
info=*m_vListData[i];
|
||||
if((info.fTime.dwHighDateTime==pFileTime->dwHighDateTime)&&(info.fTime.dwLowDateTime==pFileTime->dwLowDateTime))
|
||||
{
|
||||
return *m_vListData[i];
|
||||
}
|
||||
}
|
||||
|
||||
return *m_vListData[0];
|
||||
}
|
||||
|
||||
bool CXuiCtrl4JList::TimeSortFn(const void *a, const void *b)
|
||||
{
|
||||
CXuiCtrl4JList::LIST_ITEM_INFO *SaveDetailsA=(CXuiCtrl4JList::LIST_ITEM_INFO *)a;
|
||||
CXuiCtrl4JList::LIST_ITEM_INFO *SaveDetailsB=(CXuiCtrl4JList::LIST_ITEM_INFO *)b;
|
||||
|
||||
if(SaveDetailsA->fTime.dwHighDateTime > SaveDetailsB->fTime.dwHighDateTime)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if(SaveDetailsA->fTime.dwHighDateTime == SaveDetailsB->fTime.dwHighDateTime)
|
||||
{
|
||||
if(SaveDetailsA->fTime.dwLowDateTime > SaveDetailsB->fTime.dwLowDateTime)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
bool CXuiCtrl4JList::AlphabeticSortFn(const void *a, const void *b)
|
||||
{
|
||||
CXuiCtrl4JList::LIST_ITEM_INFO *SaveDetailsA=(CXuiCtrl4JList::LIST_ITEM_INFO *)a;
|
||||
CXuiCtrl4JList::LIST_ITEM_INFO *SaveDetailsB=(CXuiCtrl4JList::LIST_ITEM_INFO *)b;
|
||||
|
||||
wstring wstr1=SaveDetailsA->pwszText;
|
||||
wstring wstr2=SaveDetailsB->pwszText;
|
||||
if(wstr1.compare(wstr2)<0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CXuiCtrl4JList::IndexSortFn(const void *a, const void *b)
|
||||
{
|
||||
CXuiCtrl4JList::LIST_ITEM_INFO *SaveDetailsA=(CXuiCtrl4JList::LIST_ITEM_INFO *)a;
|
||||
CXuiCtrl4JList::LIST_ITEM_INFO *SaveDetailsB=(CXuiCtrl4JList::LIST_ITEM_INFO *)b;
|
||||
|
||||
int iA=SaveDetailsA->iSortIndex;
|
||||
int iB=SaveDetailsB->iSortIndex;
|
||||
if(iA>iB)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void CXuiCtrl4JList::UpdateGraphic(int iItem,HXUIBRUSH hXuiBrush )
|
||||
{
|
||||
// need to update the one with the matching filetime
|
||||
EnterCriticalSection(&m_AccessListData);
|
||||
if( GetData(iItem).hXuiBrush )
|
||||
{
|
||||
XuiDestroyBrush( GetData(iItem).hXuiBrush );
|
||||
}
|
||||
GetData(iItem).hXuiBrush=hXuiBrush;
|
||||
LeaveCriticalSection(&m_AccessListData);
|
||||
}
|
||||
|
||||
void CXuiCtrl4JList::UpdateText(int iItem,LPCWSTR pwszText )
|
||||
{
|
||||
// need to update the one with the matching filetime
|
||||
EnterCriticalSection(&m_AccessListData);
|
||||
GetData(iItem).pwszText=pwszText;
|
||||
LeaveCriticalSection(&m_AccessListData);
|
||||
}
|
||||
|
||||
void CXuiCtrl4JList::UpdateGraphicFromiData(int iData,HXUIBRUSH hXuiBrush )
|
||||
{
|
||||
// need to update the one with the matching iData
|
||||
EnterCriticalSection(&m_AccessListData);
|
||||
if( GetDataiData(iData).hXuiBrush )
|
||||
{
|
||||
XuiDestroyBrush( GetDataiData(iData).hXuiBrush );
|
||||
}
|
||||
GetDataiData(iData).hXuiBrush=hXuiBrush;
|
||||
LeaveCriticalSection(&m_AccessListData);
|
||||
}
|
||||
|
||||
void CXuiCtrl4JList::UpdateGraphic(FILETIME *pfTime,HXUIBRUSH hXuiBrush )
|
||||
{
|
||||
// need to update the one with the matching filetime
|
||||
EnterCriticalSection(&m_AccessListData);
|
||||
if( GetData(pfTime).hXuiBrush )
|
||||
{
|
||||
XuiDestroyBrush( GetData(pfTime).hXuiBrush );
|
||||
}
|
||||
GetData(pfTime).hXuiBrush=hXuiBrush;
|
||||
LeaveCriticalSection(&m_AccessListData);
|
||||
}
|
||||
|
||||
// Gets called every frame
|
||||
HRESULT CXuiCtrl4JList::OnGetSourceDataText(XUIMessageGetSourceText *pGetSourceTextData,BOOL& bHandled)
|
||||
{
|
||||
if( ( 0 == pGetSourceTextData->iData ) && ( ( pGetSourceTextData->bItemData ) ) )
|
||||
{
|
||||
EnterCriticalSection(&m_AccessListData);
|
||||
pGetSourceTextData->szText =
|
||||
GetData(pGetSourceTextData->iItem).pwszText;
|
||||
LeaveCriticalSection(&m_AccessListData);
|
||||
bHandled = TRUE;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CXuiCtrl4JList::OnGetItemCountAll(XUIMessageGetItemCount *pGetItemCountData,BOOL& bHandled)
|
||||
{
|
||||
pGetItemCountData->cItems = (int)m_vListData.size();
|
||||
bHandled = TRUE;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CXuiCtrl4JList::OnGetSourceDataImage(XUIMessageGetSourceImage *pGetSourceImageData,BOOL& bHandled)
|
||||
{
|
||||
if( ( 0 == pGetSourceImageData->iData ) && ( pGetSourceImageData->bItemData ) )
|
||||
{
|
||||
// Check for a brush
|
||||
EnterCriticalSection(&m_AccessListData);
|
||||
if(GetData(pGetSourceImageData->iItem).hXuiBrush!=NULL)
|
||||
{
|
||||
pGetSourceImageData->hBrush=GetData(pGetSourceImageData->iItem).hXuiBrush;
|
||||
}
|
||||
else
|
||||
{
|
||||
pGetSourceImageData->szPath =
|
||||
GetData(pGetSourceImageData->iItem).pwszImage;
|
||||
}
|
||||
LeaveCriticalSection(&m_AccessListData);
|
||||
bHandled = TRUE;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CXuiCtrl4JList::OnGetItemEnable(XUIMessageGetItemEnable *pGetItemEnableData,BOOL& bHandled)
|
||||
{
|
||||
if(m_vListData.size()!=0)
|
||||
{
|
||||
EnterCriticalSection(&m_AccessListData);
|
||||
pGetItemEnableData->bEnabled =
|
||||
GetData(pGetItemEnableData->iItem).fEnabled;
|
||||
LeaveCriticalSection(&m_AccessListData);
|
||||
}
|
||||
bHandled = TRUE;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
HRESULT CXuiCtrl4JList::SetBorder(DWORD dw,BOOL bShow)
|
||||
{
|
||||
CXuiControl Control;
|
||||
HXUIOBJ hVisual,hBorder;
|
||||
GetItemControl(dw,&Control);
|
||||
Control.GetVisual(&hVisual);
|
||||
XuiElementGetChildById(hVisual,L"Border",&hBorder);
|
||||
return XuiElementSetShow(hBorder,bShow);
|
||||
}
|
||||
|
||||
void CXuiCtrl4JList::SetSelectionChangedHandle(HXUIOBJ hObj)
|
||||
{
|
||||
m_hSelectionChangedHandlerObj = hObj;
|
||||
}
|
||||
|
||||
HRESULT CXuiCtrl4JList::OnDestroy()
|
||||
{
|
||||
DeleteCriticalSection(&m_AccessListData);
|
||||
|
||||
if(m_vListData.size()!=0)
|
||||
{
|
||||
for (unsigned i = 0; i < m_vListData.size(); ++i)
|
||||
{
|
||||
if( m_vListData[i]->hXuiBrush )
|
||||
{
|
||||
XuiDestroyBrush( m_vListData[i]->hXuiBrush );
|
||||
}
|
||||
delete [] (BYTE *)m_vListData[i];
|
||||
}
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CXuiCtrl4JList::OnNotifySelChanged( HXUIOBJ hObjSource, XUINotifySelChanged* pNotifySelChangedData, BOOL& bHandled )
|
||||
{
|
||||
if(m_hSelectionChangedHandlerObj)
|
||||
{
|
||||
XUIMessage xuiMsg;
|
||||
XUINotify xuiNotify;
|
||||
XUINotifySelChanged xuiNotifySel;
|
||||
XuiNotifySelChanged( &xuiMsg, &xuiNotify, &xuiNotifySel, hObjSource, pNotifySelChangedData->iItem, pNotifySelChangedData->iOldItem );
|
||||
XuiSendMessage( m_hSelectionChangedHandlerObj, &xuiMsg );
|
||||
|
||||
bHandled = xuiMsg.bHandled;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
78
Minecraft.Client/Common/XUI/XUI_Ctrl_4JList.h
Normal file
78
Minecraft.Client/Common/XUI/XUI_Ctrl_4JList.h
Normal file
@@ -0,0 +1,78 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
class CXuiCtrl4JList : public CXuiListImpl
|
||||
{
|
||||
public:
|
||||
enum
|
||||
{
|
||||
eSortList_Date = 0,
|
||||
eSortList_Alphabetical,
|
||||
eSortList_Index,
|
||||
};
|
||||
|
||||
// Information for one list item.
|
||||
typedef struct _LIST_ITEM_INFO
|
||||
{
|
||||
LPCWSTR pwszText;
|
||||
LPCWSTR pwszImage;
|
||||
HXUIBRUSH hXuiBrush;
|
||||
BOOL fChecked;
|
||||
BOOL fEnabled;
|
||||
bool bIsDamaged; // damaged save
|
||||
FILETIME fTime;
|
||||
int iData; // user data
|
||||
int iIndex; // used for internal list sorting
|
||||
int iSortIndex; // used to force an order for DLC
|
||||
}
|
||||
LIST_ITEM_INFO,*PLIST_ITEM_INFO;
|
||||
|
||||
typedef std::vector <PLIST_ITEM_INFO> LISTITEMINFOARRAY;
|
||||
|
||||
XUI_IMPLEMENT_CLASS(CXuiCtrl4JList, L"CXuiCtrl4JList", XUI_CLASS_LIST);
|
||||
|
||||
void AddData( const LIST_ITEM_INFO& ItemInfo , int iSortListFromIndex=-1, int iSortFunction=CXuiCtrl4JList::eSortList_Date);
|
||||
void RemoveAllData( );
|
||||
void UpdateText(int iItem,LPCWSTR pwszText );
|
||||
void SelectByUserData(int iData);
|
||||
int GetIndexByUserData(int iData);
|
||||
|
||||
void UpdateGraphic(int iItem,HXUIBRUSH hXuiBrush );
|
||||
void UpdateGraphic(FILETIME *pfTime,HXUIBRUSH hXuiBrush );
|
||||
void UpdateGraphicFromiData(int iData,HXUIBRUSH hXuiBrush );
|
||||
LIST_ITEM_INFO& GetData(DWORD dw);
|
||||
LIST_ITEM_INFO& GetData(FILETIME *pFileTime);
|
||||
LIST_ITEM_INFO& GetDataiData(int iData);
|
||||
HRESULT SetBorder(DWORD dw,BOOL bShow); // for a highlight around the current selected item in the controls layout
|
||||
void SetSelectionChangedHandle(HXUIOBJ hObj);
|
||||
protected:
|
||||
|
||||
XUI_BEGIN_MSG_MAP()
|
||||
XUI_ON_XM_INIT(OnInit)
|
||||
XUI_ON_XM_GET_SOURCE_TEXT(OnGetSourceDataText)
|
||||
XUI_ON_XM_GET_ITEMCOUNT_ALL(OnGetItemCountAll)
|
||||
XUI_ON_XM_GET_SOURCE_IMAGE(OnGetSourceDataImage)
|
||||
XUI_ON_XM_GET_ITEMENABLE(OnGetItemEnable)
|
||||
XUI_ON_XM_DESTROY( OnDestroy )
|
||||
XUI_ON_XM_NOTIFY_SELCHANGED( OnNotifySelChanged )
|
||||
XUI_END_MSG_MAP()
|
||||
|
||||
|
||||
HRESULT OnInit( XUIMessageInit* pInitData, BOOL& bHandled );
|
||||
HRESULT OnGetSourceDataText(XUIMessageGetSourceText *pGetSourceTextData, BOOL& bHandled);
|
||||
HRESULT OnGetItemCountAll(XUIMessageGetItemCount *pGetItemCountData, BOOL& bHandled);
|
||||
HRESULT OnGetSourceDataImage(XUIMessageGetSourceImage *pGetSourceImageData,BOOL& bHandled);
|
||||
HRESULT OnGetItemEnable(XUIMessageGetItemEnable *pGetItemEnableData,BOOL& bHandled);
|
||||
HRESULT OnDestroy();
|
||||
HRESULT OnNotifySelChanged( HXUIOBJ hObjSource, XUINotifySelChanged* pNotifySelChangedData, BOOL& bHandled );
|
||||
|
||||
LISTITEMINFOARRAY m_vListData;
|
||||
CRITICAL_SECTION m_AccessListData;
|
||||
|
||||
private:
|
||||
static bool AlphabeticSortFn(const void *a, const void *b);
|
||||
static bool TimeSortFn(const void *a, const void *b);
|
||||
static bool IndexSortFn(const void *a, const void *b);
|
||||
|
||||
HXUIOBJ m_hSelectionChangedHandlerObj;
|
||||
};
|
||||
27
Minecraft.Client/Common/XUI/XUI_Ctrl_BrewProgress.cpp
Normal file
27
Minecraft.Client/Common/XUI/XUI_Ctrl_BrewProgress.cpp
Normal file
@@ -0,0 +1,27 @@
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "..\..\..\Minecraft.World\net.minecraft.world.level.tile.entity.h"
|
||||
#include "..\..\..\Minecraft.World\SharedConstants.h"
|
||||
#include "..\..\..\Minecraft.World\net.minecraft.world.item.alchemy.h"
|
||||
#include "XUI_Ctrl_BrewProgress.h"
|
||||
|
||||
int CXuiCtrlBrewProgress::GetValue()
|
||||
{
|
||||
void* pvUserData;
|
||||
this->GetUserData( &pvUserData );
|
||||
|
||||
if( pvUserData != NULL )
|
||||
{
|
||||
BrewingStandTileEntity *pBrewingStandTileEntity = (BrewingStandTileEntity *)pvUserData;
|
||||
|
||||
return pBrewingStandTileEntity->getBrewTime();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void CXuiCtrlBrewProgress::GetRange(int *pnRangeMin, int *pnRangeMax)
|
||||
{
|
||||
*pnRangeMin = 0;
|
||||
*pnRangeMax = PotionBrewing::BREWING_TIME_SECONDS * SharedConstants::TICKS_PER_SECOND;
|
||||
}
|
||||
19
Minecraft.Client/Common/XUI/XUI_Ctrl_BrewProgress.h
Normal file
19
Minecraft.Client/Common/XUI/XUI_Ctrl_BrewProgress.h
Normal file
@@ -0,0 +1,19 @@
|
||||
#pragma once
|
||||
using namespace std;
|
||||
|
||||
#include "XUI_Ctrl_ProgressCtrlBase.h"
|
||||
|
||||
class CXuiCtrlBrewProgress : public CXuiCtrlProgressCtrlBase
|
||||
{
|
||||
public:
|
||||
// Define the class. The class name must match the ClassOverride property
|
||||
// set for the scene in the UI Authoring tool.
|
||||
XUI_IMPLEMENT_CLASS( CXuiCtrlBrewProgress, L"CXuiCtrlBrewProgress", XUI_CLASS_PROGRESSBAR )
|
||||
|
||||
XUI_BEGIN_MSG_MAP()
|
||||
XUI_ON_XM_GET_SOURCE_TEXT(OnGetSourceDataText)
|
||||
XUI_END_MSG_MAP()
|
||||
|
||||
virtual int GetValue();
|
||||
virtual void GetRange(int *pnRangeMin, int *pnRangeMax);
|
||||
};
|
||||
52
Minecraft.Client/Common/XUI/XUI_Ctrl_BubblesProgress.cpp
Normal file
52
Minecraft.Client/Common/XUI/XUI_Ctrl_BubblesProgress.cpp
Normal file
@@ -0,0 +1,52 @@
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "..\..\..\Minecraft.World\net.minecraft.world.level.tile.entity.h"
|
||||
#include "XUI_Ctrl_BubblesProgress.h"
|
||||
|
||||
int CXuiCtrlBubblesProgress::GetValue()
|
||||
{
|
||||
void* pvUserData;
|
||||
this->GetUserData( &pvUserData );
|
||||
|
||||
if( pvUserData != NULL )
|
||||
{
|
||||
BrewingStandTileEntity *pBrewingStandTileEntity = (BrewingStandTileEntity *)pvUserData;
|
||||
|
||||
int value = 0;
|
||||
int bubbleStep = (pBrewingStandTileEntity->getBrewTime() / 2) % 7;
|
||||
switch (bubbleStep)
|
||||
{
|
||||
case 0:
|
||||
value = 0;
|
||||
break;
|
||||
case 6:
|
||||
value = 5;
|
||||
break;
|
||||
case 5:
|
||||
value = 10;
|
||||
break;
|
||||
case 4:
|
||||
value = 15;
|
||||
break;
|
||||
case 3:
|
||||
value = 20;
|
||||
break;
|
||||
case 2:
|
||||
value = 25;
|
||||
break;
|
||||
case 1:
|
||||
value = 30;
|
||||
break;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void CXuiCtrlBubblesProgress::GetRange(int *pnRangeMin, int *pnRangeMax)
|
||||
{
|
||||
*pnRangeMin = 0;
|
||||
*pnRangeMax = 30;
|
||||
}
|
||||
19
Minecraft.Client/Common/XUI/XUI_Ctrl_BubblesProgress.h
Normal file
19
Minecraft.Client/Common/XUI/XUI_Ctrl_BubblesProgress.h
Normal file
@@ -0,0 +1,19 @@
|
||||
#pragma once
|
||||
using namespace std;
|
||||
|
||||
#include "XUI_Ctrl_ProgressCtrlBase.h"
|
||||
|
||||
class CXuiCtrlBubblesProgress : public CXuiCtrlProgressCtrlBase
|
||||
{
|
||||
public:
|
||||
// Define the class. The class name must match the ClassOverride property
|
||||
// set for the scene in the UI Authoring tool.
|
||||
XUI_IMPLEMENT_CLASS( CXuiCtrlBubblesProgress, L"CXuiCtrlBubblesProgress", XUI_CLASS_PROGRESSBAR )
|
||||
|
||||
XUI_BEGIN_MSG_MAP()
|
||||
XUI_ON_XM_GET_SOURCE_TEXT(OnGetSourceDataText)
|
||||
XUI_END_MSG_MAP()
|
||||
|
||||
virtual int GetValue();
|
||||
virtual void GetRange(int *pnRangeMin, int *pnRangeMax);
|
||||
};
|
||||
29
Minecraft.Client/Common/XUI/XUI_Ctrl_BurnProgress.cpp
Normal file
29
Minecraft.Client/Common/XUI/XUI_Ctrl_BurnProgress.cpp
Normal file
@@ -0,0 +1,29 @@
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "..\..\..\Minecraft.World\FurnaceMenu.h"
|
||||
#include "..\..\..\Minecraft.World\FurnaceTileEntity.h"
|
||||
#include "XUI_Scene_Furnace.h"
|
||||
#include "XUI_Ctrl_BurnProgress.h"
|
||||
|
||||
int CXuiCtrlBurnProgress::GetValue()
|
||||
{
|
||||
void* pvUserData;
|
||||
this->GetUserData( &pvUserData );
|
||||
|
||||
if( pvUserData != NULL )
|
||||
{
|
||||
FurnaceTileEntity *pFurnaceTileEntity = (FurnaceTileEntity *)pvUserData;
|
||||
|
||||
// TODO This param is a magic number in Java but we should really define it somewhere with a name
|
||||
// I think it is the number of states of the progress display (ie the max value)
|
||||
return pFurnaceTileEntity->getBurnProgress( 24 );
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void CXuiCtrlBurnProgress::GetRange(int *pnRangeMin, int *pnRangeMax)
|
||||
{
|
||||
*pnRangeMin = 0;
|
||||
*pnRangeMax = 24;
|
||||
}
|
||||
19
Minecraft.Client/Common/XUI/XUI_Ctrl_BurnProgress.h
Normal file
19
Minecraft.Client/Common/XUI/XUI_Ctrl_BurnProgress.h
Normal file
@@ -0,0 +1,19 @@
|
||||
#pragma once
|
||||
using namespace std;
|
||||
|
||||
#include "XUI_Ctrl_ProgressCtrlBase.h"
|
||||
|
||||
class CXuiCtrlBurnProgress : public CXuiCtrlProgressCtrlBase
|
||||
{
|
||||
public:
|
||||
// Define the class. The class name must match the ClassOverride property
|
||||
// set for the scene in the UI Authoring tool.
|
||||
XUI_IMPLEMENT_CLASS( CXuiCtrlBurnProgress, L"CXuiCtrlBurnProgress", XUI_CLASS_PROGRESSBAR )
|
||||
|
||||
XUI_BEGIN_MSG_MAP()
|
||||
XUI_ON_XM_GET_SOURCE_TEXT(OnGetSourceDataText)
|
||||
XUI_END_MSG_MAP()
|
||||
|
||||
virtual int GetValue();
|
||||
virtual void GetRange(int *pnRangeMin, int *pnRangeMax);
|
||||
};
|
||||
123
Minecraft.Client/Common/XUI/XUI_Ctrl_CraftIngredientSlot.cpp
Normal file
123
Minecraft.Client/Common/XUI/XUI_Ctrl_CraftIngredientSlot.cpp
Normal file
@@ -0,0 +1,123 @@
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "XUI_Ctrl_CraftIngredientSlot.h"
|
||||
#include "..\..\..\Minecraft.World\net.minecraft.world.item.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// CXuiCtrlMinecraftSlot class
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
CXuiCtrlCraftIngredientSlot::CXuiCtrlCraftIngredientSlot()
|
||||
{
|
||||
m_iID=0;
|
||||
m_Desc=NULL;
|
||||
m_isFoil = false;
|
||||
m_isDirty = false;
|
||||
m_item = nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
HRESULT CXuiCtrlCraftIngredientSlot::OnInit(XUIMessageInit* pInitData, BOOL& rfHandled)
|
||||
{
|
||||
HRESULT hr=S_OK;
|
||||
|
||||
return hr;
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
HRESULT CXuiCtrlCraftIngredientSlot::OnCustomMessage_GetSlotItem(CustomMessage_GetSlotItem_Struct *pData, BOOL& bHandled)
|
||||
{
|
||||
if( m_iID != 0 || m_item != NULL )
|
||||
{
|
||||
pData->item = m_item;
|
||||
pData->iItemBitField = MAKE_SLOTDISPLAY_ITEM_BITMASK(m_iID,m_iAuxVal,m_isFoil);
|
||||
pData->iDataBitField = MAKE_SLOTDISPLAY_DATA_BITMASK(m_iPad, m_uiAlpha,m_bDecorations,m_iCount,m_iScale,0);
|
||||
}
|
||||
else
|
||||
{
|
||||
pData->iDataBitField = 0;
|
||||
pData->szPath = L"";
|
||||
}
|
||||
pData->bDirty = m_isDirty ? TRUE : FALSE;
|
||||
m_isDirty = false;
|
||||
|
||||
bHandled = TRUE;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CXuiCtrlCraftIngredientSlot::OnGetSourceText(XUIMessageGetSourceText *pGetSourceTextData,BOOL& bHandled)
|
||||
{
|
||||
pGetSourceTextData->szText=m_Desc;
|
||||
bHandled = TRUE;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void CXuiCtrlCraftIngredientSlot::SetRedBox(BOOL bVal)
|
||||
{
|
||||
HRESULT hr=S_OK;
|
||||
|
||||
HXUIOBJ hObj,hObjChild;
|
||||
hr=GetVisual(&hObj);
|
||||
XuiElementGetChildById(hObj,L"BoxRed",&hObjChild);
|
||||
XuiElementSetShow(hObjChild,bVal);
|
||||
XuiElementGetChildById(hObj,L"Exclaim",&hObjChild);
|
||||
XuiElementSetShow(hObjChild,bVal);
|
||||
}
|
||||
|
||||
void CXuiCtrlCraftIngredientSlot::SetIcon(int iPad, int iId,int iAuxVal, int iCount, int iScale, unsigned int uiAlpha,bool bDecorations,bool isFoil, BOOL bShow)
|
||||
{
|
||||
m_item = nullptr;
|
||||
m_iID=iId;
|
||||
m_iAuxVal=iAuxVal;
|
||||
|
||||
// 4J Stu - For clocks and compasses we set the aux value to a special one that signals we should use a default texture
|
||||
// rather than the dynamic one for the player
|
||||
// not right... auxvals for diggables are damage values, can be a lot higher
|
||||
if( (m_iAuxVal & 0xFF) == 0xFF && !( iId == Item::clock_Id || iId == Item::compass_Id ) ) // 4J Stu - If the aux value is set to match any
|
||||
m_iAuxVal = 0;
|
||||
|
||||
// if the count comes in as 0, make it 1
|
||||
m_iCount=iCount==0?1:iCount;
|
||||
m_iScale=iScale;
|
||||
m_uiAlpha=uiAlpha;
|
||||
m_bDecorations=bDecorations;
|
||||
m_isFoil = isFoil;
|
||||
|
||||
m_iPad = iPad;
|
||||
m_isDirty = true;
|
||||
|
||||
XuiElementSetShow(m_hObj,bShow);
|
||||
}
|
||||
|
||||
void CXuiCtrlCraftIngredientSlot::SetIcon(int iPad, shared_ptr<ItemInstance> item, int iScale, unsigned int uiAlpha,bool bDecorations, BOOL bShow)
|
||||
{
|
||||
if(item == NULL) SetIcon(iPad, 0,0,0,0,0,false,false,bShow);
|
||||
else
|
||||
{
|
||||
m_item = item;
|
||||
m_iID = item->id;
|
||||
m_iScale = iScale;
|
||||
m_uiAlpha = uiAlpha;
|
||||
m_bDecorations = bDecorations;
|
||||
|
||||
m_iPad = iPad;
|
||||
m_isDirty = true;
|
||||
|
||||
XuiElementSetShow(m_hObj,bShow);
|
||||
}
|
||||
}
|
||||
|
||||
void CXuiCtrlCraftIngredientSlot::SetDescription(LPCWSTR Desc)
|
||||
{
|
||||
HRESULT hr=S_OK;
|
||||
|
||||
HXUIOBJ hObj,hObjChild;
|
||||
hr=GetVisual(&hObj);
|
||||
XuiElementGetChildById(hObj,L"text_name",&hObjChild);
|
||||
XuiControlSetText(hObjChild,Desc);
|
||||
XuiElementSetShow(hObjChild,Desc==NULL?FALSE:TRUE);
|
||||
m_Desc=Desc;
|
||||
}
|
||||
45
Minecraft.Client/Common/XUI/XUI_Ctrl_CraftIngredientSlot.h
Normal file
45
Minecraft.Client/Common/XUI/XUI_Ctrl_CraftIngredientSlot.h
Normal file
@@ -0,0 +1,45 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <XuiApp.h>
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// CXuiCtrlMinecraftSlot class
|
||||
//-----------------------------------------------------------------------------
|
||||
class CXuiCtrlCraftIngredientSlot : public CXuiControlImpl
|
||||
{
|
||||
public:
|
||||
XUI_IMPLEMENT_CLASS(CXuiCtrlCraftIngredientSlot, L"CXuiCtrlCraftIngredientSlot", XUI_CLASS_LABEL)
|
||||
|
||||
CXuiCtrlCraftIngredientSlot();
|
||||
virtual ~CXuiCtrlCraftIngredientSlot() { };
|
||||
void SetRedBox(BOOL bVal);
|
||||
void SetIcon(int iPad, int iId,int iAuxVal, int iCount, int iScale, unsigned int uiAlpha, bool bDecorations, bool isFoil = false, BOOL bShow=TRUE);
|
||||
void SetIcon(int iPad, shared_ptr<ItemInstance> item, int iScale, unsigned int uiAlpha,bool bDecorations, BOOL bShow=TRUE);
|
||||
void SetDescription(LPCWSTR Desc);
|
||||
protected:
|
||||
|
||||
XUI_BEGIN_MSG_MAP()
|
||||
XUI_ON_XM_INIT(OnInit)
|
||||
XUI_ON_XM_GETSLOTITEM_MESSAGE(OnCustomMessage_GetSlotItem)
|
||||
XUI_ON_XM_GET_SOURCE_TEXT(OnGetSourceText)
|
||||
XUI_END_MSG_MAP()
|
||||
|
||||
HRESULT OnCustomMessage_GetSlotItem(CustomMessage_GetSlotItem_Struct *pData, BOOL& bHandled);
|
||||
HRESULT OnGetSourceText(XUIMessageGetSourceText *pGetSourceTextData, BOOL& bHandled);
|
||||
HRESULT OnInit(XUIMessageInit* pInitData, BOOL& rfHandled);
|
||||
|
||||
private:
|
||||
shared_ptr<ItemInstance> m_item;
|
||||
int m_iID;
|
||||
int m_iAuxVal;
|
||||
int m_iCount;
|
||||
int m_iScale;
|
||||
unsigned int m_uiAlpha;
|
||||
int m_iPad;
|
||||
bool m_bDecorations;
|
||||
bool m_isFoil;
|
||||
LPCWSTR m_Desc;
|
||||
bool m_isDirty;
|
||||
};
|
||||
90
Minecraft.Client/Common/XUI/XUI_Ctrl_EnchantButton.cpp
Normal file
90
Minecraft.Client/Common/XUI/XUI_Ctrl_EnchantButton.cpp
Normal file
@@ -0,0 +1,90 @@
|
||||
#include "stdafx.h"
|
||||
#include "..\..\..\Minecraft.World\net.minecraft.world.inventory.h"
|
||||
#include "..\..\..\Minecraft.World\StringHelpers.h"
|
||||
#include "..\..\Font.h"
|
||||
#include "..\..\Lighting.h"
|
||||
#include "..\..\MultiPlayerLocalPlayer.h"
|
||||
#include "XUI_Scene_Enchant.h"
|
||||
#include "XUI_Ctrl_EnchantButton.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
HRESULT CXuiCtrlEnchantmentButton::OnInit(XUIMessageInit* pInitData, BOOL& rfHandled)
|
||||
{
|
||||
HRESULT hr=S_OK;
|
||||
|
||||
Minecraft *pMinecraft=Minecraft::GetInstance();
|
||||
|
||||
ScreenSizeCalculator ssc(pMinecraft->options, pMinecraft->width_phys, pMinecraft->height_phys);
|
||||
m_fScreenWidth=(float)pMinecraft->width_phys;
|
||||
m_fRawWidth=(float)ssc.rawWidth;
|
||||
m_fScreenHeight=(float)pMinecraft->height_phys;
|
||||
m_fRawHeight=(float)ssc.rawHeight;
|
||||
|
||||
HXUIOBJ parent = m_hObj;
|
||||
HXUICLASS hcInventoryClass = XuiFindClass( L"CXuiSceneEnchant" );
|
||||
HXUICLASS currentClass;
|
||||
|
||||
do
|
||||
{
|
||||
XuiElementGetParent(parent,&parent);
|
||||
currentClass = XuiGetObjectClass( parent );
|
||||
} while (parent != NULL && !XuiClassDerivesFrom( currentClass, hcInventoryClass ) );
|
||||
|
||||
assert( parent != NULL );
|
||||
|
||||
VOID *pObj;
|
||||
XuiObjectFromHandle( parent, &pObj );
|
||||
m_containerScene = (CXuiSceneEnchant *)pObj;
|
||||
|
||||
m_index = 0;
|
||||
m_lastCost = 0;
|
||||
m_iPad = 0;
|
||||
m_costString = L"";
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
void CXuiCtrlEnchantmentButton::SetData(int iPad, int index)
|
||||
{
|
||||
m_iPad = iPad;
|
||||
m_index = index;
|
||||
}
|
||||
|
||||
HRESULT CXuiCtrlEnchantmentButton::OnGetSourceDataText(XUIMessageGetSourceText *pGetSourceTextData, BOOL& bHandled)
|
||||
{
|
||||
EnchantmentMenu *menu = m_containerScene->getMenu();
|
||||
|
||||
int cost = menu->costs[m_index];
|
||||
|
||||
if(cost != m_lastCost)
|
||||
{
|
||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||
if(cost > pMinecraft->localplayers[m_iPad]->experienceLevel && !pMinecraft->localplayers[m_iPad]->abilities.instabuild)
|
||||
{
|
||||
// Dark background
|
||||
SetEnable(FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Light background and focus background
|
||||
SetEnable(TRUE);
|
||||
}
|
||||
m_costString = _toString<int>(cost);
|
||||
m_lastCost = cost;
|
||||
}
|
||||
if(cost == 0)
|
||||
{
|
||||
// Dark background
|
||||
SetEnable(FALSE);
|
||||
pGetSourceTextData->bDisplay = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
pGetSourceTextData->szText = m_costString.c_str();
|
||||
pGetSourceTextData->bDisplay = TRUE;
|
||||
}
|
||||
|
||||
bHandled = TRUE;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
33
Minecraft.Client/Common/XUI/XUI_Ctrl_EnchantButton.h
Normal file
33
Minecraft.Client/Common/XUI/XUI_Ctrl_EnchantButton.h
Normal file
@@ -0,0 +1,33 @@
|
||||
#pragma once
|
||||
|
||||
class CXuiSceneEnchant;
|
||||
|
||||
class CXuiCtrlEnchantmentButton : public CXuiControlImpl
|
||||
{
|
||||
friend class CXuiCtrlEnchantmentButtonText;
|
||||
public:
|
||||
XUI_IMPLEMENT_CLASS(CXuiCtrlEnchantmentButton, L"CXuiCtrlEnchantmentButton", XUI_CLASS_CONTROL)
|
||||
|
||||
protected:
|
||||
|
||||
XUI_BEGIN_MSG_MAP()
|
||||
XUI_ON_XM_INIT(OnInit)
|
||||
XUI_ON_XM_GET_SOURCE_TEXT(OnGetSourceDataText)
|
||||
XUI_END_MSG_MAP()
|
||||
|
||||
HRESULT OnInit(XUIMessageInit* pInitData, BOOL& rfHandled);
|
||||
HRESULT OnGetSourceDataText(XUIMessageGetSourceText *pGetSourceTextData, BOOL& bHandled);
|
||||
|
||||
public:
|
||||
void SetData(int iPad, int index);
|
||||
|
||||
private:
|
||||
int m_iPad;
|
||||
int m_index;
|
||||
int m_lastCost;
|
||||
wstring m_costString;
|
||||
CXuiSceneEnchant *m_containerScene;
|
||||
|
||||
float m_fScreenWidth,m_fScreenHeight;
|
||||
float m_fRawWidth,m_fRawHeight;
|
||||
};
|
||||
346
Minecraft.Client/Common/XUI/XUI_Ctrl_EnchantmentBook.cpp
Normal file
346
Minecraft.Client/Common/XUI/XUI_Ctrl_EnchantmentBook.cpp
Normal file
@@ -0,0 +1,346 @@
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "..\..\..\Minecraft.World\net.minecraft.world.item.h"
|
||||
#include "..\..\..\Minecraft.World\net.minecraft.world.level.tile.entity.h"
|
||||
#include "..\..\..\Minecraft.World\net.minecraft.world.inventory.h"
|
||||
|
||||
#include "..\..\Minecraft.h"
|
||||
#include "..\..\ScreenSizeCalculator.h"
|
||||
#include "..\..\TileEntityRenderDispatcher.h"
|
||||
#include "..\..\EnchantTableRenderer.h"
|
||||
#include "..\..\Lighting.h"
|
||||
#include "..\..\LocalPlayer.h"
|
||||
|
||||
#include "XUI_Scene_Enchant.h"
|
||||
|
||||
#include "XUI_Ctrl_EnchantmentBook.h"
|
||||
#include "..\..\BookModel.h"
|
||||
#include "..\..\Options.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// CXuiCtrlEnchantmentBook class
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
CXuiCtrlEnchantmentBook::CXuiCtrlEnchantmentBook() :
|
||||
m_bDirty(FALSE),
|
||||
m_fScale(1.0f),
|
||||
m_fAlpha(1.0f)
|
||||
{
|
||||
Minecraft *pMinecraft=Minecraft::GetInstance();
|
||||
|
||||
ScreenSizeCalculator ssc(pMinecraft->options, pMinecraft->width_phys, pMinecraft->height_phys);
|
||||
m_fScreenWidth=(float)pMinecraft->width_phys;
|
||||
m_fRawWidth=(float)ssc.rawWidth;
|
||||
m_fScreenHeight=(float)pMinecraft->height_phys;
|
||||
m_fRawHeight=(float)ssc.rawHeight;
|
||||
|
||||
model = NULL;
|
||||
|
||||
time = 0;
|
||||
flip = oFlip = flipT = flipA = 0.0f;
|
||||
open = oOpen = 0.0f;
|
||||
}
|
||||
|
||||
CXuiCtrlEnchantmentBook::~CXuiCtrlEnchantmentBook()
|
||||
{
|
||||
//if(model != NULL) delete model;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
HRESULT CXuiCtrlEnchantmentBook::OnInit(XUIMessageInit* pInitData, BOOL& rfHandled)
|
||||
{
|
||||
HRESULT hr=S_OK;
|
||||
|
||||
HXUIOBJ parent = m_hObj;
|
||||
HXUICLASS hcInventoryClass = XuiFindClass( L"CXuiSceneEnchant" );
|
||||
HXUICLASS currentClass;
|
||||
|
||||
do
|
||||
{
|
||||
XuiElementGetParent(parent,&parent);
|
||||
currentClass = XuiGetObjectClass( parent );
|
||||
} while (parent != NULL && !XuiClassDerivesFrom( currentClass, hcInventoryClass ) );
|
||||
|
||||
assert( parent != NULL );
|
||||
|
||||
VOID *pObj;
|
||||
XuiObjectFromHandle( parent, &pObj );
|
||||
m_containerScene = (CXuiSceneEnchant *)pObj;
|
||||
|
||||
last = nullptr;
|
||||
|
||||
m_iPad = m_containerScene->getPad();
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT CXuiCtrlEnchantmentBook::OnRender(XUIMessageRender *pRenderData, BOOL &bHandled )
|
||||
{
|
||||
#ifdef _XBOX
|
||||
HXUIDC hDC = pRenderData->hDC;
|
||||
|
||||
// build and render with the game call
|
||||
|
||||
RenderManager.Set_matrixDirty();
|
||||
|
||||
Minecraft *pMinecraft=Minecraft::GetInstance();
|
||||
|
||||
float alpha = 1.0f;
|
||||
//GetOpacity( &alpha );
|
||||
|
||||
|
||||
D3DXMATRIX matrix;
|
||||
GetFullXForm(&matrix);
|
||||
|
||||
float bwidth,bheight;
|
||||
GetBounds(&bwidth,&bheight);
|
||||
|
||||
glColor4f(1, 1, 1, alpha);
|
||||
|
||||
// Annoyingly, XUI renders everything to a z of 0 so if we want to render anything that needs the z-buffer on top of it, then we need to clear it.
|
||||
// Clear just the region required for this control.
|
||||
D3DRECT clearRect;
|
||||
clearRect.x1 = (int)(matrix._41) - 2;
|
||||
clearRect.y1 = (int)(matrix._42) - 2;
|
||||
clearRect.x2 = (int)(matrix._41 + ( bwidth * matrix._11 )) + 2;
|
||||
clearRect.y2 = (int)(matrix._42 + ( bheight * matrix._22 )) + 2;
|
||||
|
||||
RenderManager.Clear(GL_DEPTH_BUFFER_BIT, &clearRect);
|
||||
|
||||
glClear(GL_DEPTH_BUFFER_BIT);
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glOrtho(0, m_fRawWidth, m_fRawHeight, 0, 1000, 3000);
|
||||
//gluPerspective(90, (float) (320 / 240.0f), 0.5f, 3000);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
glTranslatef(0, 0, -2000);
|
||||
|
||||
float xo = ( (matrix._41 + ( (bwidth*matrix._11)/2) ) / m_fScreenWidth ) * m_fRawWidth;
|
||||
float yo = ( (matrix._42 + ((bheight*matrix._22)/2) ) / m_fScreenHeight ) * m_fRawHeight;
|
||||
|
||||
glEnable(GL_RESCALE_NORMAL);
|
||||
glEnable(GL_COLOR_MATERIAL);
|
||||
|
||||
glPushMatrix();
|
||||
glTranslatef(xo, yo, 50.0f);
|
||||
float ss;
|
||||
|
||||
// Base scale on height of this control
|
||||
// Potentially we might want separate x & y scales here
|
||||
ss = ( ( (bheight*matrix._22) / m_fScreenHeight ) * m_fRawHeight ) * 1.5f;
|
||||
|
||||
glScalef(-ss, ss, ss);
|
||||
//glRotatef(180, 0, 0, 1);
|
||||
|
||||
glRotatef(45 + 90, 0, 1, 0);
|
||||
Lighting::turnOn();
|
||||
glRotatef(-45 - 90, 0, 1, 0);
|
||||
|
||||
//float sss = 4;
|
||||
|
||||
//glTranslatef(0, 3.3f, -16);
|
||||
//glScalef(sss, sss, sss);
|
||||
|
||||
int tex = pMinecraft->textures->loadTexture(TN_ITEM_BOOK); // 4J was L"/1_2_2/item/book.png"
|
||||
pMinecraft->textures->bind(tex);
|
||||
|
||||
glRotatef(20, 1, 0, 0);
|
||||
|
||||
float a = 1;
|
||||
float o = oOpen + (open - oOpen) * a;
|
||||
glTranslatef((1 - o) * 0.2f, (1 - o) * 0.1f, (1 - o) * 0.25f);
|
||||
glRotatef(-(1 - o) * 90 - 90, 0, 1, 0);
|
||||
glRotatef(180, 1, 0, 0);
|
||||
|
||||
float ff1 = oFlip + (flip - oFlip) * a + 0.25f;
|
||||
float ff2 = oFlip + (flip - oFlip) * a + 0.75f;
|
||||
ff1 = (ff1 - floor(ff1)) * 1.6f - 0.3f;
|
||||
ff2 = (ff2 - floor(ff2)) * 1.6f - 0.3f;
|
||||
|
||||
if (ff1 < 0) ff1 = 0;
|
||||
if (ff2 < 0) ff2 = 0;
|
||||
if (ff1 > 1) ff1 = 1;
|
||||
if (ff2 > 1) ff2 = 1;
|
||||
|
||||
glEnable(GL_CULL_FACE);
|
||||
|
||||
if(model == NULL)
|
||||
{
|
||||
// Share the model the the EnchantTableRenderer
|
||||
|
||||
EnchantTableRenderer *etr = (EnchantTableRenderer*)TileEntityRenderDispatcher::instance->getRenderer(eTYPE_ENCHANTMENTTABLEENTITY);
|
||||
if(etr != NULL)
|
||||
{
|
||||
model = etr->bookModel;
|
||||
}
|
||||
else
|
||||
{
|
||||
model = new BookModel();
|
||||
}
|
||||
}
|
||||
|
||||
model->render(NULL, 0, ff1, ff2, o, 0, 1 / 16.0f,true);
|
||||
glDisable(GL_CULL_FACE);
|
||||
|
||||
glPopMatrix();
|
||||
Lighting::turnOff();
|
||||
glDisable(GL_RESCALE_NORMAL);
|
||||
|
||||
XuiRenderRestoreState(hDC);
|
||||
|
||||
tickBook();
|
||||
|
||||
bHandled = TRUE;
|
||||
|
||||
#endif
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
//HRESULT CXuiCtrlEnchantmentBook::OnRender(XUIMessageRender *pRenderData, BOOL &bHandled )
|
||||
//{
|
||||
// HXUIDC hDC = pRenderData->hDC;
|
||||
//
|
||||
// RenderManager.Set_matrixDirty();
|
||||
//
|
||||
// Minecraft *minecraft = Minecraft::GetInstance();
|
||||
//
|
||||
// // 4J JEV: Inputs in the java, dunno what they are.
|
||||
// float a = 1;
|
||||
//
|
||||
// D3DXMATRIX matrix;
|
||||
// CXuiControl xuiControl(m_hObj);
|
||||
// xuiControl.GetFullXForm(&matrix);
|
||||
// float bwidth,bheight;
|
||||
// xuiControl.GetBounds(&bwidth,&bheight);
|
||||
//
|
||||
// D3DXVECTOR3 vec, vecP, vecPP;
|
||||
// xuiControl.GetPosition(&vec);
|
||||
//
|
||||
// CXuiElement parent, scene;
|
||||
// xuiControl.GetParent(&parent);
|
||||
// parent.GetPosition(&vecP);
|
||||
// parent.GetParent(&scene);
|
||||
// scene.GetPosition(&vecPP);
|
||||
//
|
||||
// float xo = ( (matrix._41 + ( (bwidth*matrix._11)/2) ) / m_fScreenWidth ) * m_fRawWidth;
|
||||
// float yo = ( (matrix._42 + (bheight*matrix._22) ) / m_fScreenHeight ) * m_fRawHeight;
|
||||
//
|
||||
// glColor4f(1, 1, 1, 1);
|
||||
//
|
||||
// glPushMatrix();
|
||||
// glMatrixMode(GL_PROJECTION);
|
||||
// glPushMatrix();
|
||||
// glLoadIdentity();
|
||||
//
|
||||
// ScreenSizeCalculator ssc = ScreenSizeCalculator(minecraft->options, minecraft->width, minecraft->height);
|
||||
//
|
||||
// //glViewport((int) (ssc.getWidth() - 320) / 2 * ssc.scale, (int) (ssc.getHeight() - 240) / 2 * ssc.scale, (int) (320 * ssc.scale), (int) (240 * ssc.scale));
|
||||
//
|
||||
// // 4J JEV: Trying to position it within the XUI element
|
||||
// float xPos, yPos;
|
||||
// xPos = (vec.x + vecP.x + vecPP.x) / (minecraft->width/2); xPos = xPos - 1; xPos = 2*xPos/3;
|
||||
// yPos = (vec.y + vecP.y + vecPP.y) / (minecraft->height/2); yPos = 1 - yPos; yPos = 2*yPos/3;
|
||||
// glTranslatef(xPos, yPos, 0);
|
||||
//
|
||||
// gluPerspective(90, (float) (320 / 240.0f), 9, 80);
|
||||
//
|
||||
// float sss = 1;
|
||||
// glMatrixMode(GL_MODELVIEW);
|
||||
// glLoadIdentity();
|
||||
// Lighting::turnOn();
|
||||
//
|
||||
// glTranslatef(0, 3.3f, -16);
|
||||
// glScalef(sss, sss, sss);
|
||||
//
|
||||
// float ss = 5;
|
||||
//
|
||||
// glScalef(ss, ss, ss);
|
||||
// glRotatef(180, 0, 0, 1);
|
||||
//
|
||||
// int tex = minecraft->textures->loadTexture(TN_ITEM_BOOK); // 4J was L"/1_2_2/item/book.png"
|
||||
// minecraft->textures->bind(tex);
|
||||
//
|
||||
// glRotatef(20, 1, 0, 0);
|
||||
//
|
||||
// float o = oOpen + (open - oOpen) * a;
|
||||
// glTranslatef((1 - o) * 0.2f, (1 - o) * 0.1f, (1 - o) * 0.25f);
|
||||
// glRotatef(-(1 - o) * 90 - 90, 0, 1, 0);
|
||||
// glRotatef(180, 1, 0, 0);
|
||||
//
|
||||
// float ff1 = oFlip + (flip - oFlip) * a + 0.25f;
|
||||
// float ff2 = oFlip + (flip - oFlip) * a + 0.75f;
|
||||
// ff1 = (ff1 - floor(ff1)) * 1.6f - 0.3f;
|
||||
// ff2 = (ff2 - floor(ff2)) * 1.6f - 0.3f;
|
||||
//
|
||||
// if (ff1 < 0) ff1 = 0;
|
||||
// if (ff2 < 0) ff2 = 0;
|
||||
// if (ff1 > 1) ff1 = 1;
|
||||
// if (ff2 > 1) ff2 = 1;
|
||||
//
|
||||
// glEnable(GL_RESCALE_NORMAL);
|
||||
//
|
||||
// model.render(NULL, 0, ff1, ff2, o, 0, 1 / 16.0f,true);
|
||||
//
|
||||
// glDisable(GL_RESCALE_NORMAL);
|
||||
// Lighting::turnOff();
|
||||
// glMatrixMode(GL_PROJECTION);
|
||||
// //glViewport(0, 0, minecraft->width, minecraft->height);
|
||||
// glPopMatrix();
|
||||
// glMatrixMode(GL_MODELVIEW);
|
||||
// glPopMatrix();
|
||||
//
|
||||
// Lighting::turnOff();
|
||||
// glColor4f(1, 1, 1, 1);
|
||||
//
|
||||
// XuiRenderRestoreState(hDC);
|
||||
//
|
||||
// tickBook();
|
||||
//
|
||||
// bHandled = TRUE;
|
||||
//
|
||||
// return S_OK;
|
||||
//}
|
||||
|
||||
void CXuiCtrlEnchantmentBook::tickBook()
|
||||
{
|
||||
EnchantmentMenu *menu = m_containerScene->getMenu();
|
||||
shared_ptr<ItemInstance> current = menu->getSlot(0)->getItem();
|
||||
if (!ItemInstance::matches(current, last))
|
||||
{
|
||||
last = current;
|
||||
|
||||
do
|
||||
{
|
||||
flipT += random.nextInt(4) - random.nextInt(4);
|
||||
} while (flip <= flipT + 1 && flip >= flipT - 1);
|
||||
}
|
||||
|
||||
time++;
|
||||
oFlip = flip;
|
||||
oOpen = open;
|
||||
|
||||
bool shouldBeOpen = false;
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
if (menu->costs[i] != 0)
|
||||
{
|
||||
shouldBeOpen = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (shouldBeOpen) open += 0.2f;
|
||||
else open -= 0.2f;
|
||||
if (open < 0) open = 0;
|
||||
if (open > 1) open = 1;
|
||||
|
||||
|
||||
float diff = (flipT - flip) * 0.4f;
|
||||
float max = 0.2f;
|
||||
if (diff < -max) diff = -max;
|
||||
if (diff > +max) diff = +max;
|
||||
flipA += (diff - flipA) * 0.9f;
|
||||
|
||||
flip = flip + flipA;
|
||||
}
|
||||
51
Minecraft.Client/Common/XUI/XUI_Ctrl_EnchantmentBook.h
Normal file
51
Minecraft.Client/Common/XUI/XUI_Ctrl_EnchantmentBook.h
Normal file
@@ -0,0 +1,51 @@
|
||||
#pragma once
|
||||
#include "..\..\..\Minecraft.World\Random.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
class CXuiSceneEnchant;
|
||||
class BookModel;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// CXuiCtrlEnchantPanel class
|
||||
//-----------------------------------------------------------------------------
|
||||
class CXuiCtrlEnchantmentBook : public CXuiControlImpl
|
||||
{
|
||||
public:
|
||||
XUI_IMPLEMENT_CLASS(CXuiCtrlEnchantmentBook, L"CXuiCtrlEnchantmentBook", XUI_CLASS_LABEL)
|
||||
|
||||
CXuiCtrlEnchantmentBook();
|
||||
virtual ~CXuiCtrlEnchantmentBook();
|
||||
|
||||
void setChanged();
|
||||
void setOpen(bool);
|
||||
|
||||
protected:
|
||||
XUI_BEGIN_MSG_MAP()
|
||||
XUI_ON_XM_INIT(OnInit)
|
||||
XUI_ON_XM_RENDER(OnRender)
|
||||
XUI_END_MSG_MAP()
|
||||
|
||||
HRESULT OnInit(XUIMessageInit* pInitData, BOOL& rfHandled);
|
||||
HRESULT OnRender(XUIMessageRender *pRenderData, BOOL &rfHandled);
|
||||
|
||||
private:
|
||||
BookModel *model;
|
||||
Random random;
|
||||
|
||||
// 4J JEV: Book animation variables.
|
||||
int time;
|
||||
float flip, oFlip, flipT, flipA;
|
||||
float open, oOpen;
|
||||
|
||||
BOOL m_bDirty;
|
||||
float m_fScale,m_fAlpha;
|
||||
int m_iPad;
|
||||
CXuiSceneEnchant *m_containerScene;
|
||||
shared_ptr<ItemInstance> last;
|
||||
|
||||
float m_fScreenWidth,m_fScreenHeight;
|
||||
float m_fRawWidth,m_fRawHeight;
|
||||
|
||||
void tickBook();
|
||||
};
|
||||
185
Minecraft.Client/Common/XUI/XUI_Ctrl_EnchantmentButtonText.cpp
Normal file
185
Minecraft.Client/Common/XUI/XUI_Ctrl_EnchantmentButtonText.cpp
Normal file
@@ -0,0 +1,185 @@
|
||||
#include "stdafx.h"
|
||||
#include "..\..\..\Minecraft.World\net.minecraft.world.inventory.h"
|
||||
#include "..\..\..\Minecraft.World\StringHelpers.h"
|
||||
#include "..\..\Font.h"
|
||||
#include "..\..\Lighting.h"
|
||||
#include "..\..\MultiPlayerLocalPlayer.h"
|
||||
#include "XUI_Scene_Enchant.h"
|
||||
#include "XUI_Ctrl_EnchantButton.h"
|
||||
#include "XUI_Ctrl_EnchantmentButtonText.h"
|
||||
#include "..\..\Minecraft.h"
|
||||
#include "..\..\TexturePackRepository.h"
|
||||
#include "..\..\TexturePack.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
HRESULT CXuiCtrlEnchantmentButtonText::OnInit(XUIMessageInit* pInitData, BOOL& rfHandled)
|
||||
{
|
||||
HRESULT hr=S_OK;
|
||||
|
||||
Minecraft *pMinecraft=Minecraft::GetInstance();
|
||||
|
||||
ScreenSizeCalculator ssc(pMinecraft->options, pMinecraft->width_phys, pMinecraft->height_phys);
|
||||
m_fScreenWidth=(float)pMinecraft->width_phys;
|
||||
m_fRawWidth=(float)ssc.rawWidth;
|
||||
m_fScreenHeight=(float)pMinecraft->height_phys;
|
||||
m_fRawHeight=(float)ssc.rawHeight;
|
||||
|
||||
HXUIOBJ parent = m_hObj;
|
||||
HXUICLASS hcInventoryClass = XuiFindClass( L"CXuiCtrlEnchantmentButton" );
|
||||
HXUICLASS currentClass;
|
||||
|
||||
do
|
||||
{
|
||||
XuiElementGetParent(parent,&parent);
|
||||
currentClass = XuiGetObjectClass( parent );
|
||||
} while (parent != NULL && !XuiClassDerivesFrom( currentClass, hcInventoryClass ) );
|
||||
|
||||
assert( parent != NULL );
|
||||
|
||||
VOID *pObj;
|
||||
XuiObjectFromHandle( parent, &pObj );
|
||||
m_parentControl = (CXuiCtrlEnchantmentButton *)pObj;
|
||||
|
||||
m_lastCost = 0;
|
||||
m_enchantmentString = L"";
|
||||
|
||||
m_textColour = app.GetHTMLColour(eTextColor_Enchant);
|
||||
m_textFocusColour = app.GetHTMLColour(eTextColor_EnchantFocus);
|
||||
m_textDisabledColour = app.GetHTMLColour(eTextColor_EnchantDisabled);
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT CXuiCtrlEnchantmentButtonText::OnRender(XUIMessageRender *pRenderData, BOOL &bHandled )
|
||||
{
|
||||
HXUIDC hDC = pRenderData->hDC;
|
||||
CXuiControl xuiControl(m_hObj);
|
||||
|
||||
// build and render with the game call
|
||||
|
||||
RenderManager.Set_matrixDirty();
|
||||
|
||||
Minecraft *pMinecraft=Minecraft::GetInstance();
|
||||
|
||||
D3DXMATRIX matrix;
|
||||
xuiControl.GetFullXForm(&matrix);
|
||||
float bwidth,bheight;
|
||||
xuiControl.GetBounds(&bwidth,&bheight);
|
||||
|
||||
// Annoyingly, XUI renders everything to a z of 0 so if we want to render anything that needs the z-buffer on top of it, then we need to clear it.
|
||||
// Clear just the region required for this control.
|
||||
D3DRECT clearRect;
|
||||
clearRect.x1 = (int)(matrix._41) - 2;
|
||||
clearRect.y1 = (int)(matrix._42) - 2;
|
||||
clearRect.x2 = (int)(matrix._41 + ( bwidth * matrix._11 )) + 2;
|
||||
clearRect.y2 = (int)(matrix._42 + ( bheight * matrix._22 )) + 2;
|
||||
|
||||
RenderManager.Clear(GL_DEPTH_BUFFER_BIT, &clearRect);
|
||||
// glClear(GL_DEPTH_BUFFER_BIT);
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glOrtho(0, m_fScreenWidth, m_fScreenHeight, 0, 1000, 3000);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
glTranslatef(0, 0, -2000);
|
||||
|
||||
|
||||
glEnable(GL_RESCALE_NORMAL);
|
||||
glPushMatrix();
|
||||
glRotatef(120, 1, 0, 0);
|
||||
//Lighting::turnOnGui();
|
||||
glPopMatrix();
|
||||
|
||||
|
||||
|
||||
EnchantmentMenu *menu = m_parentControl->m_containerScene->getMenu();
|
||||
|
||||
float xo = matrix._41;
|
||||
float yo = matrix._42;
|
||||
glTranslatef(xo, yo, 50.0f);
|
||||
|
||||
float ss = 1;
|
||||
|
||||
if(!m_parentControl->m_containerScene->m_bSplitscreen)
|
||||
{
|
||||
ss = 2;
|
||||
}
|
||||
|
||||
glScalef(ss, ss, ss);
|
||||
|
||||
int cost = menu->costs[m_parentControl->m_index];
|
||||
|
||||
if(cost != m_lastCost)
|
||||
{
|
||||
m_lastCost = cost;
|
||||
m_enchantmentString = EnchantmentNames::instance.getRandomName();
|
||||
}
|
||||
|
||||
glColor4f(1, 1, 1, 1);
|
||||
if (cost != 0)
|
||||
{
|
||||
wstring line = _toString<int>(cost);
|
||||
Font *font = pMinecraft->altFont;
|
||||
//int col = 0x685E4A;
|
||||
unsigned int col = m_textColour;
|
||||
if (pMinecraft->localplayers[m_parentControl->m_iPad]->experienceLevel < cost && !pMinecraft->localplayers[m_parentControl->m_iPad]->abilities.instabuild)
|
||||
{
|
||||
col = m_textDisabledColour;
|
||||
font->drawWordWrap(m_enchantmentString, 0, 0, bwidth/ss, col, bheight/ss);
|
||||
font = pMinecraft->font;
|
||||
//col = (0x80ff20 & 0xfefefe) >> 1;
|
||||
//font->drawShadow(line, (bwidth - font->width(line))/ss, 7, col);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_parentControl->HasFocus())
|
||||
{
|
||||
//col = 0xffff80;
|
||||
col = m_textFocusColour;
|
||||
}
|
||||
font->drawWordWrap(m_enchantmentString, 0, 0, bwidth/ss, col, bheight/ss);
|
||||
font = pMinecraft->font;
|
||||
//col = 0x80ff20;
|
||||
//font->drawShadow(line, (bwidth - font->width(line))/ss, 7, col);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
|
||||
//Lighting::turnOff();
|
||||
glDisable(GL_RESCALE_NORMAL);
|
||||
|
||||
XuiRenderRestoreState(hDC);
|
||||
|
||||
bHandled = TRUE;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
CXuiCtrlEnchantmentButtonText::EnchantmentNames CXuiCtrlEnchantmentButtonText::EnchantmentNames::instance;
|
||||
|
||||
CXuiCtrlEnchantmentButtonText::EnchantmentNames::EnchantmentNames()
|
||||
{
|
||||
wstring allWords = L"the elder scrolls klaatu berata niktu xyzzy bless curse light darkness fire air earth water hot dry cold wet ignite snuff embiggen twist shorten stretch fiddle destroy imbue galvanize enchant free limited range of towards inside sphere cube self other ball mental physical grow shrink demon elemental spirit animal creature beast humanoid undead fresh stale ";
|
||||
std::wistringstream iss(allWords);
|
||||
std::copy(std::istream_iterator< std::wstring, wchar_t, std::char_traits<wchar_t> >(iss), std::istream_iterator< std::wstring, wchar_t, std::char_traits<wchar_t> >(),std::back_inserter(words));
|
||||
}
|
||||
|
||||
wstring CXuiCtrlEnchantmentButtonText::EnchantmentNames::getRandomName()
|
||||
{
|
||||
int wordCount = random.nextInt(2) + 3;
|
||||
wstring word = L"";
|
||||
for (int i = 0; i < wordCount; i++)
|
||||
{
|
||||
if (i > 0) word += L" ";
|
||||
word += words[random.nextInt(words.size())];
|
||||
}
|
||||
return word;
|
||||
}
|
||||
45
Minecraft.Client/Common/XUI/XUI_Ctrl_EnchantmentButtonText.h
Normal file
45
Minecraft.Client/Common/XUI/XUI_Ctrl_EnchantmentButtonText.h
Normal file
@@ -0,0 +1,45 @@
|
||||
#pragma once
|
||||
|
||||
class CXuiSceneEnchant;
|
||||
|
||||
class CXuiCtrlEnchantmentButtonText : public CXuiControlImpl
|
||||
{
|
||||
public:
|
||||
XUI_IMPLEMENT_CLASS(CXuiCtrlEnchantmentButtonText, L"CXuiCtrlEnchantmentButtonText", XUI_CLASS_CONTROL)
|
||||
|
||||
protected:
|
||||
|
||||
XUI_BEGIN_MSG_MAP()
|
||||
XUI_ON_XM_INIT(OnInit)
|
||||
XUI_ON_XM_RENDER(OnRender)
|
||||
XUI_END_MSG_MAP()
|
||||
|
||||
HRESULT OnInit(XUIMessageInit* pInitData, BOOL& rfHandled);
|
||||
HRESULT OnRender(XUIMessageRender *pRenderData, BOOL &rfHandled);
|
||||
|
||||
private:
|
||||
CXuiCtrlEnchantmentButton *m_parentControl;
|
||||
|
||||
float m_fScreenWidth,m_fScreenHeight;
|
||||
float m_fRawWidth,m_fRawHeight;
|
||||
|
||||
int m_lastCost;
|
||||
wstring m_enchantmentString;
|
||||
|
||||
unsigned int m_textColour, m_textFocusColour, m_textDisabledColour;
|
||||
|
||||
class EnchantmentNames
|
||||
{
|
||||
public:
|
||||
static EnchantmentNames instance;
|
||||
|
||||
private:
|
||||
Random random;
|
||||
vector<wstring> words;
|
||||
|
||||
EnchantmentNames();
|
||||
|
||||
public:
|
||||
wstring getRandomName();
|
||||
};
|
||||
};
|
||||
29
Minecraft.Client/Common/XUI/XUI_Ctrl_FireProgress.cpp
Normal file
29
Minecraft.Client/Common/XUI/XUI_Ctrl_FireProgress.cpp
Normal file
@@ -0,0 +1,29 @@
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "..\..\..\Minecraft.World\FurnaceMenu.h"
|
||||
#include "..\..\..\Minecraft.World\FurnaceTileEntity.h"
|
||||
#include "XUI_Scene_Furnace.h"
|
||||
#include "XUI_Ctrl_FireProgress.h"
|
||||
|
||||
int CXuiCtrlFireProgress::GetValue()
|
||||
{
|
||||
void* pvUserData;
|
||||
this->GetUserData( &pvUserData );
|
||||
|
||||
if( pvUserData != NULL )
|
||||
{
|
||||
FurnaceTileEntity *pFurnaceTileEntity = (FurnaceTileEntity *)pvUserData;
|
||||
|
||||
// TODO This param is a magic number in Java but we should really define it somewhere with a name
|
||||
// I think it is the number of states of the progress display (ie the max value)
|
||||
return pFurnaceTileEntity->getLitProgress( 12 );
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void CXuiCtrlFireProgress::GetRange(int *pnRangeMin, int *pnRangeMax)
|
||||
{
|
||||
*pnRangeMin = 0;
|
||||
*pnRangeMax = 12;
|
||||
}
|
||||
19
Minecraft.Client/Common/XUI/XUI_Ctrl_FireProgress.h
Normal file
19
Minecraft.Client/Common/XUI/XUI_Ctrl_FireProgress.h
Normal file
@@ -0,0 +1,19 @@
|
||||
#pragma once
|
||||
using namespace std;
|
||||
|
||||
#include "XUI_Ctrl_ProgressCtrlBase.h"
|
||||
|
||||
class CXuiCtrlFireProgress : public CXuiCtrlProgressCtrlBase
|
||||
{
|
||||
public:
|
||||
// Define the class. The class name must match the ClassOverride property
|
||||
// set for the scene in the UI Authoring tool.
|
||||
XUI_IMPLEMENT_CLASS( CXuiCtrlFireProgress, L"CXuiCtrlFireProgress", XUI_CLASS_PROGRESSBAR )
|
||||
|
||||
XUI_BEGIN_MSG_MAP()
|
||||
XUI_ON_XM_GET_SOURCE_TEXT(OnGetSourceDataText)
|
||||
XUI_END_MSG_MAP()
|
||||
|
||||
virtual int GetValue();
|
||||
virtual void GetRange(int *pnRangeMin, int *pnRangeMax);
|
||||
};
|
||||
21
Minecraft.Client/Common/XUI/XUI_Ctrl_LoadingProgress.cpp
Normal file
21
Minecraft.Client/Common/XUI/XUI_Ctrl_LoadingProgress.cpp
Normal file
@@ -0,0 +1,21 @@
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "XUI_Ctrl_LoadingProgress.h"
|
||||
#include "..\..\Minecraft.h"
|
||||
#include "..\..\ProgressRenderer.h"
|
||||
|
||||
int CXuiCtrlLoadingProgress::GetValue()
|
||||
{
|
||||
int currentValue = 0;
|
||||
|
||||
Minecraft *pMinecraft=Minecraft::GetInstance();
|
||||
currentValue = pMinecraft->progressRenderer->getCurrentPercent();
|
||||
//printf("About to render progress of %d\n", currentValue);
|
||||
return currentValue;
|
||||
}
|
||||
|
||||
void CXuiCtrlLoadingProgress::GetRange(int *pnRangeMin, int *pnRangeMax)
|
||||
{
|
||||
*pnRangeMin = 0;
|
||||
*pnRangeMax = 100;
|
||||
}
|
||||
18
Minecraft.Client/Common/XUI/XUI_Ctrl_LoadingProgress.h
Normal file
18
Minecraft.Client/Common/XUI/XUI_Ctrl_LoadingProgress.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
#include "XUI_Ctrl_ProgressCtrlBase.h"
|
||||
|
||||
class CXuiCtrlLoadingProgress : public CXuiCtrlProgressCtrlBase
|
||||
{
|
||||
public:
|
||||
// Define the class. The class name must match the ClassOverride property
|
||||
// set for the scene in the UI Authoring tool.
|
||||
XUI_IMPLEMENT_CLASS( CXuiCtrlLoadingProgress, L"CXuiCtrlLoadingProgress", XUI_CLASS_PROGRESSBAR )
|
||||
|
||||
XUI_BEGIN_MSG_MAP()
|
||||
XUI_ON_XM_GET_SOURCE_TEXT(OnGetSourceDataText)
|
||||
XUI_END_MSG_MAP()
|
||||
|
||||
virtual int GetValue();
|
||||
virtual void GetRange(int *pnRangeMin, int *pnRangeMax);
|
||||
};
|
||||
190
Minecraft.Client/Common/XUI/XUI_Ctrl_MinecraftPlayer.cpp
Normal file
190
Minecraft.Client/Common/XUI/XUI_Ctrl_MinecraftPlayer.cpp
Normal file
@@ -0,0 +1,190 @@
|
||||
#include "stdafx.h"
|
||||
#include "..\..\Minecraft.h"
|
||||
#include "..\..\ScreenSizeCalculator.h"
|
||||
#include "..\..\EntityRenderDispatcher.h"
|
||||
#include "..\..\Lighting.h"
|
||||
#include "..\..\MultiplayerLocalPlayer.h"
|
||||
#include "XUI_Ctrl_MinecraftPlayer.h"
|
||||
#include "XUI_Scene_AbstractContainer.h"
|
||||
#include "XUI_Scene_Inventory.h"
|
||||
#include "..\..\Options.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// CXuiCtrlMinecraftPlayer class
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
CXuiCtrlMinecraftPlayer::CXuiCtrlMinecraftPlayer() :
|
||||
m_bDirty(FALSE),
|
||||
m_fScale(1.0f),
|
||||
m_fAlpha(1.0f)
|
||||
{
|
||||
Minecraft *pMinecraft=Minecraft::GetInstance();
|
||||
|
||||
ScreenSizeCalculator ssc(pMinecraft->options, pMinecraft->width_phys, pMinecraft->height_phys);
|
||||
m_fScreenWidth=(float)pMinecraft->width_phys;
|
||||
m_fRawWidth=(float)ssc.rawWidth;
|
||||
m_fScreenHeight=(float)pMinecraft->height_phys;
|
||||
m_fRawHeight=(float)ssc.rawHeight;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
HRESULT CXuiCtrlMinecraftPlayer::OnInit(XUIMessageInit* pInitData, BOOL& rfHandled)
|
||||
{
|
||||
HRESULT hr=S_OK;
|
||||
|
||||
HXUIOBJ parent = m_hObj;
|
||||
HXUICLASS hcInventoryClass = XuiFindClass( L"CXuiSceneInventory" );
|
||||
HXUICLASS currentClass;
|
||||
|
||||
do
|
||||
{
|
||||
XuiElementGetParent(parent,&parent);
|
||||
currentClass = XuiGetObjectClass( parent );
|
||||
} while (parent != NULL && !XuiClassDerivesFrom( currentClass, hcInventoryClass ) );
|
||||
|
||||
assert( parent != NULL );
|
||||
|
||||
VOID *pObj;
|
||||
XuiObjectFromHandle( parent, &pObj );
|
||||
m_containerScene = (CXuiSceneInventory *)pObj;
|
||||
|
||||
m_iPad = m_containerScene->getPad();
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT CXuiCtrlMinecraftPlayer::OnRender(XUIMessageRender *pRenderData, BOOL &bHandled )
|
||||
{
|
||||
#ifdef _XBOX
|
||||
HXUIDC hDC = pRenderData->hDC;
|
||||
|
||||
// build and render with the game call
|
||||
|
||||
RenderManager.Set_matrixDirty();
|
||||
|
||||
Minecraft *pMinecraft=Minecraft::GetInstance();
|
||||
|
||||
glColor4f(1, 1, 1, 1);
|
||||
glClear(GL_DEPTH_BUFFER_BIT);
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glOrtho(0, m_fRawWidth, m_fRawHeight, 0, 1000, 3000);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
glTranslatef(0, 0, -2000);
|
||||
|
||||
|
||||
D3DXMATRIX matrix;
|
||||
CXuiControl xuiControl(m_hObj);
|
||||
xuiControl.GetFullXForm(&matrix);
|
||||
float bwidth,bheight;
|
||||
xuiControl.GetBounds(&bwidth,&bheight);
|
||||
|
||||
float xo = ( (matrix._41 + ( (bwidth*matrix._11)/2) ) / m_fScreenWidth ) * m_fRawWidth;
|
||||
float yo = ( (matrix._42 + (bheight*matrix._22) ) / m_fScreenHeight ) * m_fRawHeight;
|
||||
|
||||
glEnable(GL_RESCALE_NORMAL);
|
||||
glEnable(GL_COLOR_MATERIAL);
|
||||
|
||||
glPushMatrix();
|
||||
glTranslatef(xo, yo - 3.5f, 50.0f);
|
||||
float ss;// = 26;
|
||||
|
||||
if(!RenderManager.IsHiDef() && !RenderManager.IsWidescreen())
|
||||
{
|
||||
ss = 24;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(app.GetLocalPlayerCount()>1)
|
||||
{
|
||||
ss = 13;
|
||||
}
|
||||
else
|
||||
{
|
||||
ss = 26;
|
||||
}
|
||||
}
|
||||
// Base scale on height of this control
|
||||
// Potentially we might want separate x & y scales here
|
||||
//ss = ( ( bheight / m_fScreenHeight ) * m_fRawHeight );
|
||||
// For testing split screen - this scale is correct for 4 player split screen
|
||||
|
||||
// how many local players do we have?
|
||||
// int iPlayerC=0;
|
||||
//
|
||||
// for(int i=0;i<XUSER_MAX_COUNT;i++)
|
||||
// {
|
||||
// if(pMinecraft->localplayers[i] != NULL)
|
||||
// {
|
||||
// iPlayerC++;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// switch(iPlayerC)
|
||||
// {
|
||||
// case 1:
|
||||
// break;
|
||||
// case 2:
|
||||
// case 3:
|
||||
// case 4:
|
||||
// ss *= 0.5f;
|
||||
// break;
|
||||
// }
|
||||
|
||||
glScalef(-ss, ss, ss);
|
||||
glRotatef(180, 0, 0, 1);
|
||||
|
||||
float oybr = pMinecraft->localplayers[m_iPad]->yBodyRot;
|
||||
float oyr = pMinecraft->localplayers[m_iPad]->yRot;
|
||||
float oxr = pMinecraft->localplayers[m_iPad]->xRot;
|
||||
float oyhr = pMinecraft->localplayers[m_iPad]->yHeadRot;
|
||||
|
||||
D3DXVECTOR3 pointerPosition = m_containerScene->GetCursorScreenPosition();
|
||||
//printf("Pointer screen position is x:%f, y:%f, z:%f\n",pointerPosition.x, pointerPosition.y, pointerPosition.z);
|
||||
|
||||
float xd = ( matrix._41 + ( (bwidth*matrix._11)/2) ) - pointerPosition.x;
|
||||
|
||||
// Need to base Y on head position, not centre of mass
|
||||
float yd = ( matrix._42 + ( (bheight*matrix._22) / 2) - 40 ) - pointerPosition.y;
|
||||
|
||||
glRotatef(45 + 90, 0, 1, 0);
|
||||
Lighting::turnOn();
|
||||
glRotatef(-45 - 90, 0, 1, 0);
|
||||
|
||||
glRotatef(-(float) atan(yd / 40.0f) * 20, 1, 0, 0);
|
||||
|
||||
pMinecraft->localplayers[m_iPad]->yBodyRot = (float) atan(xd / 40.0f) * 20;
|
||||
pMinecraft->localplayers[m_iPad]->yRot = (float) atan(xd / 40.0f) * 40;
|
||||
pMinecraft->localplayers[m_iPad]->xRot = -(float) atan(yd / 40.0f) * 20;
|
||||
pMinecraft->localplayers[m_iPad]->yHeadRot = pMinecraft->localplayers[m_iPad]->yRot;
|
||||
//pMinecraft->localplayers[m_iPad]->glow = 1;
|
||||
glTranslatef(0, pMinecraft->localplayers[m_iPad]->heightOffset, 0);
|
||||
EntityRenderDispatcher::instance->playerRotY = 180;
|
||||
|
||||
// 4J Stu - Turning on hideGui while we do this stops the name rendering in split-screen
|
||||
bool wasHidingGui = pMinecraft->options->hideGui;
|
||||
pMinecraft->options->hideGui = true;
|
||||
EntityRenderDispatcher::instance->render(pMinecraft->localplayers[m_iPad], 0, 0, 0, 0, 1,false,false);
|
||||
pMinecraft->options->hideGui = wasHidingGui;
|
||||
//pMinecraft->localplayers[m_iPad]->glow = 0;
|
||||
|
||||
pMinecraft->localplayers[m_iPad]->yBodyRot = oybr;
|
||||
pMinecraft->localplayers[m_iPad]->yRot = oyr;
|
||||
pMinecraft->localplayers[m_iPad]->xRot = oxr;
|
||||
pMinecraft->localplayers[m_iPad]->yHeadRot = oyhr;
|
||||
glPopMatrix();
|
||||
Lighting::turnOff();
|
||||
glDisable(GL_RESCALE_NORMAL);
|
||||
|
||||
XuiRenderRestoreState(hDC);
|
||||
|
||||
bHandled = TRUE;
|
||||
#endif
|
||||
return S_OK;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
42
Minecraft.Client/Common/XUI/XUI_Ctrl_MinecraftPlayer.h
Normal file
42
Minecraft.Client/Common/XUI/XUI_Ctrl_MinecraftPlayer.h
Normal file
@@ -0,0 +1,42 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <XuiApp.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
class TileRenderer;
|
||||
class ItemRenderer;
|
||||
class CXuiSceneInventory;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// CXuiCtrlMinecraftPlayer class
|
||||
//-----------------------------------------------------------------------------
|
||||
class CXuiCtrlMinecraftPlayer : public CXuiControlImpl
|
||||
{
|
||||
public:
|
||||
XUI_IMPLEMENT_CLASS(CXuiCtrlMinecraftPlayer, L"CXuiCtrlMinecraftPlayer", XUI_CLASS_LABEL)
|
||||
|
||||
CXuiCtrlMinecraftPlayer();
|
||||
virtual ~CXuiCtrlMinecraftPlayer() { };
|
||||
|
||||
protected:
|
||||
|
||||
XUI_BEGIN_MSG_MAP()
|
||||
XUI_ON_XM_INIT(OnInit)
|
||||
XUI_ON_XM_RENDER(OnRender)
|
||||
XUI_END_MSG_MAP()
|
||||
|
||||
HRESULT OnInit(XUIMessageInit* pInitData, BOOL& rfHandled);
|
||||
HRESULT OnRender(XUIMessageRender *pRenderData, BOOL &rfHandled);
|
||||
|
||||
private:
|
||||
BOOL m_bDirty;
|
||||
float m_fScale,m_fAlpha;
|
||||
int m_iPad;
|
||||
CXuiSceneInventory *m_containerScene;
|
||||
|
||||
float m_fScreenWidth,m_fScreenHeight;
|
||||
float m_fRawWidth,m_fRawHeight;
|
||||
|
||||
};
|
||||
551
Minecraft.Client/Common/XUI/XUI_Ctrl_MinecraftSkinPreview.cpp
Normal file
551
Minecraft.Client/Common/XUI/XUI_Ctrl_MinecraftSkinPreview.cpp
Normal file
@@ -0,0 +1,551 @@
|
||||
#include "stdafx.h"
|
||||
#include "..\..\Minecraft.h"
|
||||
#include "..\..\ScreenSizeCalculator.h"
|
||||
#include "..\..\EntityRenderDispatcher.h"
|
||||
#include "..\..\PlayerRenderer.h"
|
||||
#include "..\..\HumanoidModel.h"
|
||||
#include "..\..\Lighting.h"
|
||||
#include "..\..\..\Minecraft.World\Class.h"
|
||||
#include "..\..\..\Minecraft.World\net.minecraft.world.entity.player.h"
|
||||
#include "XUI_Ctrl_MinecraftSkinPreview.h"
|
||||
#include "XUI_Scene_AbstractContainer.h"
|
||||
#include "XUI_Scene_Inventory.h"
|
||||
#include "..\..\Options.h"
|
||||
#include "..\..\stubs.h"
|
||||
#include "..\..\ModelPart.h"
|
||||
|
||||
//#define SKIN_PREVIEW_BOB_ANIM
|
||||
#define SKIN_PREVIEW_WALKING_ANIM
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// CXuiCtrlMinecraftSkinPreview class
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
CXuiCtrlMinecraftSkinPreview::CXuiCtrlMinecraftSkinPreview() :
|
||||
m_bDirty(FALSE),
|
||||
m_fScale(1.0f),
|
||||
m_fAlpha(1.0f)
|
||||
{
|
||||
Minecraft *pMinecraft=Minecraft::GetInstance();
|
||||
|
||||
ScreenSizeCalculator ssc(pMinecraft->options, pMinecraft->width_phys, pMinecraft->height_phys);
|
||||
m_fScreenWidth=(float)pMinecraft->width_phys;
|
||||
m_fRawWidth=(float)ssc.rawWidth;
|
||||
m_fScreenHeight=(float)pMinecraft->height_phys;
|
||||
m_fRawHeight=(float)ssc.rawHeight;
|
||||
|
||||
m_customTextureUrl = L"default";
|
||||
m_backupTexture = TN_MOB_CHAR;
|
||||
m_capeTextureUrl = L"";
|
||||
|
||||
m_yRot = 0;
|
||||
m_xRot = 0;
|
||||
|
||||
m_swingTime = 0.0f;
|
||||
m_bobTick = 0.0f;
|
||||
m_walkAnimSpeedO = 0.0f;
|
||||
m_walkAnimSpeed = 0.0f;
|
||||
m_walkAnimPos = 0.0f;
|
||||
|
||||
m_bAutoRotate = false;
|
||||
m_bRotatingLeft = false;
|
||||
|
||||
m_incXRot = false;
|
||||
m_decXRot = false;
|
||||
m_incYRot = false;
|
||||
m_decYRot = false;
|
||||
|
||||
m_currentAnimation = e_SkinPreviewAnimation_Walking;
|
||||
|
||||
m_fTargetRotation = 0.0f;
|
||||
m_fOriginalRotation = 0.0f;
|
||||
m_framesAnimatingRotation = 0;
|
||||
m_bAnimatingToFacing = false;
|
||||
m_pvAdditionalModelParts=NULL;
|
||||
m_uiAnimOverrideBitmask=0L;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
HRESULT CXuiCtrlMinecraftSkinPreview::OnInit(XUIMessageInit* pInitData, BOOL& rfHandled)
|
||||
{
|
||||
HRESULT hr=S_OK;
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
void CXuiCtrlMinecraftSkinPreview::SetTexture(const wstring &url, TEXTURE_NAME backupTexture)
|
||||
{
|
||||
m_customTextureUrl = url;
|
||||
m_backupTexture = backupTexture;
|
||||
|
||||
unsigned int uiAnimOverrideBitmask = Player::getSkinAnimOverrideBitmask( app.getSkinIdFromPath(m_customTextureUrl) );
|
||||
|
||||
if(app.GetGameSettings(eGameSetting_CustomSkinAnim)==0 )
|
||||
{
|
||||
// We have a force animation for some skins (claptrap)
|
||||
// 4J-PB - treat all the eAnim_Disable flags as a force anim
|
||||
|
||||
if((uiAnimOverrideBitmask & HumanoidModel::m_staticBitmaskIgnorePlayerCustomAnimSetting)!=0)
|
||||
{
|
||||
m_uiAnimOverrideBitmask=uiAnimOverrideBitmask;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_uiAnimOverrideBitmask=0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_uiAnimOverrideBitmask = uiAnimOverrideBitmask;
|
||||
}
|
||||
|
||||
app.DebugPrintf("+++ SetTexture - %d, %8x\n",app.getSkinIdFromPath(m_customTextureUrl)&0xFFFFFFF,m_uiAnimOverrideBitmask);
|
||||
m_pvAdditionalModelParts=app.GetAdditionalModelParts(app.getSkinIdFromPath(m_customTextureUrl));
|
||||
}
|
||||
|
||||
void CXuiCtrlMinecraftSkinPreview::SetFacing(ESkinPreviewFacing facing, bool bAnimate /*= false*/)
|
||||
{
|
||||
switch(facing)
|
||||
{
|
||||
case e_SkinPreviewFacing_Forward:
|
||||
m_fTargetRotation = 0;
|
||||
m_bRotatingLeft = true;
|
||||
break;
|
||||
case e_SkinPreviewFacing_Left:
|
||||
m_fTargetRotation = LOOK_LEFT_EXTENT;
|
||||
m_bRotatingLeft = false;
|
||||
break;
|
||||
case e_SkinPreviewFacing_Right:
|
||||
m_fTargetRotation = LOOK_RIGHT_EXTENT;
|
||||
m_bRotatingLeft = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if(!bAnimate)
|
||||
{
|
||||
m_yRot = m_fTargetRotation;
|
||||
m_bAnimatingToFacing = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_fOriginalRotation = m_yRot;
|
||||
m_bAnimatingToFacing = true;
|
||||
m_framesAnimatingRotation = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void CXuiCtrlMinecraftSkinPreview::CycleNextAnimation()
|
||||
{
|
||||
m_currentAnimation = (ESkinPreviewAnimations)(m_currentAnimation + 1);
|
||||
if(m_currentAnimation >= e_SkinPreviewAnimation_Count) m_currentAnimation = e_SkinPreviewAnimation_Walking;
|
||||
|
||||
m_swingTime = 0.0f;
|
||||
}
|
||||
|
||||
void CXuiCtrlMinecraftSkinPreview::CyclePreviousAnimation()
|
||||
{
|
||||
m_currentAnimation = (ESkinPreviewAnimations)(m_currentAnimation - 1);
|
||||
if(m_currentAnimation < e_SkinPreviewAnimation_Walking) m_currentAnimation = (ESkinPreviewAnimations)(e_SkinPreviewAnimation_Count - 1);
|
||||
|
||||
m_swingTime = 0.0f;
|
||||
}
|
||||
|
||||
HRESULT CXuiCtrlMinecraftSkinPreview::OnRender(XUIMessageRender *pRenderData, BOOL &bHandled )
|
||||
{
|
||||
if( m_bAnimatingToFacing )
|
||||
{
|
||||
++m_framesAnimatingRotation;
|
||||
m_yRot = m_fOriginalRotation + m_framesAnimatingRotation * ( (m_fTargetRotation - m_fOriginalRotation) / CHANGING_SKIN_FRAMES );
|
||||
|
||||
//if(m_framesAnimatingRotation == CHANGING_SKIN_FRAMES) m_bAnimatingToFacing = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( m_incXRot ) IncrementXRotation();
|
||||
if( m_decXRot ) DecrementXRotation();
|
||||
if( m_incYRot ) IncrementYRotation();
|
||||
if( m_decYRot ) DecrementYRotation();
|
||||
|
||||
if(m_bAutoRotate)
|
||||
{
|
||||
++m_rotateTick;
|
||||
|
||||
if(m_rotateTick%4==0)
|
||||
{
|
||||
if(m_yRot >= LOOK_LEFT_EXTENT)
|
||||
{
|
||||
m_bRotatingLeft = false;
|
||||
}
|
||||
else if(m_yRot <= LOOK_RIGHT_EXTENT)
|
||||
{
|
||||
m_bRotatingLeft = true;
|
||||
}
|
||||
|
||||
if(m_bRotatingLeft)
|
||||
{
|
||||
IncrementYRotation();
|
||||
}
|
||||
else
|
||||
{
|
||||
DecrementYRotation();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
HXUIDC hDC = pRenderData->hDC;
|
||||
|
||||
// build and render with the game call
|
||||
|
||||
RenderManager.Set_matrixDirty();
|
||||
|
||||
Minecraft *pMinecraft=Minecraft::GetInstance();
|
||||
|
||||
float alpha = 1.0f;
|
||||
//GetOpacity( &alpha );
|
||||
|
||||
glColor4f(1, 1, 1, alpha);
|
||||
glClear(GL_DEPTH_BUFFER_BIT);
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glOrtho(0, m_fRawWidth, m_fRawHeight, 0, 1000, 3000);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
glTranslatef(0, 0, -2000);
|
||||
|
||||
|
||||
D3DXMATRIX matrix;
|
||||
GetFullXForm(&matrix);
|
||||
float bwidth,bheight;
|
||||
GetBounds(&bwidth,&bheight);
|
||||
|
||||
float xo = ( (matrix._41 + ( (bwidth*matrix._11)/2) ) / m_fScreenWidth ) * m_fRawWidth;
|
||||
float yo = ( (matrix._42 + (bheight*matrix._22) ) / m_fScreenHeight ) * m_fRawHeight;
|
||||
|
||||
glEnable(GL_RESCALE_NORMAL);
|
||||
glEnable(GL_COLOR_MATERIAL);
|
||||
|
||||
glPushMatrix();
|
||||
glTranslatef(xo, yo - 3.5f, 50.0f);
|
||||
float ss;
|
||||
|
||||
// Base scale on height of this control
|
||||
// Potentially we might want separate x & y scales here
|
||||
ss = ( ( (bheight*matrix._22) / m_fScreenHeight ) * m_fRawHeight )/2;
|
||||
|
||||
glScalef(-ss, ss, ss);
|
||||
glRotatef(180, 0, 0, 1);
|
||||
|
||||
//glRotatef(45 + 90, 0, 1, 0);
|
||||
Lighting::turnOn();
|
||||
//glRotatef(-45 - 90, 0, 1, 0);
|
||||
|
||||
glRotatef(-(float)m_xRot, 1, 0, 0);
|
||||
|
||||
// 4J Stu - Turning on hideGui while we do this stops the name rendering in split-screen
|
||||
bool wasHidingGui = pMinecraft->options->hideGui;
|
||||
pMinecraft->options->hideGui = true;
|
||||
|
||||
//EntityRenderDispatcher::instance->render(pMinecraft->localplayers[0], 0, 0, 0, 0, 1);
|
||||
EntityRenderer *renderer = EntityRenderDispatcher::instance->getRenderer(eTYPE_PLAYER);
|
||||
if (renderer != NULL)
|
||||
{
|
||||
// 4J-PB - any additional parts to turn on for this player (skin dependent)
|
||||
//vector<ModelPart *> *pAdditionalModelParts=mob->GetAdditionalModelParts();
|
||||
|
||||
if(m_pvAdditionalModelParts && m_pvAdditionalModelParts->size()!=0)
|
||||
{
|
||||
for(AUTO_VAR(it, m_pvAdditionalModelParts->begin()); it != m_pvAdditionalModelParts->end(); ++it)
|
||||
{
|
||||
ModelPart *pModelPart=*it;
|
||||
|
||||
pModelPart->visible=true;
|
||||
}
|
||||
}
|
||||
|
||||
render(renderer,0,0,0,0,1);
|
||||
//renderer->postRender(entity, x, y, z, rot, a);
|
||||
|
||||
// hide the additional parts
|
||||
if(m_pvAdditionalModelParts && m_pvAdditionalModelParts->size()!=0)
|
||||
{
|
||||
for(AUTO_VAR(it, m_pvAdditionalModelParts->begin()); it != m_pvAdditionalModelParts->end(); ++it)
|
||||
{
|
||||
ModelPart *pModelPart=*it;
|
||||
|
||||
pModelPart->visible=false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pMinecraft->options->hideGui = wasHidingGui;
|
||||
|
||||
glPopMatrix();
|
||||
Lighting::turnOff();
|
||||
glDisable(GL_RESCALE_NORMAL);
|
||||
|
||||
XuiRenderRestoreState(hDC);
|
||||
|
||||
bHandled = TRUE;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
// 4J Stu - Modified version of MobRenderer::render that does not require an actual entity
|
||||
void CXuiCtrlMinecraftSkinPreview::render(EntityRenderer *renderer, double x, double y, double z, float rot, float a)
|
||||
{
|
||||
glPushMatrix();
|
||||
glDisable(GL_CULL_FACE);
|
||||
|
||||
HumanoidModel *model = (HumanoidModel *)renderer->getModel();
|
||||
|
||||
//getAttackAnim(mob, a);
|
||||
//if (armor != NULL) armor->attackTime = model->attackTime;
|
||||
//model->riding = mob->isRiding();
|
||||
//if (armor != NULL) armor->riding = model->riding;
|
||||
|
||||
// 4J Stu - Remember to reset these values once the rendering is done if you add another one
|
||||
model->attackTime = 0;
|
||||
model->sneaking = false;
|
||||
model->holdingRightHand = false;
|
||||
model->holdingLeftHand = false;
|
||||
model->idle = false;
|
||||
model->eating = false;
|
||||
model->eating_swing = 0;
|
||||
model->eating_t = 0;
|
||||
model->young = false;
|
||||
model->riding = false;
|
||||
|
||||
model->m_uiAnimOverrideBitmask = m_uiAnimOverrideBitmask;
|
||||
|
||||
if( !m_bAnimatingToFacing )
|
||||
{
|
||||
switch( m_currentAnimation )
|
||||
{
|
||||
case e_SkinPreviewAnimation_Sneaking:
|
||||
model->sneaking = true;
|
||||
break;
|
||||
case e_SkinPreviewAnimation_Attacking:
|
||||
model->holdingRightHand = true;
|
||||
m_swingTime++;
|
||||
if (m_swingTime >= (Player::SWING_DURATION * 3) )
|
||||
{
|
||||
m_swingTime = 0;
|
||||
}
|
||||
model->attackTime = m_swingTime / (float) (Player::SWING_DURATION * 3);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
float bodyRot = m_yRot; //(mob->yBodyRotO + (mob->yBodyRot - mob->yBodyRotO) * a);
|
||||
float headRot = m_yRot; //(mob->yRotO + (mob->yRot - mob->yRotO) * a);
|
||||
float headRotx = 0; //(mob->xRotO + (mob->xRot - mob->xRotO) * a);
|
||||
|
||||
//setupPosition(mob, x, y, z);
|
||||
// is equivalent to
|
||||
glTranslatef((float) x, (float) y, (float) z);
|
||||
|
||||
//float bob = getBob(mob, a);
|
||||
#ifdef SKIN_PREVIEW_BOB_ANIM
|
||||
float bob = (m_bobTick + a)/2;
|
||||
|
||||
++m_bobTick;
|
||||
if(m_bobTick>=360*2) m_bobTick = 0;
|
||||
#else
|
||||
float bob = 0.0f;
|
||||
#endif
|
||||
|
||||
//setupRotations(mob, bob, bodyRot, a);
|
||||
// is equivalent to
|
||||
glRotatef(180 - bodyRot, 0, 1, 0);
|
||||
|
||||
float _scale = 1 / 16.0f;
|
||||
glEnable(GL_RESCALE_NORMAL);
|
||||
glScalef(-1, -1, 1);
|
||||
|
||||
//scale(mob, a);
|
||||
// is equivalent to
|
||||
float s = 15 / 16.0f;
|
||||
glScalef(s, s, s);
|
||||
|
||||
glTranslatef(0, -24 * _scale - 0.125f / 16.0f, 0);
|
||||
|
||||
#ifdef SKIN_PREVIEW_WALKING_ANIM
|
||||
m_walkAnimSpeedO = m_walkAnimSpeed;
|
||||
m_walkAnimSpeed += (0.1f - m_walkAnimSpeed) * 0.4f;
|
||||
m_walkAnimPos += m_walkAnimSpeed;
|
||||
float ws = m_walkAnimSpeedO + (m_walkAnimSpeed - m_walkAnimSpeedO) * a;
|
||||
float wp = m_walkAnimPos - m_walkAnimSpeed * (1 - a);
|
||||
#else
|
||||
float ws = 0;
|
||||
float wp = 0;
|
||||
#endif
|
||||
|
||||
if (ws > 1) ws = 1;
|
||||
|
||||
MemSect(31);
|
||||
bindTexture(m_customTextureUrl, m_backupTexture);
|
||||
MemSect(0);
|
||||
glEnable(GL_ALPHA_TEST);
|
||||
|
||||
//model->prepareMobModel(mob, wp, ws, a);
|
||||
model->render(nullptr, wp, ws, bob, headRot - bodyRot, headRotx, _scale, true);
|
||||
/*for (int i = 0; i < MAX_ARMOR_LAYERS; i++)
|
||||
{
|
||||
if (prepareArmor(mob, i, a))
|
||||
{
|
||||
armor->render(wp, ws, bob, headRot - bodyRot, headRotx, _scale, true);
|
||||
glDisable(GL_BLEND);
|
||||
glEnable(GL_ALPHA_TEST);
|
||||
}
|
||||
}*/
|
||||
|
||||
//additionalRendering(mob, a);
|
||||
if (bindTexture(m_capeTextureUrl, L"" ))
|
||||
{
|
||||
glPushMatrix();
|
||||
glTranslatef(0, 0, 2 / 16.0f);
|
||||
|
||||
double xd = 0;//(mob->xCloakO + (mob->xCloak - mob->xCloakO) * a) - (mob->xo + (mob->x - mob->xo) * a);
|
||||
double yd = 0;//(mob->yCloakO + (mob->yCloak - mob->yCloakO) * a) - (mob->yo + (mob->y - mob->yo) * a);
|
||||
double zd = 0;//(mob->zCloakO + (mob->zCloak - mob->zCloakO) * a) - (mob->zo + (mob->z - mob->zo) * a);
|
||||
|
||||
float yr = 1;//mob->yBodyRotO + (mob->yBodyRot - mob->yBodyRotO) * a;
|
||||
|
||||
double xa = sin(yr * PI / 180);
|
||||
double za = -cos(yr * PI / 180);
|
||||
|
||||
float flap = (float) yd * 10;
|
||||
if (flap < -6) flap = -6;
|
||||
if (flap > 32) flap = 32;
|
||||
float lean = (float) (xd * xa + zd * za) * 100;
|
||||
float lean2 = (float) (xd * za - zd * xa) * 100;
|
||||
if (lean < 0) lean = 0;
|
||||
|
||||
//float pow = 1;//mob->oBob + (bob - mob->oBob) * a;
|
||||
|
||||
flap += 1;//sin((mob->walkDistO + (mob->walkDist - mob->walkDistO) * a) * 6) * 32 * pow;
|
||||
if (model->sneaking)
|
||||
{
|
||||
flap += 25;
|
||||
}
|
||||
|
||||
glRotatef(6.0f + lean / 2 + flap, 1, 0, 0);
|
||||
glRotatef(lean2 / 2, 0, 0, 1);
|
||||
glRotatef(-lean2 / 2, 0, 1, 0);
|
||||
glRotatef(180, 0, 1, 0);
|
||||
model->renderCloak(1 / 16.0f,true);
|
||||
glPopMatrix();
|
||||
}
|
||||
/*
|
||||
float br = mob->getBrightness(a);
|
||||
int overlayColor = getOverlayColor(mob, br, a);
|
||||
|
||||
if (((overlayColor >> 24) & 0xff) > 0 || mob->hurtTime > 0 || mob->deathTime > 0)
|
||||
{
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
glDisable(GL_ALPHA_TEST);
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glDepthFunc(GL_EQUAL);
|
||||
|
||||
// 4J - changed these renders to not use the compiled version of their models, because otherwise the render states set
|
||||
// about (in particular the depth & alpha test) don't work with our command buffer versions
|
||||
if (mob->hurtTime > 0 || mob->deathTime > 0)
|
||||
{
|
||||
glColor4f(br, 0, 0, 0.4f);
|
||||
model->render(wp, ws, bob, headRot - bodyRot, headRotx, _scale, false);
|
||||
for (int i = 0; i < MAX_ARMOR_LAYERS; i++)
|
||||
{
|
||||
if (prepareArmorOverlay(mob, i, a))
|
||||
{
|
||||
glColor4f(br, 0, 0, 0.4f);
|
||||
armor->render(wp, ws, bob, headRot - bodyRot, headRotx, _scale, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (((overlayColor >> 24) & 0xff) > 0)
|
||||
{
|
||||
float r = ((overlayColor >> 16) & 0xff) / 255.0f;
|
||||
float g = ((overlayColor >> 8) & 0xff) / 255.0f;
|
||||
float b = ((overlayColor) & 0xff) / 255.0f;
|
||||
float aa = ((overlayColor >> 24) & 0xff) / 255.0f;
|
||||
glColor4f(r, g, b, aa);
|
||||
model->render(wp, ws, bob, headRot - bodyRot, headRotx, _scale, false);
|
||||
for (int i = 0; i < MAX_ARMOR_LAYERS; i++)
|
||||
{
|
||||
if (prepareArmorOverlay(mob, i, a))
|
||||
{
|
||||
glColor4f(r, g, b, aa);
|
||||
armor->render(wp, ws, bob, headRot - bodyRot, headRotx, _scale, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
glDepthFunc(GL_LEQUAL);
|
||||
glDisable(GL_BLEND);
|
||||
glEnable(GL_ALPHA_TEST);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
}
|
||||
*/
|
||||
glDisable(GL_RESCALE_NORMAL);
|
||||
|
||||
glEnable(GL_CULL_FACE);
|
||||
|
||||
glPopMatrix();
|
||||
|
||||
MemSect(31);
|
||||
//renderName(mob, x, y, z);
|
||||
MemSect(0);
|
||||
|
||||
// Reset the model values to stop the changes we made here affecting anything in game (like the player hand render)
|
||||
model->attackTime = 0;
|
||||
model->sneaking = false;
|
||||
model->holdingRightHand = false;
|
||||
model->holdingLeftHand = false;
|
||||
}
|
||||
|
||||
bool CXuiCtrlMinecraftSkinPreview::bindTexture(const wstring& urlTexture, int backupTexture)
|
||||
{
|
||||
Textures *t = Minecraft::GetInstance()->textures;
|
||||
|
||||
// 4J-PB - no http textures on the xbox, mem textures instead
|
||||
|
||||
//int id = t->loadHttpTexture(urlTexture, backupTexture);
|
||||
int id = t->loadMemTexture(urlTexture, backupTexture);
|
||||
|
||||
if (id >= 0)
|
||||
{
|
||||
t->bind(id);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool CXuiCtrlMinecraftSkinPreview::bindTexture(const wstring& urlTexture, const wstring& backupTexture)
|
||||
{
|
||||
Textures *t = Minecraft::GetInstance()->textures;
|
||||
|
||||
// 4J-PB - no http textures on the xbox, mem textures instead
|
||||
|
||||
//int id = t->loadHttpTexture(urlTexture, backupTexture);
|
||||
int id = t->loadMemTexture(urlTexture, backupTexture);
|
||||
|
||||
if (id >= 0)
|
||||
{
|
||||
t->bind(id);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
106
Minecraft.Client/Common/XUI/XUI_Ctrl_MinecraftSkinPreview.h
Normal file
106
Minecraft.Client/Common/XUI/XUI_Ctrl_MinecraftSkinPreview.h
Normal file
@@ -0,0 +1,106 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <XuiApp.h>
|
||||
#include "..\..\Textures.h"
|
||||
//#include "..\..\Xbox\DLC\DLCSkinFile.h"
|
||||
#include "..\..\Model.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
class EntityRenderer;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// CXuiCtrlMinecraftSkinPreview class
|
||||
//-----------------------------------------------------------------------------
|
||||
class CXuiCtrlMinecraftSkinPreview : public CXuiControlImpl
|
||||
{
|
||||
private:
|
||||
static const int LOOK_LEFT_EXTENT = 45;
|
||||
static const int LOOK_RIGHT_EXTENT = -45;
|
||||
|
||||
static const int CHANGING_SKIN_FRAMES = 15;
|
||||
|
||||
enum ESkinPreviewAnimations
|
||||
{
|
||||
e_SkinPreviewAnimation_Walking,
|
||||
e_SkinPreviewAnimation_Sneaking,
|
||||
e_SkinPreviewAnimation_Attacking,
|
||||
|
||||
e_SkinPreviewAnimation_Count,
|
||||
};
|
||||
public:
|
||||
enum ESkinPreviewFacing
|
||||
{
|
||||
e_SkinPreviewFacing_Forward,
|
||||
e_SkinPreviewFacing_Left,
|
||||
e_SkinPreviewFacing_Right,
|
||||
};
|
||||
public:
|
||||
XUI_IMPLEMENT_CLASS(CXuiCtrlMinecraftSkinPreview, L"CXuiCtrlMinecraftSkinPreview", XUI_CLASS_LABEL)
|
||||
|
||||
CXuiCtrlMinecraftSkinPreview();
|
||||
virtual ~CXuiCtrlMinecraftSkinPreview() { };
|
||||
|
||||
void SetTexture(const wstring &url, TEXTURE_NAME backupTexture = TN_MOB_CHAR);
|
||||
void SetCapeTexture(const wstring &url) { m_capeTextureUrl = url; }
|
||||
void ResetRotation() { m_xRot = 0; m_yRot = 0; }
|
||||
void IncrementYRotation() { m_yRot = (m_yRot+4); if(m_yRot >= 180) m_yRot = -180; }
|
||||
void DecrementYRotation() { m_yRot = (m_yRot-4); if(m_yRot <= -180) m_yRot = 180; }
|
||||
void IncrementXRotation() { m_xRot = (m_xRot+2); if(m_xRot > 22) m_xRot = 22; }
|
||||
void DecrementXRotation() { m_xRot = (m_xRot-2); if(m_xRot < -22) m_xRot = -22; }
|
||||
void SetAutoRotate(bool autoRotate) { m_bAutoRotate = autoRotate; }
|
||||
void SetFacing(ESkinPreviewFacing facing, bool bAnimate = false);
|
||||
|
||||
void CycleNextAnimation();
|
||||
void CyclePreviousAnimation();
|
||||
|
||||
bool m_incXRot, m_decXRot;
|
||||
bool m_incYRot, m_decYRot;
|
||||
|
||||
protected:
|
||||
|
||||
XUI_BEGIN_MSG_MAP()
|
||||
XUI_ON_XM_INIT(OnInit)
|
||||
XUI_ON_XM_RENDER(OnRender)
|
||||
XUI_END_MSG_MAP()
|
||||
|
||||
HRESULT OnInit(XUIMessageInit* pInitData, BOOL& rfHandled);
|
||||
HRESULT OnRender(XUIMessageRender *pRenderData, BOOL &rfHandled);
|
||||
|
||||
private:
|
||||
void render(EntityRenderer *renderer, double x, double y, double z, float rot, float a);
|
||||
bool bindTexture(const wstring& urlTexture, int backupTexture);
|
||||
bool bindTexture(const wstring& urlTexture, const wstring& backupTexture);
|
||||
|
||||
BOOL m_bDirty;
|
||||
float m_fScale,m_fAlpha;
|
||||
|
||||
wstring m_customTextureUrl;
|
||||
TEXTURE_NAME m_backupTexture;
|
||||
wstring m_capeTextureUrl;
|
||||
unsigned int m_uiAnimOverrideBitmask;
|
||||
|
||||
float m_fScreenWidth,m_fScreenHeight;
|
||||
float m_fRawWidth,m_fRawHeight;
|
||||
|
||||
int m_yRot,m_xRot;
|
||||
|
||||
float m_bobTick;
|
||||
|
||||
float m_walkAnimSpeedO;
|
||||
float m_walkAnimSpeed;
|
||||
float m_walkAnimPos;
|
||||
|
||||
bool m_bAutoRotate, m_bRotatingLeft;
|
||||
BYTE m_rotateTick;
|
||||
float m_fTargetRotation, m_fOriginalRotation;
|
||||
int m_framesAnimatingRotation;
|
||||
bool m_bAnimatingToFacing;
|
||||
|
||||
float m_swingTime;
|
||||
|
||||
ESkinPreviewAnimations m_currentAnimation;
|
||||
//vector<Model::SKIN_BOX *> *m_pvAdditionalBoxes;
|
||||
vector<ModelPart *> *m_pvAdditionalModelParts;
|
||||
};
|
||||
356
Minecraft.Client/Common/XUI/XUI_Ctrl_MinecraftSlot.cpp
Normal file
356
Minecraft.Client/Common/XUI/XUI_Ctrl_MinecraftSlot.cpp
Normal file
@@ -0,0 +1,356 @@
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "..\..\ItemRenderer.h"
|
||||
#include "..\..\GameRenderer.h"
|
||||
#include "..\..\TileRenderer.h"
|
||||
#include "..\..\Lighting.h"
|
||||
#include "..\..\ScreenSizeCalculator.h"
|
||||
#include "..\..\LocalPlayer.h"
|
||||
#include "..\..\..\Minecraft.World\ItemInstance.h"
|
||||
#include "..\..\..\Minecraft.World\Item.h"
|
||||
#include "..\..\..\Minecraft.World\Tile.h"
|
||||
#include "XUI_Ctrl_MinecraftSlot.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// CXuiCtrlMinecraftSlot class
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// The xzp path icons for the leaderboard
|
||||
|
||||
LPCWSTR CXuiCtrlMinecraftSlot::xzpIcons[15]=
|
||||
{
|
||||
L"Graphics\\Leaderboard\\LeaderBoard_Icon_Skeleton.png",
|
||||
L"Graphics\\Leaderboard\\LeaderBoard_Icon_Creeper.png",
|
||||
L"Graphics\\Leaderboard\\LeaderBoard_Icon_SpiderJockey.png",
|
||||
L"Graphics\\Leaderboard\\LeaderBoard_Icon_Spider.png",
|
||||
L"Graphics\\Leaderboard\\LeaderBoard_Icon_Zombie.png",
|
||||
L"Graphics\\Leaderboard\\LeaderBoard_Icon_ZombiePigman.png",
|
||||
L"Graphics\\Leaderboard\\LeaderBoard_Icon_Swam.png",
|
||||
L"Graphics\\Leaderboard\\LeaderBoard_Icon_Walked.png",
|
||||
L"Graphics\\Leaderboard\\LeaderBoard_Icon_Fallen.png",
|
||||
L"Graphics\\Leaderboard\\LeaderBoard_Icon_Portal.png",
|
||||
L"Graphics\\Leaderboard\\LeaderBoard_Icon_Climbed.png",
|
||||
L"Graphics\\Leaderboard\\LeaderBoard_Icon_Ghast.png",
|
||||
L"Graphics\\Leaderboard\\LeaderBoard_Icon_Slime.png",
|
||||
L"Graphics\\CraftIcons\\icon_structures.png",
|
||||
L"Graphics\\CraftIcons\\icon_tools.png",
|
||||
};
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
CXuiCtrlMinecraftSlot::CXuiCtrlMinecraftSlot() :
|
||||
//m_hBrush(NULL),
|
||||
m_bDirty(FALSE),
|
||||
m_iPassThroughDataAssociation(0),
|
||||
m_iPassThroughIdAssociation(0),
|
||||
m_fScale(1.0f),
|
||||
m_fAlpha(1.0f),
|
||||
m_iID(0),
|
||||
m_iCount(0),
|
||||
m_iAuxVal(0),
|
||||
m_bDecorations(false),
|
||||
m_isFoil(false),
|
||||
m_popTime(0)
|
||||
{
|
||||
m_pItemRenderer = new ItemRenderer();
|
||||
m_item = nullptr;
|
||||
|
||||
m_bScreenWidthSetup = false;
|
||||
|
||||
Minecraft *pMinecraft=Minecraft::GetInstance();
|
||||
|
||||
if(pMinecraft != NULL)
|
||||
{
|
||||
m_fScreenWidth=(float)pMinecraft->width_phys;
|
||||
m_fScreenHeight=(float)pMinecraft->height_phys;
|
||||
m_bScreenWidthSetup = true;
|
||||
}
|
||||
}
|
||||
|
||||
CXuiCtrlMinecraftSlot::~CXuiCtrlMinecraftSlot()
|
||||
{
|
||||
delete m_pItemRenderer;
|
||||
}
|
||||
|
||||
VOID CXuiCtrlMinecraftSlot::SetPassThroughDataAssociation(unsigned int iID, unsigned int iData)
|
||||
{
|
||||
m_item = nullptr;
|
||||
m_iPassThroughIdAssociation = iID;
|
||||
m_iPassThroughDataAssociation = iData;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
HRESULT CXuiCtrlMinecraftSlot::OnGetSourceImage(XUIMessageGetSourceImage* pData, BOOL& rfHandled)
|
||||
{
|
||||
XUIMessage Message;
|
||||
CustomMessage_GetSlotItem_Struct MsgGetSlotItem;
|
||||
HRESULT hr;
|
||||
HXUIOBJ hObj;
|
||||
|
||||
CustomMessage_GetSlotItem(&Message, &MsgGetSlotItem, m_iPassThroughIdAssociation, m_iPassThroughDataAssociation);
|
||||
|
||||
hr = GetParent(&hObj);
|
||||
|
||||
if (HRESULT_SUCCEEDED(hr))
|
||||
{
|
||||
hr = XuiBubbleMessage(hObj, &Message);
|
||||
|
||||
if(hr == XUI_ERR_SOURCEDATA_ITEM)
|
||||
{
|
||||
// Go up the parent chain one more
|
||||
HXUIOBJ hParent;
|
||||
hr = XuiElementGetParent(hObj,&hParent);
|
||||
hr = XuiBubbleMessage(hParent, &Message);
|
||||
}
|
||||
|
||||
if (Message.bHandled)
|
||||
{
|
||||
pData->szPath = MsgGetSlotItem.szPath;
|
||||
pData->bDirty = MsgGetSlotItem.bDirty;
|
||||
|
||||
if(MsgGetSlotItem.item != NULL)
|
||||
{
|
||||
m_item = MsgGetSlotItem.item;
|
||||
m_iID = m_item->id;
|
||||
m_iPad = GET_SLOTDISPLAY_USERINDEX_FROM_DATA_BITMASK(MsgGetSlotItem.iDataBitField);
|
||||
m_fAlpha = ((float)GET_SLOTDISPLAY_ALPHA_FROM_DATA_BITMASK(MsgGetSlotItem.iDataBitField))/31.0f;
|
||||
m_bDecorations = GET_SLOTDISPLAY_DECORATIONS_FROM_DATA_BITMASK(MsgGetSlotItem.iDataBitField);
|
||||
m_fScale = ((float)GET_SLOTDISPLAY_SCALE_FROM_DATA_BITMASK(MsgGetSlotItem.iDataBitField))/10.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_iID = GET_SLOTDISPLAY_ID_FROM_ITEM_BITMASK(MsgGetSlotItem.iItemBitField);
|
||||
|
||||
// if the id is greater than or equal to 32000, then it's an xzp icon, not a game icon
|
||||
if(m_iID<32000)
|
||||
{
|
||||
// 4J Stu - Some parent controls may overide this, others will leave it as what we passed in
|
||||
|
||||
m_iPad = GET_SLOTDISPLAY_USERINDEX_FROM_DATA_BITMASK(MsgGetSlotItem.iDataBitField);
|
||||
m_fAlpha = ((float)GET_SLOTDISPLAY_ALPHA_FROM_DATA_BITMASK(MsgGetSlotItem.iDataBitField))/31.0f;
|
||||
m_bDecorations = GET_SLOTDISPLAY_DECORATIONS_FROM_DATA_BITMASK(MsgGetSlotItem.iDataBitField);
|
||||
m_iCount = GET_SLOTDISPLAY_COUNT_FROM_DATA_BITMASK(MsgGetSlotItem.iDataBitField);
|
||||
m_fScale = ((float)GET_SLOTDISPLAY_SCALE_FROM_DATA_BITMASK(MsgGetSlotItem.iDataBitField))/10.0f;
|
||||
m_popTime = GET_SLOTDISPLAY_POPTIME_FROM_DATA_BITMASK(MsgGetSlotItem.iDataBitField);
|
||||
|
||||
m_iAuxVal = GET_SLOTDISPLAY_AUXVAL_FROM_ITEM_BITMASK(MsgGetSlotItem.iItemBitField);
|
||||
|
||||
//m_iID = iID;
|
||||
|
||||
m_isFoil = GET_SLOTDISPLAY_FOIL_FROM_ITEM_BITMASK(MsgGetSlotItem.iItemBitField);
|
||||
}
|
||||
else
|
||||
{
|
||||
pData->szPath = xzpIcons[m_iID-32000];
|
||||
}
|
||||
|
||||
if(m_item != NULL && (m_item->id != m_iID || m_item->getAuxValue() != m_iAuxVal || m_item->GetCount() != m_iCount) ) m_item = nullptr;
|
||||
}
|
||||
|
||||
|
||||
rfHandled = TRUE;
|
||||
return hr;
|
||||
}
|
||||
else
|
||||
{
|
||||
pData->szPath = L"";
|
||||
}
|
||||
}
|
||||
|
||||
pData->bDirty = m_bDirty;
|
||||
m_bDirty = FALSE;
|
||||
rfHandled = TRUE;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
HRESULT CXuiCtrlMinecraftSlot::OnInit(XUIMessageInit* pInitData, BOOL& rfHandled)
|
||||
{
|
||||
//DWORD dwPropId;
|
||||
HRESULT hr=S_OK;
|
||||
return hr;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
HRESULT CXuiCtrlMinecraftSlot::OnRender(XUIMessageRender *pRenderData, BOOL &bHandled )
|
||||
{
|
||||
// Force an update of the id
|
||||
XUIMessage Message;
|
||||
XUIMessageGetSourceImage MsgGetImage;
|
||||
HRESULT hr;
|
||||
XuiMessageGetSourceImage(&Message, &MsgGetImage, m_iPassThroughIdAssociation, m_iPassThroughDataAssociation, FALSE);
|
||||
hr = XuiSendMessage(m_hObj, &Message);
|
||||
|
||||
// We cannot have an Item with id 0
|
||||
if(m_item != NULL || (m_iID > 0 && m_iID<32000) )
|
||||
{
|
||||
HXUIDC hDC = pRenderData->hDC;
|
||||
CXuiControl xuiControl(m_hObj);
|
||||
if(m_item == NULL) m_item = shared_ptr<ItemInstance>( new ItemInstance(m_iID, m_iCount, m_iAuxVal) );
|
||||
|
||||
// build and render with the game call
|
||||
|
||||
RenderManager.Set_matrixDirty();
|
||||
|
||||
Minecraft *pMinecraft=Minecraft::GetInstance();
|
||||
|
||||
D3DXMATRIX matrix;
|
||||
xuiControl.GetFullXForm(&matrix);
|
||||
float bwidth,bheight;
|
||||
xuiControl.GetBounds(&bwidth,&bheight);
|
||||
|
||||
float x = matrix._41;
|
||||
float y = matrix._42;
|
||||
|
||||
// Base scale on height of this control, compared to height of what the item renderer normally renders (16 pixels high). Potentially
|
||||
// we might want separate x & y scales here
|
||||
|
||||
float scaleX = bwidth / 16.0f;
|
||||
float scaleY = bheight / 16.0f;
|
||||
|
||||
// apply any scale in the matrix too
|
||||
scaleX *= matrix._11;
|
||||
scaleY *= matrix._22;
|
||||
|
||||
// Annoyingly, XUI renders everything to a z of 0 so if we want to render anything that needs the z-buffer on top of it, then we need to clear it.
|
||||
// Clear just the region required for this control.
|
||||
D3DRECT clearRect;
|
||||
clearRect.x1 = (int)(matrix._41) - 2;
|
||||
clearRect.y1 = (int)(matrix._42) - 2;
|
||||
clearRect.x2 = (int)(matrix._41 + ( bwidth * matrix._11 )) + 2;
|
||||
clearRect.y2 = (int)(matrix._42 + ( bheight * matrix._22 )) + 2;
|
||||
|
||||
if(!m_bScreenWidthSetup)
|
||||
{
|
||||
Minecraft *pMinecraft=Minecraft::GetInstance();
|
||||
if(pMinecraft != NULL)
|
||||
{
|
||||
m_fScreenWidth=(float)pMinecraft->width_phys;
|
||||
m_fScreenHeight=(float)pMinecraft->height_phys;
|
||||
m_bScreenWidthSetup = true;
|
||||
}
|
||||
}
|
||||
|
||||
RenderManager.Clear(GL_DEPTH_BUFFER_BIT, &clearRect);
|
||||
// glClear(GL_DEPTH_BUFFER_BIT);
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glOrtho(0, m_fScreenWidth, m_fScreenHeight, 0, 1000, 3000);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
glTranslatef(0, 0, -2000);
|
||||
|
||||
|
||||
glEnable(GL_RESCALE_NORMAL);
|
||||
glPushMatrix();
|
||||
glRotatef(120, 1, 0, 0);
|
||||
Lighting::turnOn();
|
||||
glPopMatrix();
|
||||
|
||||
|
||||
|
||||
//Make sure that pMinecraft->player is the correct player so that player specific rendering
|
||||
// eg clock and compass, are rendered correctly
|
||||
shared_ptr<MultiplayerLocalPlayer> oldPlayer = pMinecraft->player;
|
||||
|
||||
if( m_iPad >= 0 && m_iPad < XUSER_MAX_COUNT ) pMinecraft->player = pMinecraft->localplayers[m_iPad];
|
||||
|
||||
float pop = m_popTime;
|
||||
if (pop > 0)
|
||||
{
|
||||
glPushMatrix();
|
||||
float squeeze = 1 + pop / (float) Inventory::POP_TIME_DURATION;
|
||||
float sx = x;
|
||||
float sy = y;
|
||||
float sxoffs = 8 * scaleX;
|
||||
float syoffs = 12 * scaleY;
|
||||
glTranslatef((float)(sx + sxoffs), (float)(sy + syoffs), 0);
|
||||
glScalef(1 / squeeze, (squeeze + 1) / 2, 1);
|
||||
glTranslatef((float)-(sx + sxoffs), (float)-(sy + syoffs), 0);
|
||||
}
|
||||
|
||||
m_pItemRenderer->renderAndDecorateItem(pMinecraft->font, pMinecraft->textures, m_item, x, y,scaleX,scaleY,m_fAlpha,m_isFoil,false);
|
||||
|
||||
if (pop > 0)
|
||||
{
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
if(m_bDecorations)
|
||||
{
|
||||
if((scaleX!=1.0f) ||(scaleY!=1.0f))
|
||||
{
|
||||
glPushMatrix();
|
||||
glScalef(scaleX, scaleY, 1.0f);
|
||||
int iX= (int)(0.5f+((float)x)/scaleX);
|
||||
int iY= (int)(0.5f+((float)y)/scaleY);
|
||||
|
||||
m_pItemRenderer->renderGuiItemDecorations(pMinecraft->font, pMinecraft->textures, m_item, iX, iY, m_fAlpha);
|
||||
glPopMatrix();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pItemRenderer->renderGuiItemDecorations(pMinecraft->font, pMinecraft->textures, m_item, (int)x, (int)y, m_fAlpha);
|
||||
}
|
||||
}
|
||||
|
||||
pMinecraft->player = oldPlayer;
|
||||
|
||||
Lighting::turnOff();
|
||||
glDisable(GL_RESCALE_NORMAL);
|
||||
|
||||
XuiRenderRestoreState(hDC);
|
||||
|
||||
bHandled = TRUE;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
void CXuiCtrlMinecraftSlot::SetIcon(int iPad, int iId,int iAuxVal, int iCount, int iScale, unsigned int uiAlpha,bool bDecorations,BOOL bShow, bool isFoil)
|
||||
{
|
||||
m_item = nullptr;
|
||||
m_iID=iId;
|
||||
m_iAuxVal=iAuxVal;
|
||||
|
||||
// aux value for diggers can go as high as 1561
|
||||
//const _Tier *_Tier::DIAMOND = new _Tier(3, 1561, 8, 3); //
|
||||
// setMaxDamage(tier->getUses());
|
||||
|
||||
// int ItemInstance::getDamageValue()
|
||||
// {
|
||||
// return auxValue;
|
||||
// }
|
||||
|
||||
|
||||
if( (m_iAuxVal & 0xFF) == 0xFF) // 4J Stu - If the aux value is set to match any
|
||||
m_iAuxVal = 0;
|
||||
|
||||
m_iCount=iCount;
|
||||
m_fScale = (float)(iScale)/10.0f;
|
||||
//m_uiAlpha=uiAlpha;
|
||||
m_fAlpha =((float)(uiAlpha)) / 255.0f;
|
||||
m_bDecorations = bDecorations;
|
||||
// mif(bDecorations) m_iDecorations=1;
|
||||
// else m_iDecorations=0;
|
||||
|
||||
m_iPad = iPad;
|
||||
|
||||
m_isFoil = isFoil;
|
||||
|
||||
XuiElementSetShow(m_hObj,bShow);
|
||||
}
|
||||
|
||||
void CXuiCtrlMinecraftSlot::SetIcon(int iPad, shared_ptr<ItemInstance> item, int iScale, unsigned int uiAlpha,bool bDecorations, BOOL bShow)
|
||||
{
|
||||
m_item = item;
|
||||
m_isFoil = item->isFoil();
|
||||
m_iPad = iPad;
|
||||
m_fScale = (float)(iScale)/10.0f;
|
||||
m_fAlpha =((float)(uiAlpha)) / 31;
|
||||
m_bDecorations = bDecorations;
|
||||
m_bDirty = TRUE;
|
||||
XuiElementSetShow(m_hObj,bShow);
|
||||
}
|
||||
59
Minecraft.Client/Common/XUI/XUI_Ctrl_MinecraftSlot.h
Normal file
59
Minecraft.Client/Common/XUI/XUI_Ctrl_MinecraftSlot.h
Normal file
@@ -0,0 +1,59 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <XuiApp.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
class TileRenderer;
|
||||
class ItemRenderer;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// CXuiCtrlMinecraftSlot class
|
||||
//-----------------------------------------------------------------------------
|
||||
class CXuiCtrlMinecraftSlot : public CXuiControlImpl
|
||||
{
|
||||
public:
|
||||
XUI_IMPLEMENT_CLASS(CXuiCtrlMinecraftSlot, L"CXuiCtrlMinecraftSlot", XUI_CLASS_LABEL)
|
||||
|
||||
VOID SetPassThroughDataAssociation(unsigned int iID, unsigned int iData);
|
||||
CXuiCtrlMinecraftSlot();
|
||||
virtual ~CXuiCtrlMinecraftSlot();
|
||||
|
||||
void renderGuiItem(Font *font, Textures *textures,ItemInstance *item, int x, int y);
|
||||
void RenderItem();
|
||||
void SetIcon(int iPad, int iId,int iAuxVal, int iCount, int iScale, unsigned int uiAlpha,bool bDecorations,BOOL bShow, bool isFoil);
|
||||
void SetIcon(int iPad, shared_ptr<ItemInstance> item, int iScale, unsigned int uiAlpha,bool bDecorations, BOOL bShow=TRUE);
|
||||
|
||||
protected:
|
||||
|
||||
XUI_BEGIN_MSG_MAP()
|
||||
XUI_ON_XM_INIT(OnInit)
|
||||
XUI_ON_XM_GET_SOURCE_IMAGE(OnGetSourceImage)
|
||||
XUI_ON_XM_RENDER(OnRender)
|
||||
XUI_END_MSG_MAP()
|
||||
|
||||
HRESULT OnGetSourceImage(XUIMessageGetSourceImage* pData, BOOL& rfHandled);
|
||||
HRESULT OnInit(XUIMessageInit* pInitData, BOOL& rfHandled);
|
||||
HRESULT OnRender(XUIMessageRender *pRenderData, BOOL &rfHandled);
|
||||
|
||||
private:
|
||||
shared_ptr<ItemInstance> m_item;
|
||||
BOOL m_bDirty;
|
||||
INT m_iPassThroughDataAssociation;
|
||||
INT m_iPassThroughIdAssociation;
|
||||
float m_fScale,m_fAlpha;
|
||||
int m_iPad;
|
||||
int m_iID;
|
||||
int m_iCount;
|
||||
int m_iAuxVal;
|
||||
bool m_bDecorations;
|
||||
bool m_isFoil;
|
||||
int m_popTime;
|
||||
|
||||
bool m_bScreenWidthSetup;
|
||||
float m_fScreenWidth,m_fScreenHeight;
|
||||
ItemRenderer *m_pItemRenderer;
|
||||
|
||||
static LPCWSTR xzpIcons[15];
|
||||
};
|
||||
71
Minecraft.Client/Common/XUI/XUI_Ctrl_MobEffect.cpp
Normal file
71
Minecraft.Client/Common/XUI/XUI_Ctrl_MobEffect.cpp
Normal file
@@ -0,0 +1,71 @@
|
||||
#include "stdafx.h"
|
||||
#include "XUI_Ctrl_MobEffect.h"
|
||||
|
||||
LPCWSTR CXuiCtrlMobEffect::iconFrameNames[MobEffect::e_MobEffectIcon_COUNT]=
|
||||
{
|
||||
L"Normal",
|
||||
L"Blindness",
|
||||
L"Fire_Resistance",
|
||||
L"Haste",
|
||||
L"Hunger",
|
||||
L"Invisibility",
|
||||
L"Jump_Boost",
|
||||
L"Mining_Fatigue",
|
||||
L"Nausea",
|
||||
L"Night_Vision",
|
||||
L"Poison",
|
||||
L"Regeneration",
|
||||
L"Resistance",
|
||||
L"Slowness",
|
||||
L"Speed",
|
||||
L"Strength",
|
||||
L"Water_Breathing",
|
||||
L"Weakness",
|
||||
};
|
||||
|
||||
HRESULT CXuiCtrlMobEffect::OnInit(XUIMessageInit* pInitData, BOOL& rfHandled)
|
||||
{
|
||||
m_icon = MobEffect::e_MobEffectIcon_None;
|
||||
m_name = L"";
|
||||
m_duration = L"";
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CXuiCtrlMobEffect::OnGetSourceDataText(XUIMessageGetSourceText *pGetSourceTextData, BOOL& bHandled)
|
||||
{
|
||||
if( pGetSourceTextData->iData == 1 )
|
||||
{
|
||||
pGetSourceTextData->szText = m_name.c_str();
|
||||
pGetSourceTextData->bDisplay = TRUE;
|
||||
|
||||
if(FAILED(PlayVisualRange(iconFrameNames[m_icon],NULL,iconFrameNames[m_icon])))
|
||||
{
|
||||
PlayVisualRange(L"Normal",NULL,L"Normal");
|
||||
}
|
||||
|
||||
bHandled = TRUE;
|
||||
}
|
||||
else if( pGetSourceTextData->iData == 2 )
|
||||
{
|
||||
pGetSourceTextData->szText = m_duration.c_str();
|
||||
pGetSourceTextData->bDisplay = TRUE;
|
||||
|
||||
bHandled = TRUE;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void CXuiCtrlMobEffect::setIcon(MobEffect::EMobEffectIcon icon)
|
||||
{
|
||||
m_icon = icon;
|
||||
}
|
||||
|
||||
void CXuiCtrlMobEffect::setName(const wstring &name)
|
||||
{
|
||||
m_name = name;
|
||||
}
|
||||
|
||||
void CXuiCtrlMobEffect::setDuration(const wstring &duration)
|
||||
{
|
||||
m_duration = duration;
|
||||
}
|
||||
31
Minecraft.Client/Common/XUI/XUI_Ctrl_MobEffect.h
Normal file
31
Minecraft.Client/Common/XUI/XUI_Ctrl_MobEffect.h
Normal file
@@ -0,0 +1,31 @@
|
||||
#pragma once
|
||||
using namespace std;
|
||||
|
||||
#include "..\..\..\Minecraft.World\MobEffect.h"
|
||||
|
||||
class CXuiCtrlMobEffect : public CXuiControlImpl
|
||||
{
|
||||
public:
|
||||
XUI_IMPLEMENT_CLASS(CXuiCtrlMobEffect, L"CXuiCtrlMobEffect", XUI_CLASS_CONTROL)
|
||||
|
||||
protected:
|
||||
XUI_BEGIN_MSG_MAP()
|
||||
XUI_ON_XM_INIT(OnInit)
|
||||
XUI_ON_XM_GET_SOURCE_TEXT(OnGetSourceDataText)
|
||||
XUI_END_MSG_MAP()
|
||||
|
||||
HRESULT OnInit(XUIMessageInit* pInitData, BOOL& rfHandled);
|
||||
HRESULT OnGetSourceDataText(XUIMessageGetSourceText *pGetSourceTextData, BOOL& bHandled);
|
||||
|
||||
public:
|
||||
void setIcon(MobEffect::EMobEffectIcon icon);
|
||||
void setName(const wstring &name);
|
||||
void setDuration(const wstring &duration);
|
||||
|
||||
private:
|
||||
MobEffect::EMobEffectIcon m_icon;
|
||||
wstring m_name;
|
||||
wstring m_duration;
|
||||
|
||||
static LPCWSTR iconFrameNames[MobEffect::e_MobEffectIcon_COUNT];
|
||||
};
|
||||
109
Minecraft.Client/Common/XUI/XUI_Ctrl_PassThroughList.cpp
Normal file
109
Minecraft.Client/Common/XUI/XUI_Ctrl_PassThroughList.cpp
Normal file
@@ -0,0 +1,109 @@
|
||||
#include "stdafx.h"
|
||||
#include "XUI_Ctrl_PassThroughList.h"
|
||||
|
||||
HRESULT CXuiCtrlPassThroughList::OnInit(XUIMessageInit *pInitData, BOOL& bHandled)
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CXuiCtrlPassThroughList::OnKeyDown(XUIMessageInput* pInputData, BOOL& bHandled)
|
||||
{
|
||||
XUIMessage message;
|
||||
XUIMessageInput messageInput;
|
||||
HRESULT hr;
|
||||
HXUIOBJ hObj;
|
||||
|
||||
XuiMessageInput( &message, &messageInput, XUI_KEYDOWN, pInputData->dwKeyCode, pInputData->wch, pInputData->dwFlags, pInputData->UserIndex );
|
||||
|
||||
hr = GetParent(&hObj);
|
||||
|
||||
if (HRESULT_SUCCEEDED(hr))
|
||||
{
|
||||
hr = XuiBubbleMessage(hObj, &message);
|
||||
|
||||
if (message.bHandled)
|
||||
{
|
||||
bHandled = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
// Gets called every frame
|
||||
HRESULT CXuiCtrlPassThroughList::OnGetSourceDataText(XUIMessageGetSourceText *pGetSourceTextData,BOOL& bHandled)
|
||||
{
|
||||
XUIMessage Message;
|
||||
XUIMessageGetSourceText MsgGetText;
|
||||
HRESULT hr;
|
||||
HXUIOBJ hObj;
|
||||
|
||||
|
||||
XuiMessageGetSourceText(&Message, &MsgGetText, pGetSourceTextData->iItem, pGetSourceTextData->iData, pGetSourceTextData->bItemData);
|
||||
|
||||
hr = GetParent(&hObj);
|
||||
|
||||
if (HRESULT_SUCCEEDED(hr))
|
||||
{
|
||||
hr = XuiBubbleMessage(hObj, &Message);
|
||||
|
||||
if (Message.bHandled)
|
||||
{
|
||||
pGetSourceTextData->szText = MsgGetText.szText;
|
||||
bHandled = TRUE;
|
||||
}
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
// Gets called every frame
|
||||
HRESULT CXuiCtrlPassThroughList::OnGetSourceDataImage(XUIMessageGetSourceImage *pGetSourceImageData,BOOL& bHandled)
|
||||
{
|
||||
XUIMessage Message;
|
||||
XUIMessageGetSourceImage MsgGetImage;
|
||||
HRESULT hr;
|
||||
HXUIOBJ hObj;
|
||||
|
||||
|
||||
XuiMessageGetSourceImage(&Message, &MsgGetImage, pGetSourceImageData->iItem, pGetSourceImageData->iData, pGetSourceImageData->bItemData);
|
||||
|
||||
hr = GetParent(&hObj);
|
||||
|
||||
if (HRESULT_SUCCEEDED(hr))
|
||||
{
|
||||
hr = XuiBubbleMessage(hObj, &Message);
|
||||
|
||||
if (Message.bHandled)
|
||||
{
|
||||
pGetSourceImageData->szPath = MsgGetImage.szPath;
|
||||
bHandled = TRUE;
|
||||
}
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CXuiCtrlPassThroughList::OnGetItemCountAll(XUIMessageGetItemCount *pGetItemCountData,BOOL& bHandled)
|
||||
{
|
||||
XUIMessage Message;
|
||||
XUIMessageGetItemCount MsgGetItemCountAll;
|
||||
HRESULT hr;
|
||||
HXUIOBJ hObj;
|
||||
|
||||
|
||||
XuiMessageGetItemCount(&Message, &MsgGetItemCountAll, XUI_ITEMCOUNT_ALL);
|
||||
|
||||
hr = GetParent(&hObj);
|
||||
|
||||
if (HRESULT_SUCCEEDED(hr))
|
||||
{
|
||||
hr = XuiBubbleMessage(hObj, &Message);
|
||||
|
||||
if (Message.bHandled)
|
||||
{
|
||||
pGetItemCountData->cItems = MsgGetItemCountAll.cItems;
|
||||
bHandled = TRUE;
|
||||
}
|
||||
}
|
||||
bHandled = TRUE;
|
||||
return S_OK;
|
||||
}
|
||||
28
Minecraft.Client/Common/XUI/XUI_Ctrl_PassthroughList.h
Normal file
28
Minecraft.Client/Common/XUI/XUI_Ctrl_PassthroughList.h
Normal file
@@ -0,0 +1,28 @@
|
||||
#pragma once
|
||||
|
||||
// 4J Stu - A list control that responds by sending the message to it's parent and
|
||||
// returning what the parent returns
|
||||
|
||||
class CXuiCtrlPassThroughList : public CXuiListImpl
|
||||
{
|
||||
public:
|
||||
XUI_IMPLEMENT_CLASS(CXuiCtrlPassThroughList, L"CXuiCtrlPassThroughList", XUI_CLASS_LIST);
|
||||
protected:
|
||||
|
||||
XUI_BEGIN_MSG_MAP()
|
||||
XUI_ON_XM_INIT(OnInit)
|
||||
XUI_ON_XM_KEYDOWN(OnKeyDown)
|
||||
XUI_ON_XM_GET_SOURCE_TEXT(OnGetSourceDataText)
|
||||
XUI_ON_XM_GET_SOURCE_IMAGE(OnGetSourceDataImage)
|
||||
XUI_ON_XM_GET_ITEMCOUNT_ALL(OnGetItemCountAll)
|
||||
XUI_END_MSG_MAP()
|
||||
|
||||
|
||||
HRESULT OnInit( XUIMessageInit* pInitData, BOOL& bHandled );
|
||||
HRESULT OnKeyDown(XUIMessageInput* pInputData, BOOL& bHandled);
|
||||
HRESULT OnGetSourceDataText(XUIMessageGetSourceText *pGetSourceTextData, BOOL& bHandled);
|
||||
HRESULT OnGetSourceDataImage(XUIMessageGetSourceImage *pGetSourceImageData,BOOL& bHandled);
|
||||
HRESULT OnGetItemCountAll(XUIMessageGetItemCount *pGetItemCountData, BOOL& bHandled);
|
||||
|
||||
|
||||
};
|
||||
22
Minecraft.Client/Common/XUI/XUI_Ctrl_ProgressCtrlBase.cpp
Normal file
22
Minecraft.Client/Common/XUI/XUI_Ctrl_ProgressCtrlBase.cpp
Normal file
@@ -0,0 +1,22 @@
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "XUI_Ctrl_ProgressCtrlBase.h"
|
||||
|
||||
HRESULT CXuiCtrlProgressCtrlBase::OnGetSourceDataText(XUIMessageGetSourceText *pGetSourceTextData, BOOL& bHandled)
|
||||
{
|
||||
// The Xui backend calls GetSourceDataText every frame to get the text for the indexed label
|
||||
// We don't want to change the label, but take this opportunity to send out a message to ourself
|
||||
// to update the value of the progress bar
|
||||
this->SetValue( GetValue() );
|
||||
|
||||
int min, max;
|
||||
this->GetRange( &min, &max );
|
||||
this->SetRange( min, max );
|
||||
|
||||
pGetSourceTextData->szText = L"";
|
||||
pGetSourceTextData->bDisplay = FALSE;
|
||||
|
||||
bHandled = TRUE;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
11
Minecraft.Client/Common/XUI/XUI_Ctrl_ProgressCtrlBase.h
Normal file
11
Minecraft.Client/Common/XUI/XUI_Ctrl_ProgressCtrlBase.h
Normal file
@@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
class CXuiCtrlProgressCtrlBase : public CXuiProgressBar, public CXuiElementImplBase
|
||||
{
|
||||
public:
|
||||
HRESULT OnGetSourceDataText(XUIMessageGetSourceText *pGetSourceTextData, BOOL& bHandled);
|
||||
|
||||
// Override these in the derived classes to return the values to be displayed on the control
|
||||
virtual int GetValue() = 0;
|
||||
virtual void GetRange(int *pnRangeMin, int *pnRangeMax) = 0;
|
||||
};
|
||||
174
Minecraft.Client/Common/XUI/XUI_Ctrl_SliderWrapper.cpp
Normal file
174
Minecraft.Client/Common/XUI/XUI_Ctrl_SliderWrapper.cpp
Normal file
@@ -0,0 +1,174 @@
|
||||
#include "stdafx.h"
|
||||
#include "XUI_Ctrl_SliderWrapper.h"
|
||||
|
||||
#define NO_SOUND_TIMER 0
|
||||
|
||||
HRESULT CXuiCtrlSliderWrapper::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
|
||||
{
|
||||
VOID *pObj;
|
||||
HXUIOBJ hObjChild;
|
||||
|
||||
XuiElementGetChildById(m_hObj,L"FocusSink",&hObjChild);
|
||||
XuiObjectFromHandle( hObjChild, &pObj );
|
||||
m_pFocusSink = (CXuiControl *)pObj;
|
||||
|
||||
XuiElementGetChildById(m_hObj,L"XuiSlider",&hObjChild);
|
||||
XuiObjectFromHandle( hObjChild, &pObj );
|
||||
m_pSlider = (CXuiSlider *)pObj;
|
||||
|
||||
m_sliderActive = false;
|
||||
m_bDisplayVal=true;
|
||||
m_bPlaySound=false; // make this false to avoid a sound being played in the first setting of the slider value in a scene
|
||||
XuiSetTimer( m_hObj,NO_SOUND_TIMER,50);
|
||||
bHandled = TRUE;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CXuiCtrlSliderWrapper::OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandled)
|
||||
{
|
||||
ui.AnimateKeyPress(pInputData->UserIndex, pInputData->dwKeyCode);
|
||||
|
||||
// switch(pInputData->dwKeyCode)
|
||||
// {
|
||||
|
||||
// case VK_PAD_A:
|
||||
// // 4J-PB - IGNORE !
|
||||
// if(m_sliderActive)
|
||||
// {
|
||||
// m_pFocusSink->SetFocus(pInputData->UserIndex);
|
||||
// m_sliderActive = false;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// m_pSlider->SetFocus(pInputData->UserIndex);
|
||||
// m_sliderActive = true;
|
||||
// }
|
||||
// rfHandled = TRUE;
|
||||
//
|
||||
// break;
|
||||
// default:
|
||||
// m_pSlider->SetFocus(pInputData->UserIndex);
|
||||
// m_sliderActive = false;
|
||||
// break;
|
||||
//
|
||||
// }
|
||||
//
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CXuiCtrlSliderWrapper::OnNotifyValueChanged (HXUIOBJ hObjSource, XUINotifyValueChanged* pValueChangedData, BOOL& rfHandled)
|
||||
{
|
||||
XUIMessage Message;
|
||||
XUINotify Notify;
|
||||
XUINotifyValueChanged MsgValueChanged;
|
||||
HRESULT hr;
|
||||
HXUIOBJ hObj;
|
||||
|
||||
if(m_bPlaySound)
|
||||
{
|
||||
m_bPlaySound=false;
|
||||
CXuiSceneBase::PlayUISFX(eSFX_Scroll);
|
||||
XuiSetTimer( m_hObj,NO_SOUND_TIMER,150);
|
||||
}
|
||||
|
||||
//app.DebugPrintf("Slider val changed - %d\n",pValueChangedData->nValue);
|
||||
|
||||
XuiNotifyValueChanged(&Message,&Notify,&MsgValueChanged,hObjSource,pValueChangedData->nValue);
|
||||
|
||||
hr = GetParent(&hObj);
|
||||
|
||||
if (HRESULT_SUCCEEDED(hr))
|
||||
{
|
||||
hr = XuiBubbleMessage(hObj, &Message);
|
||||
rfHandled = TRUE;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
HRESULT CXuiCtrlSliderWrapper::OnTimer(XUIMessageTimer *pData,BOOL& rfHandled)
|
||||
{
|
||||
if(pData->nId==NO_SOUND_TIMER)
|
||||
{
|
||||
XuiKillTimer(m_hObj,NO_SOUND_TIMER);
|
||||
m_bPlaySound=true;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CXuiCtrlSliderWrapper::SetValue( int nValue )
|
||||
{
|
||||
CXuiCtrlSliderWrapper *pThis;
|
||||
HRESULT hr = XuiObjectFromHandle(m_hObj, (void **) &pThis);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
pThis->m_pSlider->SetValue(nValue);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CXuiCtrlSliderWrapper::SetValueDisplay( BOOL bShow )
|
||||
{
|
||||
CXuiCtrlSliderWrapper *pThis;
|
||||
HXUIOBJ hVisual,hText;
|
||||
HRESULT hr = XuiObjectFromHandle(m_hObj, (void **) &pThis);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
hr=XuiControlGetVisual(pThis->m_pSlider->m_hObj,&hVisual);
|
||||
hr=XuiElementGetChildById(hVisual,L"Text_Value",&hText);
|
||||
|
||||
if(hText!=NULL)
|
||||
{
|
||||
XuiElementSetShow(hText,bShow);
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
LPCWSTR CXuiCtrlSliderWrapper::GetText( )
|
||||
{
|
||||
CXuiCtrlSliderWrapper *pThis;
|
||||
HRESULT hr = XuiObjectFromHandle(m_hObj, (void **) &pThis);
|
||||
if (FAILED(hr))
|
||||
return NULL;
|
||||
return pThis->m_pSlider->GetText();
|
||||
//return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CXuiCtrlSliderWrapper::SetText(LPCWSTR text , int iDataAssoc)
|
||||
{
|
||||
CXuiCtrlSliderWrapper *pThis;
|
||||
HRESULT hr = XuiObjectFromHandle(m_hObj, (void **) &pThis);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
// if there's a data assoc value, find the right control for it
|
||||
if(iDataAssoc!=0)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
pThis->m_pSlider->SetText(text);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HXUIOBJ CXuiCtrlSliderWrapper::GetSlider()
|
||||
{
|
||||
CXuiCtrlSliderWrapper *pThis;
|
||||
HRESULT hr = XuiObjectFromHandle(m_hObj, (void **) &pThis);
|
||||
if (FAILED(hr))
|
||||
return NULL;
|
||||
return pThis->m_pSlider->m_hObj;
|
||||
}
|
||||
|
||||
HRESULT CXuiCtrlSliderWrapper::SetRange( int nRangeMin, int nRangeMax)
|
||||
{
|
||||
CXuiCtrlSliderWrapper *pThis;
|
||||
HRESULT hr = XuiObjectFromHandle(m_hObj, (void **) &pThis);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
pThis->m_pSlider->SetRange(nRangeMin, nRangeMax);
|
||||
return S_OK;
|
||||
}
|
||||
38
Minecraft.Client/Common/XUI/XUI_Ctrl_SliderWrapper.h
Normal file
38
Minecraft.Client/Common/XUI/XUI_Ctrl_SliderWrapper.h
Normal file
@@ -0,0 +1,38 @@
|
||||
#pragma once
|
||||
|
||||
class CXuiCtrlSliderWrapper : public CXuiSceneImpl
|
||||
{
|
||||
private:
|
||||
CXuiSlider *m_pSlider;
|
||||
CXuiControl *m_pFocusSink;
|
||||
bool m_sliderActive;
|
||||
bool m_bDisplayVal;
|
||||
bool m_bPlaySound;
|
||||
|
||||
protected:
|
||||
// Message map. Here we tie messages to message handlers.
|
||||
XUI_BEGIN_MSG_MAP()
|
||||
XUI_ON_XM_INIT( OnInit )
|
||||
XUI_ON_XM_TIMER( OnTimer )
|
||||
XUI_ON_XM_KEYDOWN(OnKeyDown)
|
||||
XUI_ON_XM_NOTIFY_VALUE_CHANGED(OnNotifyValueChanged)
|
||||
XUI_END_MSG_MAP()
|
||||
|
||||
HRESULT OnInit( XUIMessageInit* pInitData, BOOL& bHandled );
|
||||
HRESULT OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandled);
|
||||
HRESULT OnNotifyValueChanged (HXUIOBJ hObjSource, XUINotifyValueChanged* pValueChangedData, BOOL& rfHandled);
|
||||
HRESULT OnTimer(XUIMessageTimer *pData,BOOL& rfHandled);
|
||||
public:
|
||||
|
||||
// Define the class. The class name must match the ClassOverride property
|
||||
// set for the scene in the UI Authoring tool.
|
||||
XUI_IMPLEMENT_CLASS( CXuiCtrlSliderWrapper, L"CXuiCtrlSliderWrapper", XUI_CLASS_SCENE )
|
||||
|
||||
HRESULT SetValue( int nValue );
|
||||
HXUIOBJ GetSlider();
|
||||
HRESULT SetRange( int nRangeMin, int nRangeMax);
|
||||
LPCWSTR GetText( );
|
||||
HRESULT SetText(LPCWSTR text, int iDataAssoc=0 );
|
||||
HRESULT SetValueDisplay( BOOL bShow );
|
||||
|
||||
};
|
||||
37
Minecraft.Client/Common/XUI/XUI_Ctrl_SlotItem.h
Normal file
37
Minecraft.Client/Common/XUI/XUI_Ctrl_SlotItem.h
Normal file
@@ -0,0 +1,37 @@
|
||||
#pragma once
|
||||
#include "XUI_Ctrl_SlotItemCtrlBase.h"
|
||||
|
||||
class CXuiCtrlSlotItem : public CXuiControlImpl, public CXuiCtrlSlotItemCtrlBase
|
||||
{
|
||||
public:
|
||||
// Define the class. The class name must match the ClassOverride property
|
||||
// set for the scene in the UI Authoring tool.
|
||||
XUI_IMPLEMENT_CLASS( CXuiCtrlSlotItem, L"CXuiCtrlSlotItem", XUI_CLASS_CONTROL )
|
||||
|
||||
XUI_BEGIN_MSG_MAP()
|
||||
XUI_ON_XM_INIT( OnInit )
|
||||
XUI_ON_XM_DESTROY(OnDestroy)
|
||||
XUI_ON_XM_GETSLOTITEM_MESSAGE(OnCustomMessage_GetSlotItem)
|
||||
|
||||
// 4J WESTY : Pointer Prototype : Added to support prototype only.
|
||||
XUI_ON_XM_CONTROL_NAVIGATE( OnControlNavigate )
|
||||
|
||||
XUI_ON_XM_KEYDOWN( OnKeyDown )
|
||||
XUI_END_MSG_MAP()
|
||||
|
||||
using CXuiCtrlSlotItemCtrlBase::OnInit;
|
||||
HRESULT OnInit(XUIMessageInit* pInitData, BOOL& bHandled) { return this->OnInit( m_hObj, pInitData, bHandled ); };
|
||||
|
||||
using CXuiCtrlSlotItemCtrlBase::OnDestroy;
|
||||
HRESULT OnDestroy() { return this->OnDestroy( m_hObj ); };
|
||||
|
||||
using CXuiCtrlSlotItemCtrlBase::OnCustomMessage_GetSlotItem;
|
||||
HRESULT OnCustomMessage_GetSlotItem(CustomMessage_GetSlotItem_Struct *pData, BOOL& bHandled) { return this->OnCustomMessage_GetSlotItem( m_hObj, pData, bHandled ); };
|
||||
|
||||
// 4J WESTY : Pointer Prototype : Added to support prototype only.
|
||||
using CXuiCtrlSlotItemCtrlBase::OnControlNavigate;
|
||||
HRESULT OnControlNavigate(XUIMessageControlNavigate *pControlNavigateData, BOOL& bHandled) { return this->OnControlNavigate( m_hObj, pControlNavigateData, bHandled ); };
|
||||
|
||||
using CXuiCtrlSlotItemCtrlBase::OnKeyDown;
|
||||
HRESULT OnKeyDown(XUIMessageInput *pInputData, BOOL& bHandled) { return this->OnKeyDown( m_hObj, pInputData, bHandled ); };
|
||||
};
|
||||
392
Minecraft.Client/Common/XUI/XUI_Ctrl_SlotItemCtrlBase.cpp
Normal file
392
Minecraft.Client/Common/XUI/XUI_Ctrl_SlotItemCtrlBase.cpp
Normal file
@@ -0,0 +1,392 @@
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "..\..\..\Minecraft.World\StringHelpers.h"
|
||||
#include "..\..\..\Minecraft.World\Slot.h"
|
||||
#include "..\..\..\Minecraft.World\net.minecraft.world.item.h"
|
||||
#include "..\..\MultiPlayerLocalPlayer.h"
|
||||
#include "..\..\Minecraft.h"
|
||||
|
||||
#include "XUI_Ctrl_SlotItemCtrlBase.h"
|
||||
|
||||
HRESULT CXuiCtrlSlotItemCtrlBase::OnInit( HXUIOBJ hObj, XUIMessageInit* pInitData, BOOL& bHandled )
|
||||
{
|
||||
HRESULT hr = S_OK;
|
||||
SlotControlUserDataContainer* pvUserData = new SlotControlUserDataContainer();
|
||||
hr = XuiElementSetUserData(hObj, (void *)pvUserData );
|
||||
|
||||
// 4J WESTY : Pointer Prototype : Added to support prototype only.
|
||||
m_bSkipDefaultNavigation = false;
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT CXuiCtrlSlotItemCtrlBase::OnDestroy( HXUIOBJ hObj )
|
||||
{
|
||||
HRESULT hr = S_OK;
|
||||
void* pvUserData;
|
||||
hr = XuiElementGetUserData( hObj, &pvUserData );
|
||||
|
||||
if( pvUserData != NULL )
|
||||
{
|
||||
delete pvUserData;
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT CXuiCtrlSlotItemCtrlBase::OnCustomMessage_GetSlotItem(HXUIOBJ hObj, CustomMessage_GetSlotItem_Struct *pData, BOOL& bHandled)
|
||||
{
|
||||
shared_ptr<ItemInstance> item = shared_ptr<ItemInstance>();
|
||||
|
||||
void* pvUserData;
|
||||
XuiElementGetUserData( hObj, &pvUserData );
|
||||
|
||||
SlotControlUserDataContainer* pUserDataContainer = (SlotControlUserDataContainer*)pvUserData;
|
||||
|
||||
if( pUserDataContainer->slot != NULL )
|
||||
{
|
||||
item = pUserDataContainer->slot->getItem();
|
||||
}
|
||||
else if(pUserDataContainer->m_iPad >= 0 && pUserDataContainer->m_iPad < XUSER_MAX_COUNT)
|
||||
{
|
||||
shared_ptr<Player> player = dynamic_pointer_cast<Player>( Minecraft::GetInstance()->localplayers[pUserDataContainer->m_iPad] );
|
||||
if(player != NULL) item = player->inventory->getCarried();
|
||||
}
|
||||
|
||||
if( item != NULL )
|
||||
{
|
||||
pData->item = item;
|
||||
pData->iItemBitField = MAKE_SLOTDISPLAY_ITEM_BITMASK(item->id,item->getAuxValue(),item->isFoil());
|
||||
//int iAuxVal=item->getAuxValue();
|
||||
//int iCount = item->GetCount();
|
||||
// 8 bits - alpha
|
||||
// 1 bit - decorations on
|
||||
// 11 bits - auxval
|
||||
// 6 bits - count
|
||||
// 6 bits - scale
|
||||
pData->iDataBitField = MAKE_SLOTDISPLAY_DATA_BITMASK(pUserDataContainer->m_iPad, (int)(31*pUserDataContainer->m_fAlpha),true,item->GetCount(),7,item->popTime);
|
||||
}
|
||||
else
|
||||
{
|
||||
//pGetSourceImageData->iData = 0;
|
||||
pData->szPath = L"";
|
||||
}
|
||||
|
||||
bHandled = TRUE;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void CXuiCtrlSlotItemCtrlBase::SetSlot( HXUIOBJ hObj, Slot* slot )
|
||||
{
|
||||
void* pvUserData;
|
||||
XuiElementGetUserData( hObj, &pvUserData );
|
||||
|
||||
SlotControlUserDataContainer* pUserDataContainer = (SlotControlUserDataContainer*)pvUserData;
|
||||
|
||||
pUserDataContainer->slot = slot;
|
||||
}
|
||||
|
||||
void CXuiCtrlSlotItemCtrlBase::SetUserIndex( HXUIOBJ hObj, int iPad )
|
||||
{
|
||||
void* pvUserData;
|
||||
XuiElementGetUserData( hObj, &pvUserData );
|
||||
|
||||
SlotControlUserDataContainer* pUserDataContainer = (SlotControlUserDataContainer*)pvUserData;
|
||||
|
||||
pUserDataContainer->m_iPad = iPad;
|
||||
}
|
||||
|
||||
void CXuiCtrlSlotItemCtrlBase::SetAlpha( HXUIOBJ hObj, float fAlpha )
|
||||
{
|
||||
void* pvUserData;
|
||||
XuiElementGetUserData( hObj, &pvUserData );
|
||||
|
||||
SlotControlUserDataContainer* pUserDataContainer = (SlotControlUserDataContainer*)pvUserData;
|
||||
|
||||
pUserDataContainer->m_fAlpha = fAlpha;
|
||||
}
|
||||
|
||||
bool CXuiCtrlSlotItemCtrlBase::isEmpty( HXUIOBJ hObj )
|
||||
{
|
||||
void* pvUserData;
|
||||
XuiElementGetUserData( hObj, &pvUserData );
|
||||
SlotControlUserDataContainer* pUserDataContainer = (SlotControlUserDataContainer*)pvUserData;
|
||||
|
||||
if(pUserDataContainer->slot != NULL)
|
||||
{
|
||||
return !pUserDataContainer->slot->hasItem();
|
||||
}
|
||||
else if(pUserDataContainer->m_iPad >= 0 && pUserDataContainer->m_iPad < XUSER_MAX_COUNT)
|
||||
{
|
||||
shared_ptr<Player> player = dynamic_pointer_cast<Player>( Minecraft::GetInstance()->localplayers[pUserDataContainer->m_iPad] );
|
||||
if(player != NULL) return player->inventory->getCarried() == NULL;
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
wstring CXuiCtrlSlotItemCtrlBase::GetItemDescription( HXUIOBJ hObj, vector<wstring> &unformattedStrings )
|
||||
{
|
||||
void* pvUserData;
|
||||
XuiElementGetUserData( hObj, &pvUserData );
|
||||
SlotControlUserDataContainer* pUserDataContainer = (SlotControlUserDataContainer*)pvUserData;
|
||||
|
||||
if(pUserDataContainer->slot != NULL)
|
||||
{
|
||||
wstring desc = L"";
|
||||
vector<wstring> *strings = pUserDataContainer->slot->getItem()->getHoverText(Minecraft::GetInstance()->localplayers[pUserDataContainer->m_iPad], false, unformattedStrings);
|
||||
bool firstLine = true;
|
||||
for(AUTO_VAR(it, strings->begin()); it != strings->end(); ++it)
|
||||
{
|
||||
wstring thisString = *it;
|
||||
if(!firstLine)
|
||||
{
|
||||
desc.append( L"<br />" );
|
||||
}
|
||||
else
|
||||
{
|
||||
firstLine = false;
|
||||
wchar_t formatted[256];
|
||||
eMinecraftColour rarityColour = pUserDataContainer->slot->getItem()->getRarity()->color;
|
||||
int colour = app.GetHTMLColour(rarityColour);
|
||||
|
||||
if(pUserDataContainer->slot->getItem()->hasCustomHoverName())
|
||||
{
|
||||
colour = app.GetHTMLColour(eTextColor_RenamedItemTitle);
|
||||
}
|
||||
|
||||
swprintf(formatted, 256, L"<font color=\"#%08x\">%s</font>",colour,thisString.c_str());
|
||||
thisString = formatted;
|
||||
}
|
||||
desc.append( thisString );
|
||||
}
|
||||
strings->clear();
|
||||
delete strings;
|
||||
return desc;//app.GetString( pUserDataContainer->slot->getItem()->getDescriptionId() );
|
||||
}
|
||||
else if(pUserDataContainer->m_iPad >= 0 && pUserDataContainer->m_iPad < XUSER_MAX_COUNT)
|
||||
{
|
||||
shared_ptr<Player> player = dynamic_pointer_cast<Player>( Minecraft::GetInstance()->localplayers[pUserDataContainer->m_iPad] );
|
||||
if(player != NULL)
|
||||
{
|
||||
shared_ptr<ItemInstance> item = player->inventory->getCarried();
|
||||
if(item != NULL) return app.GetString( item->getDescriptionId() );
|
||||
}
|
||||
|
||||
}
|
||||
return L"";
|
||||
}
|
||||
|
||||
shared_ptr<ItemInstance> CXuiCtrlSlotItemCtrlBase::getItemInstance( HXUIOBJ hObj )
|
||||
{
|
||||
void* pvUserData;
|
||||
XuiElementGetUserData( hObj, &pvUserData );
|
||||
SlotControlUserDataContainer* pUserDataContainer = (SlotControlUserDataContainer*)pvUserData;
|
||||
|
||||
if(pUserDataContainer->slot != NULL)
|
||||
{
|
||||
return pUserDataContainer->slot->getItem();
|
||||
}
|
||||
else if(pUserDataContainer->m_iPad >= 0 && pUserDataContainer->m_iPad < XUSER_MAX_COUNT)
|
||||
{
|
||||
shared_ptr<Player> player = dynamic_pointer_cast<Player>( Minecraft::GetInstance()->localplayers[pUserDataContainer->m_iPad] );
|
||||
if(player != NULL) return player->inventory->getCarried();
|
||||
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Slot *CXuiCtrlSlotItemCtrlBase::getSlot( HXUIOBJ hObj )
|
||||
{
|
||||
void* pvUserData;
|
||||
XuiElementGetUserData( hObj, &pvUserData );
|
||||
SlotControlUserDataContainer* pUserDataContainer = (SlotControlUserDataContainer*)pvUserData;
|
||||
|
||||
return pUserDataContainer->slot;
|
||||
}
|
||||
|
||||
HRESULT CXuiCtrlSlotItemCtrlBase::OnKeyDown(HXUIOBJ hObj, XUIMessageInput *pInputData, BOOL& bHandled)
|
||||
{
|
||||
if( pInputData->dwKeyCode == VK_PAD_DPAD_LEFT ||
|
||||
pInputData->dwKeyCode == VK_PAD_DPAD_RIGHT ||
|
||||
pInputData->dwKeyCode == VK_PAD_DPAD_UP ||
|
||||
pInputData->dwKeyCode == VK_PAD_DPAD_DOWN ||
|
||||
pInputData->dwKeyCode == VK_PAD_LTRIGGER ||
|
||||
pInputData->dwKeyCode == VK_PAD_RTRIGGER)
|
||||
{
|
||||
HXUIOBJ parent;
|
||||
HRESULT hr;
|
||||
hr = XuiElementGetParent( hObj, &parent );
|
||||
|
||||
XUIMessage message;
|
||||
XUIMessageInput messageInput;
|
||||
|
||||
XuiMessageInput( &message, &messageInput, XUI_KEYDOWN, pInputData->dwKeyCode, pInputData->wch, pInputData->dwFlags, pInputData->UserIndex );
|
||||
|
||||
if (HRESULT_SUCCEEDED(hr))
|
||||
{
|
||||
hr = XuiBubbleMessage(parent, &message);
|
||||
|
||||
if (message.bHandled)
|
||||
{
|
||||
bHandled = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
// 4J WESTY : Pointer Prototype : Added to support prototype only.
|
||||
HRESULT CXuiCtrlSlotItemCtrlBase::OnControlNavigate( HXUIOBJ hObj, XUIMessageControlNavigate *pControlNavigateData, BOOL& bHandled)
|
||||
{
|
||||
// Skip default navigation behaviour when navigation is by pointer.
|
||||
if ( m_bSkipDefaultNavigation )
|
||||
{
|
||||
pControlNavigateData->bSkipNavigate = TRUE;
|
||||
bHandled = TRUE;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
// 4J WESTY : Pointer Prototype : Added to support prototype only.
|
||||
int CXuiCtrlSlotItemCtrlBase::GetObjectCount( HXUIOBJ hObj )
|
||||
{
|
||||
void* pvUserData;
|
||||
XuiElementGetUserData( hObj, &pvUserData );
|
||||
SlotControlUserDataContainer* pUserDataContainer = (SlotControlUserDataContainer*)pvUserData;
|
||||
|
||||
int iCount = 0;
|
||||
|
||||
if(pUserDataContainer->slot != NULL)
|
||||
{
|
||||
if ( pUserDataContainer->slot->hasItem() )
|
||||
{
|
||||
iCount = pUserDataContainer->slot->getItem()->GetCount();
|
||||
}
|
||||
}
|
||||
else if(pUserDataContainer->m_iPad >= 0 && pUserDataContainer->m_iPad < XUSER_MAX_COUNT)
|
||||
{
|
||||
shared_ptr<Player> player = dynamic_pointer_cast<Player>( Minecraft::GetInstance()->localplayers[pUserDataContainer->m_iPad] );
|
||||
if(player != NULL && player->inventory->getCarried() != NULL)
|
||||
{
|
||||
iCount = player->inventory->getCarried()->count;
|
||||
}
|
||||
|
||||
}
|
||||
return iCount;
|
||||
}
|
||||
|
||||
|
||||
// 4J WESTY : Pointer Prototype : Added to support prototype only.
|
||||
bool CXuiCtrlSlotItemCtrlBase::IsSameItemAs( HXUIOBJ hThisObj, HXUIOBJ hOtherObj )
|
||||
{
|
||||
bool bThisItemExists = false;
|
||||
int iThisID = 0;
|
||||
int iThisAux = 0;
|
||||
|
||||
bool bOtherItemExists = false;
|
||||
int iOtherID = 0;
|
||||
int iOtherAux = 0;
|
||||
|
||||
bool bStackedByData = false;
|
||||
|
||||
// Get the info on this item.
|
||||
void* pvThisUserData;
|
||||
XuiElementGetUserData( hThisObj, &pvThisUserData );
|
||||
SlotControlUserDataContainer* pThisUserDataContainer = (SlotControlUserDataContainer*)pvThisUserData;
|
||||
|
||||
if(pThisUserDataContainer->slot != NULL)
|
||||
{
|
||||
if ( pThisUserDataContainer->slot->hasItem() )
|
||||
{
|
||||
iThisID = pThisUserDataContainer->slot->getItem()->id;
|
||||
iThisAux = pThisUserDataContainer->slot->getItem()->getAuxValue();
|
||||
bThisItemExists = true;
|
||||
bStackedByData = pThisUserDataContainer->slot->getItem()->isStackedByData();
|
||||
}
|
||||
}
|
||||
else if(pThisUserDataContainer->m_iPad >= 0 && pThisUserDataContainer->m_iPad < XUSER_MAX_COUNT)
|
||||
{
|
||||
shared_ptr<Player> player = dynamic_pointer_cast<Player>( Minecraft::GetInstance()->localplayers[pThisUserDataContainer->m_iPad] );
|
||||
if(player != NULL && player->inventory->getCarried() != NULL)
|
||||
{
|
||||
iThisID = player->inventory->getCarried()->id;
|
||||
iThisAux = player->inventory->getCarried()->getAuxValue();
|
||||
bThisItemExists = true;
|
||||
bStackedByData = player->inventory->getCarried()->isStackedByData();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Get the info on other item.
|
||||
void* pvOtherUserData;
|
||||
XuiElementGetUserData( hOtherObj, &pvOtherUserData );
|
||||
SlotControlUserDataContainer* pOtherUserDataContainer = (SlotControlUserDataContainer*)pvOtherUserData;
|
||||
|
||||
if(pOtherUserDataContainer->slot != NULL)
|
||||
{
|
||||
if ( pOtherUserDataContainer->slot->hasItem() )
|
||||
{
|
||||
iOtherID = pOtherUserDataContainer->slot->getItem()->id;
|
||||
iOtherAux = pOtherUserDataContainer->slot->getItem()->getAuxValue();
|
||||
bOtherItemExists = true;
|
||||
}
|
||||
}
|
||||
else if(pOtherUserDataContainer->m_iPad >= 0 && pOtherUserDataContainer->m_iPad < XUSER_MAX_COUNT)
|
||||
{
|
||||
shared_ptr<Player> player = dynamic_pointer_cast<Player>( Minecraft::GetInstance()->localplayers[pOtherUserDataContainer->m_iPad] );
|
||||
if(player != NULL && player->inventory->getCarried() != NULL)
|
||||
{
|
||||
iOtherID = player->inventory->getCarried()->id;
|
||||
iOtherAux = player->inventory->getCarried()->getAuxValue();
|
||||
bOtherItemExists = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ( bThisItemExists && bOtherItemExists )
|
||||
{
|
||||
return ( ( iThisID == iOtherID ) && ( (bStackedByData && iThisAux == iOtherAux) || !bStackedByData ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// 4J WESTY : Pointer Prototype : Added to support prototype only.
|
||||
// Returns number of items that can still be stacked into this slot.
|
||||
int CXuiCtrlSlotItemCtrlBase::GetEmptyStackSpace( HXUIOBJ hObj )
|
||||
{
|
||||
int iResult = 0;
|
||||
|
||||
void* pvUserData;
|
||||
XuiElementGetUserData( hObj, &pvUserData );
|
||||
SlotControlUserDataContainer* pUserDataContainer = (SlotControlUserDataContainer*)pvUserData;
|
||||
|
||||
int iCount = 0;
|
||||
int iMaxStackSize = 0;
|
||||
bool bStackable = false;
|
||||
|
||||
if(pUserDataContainer->slot != NULL)
|
||||
{
|
||||
if ( pUserDataContainer->slot->hasItem() )
|
||||
{
|
||||
bStackable = pUserDataContainer->slot->getItem()->isStackable();
|
||||
if ( bStackable )
|
||||
{
|
||||
iCount = pUserDataContainer->slot->getItem()->GetCount();
|
||||
iMaxStackSize = min(pUserDataContainer->slot->getItem()->getMaxStackSize(), pUserDataContainer->slot->getMaxStackSize() );
|
||||
|
||||
iResult = iMaxStackSize - iCount;
|
||||
|
||||
if(iResult < 0 ) iResult = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return iResult;
|
||||
}
|
||||
|
||||
78
Minecraft.Client/Common/XUI/XUI_Ctrl_SlotItemCtrlBase.h
Normal file
78
Minecraft.Client/Common/XUI/XUI_Ctrl_SlotItemCtrlBase.h
Normal file
@@ -0,0 +1,78 @@
|
||||
#pragma once
|
||||
using namespace std;
|
||||
|
||||
class Slot;
|
||||
class ItemInstance;
|
||||
|
||||
#include "XUI_CustomMessages.h"
|
||||
|
||||
class SlotControlUserDataContainer
|
||||
{
|
||||
public:
|
||||
SlotControlUserDataContainer() : slot( NULL ), hProgressBar( NULL ), m_iPad( -1 ), m_fAlpha(1.0f) {};
|
||||
Slot* slot;
|
||||
HXUIOBJ hProgressBar;
|
||||
float m_fAlpha;
|
||||
int m_iPad;
|
||||
};
|
||||
|
||||
// The base class for all controls with the "ItemButton" visual
|
||||
// This could be a list item or just a button.
|
||||
// We need this class to be able to easily access all the parts of the visual
|
||||
|
||||
class CXuiCtrlSlotItemCtrlBase
|
||||
{
|
||||
private:
|
||||
// 4J WESTY : Pointer Prototype : Added to support prototype only.
|
||||
BOOL m_bSkipDefaultNavigation;
|
||||
|
||||
public:
|
||||
// We define a lot of functions as virtual. These should be implemented to call the protected version by
|
||||
// passing in the HXUIOBJ of the control as the first parameter. We do not have access to that normally
|
||||
// due to the inheritance structure
|
||||
virtual HRESULT OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) = 0;
|
||||
|
||||
virtual HRESULT OnDestroy() = 0;
|
||||
|
||||
virtual HRESULT OnCustomMessage_GetSlotItem(CustomMessage_GetSlotItem_Struct *pData, BOOL& bHandled) = 0;
|
||||
|
||||
// 4J WESTY : Pointer Prototype : Added to support prototype only.
|
||||
virtual HRESULT OnControlNavigate(XUIMessageControlNavigate *pControlNavigateData, BOOL& bHandled) = 0;
|
||||
|
||||
virtual HRESULT OnKeyDown(XUIMessageInput *pInputData, BOOL& bHandled) = 0;
|
||||
|
||||
void SetSlot( HXUIOBJ hObj, Slot* slot );
|
||||
void SetAlpha( HXUIOBJ hObj, float fAlpha );
|
||||
void SetUserIndex( HXUIOBJ hObj, int iPad );
|
||||
|
||||
bool isEmpty( HXUIOBJ hObj );
|
||||
|
||||
wstring GetItemDescription( HXUIOBJ hObj, vector<wstring> &unformattedStrings );
|
||||
|
||||
shared_ptr<ItemInstance> getItemInstance( HXUIOBJ hObj );
|
||||
Slot *getSlot( HXUIOBJ hObj );
|
||||
|
||||
// 4J WESTY : Pointer Prototype : Added to support prototype only.
|
||||
int GetObjectCount( HXUIOBJ hObj );
|
||||
|
||||
// 4J WESTY : Pointer Prototype : Added to support prototype only.
|
||||
void SetSkipsDefaultNavigation( BOOL bSkipDefaultNavigation ) { m_bSkipDefaultNavigation = bSkipDefaultNavigation; }
|
||||
|
||||
// 4J WESTY : Pointer Prototype : Added to support prototype only.
|
||||
int GetEmptyStackSpace( HXUIOBJ hObj ); // Returns number of items that can still be stacked into this slot.
|
||||
|
||||
// 4J WESTY : Pointer Prototype : Added to support prototype only.
|
||||
bool IsSameItemAs( HXUIOBJ hThisObj, HXUIOBJ hOtherObj );
|
||||
|
||||
protected:
|
||||
HRESULT OnInit( HXUIOBJ hObj, XUIMessageInit* pInitData, BOOL& bHandled );
|
||||
|
||||
HRESULT OnDestroy( HXUIOBJ hObj );
|
||||
|
||||
HRESULT OnCustomMessage_GetSlotItem(HXUIOBJ hObj, CustomMessage_GetSlotItem_Struct *pData, BOOL& bHandled);
|
||||
|
||||
// 4J WESTY : Pointer Prototype : Added to support prototype only.
|
||||
HRESULT OnControlNavigate(HXUIOBJ hObj, XUIMessageControlNavigate *pControlNavigateData, BOOL& bHandled);
|
||||
|
||||
HRESULT OnKeyDown(HXUIOBJ hObj, XUIMessageInput *pInputData, BOOL& bHandled);
|
||||
};
|
||||
38
Minecraft.Client/Common/XUI/XUI_Ctrl_SlotItemListItem.h
Normal file
38
Minecraft.Client/Common/XUI/XUI_Ctrl_SlotItemListItem.h
Normal file
@@ -0,0 +1,38 @@
|
||||
#pragma once
|
||||
|
||||
#include "XUI_Ctrl_SlotItemCtrlBase.h"
|
||||
|
||||
class CXuiCtrlSlotItemListItem : public CXuiListItemImpl, public CXuiCtrlSlotItemCtrlBase
|
||||
{
|
||||
public:
|
||||
// Define the class. The class name must match the ClassOverride property
|
||||
// set for the scene in the UI Authoring tool.
|
||||
XUI_IMPLEMENT_CLASS( CXuiCtrlSlotItemListItem, L"CXuiCtrlSlotItemListItem", XUI_CLASS_LISTITEM )
|
||||
|
||||
XUI_BEGIN_MSG_MAP()
|
||||
XUI_ON_XM_INIT( OnInit )
|
||||
XUI_ON_XM_DESTROY(OnDestroy)
|
||||
XUI_ON_XM_GETSLOTITEM_MESSAGE(OnCustomMessage_GetSlotItem)
|
||||
|
||||
// 4J WESTY : Pointer Prototype : Added to support prototype only.
|
||||
XUI_ON_XM_CONTROL_NAVIGATE( OnControlNavigate )
|
||||
|
||||
XUI_ON_XM_KEYDOWN( OnKeyDown )
|
||||
XUI_END_MSG_MAP()
|
||||
|
||||
using CXuiCtrlSlotItemCtrlBase::OnInit;
|
||||
HRESULT OnInit(XUIMessageInit* pInitData, BOOL& bHandled) { return this->OnInit( m_hObj, pInitData, bHandled ); };
|
||||
|
||||
using CXuiCtrlSlotItemCtrlBase::OnDestroy;
|
||||
HRESULT OnDestroy() { return this->OnDestroy( m_hObj ); };
|
||||
|
||||
using CXuiCtrlSlotItemCtrlBase::OnCustomMessage_GetSlotItem;
|
||||
HRESULT OnCustomMessage_GetSlotItem(CustomMessage_GetSlotItem_Struct *pData, BOOL& bHandled) { return this->OnCustomMessage_GetSlotItem( m_hObj, pData, bHandled ); };
|
||||
|
||||
// 4J WESTY : Pointer Prototype : Added to support prototype only.
|
||||
using CXuiCtrlSlotItemCtrlBase::OnControlNavigate;
|
||||
HRESULT OnControlNavigate(XUIMessageControlNavigate *pControlNavigateData, BOOL& bHandled) { return this->OnControlNavigate( m_hObj, pControlNavigateData, bHandled ); }
|
||||
|
||||
using CXuiCtrlSlotItemCtrlBase::OnKeyDown;
|
||||
HRESULT OnKeyDown(XUIMessageInput *pInputData, BOOL& bHandled) { return this->OnKeyDown( m_hObj, pInputData, bHandled ); };
|
||||
};
|
||||
231
Minecraft.Client/Common/XUI/XUI_Ctrl_SlotList.cpp
Normal file
231
Minecraft.Client/Common/XUI/XUI_Ctrl_SlotList.cpp
Normal file
@@ -0,0 +1,231 @@
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "..\..\..\Minecraft.World\AbstractContainerMenu.h"
|
||||
|
||||
#include "XUI_Ctrl_SlotItemListItem.h"
|
||||
#include "XUI_Ctrl_SlotList.h"
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
// Name: CXuiCtrlSlotList::OnInit
|
||||
// Desc: Message handler for XM_INIT
|
||||
//--------------------------------------------------------------------------------------
|
||||
HRESULT CXuiCtrlSlotList::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
|
||||
{
|
||||
slotCount = 0;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CXuiCtrlSlotList::OnDestroy()
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CXuiCtrlSlotList::OnKeyDown(XUIMessageInput *pInputData, BOOL& bHandled)
|
||||
{
|
||||
if( pInputData->dwKeyCode == VK_PAD_DPAD_LEFT ||
|
||||
pInputData->dwKeyCode == VK_PAD_DPAD_RIGHT ||
|
||||
pInputData->dwKeyCode == VK_PAD_DPAD_UP ||
|
||||
pInputData->dwKeyCode == VK_PAD_DPAD_DOWN ||
|
||||
pInputData->dwKeyCode == VK_PAD_LTRIGGER ||
|
||||
pInputData->dwKeyCode == VK_PAD_RTRIGGER)
|
||||
{
|
||||
HXUIOBJ parent;
|
||||
HRESULT hr;
|
||||
hr = XuiElementGetParent( m_hObj, &parent );
|
||||
|
||||
XUIMessage message;
|
||||
XUIMessageInput messageInput;
|
||||
|
||||
XuiMessageInput( &message, &messageInput, XUI_KEYDOWN, pInputData->dwKeyCode, pInputData->wch, pInputData->dwFlags, pInputData->UserIndex );
|
||||
|
||||
if (HRESULT_SUCCEEDED(hr))
|
||||
{
|
||||
hr = XuiBubbleMessage(parent, &message);
|
||||
|
||||
if (message.bHandled)
|
||||
{
|
||||
bHandled = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void CXuiCtrlSlotList::SetData(int m_iPad, AbstractContainerMenu* menu, int rows, int columns, int startIndex /*= 0*/, int endIndex /*= 0*/)
|
||||
{
|
||||
assert( startIndex >= 0 && startIndex < menu->getSize() );
|
||||
assert( endIndex <= menu->getSize() );
|
||||
|
||||
if( startIndex < 0 )
|
||||
{
|
||||
startIndex = 0;
|
||||
}
|
||||
else if( startIndex > menu->getSize() )
|
||||
{
|
||||
startIndex = menu->getSize();
|
||||
}
|
||||
|
||||
if( endIndex == 0 )
|
||||
{
|
||||
endIndex = startIndex + (rows * columns);
|
||||
}
|
||||
|
||||
if( endIndex > menu->getSize() )
|
||||
{
|
||||
endIndex = menu->getSize();
|
||||
}
|
||||
|
||||
if( startIndex > endIndex )
|
||||
{
|
||||
endIndex = startIndex;
|
||||
}
|
||||
|
||||
assert( (rows * columns) == (endIndex - startIndex) );
|
||||
|
||||
this->rows = rows;
|
||||
this->columns = columns;
|
||||
|
||||
this->startIndex = startIndex;
|
||||
|
||||
this->slotCount = rows * columns;
|
||||
|
||||
InsertItems( 0, slotCount );
|
||||
|
||||
for(int i = 0; i < slotCount; i++)
|
||||
{
|
||||
CXuiCtrlSlotItemListItem* slotControl;
|
||||
GetCXuiCtrlSlotItem(i, &slotControl);
|
||||
|
||||
slotControl->SetSlot( slotControl->m_hObj, menu->getSlot( i + startIndex ) );
|
||||
|
||||
slotControl->SetUserIndex( slotControl->m_hObj, m_iPad );
|
||||
|
||||
slotControl = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT CXuiCtrlSlotList::OnGetItemCountAll( XUIMessageGetItemCount *pGetItemCountData, BOOL& bHandled )
|
||||
{
|
||||
// We don't need to look at the type of request. The message map
|
||||
// has already filtered out a request to retrieve all items.
|
||||
pGetItemCountData->cItems = slotCount;
|
||||
bHandled = TRUE;
|
||||
|
||||
return( S_OK );
|
||||
}
|
||||
|
||||
HRESULT CXuiCtrlSlotList::OnGetItemCountMaxLines( XUIMessageGetItemCount *pGetItemCountData, BOOL& bHandled )
|
||||
{
|
||||
// We don't need to look at the type of request. The message map
|
||||
// has already filtered out a request to retrieve max lines.
|
||||
pGetItemCountData->cItems = rows;
|
||||
bHandled = TRUE;
|
||||
|
||||
return( S_OK );
|
||||
}
|
||||
|
||||
HRESULT CXuiCtrlSlotList::OnGetItemCountMaxPerLine( XUIMessageGetItemCount *pGetItemCountData, BOOL& bHandled )
|
||||
{
|
||||
// We don't need to look at the type of request. The message map
|
||||
// has already filtered out a request to retrieve max per line.
|
||||
pGetItemCountData->cItems = columns;
|
||||
bHandled = TRUE;
|
||||
|
||||
return( S_OK );
|
||||
}
|
||||
|
||||
int CXuiCtrlSlotList::GetCurrentColumn()
|
||||
{
|
||||
int currentItemIndex = GetCurSel();
|
||||
|
||||
return currentItemIndex % columns;
|
||||
}
|
||||
|
||||
int CXuiCtrlSlotList::GetCurrentRow()
|
||||
{
|
||||
int currentItemIndex = GetCurSel();
|
||||
|
||||
return (currentItemIndex/columns) % rows;
|
||||
}
|
||||
|
||||
// Return the index in the menu object
|
||||
int CXuiCtrlSlotList::GetCurrentIndex()
|
||||
{
|
||||
int currentSelected = GetCurSel();
|
||||
return currentSelected + this->startIndex;
|
||||
}
|
||||
|
||||
void CXuiCtrlSlotList::SetCurrentSlot(int row, int column)
|
||||
{
|
||||
if( row >= rows )
|
||||
{
|
||||
row = rows - 1;
|
||||
}
|
||||
else if ( row < 0 )
|
||||
{
|
||||
row = 0;
|
||||
}
|
||||
if( column >= columns )
|
||||
{
|
||||
column = columns - 1;
|
||||
}
|
||||
else if ( column < 0 )
|
||||
{
|
||||
column = 0;
|
||||
}
|
||||
int newSlot = ( row * columns ) + column;
|
||||
SetCurSel( newSlot );
|
||||
}
|
||||
|
||||
void CXuiCtrlSlotList::SetEntrySlot(int row, int column, XUI_CONTROL_NAVIGATE direction)
|
||||
{
|
||||
// The direction is the direction in which we are leaving the previous control to get to here
|
||||
// So a Navigate up means we want to start at the bottom of ourself
|
||||
switch( direction )
|
||||
{
|
||||
case XUI_CONTROL_NAVIGATE_UP:
|
||||
{
|
||||
row = rows - 1;
|
||||
break;
|
||||
}
|
||||
case XUI_CONTROL_NAVIGATE_DOWN:
|
||||
{
|
||||
row = 0;
|
||||
break;
|
||||
}
|
||||
case XUI_CONTROL_NAVIGATE_LEFT:
|
||||
case XUI_CONTROL_NAVIGATE_TABBACKWARD:
|
||||
{
|
||||
column = columns - 1;
|
||||
break;
|
||||
}
|
||||
case XUI_CONTROL_NAVIGATE_RIGHT:
|
||||
case XUI_CONTROL_NAVIGATE_TABFORWARD:
|
||||
{
|
||||
column = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
SetCurrentSlot( row, column );
|
||||
}
|
||||
|
||||
void CXuiCtrlSlotList::Clicked()
|
||||
{
|
||||
CXuiCtrlSlotItemListItem* slot;
|
||||
GetCXuiCtrlSlotItem( GetCurSel() , &slot);
|
||||
|
||||
// To get the press animation
|
||||
slot->Press();
|
||||
}
|
||||
|
||||
void CXuiCtrlSlotList::GetCXuiCtrlSlotItem(int itemIndex, CXuiCtrlSlotItemListItem** CXuiCtrlSlotItem)
|
||||
{
|
||||
HXUIOBJ itemControl = this->GetItemControl(itemIndex);
|
||||
VOID *pObj;
|
||||
XuiObjectFromHandle( itemControl, &pObj );
|
||||
*CXuiCtrlSlotItem = (CXuiCtrlSlotItemListItem *)pObj;
|
||||
}
|
||||
|
||||
73
Minecraft.Client/Common/XUI/XUI_Ctrl_SlotList.h
Normal file
73
Minecraft.Client/Common/XUI/XUI_Ctrl_SlotList.h
Normal file
@@ -0,0 +1,73 @@
|
||||
#pragma once
|
||||
|
||||
// Sig: HRESULT OnGetItemCountMaxLines(XUIMessageGetItemCount *pGetItemCountData, BOOL& bHandled)
|
||||
#define XUI_ON_XM_GET_ITEMCOUNT_MAX_LINES(MemberFunc)\
|
||||
if (pMessage->dwMessage == XM_GET_ITEMCOUNT && ((XUIMessageGetItemCount *) pMessage->pvData)->nType == XUI_ITEMCOUNT_MAX_LINES)\
|
||||
{\
|
||||
XUIMessageGetItemCount *pData = (XUIMessageGetItemCount *) pMessage->pvData;\
|
||||
return MemberFunc(pData, pMessage->bHandled);\
|
||||
}
|
||||
|
||||
// Sig: HRESULT OnGetItemCountMaxPerLine(XUIMessageGetItemCount *pGetItemCountData, BOOL& bHandled)
|
||||
#define XUI_ON_XM_GET_ITEMCOUNT_MAX_PER_LINE(MemberFunc)\
|
||||
if (pMessage->dwMessage == XM_GET_ITEMCOUNT && ((XUIMessageGetItemCount *) pMessage->pvData)->nType == XUI_ITEMCOUNT_MAX_PER_LINE)\
|
||||
{\
|
||||
XUIMessageGetItemCount *pData = (XUIMessageGetItemCount *) pMessage->pvData;\
|
||||
return MemberFunc(pData, pMessage->bHandled);\
|
||||
}
|
||||
|
||||
class AbstractContainerMenu;
|
||||
class SlotListItemControl;
|
||||
class CXuiCtrlSlotItemListItem;
|
||||
|
||||
class CXuiCtrlSlotList : public CXuiListImpl
|
||||
{
|
||||
public:
|
||||
// Define the class. The class name must match the ClassOverride property
|
||||
// set for the scene in the UI Authoring tool.
|
||||
XUI_IMPLEMENT_CLASS( CXuiCtrlSlotList, L"CXuiCtrlSlotList", XUI_CLASS_LIST )
|
||||
|
||||
XUI_BEGIN_MSG_MAP()
|
||||
XUI_ON_XM_INIT( OnInit )
|
||||
XUI_ON_XM_DESTROY(OnDestroy)
|
||||
XUI_ON_XM_KEYDOWN( OnKeyDown )
|
||||
XUI_ON_XM_GET_ITEMCOUNT_ALL( OnGetItemCountAll )
|
||||
XUI_ON_XM_GET_ITEMCOUNT_MAX_LINES(OnGetItemCountMaxLines)
|
||||
XUI_ON_XM_GET_ITEMCOUNT_MAX_PER_LINE(OnGetItemCountMaxPerLine)
|
||||
XUI_END_MSG_MAP()
|
||||
|
||||
HRESULT OnInit( XUIMessageInit* pInitData, BOOL& bHandled );
|
||||
HRESULT OnDestroy();
|
||||
HRESULT OnKeyDown(XUIMessageInput *pInputData, BOOL& bHandled);
|
||||
HRESULT OnGetItemCountAll( XUIMessageGetItemCount *pGetItemCountData, BOOL& bHandled );
|
||||
HRESULT OnGetItemCountMaxLines(XUIMessageGetItemCount *pGetItemCountData, BOOL& bHandled);
|
||||
HRESULT OnGetItemCountMaxPerLine(XUIMessageGetItemCount *pGetItemCountData, BOOL& bHandled);
|
||||
HRESULT OnRender(XUIMessageRender *pRenderData, BOOL &rfHandled);
|
||||
|
||||
public:
|
||||
void SetData(int m_iPad, AbstractContainerMenu* menu, int rows, int columns, int startIndex = 0, int endIndex = 0);
|
||||
|
||||
int GetRows() { return rows; };
|
||||
int GetColumns() { return columns; };
|
||||
int GetCurrentColumn();
|
||||
int GetCurrentRow();
|
||||
|
||||
int GetCurrentIndex();
|
||||
|
||||
void SetCurrentSlot(int row, int column);
|
||||
void SetEntrySlot(int row, int column, XUI_CONTROL_NAVIGATE direction);
|
||||
|
||||
void Clicked();
|
||||
|
||||
// 4J WESTY : Pointer Prototype : Made public.
|
||||
void GetCXuiCtrlSlotItem(int itemIndex, CXuiCtrlSlotItemListItem** CXuiCtrlSlotItem);
|
||||
|
||||
private:
|
||||
int slotCount;
|
||||
int rows;
|
||||
int columns;
|
||||
int startIndex;
|
||||
|
||||
// 4J WESTY : Pointer Prototype : Made public.
|
||||
//void GetCXuiCtrlSlotItem(int itemIndex, CXuiCtrlSlotItemListItem** CXuiCtrlSlotItem);
|
||||
};
|
||||
94
Minecraft.Client/Common/XUI/XUI_Ctrl_SplashPulser.cpp
Normal file
94
Minecraft.Client/Common/XUI/XUI_Ctrl_SplashPulser.cpp
Normal file
@@ -0,0 +1,94 @@
|
||||
#include "stdafx.h"
|
||||
#include "..\..\Minecraft.h"
|
||||
#include "..\..\ScreenSizeCalculator.h"
|
||||
#include "..\..\Lighting.h"
|
||||
#include "XUI_Ctrl_SplashPulser.h"
|
||||
#include "..\..\Font.h"
|
||||
#include "..\..\..\Minecraft.World\Mth.h"
|
||||
#include "..\..\..\Minecraft.World\System.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// CXuiCtrlSplashPulser class
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
CXuiCtrlSplashPulser::CXuiCtrlSplashPulser() :
|
||||
m_bDirty(FALSE),
|
||||
m_fScale(1.0f),
|
||||
m_fAlpha(1.0f)
|
||||
{
|
||||
Minecraft *pMinecraft=Minecraft::GetInstance();
|
||||
|
||||
ScreenSizeCalculator ssc(pMinecraft->options, pMinecraft->width_phys, pMinecraft->height_phys);
|
||||
m_fScreenWidth=(float)pMinecraft->width_phys;
|
||||
m_fRawWidth=(float)ssc.rawWidth;
|
||||
m_fScreenHeight=(float)pMinecraft->height_phys;
|
||||
m_fRawHeight=(float)ssc.rawHeight;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
HRESULT CXuiCtrlSplashPulser::OnInit(XUIMessageInit* pInitData, BOOL& rfHandled)
|
||||
{
|
||||
HRESULT hr=S_OK;
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT CXuiCtrlSplashPulser::OnRender(XUIMessageRender *pRenderData, BOOL &bHandled )
|
||||
{
|
||||
#ifdef _XBOX
|
||||
HXUIDC hDC = pRenderData->hDC;
|
||||
|
||||
Minecraft *pMinecraft=Minecraft::GetInstance();
|
||||
Font *font = pMinecraft->font;
|
||||
|
||||
wstring splash( GetText() );
|
||||
|
||||
// build and render with the game call
|
||||
|
||||
glDisable(GL_CULL_FACE);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
|
||||
RenderManager.Set_matrixDirty();
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glOrtho(0, 1280.0f, 720.0f, 0, 1000, 3000);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
glTranslatef(0, 0, -2000);
|
||||
glColor4f(1.0f,1.0f,1.0f,1.0f);
|
||||
|
||||
glPushMatrix();
|
||||
|
||||
D3DXMATRIX matrix;
|
||||
CXuiControl xuiControl(m_hObj);
|
||||
xuiControl.GetFullXForm(&matrix);
|
||||
float bwidth,bheight;
|
||||
xuiControl.GetBounds(&bwidth,&bheight);
|
||||
|
||||
float xo = (matrix._41 + (bwidth*matrix._11)/2 );
|
||||
float yo = (matrix._42 + (bheight*matrix._22) );
|
||||
glTranslatef(xo, yo, 0);
|
||||
|
||||
glRotatef(-17, 0, 0, 1);
|
||||
float sss = 1.8f - Mth::abs(Mth::sin(System::currentTimeMillis() % 1000 / 1000.0f * PI * 2) * 0.1f);
|
||||
sss*=(m_fScreenWidth/m_fRawWidth);
|
||||
|
||||
sss = sss * 100 / (font->width(splash) + 8 * 4);
|
||||
glScalef(sss, sss, sss);
|
||||
//drawCenteredString(font, splash, 0, -8, 0xffff00);
|
||||
font->drawShadow(splash, 0 - (font->width(splash)) / 2, -8, 0xffff00);
|
||||
glPopMatrix();
|
||||
|
||||
glDisable(GL_RESCALE_NORMAL);
|
||||
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
|
||||
XuiRenderRestoreState(hDC);
|
||||
|
||||
bHandled = TRUE;
|
||||
#endif
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
36
Minecraft.Client/Common/XUI/XUI_Ctrl_SplashPulser.h
Normal file
36
Minecraft.Client/Common/XUI/XUI_Ctrl_SplashPulser.h
Normal file
@@ -0,0 +1,36 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <XuiApp.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// CXuiCtrlSplashPulser class
|
||||
//-----------------------------------------------------------------------------
|
||||
class CXuiCtrlSplashPulser : public CXuiControlImpl
|
||||
{
|
||||
public:
|
||||
XUI_IMPLEMENT_CLASS(CXuiCtrlSplashPulser, L"CXuiCtrlSplashPulser", XUI_CLASS_LABEL)
|
||||
|
||||
CXuiCtrlSplashPulser();
|
||||
virtual ~CXuiCtrlSplashPulser() { };
|
||||
|
||||
protected:
|
||||
|
||||
XUI_BEGIN_MSG_MAP()
|
||||
XUI_ON_XM_INIT(OnInit)
|
||||
XUI_ON_XM_RENDER(OnRender)
|
||||
XUI_END_MSG_MAP()
|
||||
|
||||
HRESULT OnInit(XUIMessageInit* pInitData, BOOL& rfHandled);
|
||||
HRESULT OnRender(XUIMessageRender *pRenderData, BOOL &rfHandled);
|
||||
|
||||
private:
|
||||
BOOL m_bDirty;
|
||||
float m_fScale,m_fAlpha;
|
||||
|
||||
float m_fScreenWidth,m_fScreenHeight;
|
||||
float m_fRawWidth,m_fRawHeight;
|
||||
|
||||
};
|
||||
193
Minecraft.Client/Common/XUI/XUI_CustomMessages.h
Normal file
193
Minecraft.Client/Common/XUI/XUI_CustomMessages.h
Normal file
@@ -0,0 +1,193 @@
|
||||
#pragma once
|
||||
|
||||
#define XM_SPLITSCREENPLAYER_MESSAGE XM_USER
|
||||
#define XM_FONTRENDERERCHANGE_MESSAGE XM_USER + 1
|
||||
#define XM_DLCMOUNTED_MESSAGE XM_USER + 2
|
||||
#define XM_BASE_POSITION_CHANGED_MESSAGE XM_USER + 3
|
||||
#define XM_DLCSINSTALLED_MESSAGE XM_USER + 4
|
||||
#define XM_INVENTORYUPDATED_MESSAGE XM_USER + 5
|
||||
#define XM_TMS_DLCFILE_RETRIEVED_MESSAGE XM_USER + 6
|
||||
#define XM_TMS_BANFILE_RETRIEVED_MESSAGE XM_USER + 7
|
||||
#define XM_TMS_ALLFILES_RETRIEVED_MESSAGE XM_USER + 8
|
||||
#define XM_CUSTOMTICKSCENE_MESSAGE XM_USER + 9
|
||||
#define XM_GETSLOTITEM_MESSAGE XM_USER + 10
|
||||
|
||||
typedef struct
|
||||
{
|
||||
shared_ptr<ItemInstance> item;
|
||||
|
||||
// Legacy values for compatibility
|
||||
int iDataBitField;
|
||||
int iItemBitField;
|
||||
LPCWSTR szPath;
|
||||
BOOL bDirty;
|
||||
}
|
||||
CustomMessage_GetSlotItem_Struct;
|
||||
|
||||
|
||||
// Define the prototype for your handler function
|
||||
// Sig: HRESULT OnCustomMessage_GetSlotItem(CustomMessage_GetSlotItem_Struct *pData, BOOL& bHandled)
|
||||
|
||||
// Define the message map macro
|
||||
#define XUI_ON_XM_GETSLOTITEM_MESSAGE(MemberFunc)\
|
||||
if (pMessage->dwMessage == XM_GETSLOTITEM_MESSAGE)\
|
||||
{\
|
||||
CustomMessage_GetSlotItem_Struct *pData = (CustomMessage_GetSlotItem_Struct *) pMessage->pvData;\
|
||||
return MemberFunc(pData, pMessage->bHandled);\
|
||||
}
|
||||
|
||||
static __declspec(noinline) void CustomMessage_GetSlotItem(XUIMessage *pMsg, CustomMessage_GetSlotItem_Struct* pData, int iDataBitField, int iItemBitField)
|
||||
{
|
||||
XuiMessage(pMsg,XM_GETSLOTITEM_MESSAGE);
|
||||
_XuiMessageExtra(pMsg,(XUIMessageData*) pData, sizeof(*pData));
|
||||
pData->item = nullptr;
|
||||
pData->iDataBitField = iDataBitField;
|
||||
pData->iItemBitField = iItemBitField;
|
||||
pData->szPath = NULL;
|
||||
pData->bDirty = false;
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
bool bJoining; // if you're not joining, your leaving
|
||||
}
|
||||
CustomMessage_Splitscreenplayer_Struct;
|
||||
|
||||
|
||||
// Define the prototype for your handler function
|
||||
// Sig: HRESULT OnCustomMessage_Splitscreenplayer(bool bJoining, BOOL& bHandled)
|
||||
|
||||
// Define the message map macro
|
||||
#define XUI_ON_XM_SPLITSCREENPLAYER_MESSAGE(MemberFunc)\
|
||||
if (pMessage->dwMessage == XM_SPLITSCREENPLAYER_MESSAGE)\
|
||||
{\
|
||||
CustomMessage_Splitscreenplayer_Struct *pData = (CustomMessage_Splitscreenplayer_Struct *) pMessage->pvData;\
|
||||
return MemberFunc(pData->bJoining, pMessage->bHandled);\
|
||||
}
|
||||
|
||||
static __declspec(noinline) void CustomMessage_Splitscreenplayer(XUIMessage *pMsg, CustomMessage_Splitscreenplayer_Struct* pData, bool bJoining)
|
||||
{
|
||||
XuiMessage(pMsg,XM_SPLITSCREENPLAYER_MESSAGE);
|
||||
_XuiMessageExtra(pMsg,(XUIMessageData*) pData, sizeof(*pData));
|
||||
pData->bJoining = bJoining;
|
||||
}
|
||||
|
||||
// Define the prototype for your handler function
|
||||
// Sig: HRESULT OnFontRendererChange()
|
||||
|
||||
// Define the message map macro
|
||||
#define XUI_ON_XM_FONTRENDERERCHANGE_MESSAGE(MemberFunc)\
|
||||
if (pMessage->dwMessage == XM_FONTRENDERERCHANGE_MESSAGE)\
|
||||
{\
|
||||
return MemberFunc();\
|
||||
}
|
||||
|
||||
static __declspec(noinline) void CustomMessage_FontRendererChange(XUIMessage *pMsg)
|
||||
{
|
||||
XuiMessage(pMsg,XM_FONTRENDERERCHANGE_MESSAGE);
|
||||
}
|
||||
|
||||
// Define the prototype for your handler function
|
||||
// Sig: HRESULT OnDLCMounted()
|
||||
|
||||
// Define the message map macro
|
||||
#define XUI_ON_XM_DLCLOADED_MESSAGE(MemberFunc)\
|
||||
if (pMessage->dwMessage == XM_DLCMOUNTED_MESSAGE)\
|
||||
{\
|
||||
return MemberFunc();\
|
||||
}
|
||||
|
||||
static __declspec(noinline) void CustomMessage_DLCMountingComplete(XUIMessage *pMsg)
|
||||
{
|
||||
XuiMessage(pMsg,XM_DLCMOUNTED_MESSAGE);
|
||||
}
|
||||
|
||||
// Define the prototype for your handler function
|
||||
// Sig: HRESULT OnBasePositionChanged()
|
||||
|
||||
// Define the message map macro
|
||||
#define XUI_ON_XM_BASE_POSITION_CHANGED_MESSAGE(MemberFunc)\
|
||||
if (pMessage->dwMessage == XM_BASE_POSITION_CHANGED_MESSAGE)\
|
||||
{\
|
||||
return MemberFunc();\
|
||||
}
|
||||
|
||||
static __declspec(noinline) void CustomMessage_BasePositionChanged(XUIMessage *pMsg)
|
||||
{
|
||||
XuiMessage(pMsg,XM_BASE_POSITION_CHANGED_MESSAGE);
|
||||
}
|
||||
|
||||
// the prototype for your handler function
|
||||
// Sig: HRESULT OnDLCInstalled()
|
||||
|
||||
// Define the message map macro
|
||||
#define XUI_ON_XM_DLCINSTALLED_MESSAGE(MemberFunc)\
|
||||
if (pMessage->dwMessage == XM_DLCSINSTALLED_MESSAGE)\
|
||||
{\
|
||||
return MemberFunc();\
|
||||
}
|
||||
|
||||
static __declspec(noinline) void CustomMessage_DLCInstalled(XUIMessage *pMsg)
|
||||
{
|
||||
XuiMessage(pMsg,XM_DLCSINSTALLED_MESSAGE);
|
||||
}
|
||||
|
||||
// the prototype for your handler function
|
||||
// Sig: HRESULT OnCustomMessage_InventoryUpdated()
|
||||
|
||||
// Define the message map macro
|
||||
#define XUI_ON_XM_INVENTORYUPDATED_MESSAGE(MemberFunc)\
|
||||
if (pMessage->dwMessage == XM_INVENTORYUPDATED_MESSAGE)\
|
||||
{\
|
||||
return MemberFunc();\
|
||||
}
|
||||
|
||||
static __declspec(noinline) void CustomMessage_InventoryUpdated(XUIMessage *pMsg)
|
||||
{
|
||||
XuiMessage(pMsg,XM_INVENTORYUPDATED_MESSAGE);
|
||||
}
|
||||
|
||||
// the prototype for your handler function
|
||||
// Sig: HRESULT OnCustomMessage_()
|
||||
|
||||
// Define the message map macro
|
||||
#define XUI_ON_XM_TMS_DLCFILE_RETRIEVED_MESSAGE(MemberFunc)\
|
||||
if (pMessage->dwMessage == XM_TMS_DLCFILE_RETRIEVED_MESSAGE)\
|
||||
{\
|
||||
return MemberFunc();\
|
||||
}
|
||||
|
||||
static __declspec(noinline) void CustomMessage_TMS_DLCFileRetrieved(XUIMessage *pMsg)
|
||||
{
|
||||
XuiMessage(pMsg,XM_TMS_DLCFILE_RETRIEVED_MESSAGE);
|
||||
}
|
||||
|
||||
// the prototype for your handler function
|
||||
// Sig: HRESULT OnCustomMessage_()
|
||||
|
||||
// Define the message map macro
|
||||
#define XUI_ON_XM_TMS_BANFILE_RETRIEVED_MESSAGE(MemberFunc)\
|
||||
if (pMessage->dwMessage == XM_TMS_BANFILE_RETRIEVED_MESSAGE)\
|
||||
{\
|
||||
return MemberFunc();\
|
||||
}
|
||||
|
||||
static __declspec(noinline) void CustomMessage_TMS_BanFileRetrieved(XUIMessage *pMsg)
|
||||
{
|
||||
XuiMessage(pMsg,XM_TMS_BANFILE_RETRIEVED_MESSAGE);
|
||||
}
|
||||
|
||||
// Define the prototype for your handler function
|
||||
// Sig: HRESULT OnCustomMessage_TickScene()
|
||||
|
||||
// Define the message map macro
|
||||
#define XUI_ON_XM_CUSTOMTICKSCENE_MESSAGE(MemberFunc)\
|
||||
if (pMessage->dwMessage == XM_CUSTOMTICKSCENE_MESSAGE)\
|
||||
{\
|
||||
return MemberFunc();\
|
||||
}
|
||||
|
||||
static __declspec(noinline) void CustomMessage_TickScene(XUIMessage *pMsg)
|
||||
{
|
||||
XuiMessage(pMsg,XM_CUSTOMTICKSCENE_MESSAGE);
|
||||
}
|
||||
886
Minecraft.Client/Common/XUI/XUI_DLCOffers.cpp
Normal file
886
Minecraft.Client/Common/XUI/XUI_DLCOffers.cpp
Normal file
@@ -0,0 +1,886 @@
|
||||
// Minecraft.cpp : Defines the entry point for the application.
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "..\..\..\Minecraft.World\ByteArrayInputStream.h"
|
||||
#include "..\..\..\Minecraft.World\BufferedReader.h"
|
||||
#include "..\..\..\Minecraft.World\InputStreamReader.h"
|
||||
#include "..\..\..\Minecraft.World\ArrayWithLength.h"
|
||||
#include <assert.h>
|
||||
#include "XUI_Ctrl_4JIcon.h"
|
||||
#include "XUI_DLCOffers.h"
|
||||
#include "..\..\..\Minecraft.World\StringHelpers.h"
|
||||
#ifdef _XBOX
|
||||
#include <xavatar.h>
|
||||
#endif
|
||||
|
||||
#define TIMER_ID_NETWORK_CONNECTION 1
|
||||
#define TIMER_ID_NAVIGATE_BACK 2
|
||||
// Constants
|
||||
|
||||
//const wstring CScene_DLCOffers::DEFAULT_BANNER = L"Graphics/banner.png";
|
||||
|
||||
// DLC Main
|
||||
|
||||
HRESULT CScene_DLCMain::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
|
||||
{
|
||||
iPad = *(int *) pInitData->pvInitData;
|
||||
|
||||
MapChildControls();
|
||||
|
||||
app.SetTickTMSDLCFiles(true);
|
||||
|
||||
XuiControlSetText(xList,app.GetString(IDS_DOWNLOADABLE_CONTENT_OFFERS));
|
||||
|
||||
//if(app.GetTMSDLCInfoRead())
|
||||
{
|
||||
m_Timer.SetShow(FALSE);
|
||||
m_bIgnoreInput=false;
|
||||
|
||||
VOID *pObj;
|
||||
XuiObjectFromHandle( xList, &pObj );
|
||||
list = (CXuiCtrl4JList *) pObj;
|
||||
|
||||
ui.SetTooltips( DEFAULT_XUI_MENU_USER, IDS_TOOLTIPS_SELECT, IDS_TOOLTIPS_BACK );
|
||||
|
||||
CXuiCtrl4JList::LIST_ITEM_INFO *pListInfo = new CXuiCtrl4JList::LIST_ITEM_INFO [e_DLC_MAX_MinecraftStore];
|
||||
ZeroMemory(pListInfo,sizeof(CXuiCtrl4JList::LIST_ITEM_INFO)*e_DLC_MAX_MinecraftStore);
|
||||
|
||||
m_bAllDLCContentRetrieved=false;
|
||||
pListInfo[e_DLC_SkinPack].pwszText = app.GetString(IDS_DLC_MENU_SKINPACKS);
|
||||
pListInfo[e_DLC_SkinPack].fEnabled=TRUE;
|
||||
list->AddData(pListInfo[e_DLC_SkinPack]);
|
||||
|
||||
pListInfo[e_DLC_TexturePacks].pwszText = app.GetString(IDS_DLC_MENU_TEXTUREPACKS);
|
||||
pListInfo[e_DLC_TexturePacks].fEnabled=TRUE;
|
||||
list->AddData(pListInfo[e_DLC_TexturePacks]);
|
||||
|
||||
pListInfo[e_DLC_MashupPacks].pwszText = app.GetString(IDS_DLC_MENU_MASHUPPACKS);
|
||||
pListInfo[e_DLC_MashupPacks].fEnabled=TRUE;
|
||||
list->AddData(pListInfo[e_DLC_MashupPacks]);
|
||||
|
||||
pListInfo[e_DLC_Themes].pwszText = app.GetString(IDS_DLC_MENU_THEMES);
|
||||
pListInfo[e_DLC_Themes].fEnabled=TRUE;
|
||||
list->AddData(pListInfo[e_DLC_Themes]);
|
||||
|
||||
pListInfo[e_DLC_AvatarItems].pwszText = app.GetString(IDS_DLC_MENU_AVATARITEMS);
|
||||
pListInfo[e_DLC_AvatarItems].fEnabled=TRUE;
|
||||
list->AddData(pListInfo[e_DLC_AvatarItems]);
|
||||
|
||||
pListInfo[e_DLC_Gamerpics].pwszText = app.GetString(IDS_DLC_MENU_GAMERPICS);
|
||||
pListInfo[e_DLC_Gamerpics].fEnabled=TRUE;
|
||||
list->AddData(pListInfo[e_DLC_Gamerpics]);
|
||||
|
||||
app.AddDLCRequest(e_Marketplace_Content); // content is skin packs, texture packs and mash-up packs
|
||||
app.AddDLCRequest(e_Marketplace_Gamerpics);
|
||||
app.AddDLCRequest(e_Marketplace_Themes);
|
||||
app.AddDLCRequest(e_Marketplace_AvatarItems);
|
||||
|
||||
// start retrieving the images needed from TMS
|
||||
app.AddTMSPPFileTypeRequest(e_DLC_SkinPack);
|
||||
app.AddTMSPPFileTypeRequest(e_DLC_Gamerpics);
|
||||
app.AddTMSPPFileTypeRequest(e_DLC_Themes);
|
||||
app.AddTMSPPFileTypeRequest(e_DLC_AvatarItems);
|
||||
app.AddTMSPPFileTypeRequest(e_DLC_TexturePacks);
|
||||
app.AddTMSPPFileTypeRequest(e_DLC_MashupPacks);
|
||||
}
|
||||
|
||||
XuiElementInitUserFocus(xList, ProfileManager.GetPrimaryPad(), TRUE);
|
||||
TelemetryManager->RecordMenuShown(iPad, eUIScene_DLCMainMenu, 0); // 4J JEV ?
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CScene_DLCMain::OnDestroy()
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CScene_DLCMain::OnTimer(XUIMessageTimer *pData,BOOL& rfHandled)
|
||||
{
|
||||
if(pData->nId==TIMER_ID_NETWORK_CONNECTION)
|
||||
{
|
||||
if(ProfileManager.GetLiveConnectionStatus()!=XONLINE_S_LOGON_CONNECTION_ESTABLISHED)
|
||||
{
|
||||
UINT uiIDA[1];
|
||||
uiIDA[0]=IDS_CONFIRM_OK;
|
||||
|
||||
StorageManager.ClearDLCOffers();
|
||||
app.ClearAndResetDLCDownloadQueue();
|
||||
}
|
||||
}
|
||||
else if(pData->nId==TIMER_ID_NAVIGATE_BACK)
|
||||
{
|
||||
if(app.CheckTMSDLCCanStop())
|
||||
{
|
||||
XuiKillTimer(m_hObj,TIMER_ID_NAVIGATE_BACK);
|
||||
app.NavigateBack(XUSER_INDEX_ANY);
|
||||
}
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
HRESULT CScene_DLCMain::OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandled)
|
||||
{
|
||||
if(m_bIgnoreInput) return S_OK;
|
||||
|
||||
ui.AnimateKeyPress(pInputData->UserIndex, pInputData->dwKeyCode);
|
||||
|
||||
switch(pInputData->dwKeyCode)
|
||||
{
|
||||
case VK_PAD_B:
|
||||
case VK_ESCAPE:
|
||||
app.SetTickTMSDLCFiles(false);
|
||||
|
||||
// set the timer running to navigate back when any tms retrieval has come in
|
||||
XuiSetTimer(m_hObj,TIMER_ID_NAVIGATE_BACK,50);
|
||||
m_bIgnoreInput=true;
|
||||
m_Timer.SetShow(TRUE);
|
||||
//app.NavigateBack(XUSER_INDEX_ANY);
|
||||
rfHandled = TRUE;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CScene_DLCMain::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* pNotifyPressData, BOOL& rfHandled)
|
||||
{
|
||||
ui.AnimateKeyPress(pNotifyPressData->UserIndex, VK_PAD_A);
|
||||
|
||||
if(hObjPressed==xList)
|
||||
{
|
||||
int iIndex;
|
||||
CXuiControl pItem;
|
||||
iIndex=xList.GetCurSel(&pItem);
|
||||
|
||||
DLCOffersParam *param = new DLCOffersParam();
|
||||
param->iPad = iPad;
|
||||
param->iType = iIndex;
|
||||
|
||||
// promote the DLC content request type
|
||||
app.AddDLCRequest((eDLCMarketplaceType)iIndex, true);
|
||||
app.NavigateToScene(iPad,eUIScene_DLCOffersMenu, param);
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CScene_DLCMain::OnNavReturn(HXUIOBJ hObj,BOOL& rfHandled)
|
||||
{
|
||||
ui.SetTooltips( DEFAULT_XUI_MENU_USER, IDS_TOOLTIPS_SELECT, IDS_TOOLTIPS_BACK );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
// DLC OFFERS
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Performs initialization tasks - retrieves controls.
|
||||
//----------------------------------------------------------------------------------
|
||||
HRESULT CScene_DLCOffers::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
|
||||
{
|
||||
DLCOffersParam *param = (DLCOffersParam *) pInitData->pvInitData;
|
||||
m_iPad = param->iPad;
|
||||
m_iType = param->iType;
|
||||
m_iOfferC = app.GetDLCOffersCount();
|
||||
m_bIsFemale = false;
|
||||
m_pNoImageFor_DLC=NULL;
|
||||
bNoDLCToDisplay=true;
|
||||
//hCostText=NULL;
|
||||
|
||||
|
||||
// 4J JEV: Deleting this here seems simpler.
|
||||
delete param;
|
||||
|
||||
// If this is the avatar items, we need to init the avatar system to allow us to find out what the player avatar gender is (since we should only display tshirts etc with the right gender)
|
||||
// The init reserves 3MB of memory, so we shut down on leaving this.
|
||||
if(m_iType==e_DLC_AvatarItems)
|
||||
{
|
||||
XAVATAR_METADATA AvatarMetadata;
|
||||
HRESULT hRes;
|
||||
|
||||
|
||||
hRes=XAvatarInitialize(XAVATAR_COORDINATE_SYSTEM_LEFT_HANDED,0,0,0,NULL);
|
||||
|
||||
// get the avatar gender
|
||||
hRes=XAvatarGetMetadataLocalUser(m_iPad,&AvatarMetadata,NULL);
|
||||
|
||||
m_bIsFemale= (XAVATAR_BODY_TYPE_FEMALE == XAvatarMetadataGetBodyType(&AvatarMetadata));
|
||||
// shutdown the avatar system
|
||||
|
||||
XAvatarShutdown();
|
||||
}
|
||||
|
||||
m_bIsSD=!RenderManager.IsHiDef() && !RenderManager.IsWidescreen();
|
||||
|
||||
MapChildControls();
|
||||
|
||||
XuiControlSetText(m_List,app.GetString(IDS_DOWNLOADABLE_CONTENT_OFFERS));
|
||||
|
||||
m_bIgnorePress=true;
|
||||
|
||||
VOID *pObj;
|
||||
m_hXuiBrush=NULL;
|
||||
|
||||
XuiObjectFromHandle( m_List, &pObj );
|
||||
m_pOffersList = (CXuiCtrl4JList *)pObj;
|
||||
m_bAllDLCContentRetrieved=false;
|
||||
|
||||
XuiElementInitUserFocus(m_hObj,ProfileManager.GetPrimaryPad(),TRUE);
|
||||
TelemetryManager->RecordMenuShown(m_iPad, eUIScene_DLCOffersMenu, 0);
|
||||
ui.SetTooltips( DEFAULT_XUI_MENU_USER, -1,IDS_TOOLTIPS_BACK);
|
||||
|
||||
// Disable the price tag display
|
||||
m_PriceTag.SetShow(FALSE);
|
||||
|
||||
// If we don't yet have this DLC, we need to display a timer
|
||||
m_bDLCRequiredIsRetrieved=false;
|
||||
|
||||
// Is the DLC we're looking for available?
|
||||
if(!m_bDLCRequiredIsRetrieved)
|
||||
{
|
||||
if(app.DLCContentRetrieved((eDLCMarketplaceType)m_iType))
|
||||
{
|
||||
m_bDLCRequiredIsRetrieved=true;
|
||||
|
||||
// Retrieve the info
|
||||
GetDLCInfo(app.GetDLCOffersCount(), false);
|
||||
m_bIgnorePress=false;
|
||||
}
|
||||
}
|
||||
|
||||
XuiSetTimer(m_hObj,TIMER_ID_NETWORK_CONNECTION,50);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CScene_DLCOffers::GetDLCInfo( int iOfferC, bool bUpdateOnly )
|
||||
{
|
||||
CXuiCtrl4JList::LIST_ITEM_INFO *pListInfo=NULL;
|
||||
//XMARKETPLACE_CONTENTOFFER_INFO xOffer;
|
||||
XMARKETPLACE_CURRENCY_CONTENTOFFER_INFO xOffer;
|
||||
const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string
|
||||
WCHAR szResourceLocator[ LOCATOR_SIZE ];
|
||||
ZeroMemory(szResourceLocator,sizeof(WCHAR)*LOCATOR_SIZE);
|
||||
const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL);
|
||||
int iCount=0;
|
||||
|
||||
if(bUpdateOnly) // Just update the info on the current list
|
||||
{
|
||||
for(int i=0;i<iOfferC;i++)
|
||||
{
|
||||
xOffer = StorageManager.GetOffer(i);
|
||||
// Check that this is in the list of known DLC
|
||||
DLC_INFO *pDLC=app.GetDLCInfoForFullOfferID(xOffer.qwOfferID);
|
||||
if(pDLC==NULL)
|
||||
{
|
||||
// try the trial version
|
||||
pDLC=app.GetDLCInfoForTrialOfferID(xOffer.qwOfferID);
|
||||
}
|
||||
|
||||
if(pDLC==NULL)
|
||||
{
|
||||
// skip this one
|
||||
#ifdef _DEBUG
|
||||
app.DebugPrintf("Unknown offer - ");
|
||||
OutputDebugStringW(xOffer.wszOfferName);
|
||||
app.DebugPrintf("\n");
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
|
||||
// If the item has a gender, then skip ones that are the other gender
|
||||
if((pDLC->iGender==1) && (m_bIsFemale==true))
|
||||
{
|
||||
app.DebugPrintf("Wrong gender\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
// can't trust the offer type - partnernet is giving avatar items the CONTENT type
|
||||
//if(Offer.dwOfferType==app.GetDLCContentType((eDLCContentType)m_iType))
|
||||
if(pDLC->eDLCType==(eDLCContentType)m_iType)
|
||||
{
|
||||
if(xOffer.fUserHasPurchased)
|
||||
{
|
||||
HXUIBRUSH hBrush;
|
||||
|
||||
if(RenderManager.IsHiDef() || RenderManager.IsWidescreen())
|
||||
{
|
||||
swprintf(szResourceLocator, LOCATOR_SIZE, L"section://%X,%ls#%ls",c_ModuleHandle,L"media", L"media/Graphics/DLC_Tick.png");
|
||||
XuiCreateTextureBrush(szResourceLocator,&hBrush);
|
||||
}
|
||||
else
|
||||
{
|
||||
swprintf(szResourceLocator, LOCATOR_SIZE, L"section://%X,%ls#%ls",c_ModuleHandle,L"media", L"media/Graphics/DLC_TickSmall.png");
|
||||
XuiCreateTextureBrush(szResourceLocator,&hBrush);
|
||||
}
|
||||
m_pOffersList->UpdateGraphic(i,hBrush );
|
||||
}
|
||||
|
||||
iCount++;
|
||||
}
|
||||
}
|
||||
|
||||
if(iCount>0)
|
||||
{
|
||||
bNoDLCToDisplay=false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(iOfferC!=0)
|
||||
{
|
||||
pListInfo = new CXuiCtrl4JList::LIST_ITEM_INFO [iOfferC];
|
||||
ZeroMemory(pListInfo,sizeof(CXuiCtrl4JList::LIST_ITEM_INFO)*iOfferC);
|
||||
}
|
||||
|
||||
for(int i = 0; i < iOfferC; i++)
|
||||
{
|
||||
xOffer = StorageManager.GetOffer(i);
|
||||
|
||||
// Check that this is in the list of known DLC
|
||||
DLC_INFO *pDLC=app.GetDLCInfoForFullOfferID(xOffer.qwOfferID);
|
||||
if(pDLC==NULL)
|
||||
{
|
||||
// try the trial version
|
||||
pDLC=app.GetDLCInfoForTrialOfferID(xOffer.qwOfferID);
|
||||
}
|
||||
|
||||
if(pDLC==NULL)
|
||||
{
|
||||
// skip this one
|
||||
#ifdef _DEBUG
|
||||
app.DebugPrintf("Unknown offer - ");
|
||||
OutputDebugStringW(xOffer.wszOfferName);
|
||||
app.DebugPrintf("\n");
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
|
||||
// can't trust the offer type - partnernet is giving avatar items the CONTENT type
|
||||
//if(Offer.dwOfferType==app.GetDLCContentType((eDLCContentType)m_iType))
|
||||
if(pDLC->eDLCType==(eDLCContentType)m_iType)
|
||||
{
|
||||
wstring wstrTemp=xOffer.wszOfferName;
|
||||
|
||||
// If the string starts with Minecraft, removed that
|
||||
|
||||
// Bug 49249 - JPN: Code Defect: Missing Text: String 'Minecraft' is missing in contents download screen.
|
||||
// Looks like we shouldn't be removing this text for Japanese, and probably Chinese & Korean
|
||||
|
||||
DWORD dwLanguage = XGetLanguage( );
|
||||
switch(dwLanguage)
|
||||
{
|
||||
case XC_LANGUAGE_KOREAN:
|
||||
case XC_LANGUAGE_JAPANESE:
|
||||
case XC_LANGUAGE_TCHINESE:
|
||||
pListInfo[iCount].pwszText = xOffer.wszOfferName;
|
||||
break;
|
||||
default:
|
||||
if(wstrTemp.compare(0,10,L"Minecraft ")==0)
|
||||
{
|
||||
pListInfo[iCount].pwszText = &xOffer.wszOfferName[10];
|
||||
}
|
||||
else
|
||||
{
|
||||
pListInfo[iCount].pwszText = xOffer.wszOfferName;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
pListInfo[iCount].fEnabled=TRUE;
|
||||
|
||||
// store the offer index
|
||||
pListInfo[iCount].iData=i;
|
||||
pListInfo[iCount].iSortIndex=(int)pDLC->uiSortIndex;
|
||||
#ifdef _DEBUG
|
||||
app.DebugPrintf("Adding ");
|
||||
OutputDebugStringW(pListInfo[iCount].pwszText);
|
||||
app.DebugPrintf(" at %d\n",i);
|
||||
#endif
|
||||
|
||||
m_pOffersList->AddData(pListInfo[iCount],0,CXuiCtrl4JList::eSortList_Index);
|
||||
//offerIndexes.push_back(i);
|
||||
|
||||
if(xOffer.fUserHasPurchased)
|
||||
{
|
||||
HXUIBRUSH hBrush;
|
||||
|
||||
if(RenderManager.IsHiDef() || RenderManager.IsWidescreen())
|
||||
{
|
||||
swprintf(szResourceLocator, LOCATOR_SIZE, L"section://%X,%ls#%ls",c_ModuleHandle,L"media", L"media/Graphics/DLC_Tick.png");
|
||||
XuiCreateTextureBrush(szResourceLocator,&hBrush);
|
||||
}
|
||||
else
|
||||
{
|
||||
swprintf(szResourceLocator, LOCATOR_SIZE, L"section://%X,%ls#%ls",c_ModuleHandle,L"media", L"media/Graphics/DLC_TickSmall.png");
|
||||
XuiCreateTextureBrush(szResourceLocator,&hBrush);
|
||||
}
|
||||
m_pOffersList->UpdateGraphicFromiData(i,hBrush);
|
||||
}
|
||||
|
||||
/** 4J JEV:
|
||||
* We've filtered results out from the list, need to keep track
|
||||
* of the 'actual' list index.
|
||||
*/
|
||||
iCount++;
|
||||
}
|
||||
}
|
||||
|
||||
// Check if there is nothing to display, and display the default "nothing available at this time"
|
||||
if(iCount>0)
|
||||
{
|
||||
bNoDLCToDisplay=false;
|
||||
}
|
||||
}
|
||||
|
||||
// turn off the timer display
|
||||
m_Timer.SetShow(FALSE);
|
||||
if(iCount!=0)
|
||||
{
|
||||
// get the right index for the first list item - it will have been re-sorted internally in the list
|
||||
int iIndex=0;
|
||||
xOffer=StorageManager.GetOffer(m_pOffersList->GetData(iIndex).iData);
|
||||
m_pOffersList->SetCurSelVisible(0);
|
||||
|
||||
DLC_INFO *dlc = app.GetDLCInfoForFullOfferID(xOffer.qwOfferID);
|
||||
if (dlc != NULL)
|
||||
{
|
||||
BYTE *pData=NULL;
|
||||
UINT uiSize=0;
|
||||
DWORD dwSize=0;
|
||||
|
||||
WCHAR *cString = dlc->wchBanner;
|
||||
// is the file in the TMS XZP?
|
||||
int iIndex = app.GetLocalTMSFileIndex(cString, true);
|
||||
|
||||
if(iIndex!=-1)
|
||||
{
|
||||
// it's in the xzp
|
||||
if(m_hXuiBrush!=NULL)
|
||||
{
|
||||
XuiDestroyBrush(m_hXuiBrush);
|
||||
// clear the TMS XZP vector memory
|
||||
//app.FreeLocalTMSFiles();
|
||||
}
|
||||
app.LoadLocalTMSFile(cString);
|
||||
XuiCreateTextureBrushFromMemory(app.TMSFileA[iIndex].pbData,app.TMSFileA[iIndex].uiSize,&m_hXuiBrush);
|
||||
}
|
||||
else
|
||||
{
|
||||
bool bPresent = app.IsFileInMemoryTextures(cString);
|
||||
if (!bPresent)
|
||||
{
|
||||
// Image has not come in yet
|
||||
// Set the item monitored in the timer, so we can set the image when it comes in
|
||||
m_pNoImageFor_DLC=dlc;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(m_hXuiBrush!=NULL)
|
||||
{
|
||||
XuiDestroyBrush(m_hXuiBrush);
|
||||
// clear the TMS XZP vector memory
|
||||
//app.FreeLocalTMSFiles();
|
||||
}
|
||||
app.GetMemFileDetails(cString,&pData,&dwSize);
|
||||
XuiCreateTextureBrushFromMemory(pData,dwSize,&m_hXuiBrush);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
wchar_t formatting[40];
|
||||
wstring wstrTemp = xOffer.wszSellText;
|
||||
swprintf(formatting, 40, L"<font size=\"%d\">", m_bIsSD?12:14);
|
||||
wstrTemp = formatting + wstrTemp;
|
||||
|
||||
m_SellText.SetText(wstrTemp.c_str());
|
||||
m_SellText.SetShow(TRUE);
|
||||
|
||||
// set the price info
|
||||
m_PriceTag.SetShow(TRUE);
|
||||
// swprintf(formatting, 40, L"%d",xOffer.dwPointsPrice);
|
||||
// wstrTemp=wstring(formatting);
|
||||
// m_PriceTag.SetText(wstrTemp.c_str());
|
||||
m_PriceTag.SetText(xOffer.wszCurrencyPrice);
|
||||
|
||||
XuiElementSetShow(m_List,TRUE);
|
||||
XuiElementSetFocus(m_List);
|
||||
|
||||
UpdateTooltips(xOffer);
|
||||
}
|
||||
else if(bNoDLCToDisplay)
|
||||
{
|
||||
// set the default text
|
||||
|
||||
wchar_t formatting[40];
|
||||
wstring wstrTemp = app.GetString(IDS_NO_DLCOFFERS);
|
||||
swprintf(formatting, 40, L"<font size=\"%d\">", m_bIsSD?12:14);
|
||||
wstrTemp = formatting + wstrTemp;
|
||||
|
||||
m_SellText.SetText(wstrTemp.c_str());
|
||||
m_SellText.SetShow(TRUE);
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CScene_DLCOffers::OnDestroy()
|
||||
{
|
||||
// 4J-PB - don't cancel the DLC anymore
|
||||
//StorageManager.CancelGetDLCOffers();
|
||||
|
||||
// clear out any TMS images loaded from the XZP
|
||||
app.FreeLocalTMSFiles(eTMSFileType_MinecraftStore);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Handler for the button press message.
|
||||
//----------------------------------------------------------------------------------
|
||||
HRESULT CScene_DLCOffers::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* pNotifyPressData, BOOL& rfHandled)
|
||||
{
|
||||
if(m_bIgnorePress) return S_OK;
|
||||
|
||||
// This assumes all buttons can only be pressed with the A button
|
||||
ui.AnimateKeyPress(pNotifyPressData->UserIndex, VK_PAD_A);
|
||||
|
||||
if(hObjPressed==m_List)
|
||||
{
|
||||
CXuiControl pItem;
|
||||
int iIndex;
|
||||
CXuiCtrl4JList::LIST_ITEM_INFO ItemInfo;
|
||||
// get the selected item
|
||||
iIndex=m_List.GetCurSel(&pItem);
|
||||
ItemInfo=m_pOffersList->GetData(iIndex);
|
||||
|
||||
ULONGLONG ullIndexA[1];
|
||||
|
||||
// check if it's already installed
|
||||
// if(StorageManager.GetOffer(iIndex).fUserHasPurchased)
|
||||
// {
|
||||
//
|
||||
// }
|
||||
// else
|
||||
// if it's already been purchased, we need to let the user download it anyway
|
||||
{
|
||||
ullIndexA[0]=StorageManager.GetOffer(ItemInfo.iData).qwOfferID;
|
||||
StorageManager.InstallOffer(1,ullIndexA,NULL,NULL);
|
||||
}
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CScene_DLCOffers::OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandled)
|
||||
{
|
||||
// Fix for Compliance fail -
|
||||
// On a functional console, the game must not enter an extended unresponsive state, cause unintentional loss of player data, crash, or cause an unintended reboot of the machine.
|
||||
|
||||
//if(m_bIgnorePress) return S_OK;
|
||||
|
||||
ui.AnimateKeyPress(pInputData->UserIndex, pInputData->dwKeyCode);
|
||||
|
||||
switch(pInputData->dwKeyCode)
|
||||
{
|
||||
|
||||
case VK_PAD_B:
|
||||
case VK_ESCAPE:
|
||||
app.NavigateBack(XUSER_INDEX_ANY);
|
||||
rfHandled = TRUE;
|
||||
|
||||
break;
|
||||
|
||||
case VK_PAD_RTHUMB_DOWN:
|
||||
{
|
||||
XUIHtmlScrollInfo ScrollInfo;
|
||||
|
||||
XuiHtmlControlGetVScrollInfo(m_SellText.m_hObj,&ScrollInfo);
|
||||
if(!ScrollInfo.bScrolling)
|
||||
{
|
||||
XuiHtmlControlVScrollBy(m_SellText.m_hObj,1);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case VK_PAD_RTHUMB_UP:
|
||||
{
|
||||
XUIHtmlScrollInfo ScrollInfo;
|
||||
|
||||
XuiHtmlControlGetVScrollInfo(m_SellText.m_hObj,&ScrollInfo);
|
||||
if(!ScrollInfo.bScrolling)
|
||||
{
|
||||
XuiHtmlControlVScrollBy(m_SellText.m_hObj,-1);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
HRESULT CScene_DLCOffers::OnNavReturn(HXUIOBJ hObj,BOOL& rfHandled)
|
||||
{
|
||||
// re-enable button presses
|
||||
m_bIgnorePress=false;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
//void CScene_DLCOffers::UpdateTooltips(XMARKETPLACE_CONTENTOFFER_INFO& xOffer)
|
||||
void CScene_DLCOffers::UpdateTooltips(XMARKETPLACE_CURRENCY_CONTENTOFFER_INFO& xOffer)
|
||||
{
|
||||
// if the current offer hasn't been purchased already, check if there's a trial version available
|
||||
if(xOffer.fUserHasPurchased==false )
|
||||
{
|
||||
ui.SetTooltips( DEFAULT_XUI_MENU_USER, IDS_TOOLTIPS_INSTALL,IDS_TOOLTIPS_BACK);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui.SetTooltips( DEFAULT_XUI_MENU_USER, IDS_TOOLTIPS_REINSTALL,IDS_TOOLTIPS_BACK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
HRESULT CScene_DLCOffers::OnGetSourceDataImage(XUIMessageGetSourceImage *pGetSourceImageData,BOOL& bHandled)
|
||||
{
|
||||
if( pGetSourceImageData->bItemData )
|
||||
{
|
||||
pGetSourceImageData->hBrush = m_hXuiBrush;
|
||||
|
||||
bHandled = TRUE;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CScene_DLCOffers::OnNotifySelChanged(HXUIOBJ hObjSource, XUINotifySelChanged *pNotifySelChangedData, BOOL& bHandled)
|
||||
{
|
||||
//int index = pNotifySelChangedData->iItem;
|
||||
// reset the image monitor, but not for the first selection
|
||||
if(pNotifySelChangedData->iOldItem!=-1)
|
||||
{
|
||||
m_pNoImageFor_DLC=NULL;
|
||||
}
|
||||
|
||||
if (m_List.TreeHasFocus())// && offerIndexes.size() > index)
|
||||
{
|
||||
CXuiControl pItem;
|
||||
int iIndex;
|
||||
CXuiCtrl4JList::LIST_ITEM_INFO ItemInfo;
|
||||
// get the selected item
|
||||
iIndex=m_List.GetCurSel(&pItem);
|
||||
ItemInfo=m_pOffersList->GetData(iIndex);
|
||||
|
||||
// XMARKETPLACE_CONTENTOFFER_INFO xOffer=
|
||||
// StorageManager.GetOffer(ItemInfo.iData);
|
||||
XMARKETPLACE_CURRENCY_CONTENTOFFER_INFO xOffer=
|
||||
StorageManager.GetOffer(ItemInfo.iData);
|
||||
|
||||
|
||||
wchar_t formatting[40];
|
||||
wstring wstrTemp=xOffer.wszSellText;
|
||||
swprintf(formatting, 40, L"<font size=\"%d\">",m_bIsSD?12:14);
|
||||
wstrTemp = wstring(formatting) + wstrTemp;
|
||||
|
||||
m_SellText.SetText(wstrTemp.c_str());
|
||||
|
||||
// set the price info
|
||||
m_PriceTag.SetShow(TRUE);
|
||||
// swprintf(formatting, 40, L"%d",xOffer.dwPointsPrice);
|
||||
// wstrTemp=wstring(formatting);
|
||||
// m_PriceTag.SetText(wstrTemp.c_str());
|
||||
m_PriceTag.SetText(xOffer.wszCurrencyPrice);
|
||||
|
||||
DLC_INFO *dlc = app.GetDLCInfoForTrialOfferID(xOffer.qwOfferID);
|
||||
if(dlc==NULL)
|
||||
{
|
||||
dlc = app.GetDLCInfoForFullOfferID(xOffer.qwOfferID);
|
||||
}
|
||||
|
||||
if (dlc != NULL)
|
||||
{
|
||||
BYTE *pImage=NULL;
|
||||
UINT uiSize=0;
|
||||
DWORD dwSize=0;
|
||||
|
||||
WCHAR *cString = dlc->wchBanner;
|
||||
|
||||
int iIndex = app.GetLocalTMSFileIndex(cString,true);
|
||||
|
||||
if(iIndex!=-1)
|
||||
{
|
||||
// it's in the xzp
|
||||
if(m_hXuiBrush!=NULL)
|
||||
{
|
||||
XuiDestroyBrush(m_hXuiBrush);
|
||||
// clear the TMS XZP vector memory
|
||||
//app.FreeLocalTMSFiles();
|
||||
}
|
||||
app.LoadLocalTMSFile(cString);
|
||||
XuiCreateTextureBrushFromMemory(app.TMSFileA[iIndex].pbData,app.TMSFileA[iIndex].uiSize,&m_hXuiBrush);
|
||||
}
|
||||
else
|
||||
{
|
||||
bool bPresent = app.IsFileInMemoryTextures(cString);
|
||||
if (!bPresent)
|
||||
{
|
||||
// Image has not come in yet
|
||||
// Set the item monitored in the timer, so we can set the image when it comes in
|
||||
m_pNoImageFor_DLC=dlc;
|
||||
|
||||
// promote it to the top of the queue of images to be retrieved
|
||||
// We can't trust the dwContentCategory from partnernet - it has avatar items as content instead of avatars
|
||||
app.AddTMSPPFileTypeRequest(dlc->eDLCType,true);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(m_hXuiBrush!=NULL)
|
||||
{
|
||||
XuiDestroyBrush(m_hXuiBrush);
|
||||
// clear the TMS XZP vector memory
|
||||
//app.FreeLocalTMSFiles();
|
||||
}
|
||||
app.GetMemFileDetails(cString,&pImage,&dwSize);
|
||||
XuiCreateTextureBrushFromMemory(pImage,dwSize,&m_hXuiBrush);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(m_hXuiBrush!=NULL)
|
||||
{
|
||||
XuiDestroyBrush(m_hXuiBrush);
|
||||
// clear the TMS XZP vector memory
|
||||
//app.FreeLocalTMSFiles();
|
||||
|
||||
m_hXuiBrush=NULL;
|
||||
}
|
||||
}
|
||||
|
||||
UpdateTooltips(xOffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_SellText.SetText(L"");
|
||||
ui.SetTooltips( DEFAULT_XUI_MENU_USER, IDS_TOOLTIPS_ACCEPT ,IDS_TOOLTIPS_BACK);
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
HRESULT CScene_DLCOffers::OnTimer(XUIMessageTimer *pData,BOOL& rfHandled)
|
||||
{
|
||||
// check the ethernet status - if it's disconnected, exit the xui
|
||||
|
||||
if(ProfileManager.GetLiveConnectionStatus()!=XONLINE_S_LOGON_CONNECTION_ESTABLISHED)
|
||||
{
|
||||
UINT uiIDA[1];
|
||||
uiIDA[0]=IDS_CONFIRM_OK;
|
||||
|
||||
m_pOffersList->RemoveAllData();
|
||||
m_iOfferC=0;
|
||||
StorageManager.ClearDLCOffers();
|
||||
app.ClearAndResetDLCDownloadQueue();
|
||||
|
||||
StorageManager.RequestMessageBox(IDS_CONNECTION_LOST, IDS_CONNECTION_LOST_LIVE, uiIDA, 1, ProfileManager.GetPrimaryPad(),&CConsoleMinecraftApp::EthernetDisconnectReturned,this, app.GetStringTable());
|
||||
}
|
||||
|
||||
// Is the DLC we're looking for available?
|
||||
if(!m_bDLCRequiredIsRetrieved)
|
||||
{
|
||||
if(app.DLCContentRetrieved((eDLCMarketplaceType)m_iType))
|
||||
{
|
||||
m_bDLCRequiredIsRetrieved=true;
|
||||
|
||||
// Retrieve the info
|
||||
GetDLCInfo(app.GetDLCOffersCount(), false);
|
||||
m_bIgnorePress=false;
|
||||
}
|
||||
}
|
||||
|
||||
// Check for any TMS image we're waiting for
|
||||
if(m_pNoImageFor_DLC!=NULL)
|
||||
{
|
||||
// Is it present now?
|
||||
WCHAR *cString = m_pNoImageFor_DLC->wchBanner;
|
||||
|
||||
bool bPresent = app.IsFileInMemoryTextures(cString);
|
||||
|
||||
if(bPresent)
|
||||
{
|
||||
BYTE *pImage=NULL;
|
||||
DWORD dwSize=0;
|
||||
|
||||
if(m_hXuiBrush!=NULL)
|
||||
{
|
||||
XuiDestroyBrush(m_hXuiBrush);
|
||||
// clear the TMS XZP vector memory
|
||||
//app.FreeLocalTMSFiles();
|
||||
}
|
||||
app.GetMemFileDetails(cString,&pImage,&dwSize);
|
||||
XuiCreateTextureBrushFromMemory(pImage,dwSize,&m_hXuiBrush);
|
||||
m_pNoImageFor_DLC=NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
// int CScene_DLCOffers::EthernetDisconnectReturned(void *pParam,int iPad,const C4JStorage::EMessageResult)
|
||||
// {
|
||||
// CConsoleMinecraftApp* pApp = (CConsoleMinecraftApp*)pParam;
|
||||
//
|
||||
// pApp->NavigateBack(XUSER_INDEX_ANY);
|
||||
//
|
||||
// return 0;
|
||||
// }
|
||||
|
||||
HRESULT CScene_DLCOffers::OnCustomMessage_DLCInstalled()
|
||||
{
|
||||
// mounted DLC may have changed - need to re-run the GetDLC
|
||||
ui.SetTooltips( DEFAULT_XUI_MENU_USER, -1, IDS_TOOLTIPS_BACK);
|
||||
m_bIgnorePress=true;
|
||||
m_pOffersList->RemoveAllData();
|
||||
m_iOfferC=0;
|
||||
|
||||
// Update the dlc info
|
||||
StorageManager.ClearDLCOffers();
|
||||
app.ClearAndResetDLCDownloadQueue();
|
||||
|
||||
// order these requests so the current DLC comes in first
|
||||
switch(m_iType)
|
||||
{
|
||||
case e_DLC_Gamerpics:
|
||||
app.AddDLCRequest(e_Marketplace_Gamerpics);
|
||||
app.AddDLCRequest(e_Marketplace_Content);
|
||||
app.AddDLCRequest(e_Marketplace_Themes);
|
||||
app.AddDLCRequest(e_Marketplace_AvatarItems);
|
||||
break;
|
||||
case e_DLC_Themes:
|
||||
app.AddDLCRequest(e_Marketplace_Themes);
|
||||
app.AddDLCRequest(e_Marketplace_Content);
|
||||
app.AddDLCRequest(e_Marketplace_Gamerpics);
|
||||
app.AddDLCRequest(e_Marketplace_AvatarItems);
|
||||
break;
|
||||
case e_DLC_AvatarItems:
|
||||
app.AddDLCRequest(e_Marketplace_AvatarItems);
|
||||
app.AddDLCRequest(e_Marketplace_Content);
|
||||
app.AddDLCRequest(e_Marketplace_Themes);
|
||||
app.AddDLCRequest(e_Marketplace_Gamerpics);
|
||||
break;
|
||||
default:
|
||||
app.AddDLCRequest(e_Marketplace_Content);
|
||||
app.AddDLCRequest(e_Marketplace_Gamerpics);
|
||||
app.AddDLCRequest(e_Marketplace_Themes);
|
||||
app.AddDLCRequest(e_Marketplace_AvatarItems);
|
||||
break;
|
||||
}
|
||||
|
||||
m_Timer.SetShow(TRUE);
|
||||
m_bDLCRequiredIsRetrieved=false;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
136
Minecraft.Client/Common/XUI/XUI_DLCOffers.h
Normal file
136
Minecraft.Client/Common/XUI/XUI_DLCOffers.h
Normal file
@@ -0,0 +1,136 @@
|
||||
#pragma once
|
||||
|
||||
#include "../media\xuiscene_DLCOffers.h"
|
||||
#include "../media\xuiscene_DLCMain.h"
|
||||
|
||||
|
||||
#include "XUI_CustomMessages.h"
|
||||
#include "XUI_Ctrl_4JList.h"
|
||||
#include "XUI_Ctrl_4JIcon.h"
|
||||
//#include "XUI_Ctrl_DLCPrice.h"
|
||||
|
||||
class CXuiCtrl4JList;
|
||||
class CScene_DLCOffers;
|
||||
class CXuiCtrlDLCPrice;
|
||||
|
||||
class CScene_DLCMain : public CXuiSceneImpl
|
||||
{
|
||||
// Xui Elements
|
||||
CXuiList xList;
|
||||
CXuiCtrl4JList *list;
|
||||
CXuiControl m_Timer;
|
||||
|
||||
// Misc
|
||||
int iPad, iOfferC;
|
||||
|
||||
XUI_BEGIN_MSG_MAP()
|
||||
XUI_ON_XM_INIT( OnInit )
|
||||
XUI_ON_XM_DESTROY(OnDestroy)
|
||||
XUI_ON_XM_KEYDOWN( OnKeyDown )
|
||||
XUI_ON_XM_NOTIFY_PRESS_EX(OnNotifyPressEx)
|
||||
XUI_ON_XM_NAV_RETURN(OnNavReturn)
|
||||
XUI_ON_XM_TIMER( OnTimer )
|
||||
XUI_END_MSG_MAP()
|
||||
|
||||
BEGIN_CONTROL_MAP()
|
||||
MAP_CONTROL(IDC_XuiOffersList, xList)
|
||||
MAP_CONTROL(IDC_Timer, m_Timer)
|
||||
END_CONTROL_MAP()
|
||||
|
||||
HRESULT OnInit( XUIMessageInit* pInitData, BOOL& bHandled );
|
||||
HRESULT OnDestroy();
|
||||
HRESULT OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandled);
|
||||
HRESULT OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* pNotifyPressData, BOOL& rfHandled);
|
||||
HRESULT OnNavReturn(HXUIOBJ hObj,BOOL& rfHandled);
|
||||
HRESULT OnTimer( XUIMessageTimer *pTimer, BOOL& bHandled );
|
||||
|
||||
public:
|
||||
XUI_IMPLEMENT_CLASS( CScene_DLCMain, L"CScene_DLCMain", XUI_CLASS_SCENE )
|
||||
|
||||
private:
|
||||
bool m_bAllDLCContentRetrieved;
|
||||
bool m_bIgnoreInput;
|
||||
};
|
||||
|
||||
class CScene_DLCOffers : public CXuiSceneImpl
|
||||
{
|
||||
protected:
|
||||
//static const wstring DEFAULT_BANNER;
|
||||
|
||||
// Control and Element wrapper objects.
|
||||
CXuiList m_List;
|
||||
CXuiCtrl4JList *m_pOffersList;
|
||||
CXuiImageElement m_Banner;
|
||||
CXuiCtrl4JIcon m_TMSImage;
|
||||
CXuiHtmlControl m_SellText;
|
||||
CXuiControl m_PriceTag;
|
||||
CXuiControl m_Timer;
|
||||
HXUIBRUSH m_hXuiBrush;
|
||||
|
||||
// Message map. Here we tie messages to message handlers.
|
||||
XUI_BEGIN_MSG_MAP()
|
||||
XUI_ON_XM_INIT( OnInit )
|
||||
XUI_ON_XM_NOTIFY_SELCHANGED( OnNotifySelChanged )
|
||||
XUI_ON_XM_NOTIFY_PRESS_EX(OnNotifyPressEx)
|
||||
XUI_ON_XM_KEYDOWN(OnKeyDown)
|
||||
XUI_ON_XM_DESTROY(OnDestroy)
|
||||
XUI_ON_XM_NAV_RETURN(OnNavReturn)
|
||||
XUI_ON_XM_TIMER( OnTimer )
|
||||
XUI_ON_XM_DLCINSTALLED_MESSAGE(OnCustomMessage_DLCInstalled)
|
||||
XUI_ON_XM_GET_SOURCE_IMAGE( OnGetSourceDataImage )
|
||||
XUI_END_MSG_MAP()
|
||||
|
||||
// Control mapping to objects
|
||||
BEGIN_CONTROL_MAP()
|
||||
MAP_CONTROL(IDC_XuiOffersList, m_List)
|
||||
MAP_CONTROL(IDC_XuiHTMLSellText, m_SellText)
|
||||
MAP_CONTROL(IDC_XuiDLCPriceTag, m_PriceTag)
|
||||
MAP_CONTROL(IDC_XuiDLCBanner, m_TMSImage)
|
||||
MAP_CONTROL(IDC_Timer, m_Timer)
|
||||
END_CONTROL_MAP()
|
||||
|
||||
HRESULT OnInit( XUIMessageInit* pInitData, BOOL& bHandled );
|
||||
HRESULT OnNotifySelChanged( HXUIOBJ hObjSource, XUINotifySelChanged* pNotifySelChangedData, BOOL& bHandled );
|
||||
HRESULT OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* pNotifyPressData, BOOL& rfHandled);
|
||||
HRESULT OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandled);
|
||||
HRESULT OnDestroy();
|
||||
HRESULT OnNavReturn(HXUIOBJ hObj,BOOL& rfHandled);
|
||||
HRESULT OnTimer( XUIMessageTimer *pTimer, BOOL& bHandled );
|
||||
HRESULT OnCustomMessage_DLCInstalled();
|
||||
HRESULT OnGetSourceDataImage(XUIMessageGetSourceImage *pGetSourceImageData,BOOL& bHandled);
|
||||
|
||||
HRESULT GetDLCInfo( int iOfferC, bool bUpdateOnly=false );
|
||||
|
||||
//static int EthernetDisconnectReturned(void *pParam,int iPad,const C4JStorage::EMessageResult);
|
||||
static int TMSReadCallback(void *pParam,int iPad,bool bResult);
|
||||
|
||||
//void UpdateTooltips(XMARKETPLACE_CONTENTOFFER_INFO& xOffer);
|
||||
void UpdateTooltips(XMARKETPLACE_CURRENCY_CONTENTOFFER_INFO& xOffer);
|
||||
public:
|
||||
|
||||
// Define the class. The class name must match the ClassOverride property
|
||||
// set for the scene in the UI Authoring tool.
|
||||
XUI_IMPLEMENT_CLASS( CScene_DLCOffers, L"CScene_DLCOffers", XUI_CLASS_SCENE )
|
||||
|
||||
typedef struct _DLCOffer
|
||||
{
|
||||
int iOfferC;
|
||||
}
|
||||
DLCOffer;
|
||||
|
||||
private:
|
||||
|
||||
//vector<int> offerIndexes;
|
||||
CScene_DLCMain *pMain;
|
||||
bool m_bIgnorePress;
|
||||
int m_iPad;
|
||||
int m_iOfferC;
|
||||
int m_iType;
|
||||
bool m_bIsSD;
|
||||
bool m_bAllDLCContentRetrieved;
|
||||
bool m_bDLCRequiredIsRetrieved;
|
||||
bool m_bIsFemale; // to only show the correct gender type offers for avatars
|
||||
DLC_INFO *m_pNoImageFor_DLC;
|
||||
bool bNoDLCToDisplay; // to display a default "No DLC available at this time"
|
||||
|
||||
};
|
||||
242
Minecraft.Client/Common/XUI/XUI_Death.cpp
Normal file
242
Minecraft.Client/Common/XUI/XUI_Death.cpp
Normal file
@@ -0,0 +1,242 @@
|
||||
// Minecraft.cpp : Defines the entry point for the application.
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "..\XUI\XUI_Death.h"
|
||||
#include <assert.h>
|
||||
#include "..\..\..\Minecraft.World\AABB.h"
|
||||
#include "..\..\..\Minecraft.World\Vec3.h"
|
||||
#include "..\..\..\Minecraft.World\net.minecraft.stats.h"
|
||||
#include "..\..\..\Minecraft.Client\StatsCounter.h"
|
||||
#include "..\..\..\Minecraft.World\Entity.h"
|
||||
#include "..\..\..\Minecraft.Client\MultiplayerLocalPlayer.h"
|
||||
#include "..\..\..\Minecraft.World\Level.h"
|
||||
#include "..\..\..\Minecraft.World\ChunkSource.h"
|
||||
#include "..\..\..\Minecraft.Client\ProgressRenderer.h"
|
||||
#include "..\..\..\Minecraft.Client\GameRenderer.h"
|
||||
#include "..\..\..\Minecraft.Client\LevelRenderer.h"
|
||||
#include "..\..\..\Minecraft.World\Pos.h"
|
||||
#include "..\..\..\Minecraft.World\Dimension.h"
|
||||
#include "..\..\Minecraft.h"
|
||||
#include "..\..\Options.h"
|
||||
#include "..\..\LocalPlayer.h"
|
||||
#include "..\..\..\Minecraft.World\compression.h"
|
||||
//----------------------------------------------------------------------------------
|
||||
// Performs initialization tasks - retrieves controls.
|
||||
//----------------------------------------------------------------------------------
|
||||
HRESULT CScene_Death::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
|
||||
{
|
||||
m_iPad = *(int *)pInitData->pvInitData;
|
||||
|
||||
m_bIgnoreInput = false;
|
||||
|
||||
MapChildControls();
|
||||
if(app.GetLocalPlayerCount()>1)
|
||||
{
|
||||
app.AdjustSplitscreenScene(m_hObj,&m_OriginalPosition,m_iPad);
|
||||
}
|
||||
|
||||
XuiControlSetText(m_Title,app.GetString(IDS_YOU_DIED));
|
||||
XuiControlSetText(m_Buttons[BUTTON_DEATH_RESPAWN],app.GetString(IDS_RESPAWN));
|
||||
XuiControlSetText(m_Buttons[BUTTON_DEATH_EXITGAME],app.GetString(IDS_EXIT_GAME));
|
||||
|
||||
// Display the tooltips
|
||||
ui.SetTooltips( m_iPad, IDS_TOOLTIPS_SELECT);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Updates the UI when the list selection changes.
|
||||
//----------------------------------------------------------------------------------
|
||||
HRESULT CScene_Death::OnNotifySelChanged( HXUIOBJ hObjSource, XUINotifySelChanged* pNotifySelChangedData, BOOL& bHandled )
|
||||
{
|
||||
if( hObjSource == m_Scene )
|
||||
{
|
||||
/*int curSel = m_List.GetCurSel();
|
||||
|
||||
// Set the locale with the current language.
|
||||
XuiSetLocale( Languages[curSel].pszLanguagePath );
|
||||
|
||||
// Apply the locale to the main scene.
|
||||
XuiApplyLocale( m_hObj, NULL );
|
||||
|
||||
// Update the text for the current value.
|
||||
m_Value.SetText( m_List.GetText( curSel ) );*/
|
||||
|
||||
|
||||
|
||||
bHandled = TRUE;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Handler for the button press message.
|
||||
//----------------------------------------------------------------------------------
|
||||
HRESULT CScene_Death::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* pNotifyPressData, BOOL& rfHandled)
|
||||
{
|
||||
if(m_bIgnoreInput) return S_OK;
|
||||
|
||||
// This assumes all buttons can only be pressed with the A button
|
||||
ui.AnimateKeyPress(pNotifyPressData->UserIndex, VK_PAD_A);
|
||||
|
||||
unsigned int uiButtonCounter=0;
|
||||
|
||||
while((uiButtonCounter<BUTTONS_DEATH_MAX) && (m_Buttons[uiButtonCounter]!=hObjPressed)) uiButtonCounter++;
|
||||
|
||||
Minecraft *pMinecraft=Minecraft::GetInstance();
|
||||
|
||||
// Determine which button was pressed,
|
||||
// and call the appropriate function.
|
||||
switch(uiButtonCounter)
|
||||
{
|
||||
case BUTTON_DEATH_EXITGAME:
|
||||
{
|
||||
// 4J-PB - fix for #8333 - BLOCKER: If player decides to exit game, then cancels the exit player becomes stuck at game over screen
|
||||
//m_bIgnoreInput = true;
|
||||
// Check if it's the trial version
|
||||
if(ProfileManager.IsFullVersion())
|
||||
{
|
||||
UINT uiIDA[3];
|
||||
|
||||
// is it the primary player exiting?
|
||||
if(pNotifyPressData->UserIndex==ProfileManager.GetPrimaryPad())
|
||||
{
|
||||
int playTime = -1;
|
||||
if( pMinecraft->localplayers[pNotifyPressData->UserIndex] != NULL )
|
||||
{
|
||||
playTime = (int)pMinecraft->localplayers[pNotifyPressData->UserIndex]->getSessionTimer();
|
||||
}
|
||||
TelemetryManager->RecordLevelExit(pNotifyPressData->UserIndex, eSen_LevelExitStatus_Failed);
|
||||
|
||||
if(StorageManager.GetSaveDisabled())
|
||||
{
|
||||
uiIDA[0]=IDS_CONFIRM_CANCEL;
|
||||
uiIDA[1]=IDS_CONFIRM_OK;
|
||||
StorageManager.RequestMessageBox(IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME_PROGRESS_LOST, uiIDA, 2, pNotifyPressData->UserIndex,&UIScene_PauseMenu::ExitGameDialogReturned,this, app.GetStringTable());
|
||||
}
|
||||
else
|
||||
{
|
||||
if( g_NetworkManager.IsHost() )
|
||||
{
|
||||
uiIDA[0]=IDS_CONFIRM_CANCEL;
|
||||
uiIDA[1]=IDS_EXIT_GAME_SAVE;
|
||||
uiIDA[2]=IDS_EXIT_GAME_NO_SAVE;
|
||||
|
||||
StorageManager.RequestMessageBox(IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME, uiIDA, 3, pNotifyPressData->UserIndex,&UIScene_PauseMenu::ExitGameSaveDialogReturned,this, app.GetStringTable());
|
||||
}
|
||||
else
|
||||
{
|
||||
uiIDA[0]=IDS_CONFIRM_CANCEL;
|
||||
uiIDA[1]=IDS_CONFIRM_OK;
|
||||
|
||||
StorageManager.RequestMessageBox(IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME, uiIDA, 2, pNotifyPressData->UserIndex,&UIScene_PauseMenu::ExitGameDialogReturned,this, app.GetStringTable());
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
TelemetryManager->RecordLevelExit(pNotifyPressData->UserIndex, eSen_LevelExitStatus_Failed);
|
||||
|
||||
// just exit the player
|
||||
app.SetAction(pNotifyPressData->UserIndex,eAppAction_ExitPlayer);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// is it the primary player exiting?
|
||||
if(pNotifyPressData->UserIndex==ProfileManager.GetPrimaryPad())
|
||||
{
|
||||
TelemetryManager->RecordLevelExit(pNotifyPressData->UserIndex, eSen_LevelExitStatus_Failed);
|
||||
|
||||
// adjust the trial time played
|
||||
CXuiSceneBase::ReduceTrialTimerValue();
|
||||
|
||||
// exit the level
|
||||
UINT uiIDA[2];
|
||||
uiIDA[0]=IDS_CONFIRM_CANCEL;
|
||||
uiIDA[1]=IDS_CONFIRM_OK;
|
||||
StorageManager.RequestMessageBox(IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME_PROGRESS_LOST, uiIDA, 2, pNotifyPressData->UserIndex,&UIScene_PauseMenu::ExitGameDialogReturned,this, app.GetStringTable());
|
||||
}
|
||||
else
|
||||
{
|
||||
TelemetryManager->RecordLevelExit(pNotifyPressData->UserIndex, eSen_LevelExitStatus_Failed);
|
||||
|
||||
// just exit the player
|
||||
app.SetAction(pNotifyPressData->UserIndex,eAppAction_ExitPlayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case BUTTON_DEATH_RESPAWN:
|
||||
{
|
||||
m_bIgnoreInput = true;
|
||||
app.SetAction(pNotifyPressData->UserIndex,eAppAction_Respawn);
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CScene_Death::OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandled)
|
||||
{
|
||||
ui.AnimateKeyPress(pInputData->UserIndex, pInputData->dwKeyCode);
|
||||
|
||||
|
||||
switch(pInputData->dwKeyCode)
|
||||
{
|
||||
|
||||
case VK_PAD_B:
|
||||
case VK_PAD_START:
|
||||
case VK_ESCAPE:
|
||||
|
||||
// kill the crafting xui
|
||||
// 4J Stu - No back out, must choose
|
||||
//app.CloseXuiScenes();
|
||||
|
||||
rfHandled = TRUE;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
int CScene_Death::RespawnThreadProc( void* lpParameter )
|
||||
{
|
||||
AABB::UseDefaultThreadStorage();
|
||||
Vec3::UseDefaultThreadStorage();
|
||||
Compression::UseDefaultThreadStorage();
|
||||
size_t iPad=(size_t)lpParameter;
|
||||
|
||||
Minecraft *pMinecraft=Minecraft::GetInstance();
|
||||
|
||||
pMinecraft->localplayers[iPad]->respawn();
|
||||
|
||||
app.SetGameStarted(true);
|
||||
pMinecraft->gameRenderer->EnableUpdateThread();
|
||||
|
||||
// If we are online, then we should wait here until the respawn is done
|
||||
// If we are offline, this should release straight away
|
||||
//WaitForSingleObject( pMinecraft->m_hPlayerRespawned, INFINITE );
|
||||
while(pMinecraft->localplayers[iPad]->GetPlayerRespawned()==false)
|
||||
{
|
||||
Sleep(50);
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CScene_Death::OnCustomMessage_Splitscreenplayer(bool bJoining, BOOL& bHandled)
|
||||
{
|
||||
bHandled=true;
|
||||
return app.AdjustSplitscreenScene_PlayerChanged(m_hObj,&m_OriginalPosition,m_iPad,bJoining);
|
||||
}
|
||||
52
Minecraft.Client/Common/XUI/XUI_Death.h
Normal file
52
Minecraft.Client/Common/XUI/XUI_Death.h
Normal file
@@ -0,0 +1,52 @@
|
||||
#pragma once
|
||||
|
||||
#include "../media/xuiscene_Death.h"
|
||||
#include "XUI_CustomMessages.h"
|
||||
|
||||
#define BUTTON_DEATH_RESPAWN 0
|
||||
#define BUTTON_DEATH_EXITGAME 1
|
||||
#define BUTTONS_DEATH_MAX BUTTON_DEATH_EXITGAME + 1
|
||||
|
||||
|
||||
|
||||
class CScene_Death : public CXuiSceneImpl
|
||||
{
|
||||
protected:
|
||||
// Control and Element wrapper objects.
|
||||
CXuiScene m_Scene;
|
||||
CXuiControl m_Buttons[BUTTONS_DEATH_MAX];
|
||||
CXuiControl m_Title;
|
||||
// Message map. Here we tie messages to message handlers.
|
||||
XUI_BEGIN_MSG_MAP()
|
||||
XUI_ON_XM_INIT( OnInit )
|
||||
XUI_ON_XM_NOTIFY_SELCHANGED( OnNotifySelChanged )
|
||||
XUI_ON_XM_NOTIFY_PRESS_EX(OnNotifyPressEx)
|
||||
XUI_ON_XM_KEYDOWN(OnKeyDown)
|
||||
XUI_ON_XM_SPLITSCREENPLAYER_MESSAGE(OnCustomMessage_Splitscreenplayer)
|
||||
XUI_END_MSG_MAP()
|
||||
|
||||
// Control mapping to objects
|
||||
BEGIN_CONTROL_MAP()
|
||||
MAP_CONTROL(IDC_Respawn, m_Buttons[BUTTON_DEATH_RESPAWN])
|
||||
MAP_CONTROL(IDC_ExitGame, m_Buttons[BUTTON_DEATH_EXITGAME])
|
||||
MAP_CONTROL(IDC_Title, m_Title)
|
||||
END_CONTROL_MAP()
|
||||
|
||||
HRESULT OnInit( XUIMessageInit* pInitData, BOOL& bHandled );
|
||||
HRESULT OnNotifySelChanged( HXUIOBJ hObjSource, XUINotifySelChanged* pNotifySelChangedData, BOOL& bHandled );
|
||||
HRESULT OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* pNotifyPressData,BOOL& rfHandled);
|
||||
HRESULT OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandled);
|
||||
HRESULT OnCustomMessage_Splitscreenplayer(bool bJoining, BOOL& bHandled);
|
||||
public:
|
||||
|
||||
// Define the class. The class name must match the ClassOverride property
|
||||
// set for the scene in the UI Authoring tool.
|
||||
XUI_IMPLEMENT_CLASS( CScene_Death, L"CScene_Death", XUI_CLASS_SCENE )
|
||||
|
||||
static int RespawnThreadProc( void* lpParameter );
|
||||
private:
|
||||
bool m_bIgnoreInput;
|
||||
int m_iPad;
|
||||
D3DXVECTOR3 m_OriginalPosition;
|
||||
|
||||
};
|
||||
53
Minecraft.Client/Common/XUI/XUI_Debug.h
Normal file
53
Minecraft.Client/Common/XUI/XUI_Debug.h
Normal file
@@ -0,0 +1,53 @@
|
||||
#pragma once
|
||||
|
||||
#include "../media/xuiscene_debug.h"
|
||||
|
||||
class CScene_Debug : public CXuiSceneImpl
|
||||
{
|
||||
protected:
|
||||
|
||||
|
||||
// Message map. Here we tie messages to message handlers.
|
||||
XUI_BEGIN_MSG_MAP()
|
||||
XUI_ON_XM_INIT( OnInit )
|
||||
XUI_ON_XM_KEYDOWN(OnKeyDown)
|
||||
XUI_ON_XM_NOTIFY_SELCHANGED( OnNotifySelChanged )
|
||||
XUI_ON_XM_NOTIFY_VALUE_CHANGED( OnNotifyValueChanged )
|
||||
XUI_ON_XM_NOTIFY_PRESS_EX(OnNotifyPressEx)
|
||||
XUI_ON_XM_CONTROL_NAVIGATE(OnControlNavigate)
|
||||
XUI_END_MSG_MAP()
|
||||
|
||||
HRESULT OnInit( XUIMessageInit* pInitData, BOOL& bHandled );
|
||||
HRESULT OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandled);
|
||||
HRESULT OnNotifySelChanged( HXUIOBJ hObjSource, XUINotifySelChanged* pNotifySelChangedData, BOOL& bHandled );
|
||||
HRESULT OnNotifyValueChanged( HXUIOBJ hObjSource, XUINotifyValueChanged* pNotifyValueChanged, BOOL& bHandled );
|
||||
HRESULT OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* pNotifyPressData,BOOL& rfHandled);
|
||||
HRESULT OnControlNavigate(XUIMessageControlNavigate *pControlNavigateData, BOOL& bHandled);
|
||||
public:
|
||||
|
||||
|
||||
// Define the class. The class name must match the ClassOverride property
|
||||
// set for the scene in the UI Authoring tool.
|
||||
XUI_IMPLEMENT_CLASS( CScene_Debug, L"CScene_Debug", XUI_CLASS_SCENE )
|
||||
|
||||
private:
|
||||
|
||||
typedef struct
|
||||
{
|
||||
HXUIOBJ hXuiObj;
|
||||
VOID *pvData;
|
||||
}
|
||||
DEBUGDATA;
|
||||
|
||||
|
||||
static LPCWSTR m_DebugCheckboxTextA[eDebugSetting_Max+1];
|
||||
static LPCWSTR m_DebugButtonTextA[eDebugButton_Max+1];
|
||||
int m_iTotalCheckboxElements;
|
||||
int m_iTotalButtonElements;
|
||||
DEBUGDATA *m_DebugCheckboxDataA;
|
||||
DEBUGDATA *m_DebugButtonDataA;
|
||||
int m_iCurrentCheckboxElement;
|
||||
int m_iCurrentButtonElement;
|
||||
int m_iPad;
|
||||
bool m_bOnCheckboxes; // for navigations
|
||||
};
|
||||
118
Minecraft.Client/Common/XUI/XUI_DebugItemEditor.cpp
Normal file
118
Minecraft.Client/Common/XUI/XUI_DebugItemEditor.cpp
Normal file
@@ -0,0 +1,118 @@
|
||||
#include "stdafx.h"
|
||||
#include "..\..\..\Minecraft.World\StringHelpers.h"
|
||||
#include "..\..\..\Minecraft.World\net.minecraft.world.inventory.h"
|
||||
#include "..\..\..\Minecraft.World\net.minecraft.world.item.h"
|
||||
#include "..\..\..\Minecraft.World\net.minecraft.network.packet.h"
|
||||
#include "..\..\Minecraft.h"
|
||||
#include "..\..\MultiPlayerLocalPlayer.h"
|
||||
#include "..\..\ClientConnection.h"
|
||||
#include "..\..\Common\GameRules\ConsoleGameRules.h"
|
||||
#include "XUI_DebugItemEditor.h"
|
||||
|
||||
#ifdef _DEBUG_MENUS_ENABLED
|
||||
HRESULT CScene_DebugItemEditor::OnInit( XUIMessageInit *pInitData, BOOL &bHandled )
|
||||
{
|
||||
MapChildControls();
|
||||
|
||||
ItemEditorInput *initData = (ItemEditorInput *)pInitData->pvInitData;
|
||||
m_iPad = initData->iPad;
|
||||
m_slot = initData->slot;
|
||||
m_menu = initData->menu;
|
||||
if(m_slot != NULL) m_item = m_slot->getItem();
|
||||
|
||||
if(m_item!=NULL)
|
||||
{
|
||||
m_icon->SetIcon(m_iPad, m_item->id,m_item->getAuxValue(),m_item->count,10,31,false,m_item->isFoil());
|
||||
m_itemName.SetText( app.GetString( Item::items[m_item->id]->getDescriptionId(m_item) ) );
|
||||
|
||||
m_itemId .SetText( _toString<int>(m_item->id).c_str() );
|
||||
m_itemAuxValue .SetText( _toString<int>(m_item->getAuxValue()).c_str() );
|
||||
m_itemCount .SetText( _toString<int>(m_item->count).c_str() );
|
||||
m_item4JData .SetText( _toString<int>(m_item->get4JData()).c_str() );
|
||||
}
|
||||
|
||||
m_itemId .SetKeyboardType(C_4JInput::EKeyboardMode_Numeric);
|
||||
m_itemAuxValue .SetKeyboardType(C_4JInput::EKeyboardMode_Numeric);
|
||||
m_itemCount .SetKeyboardType(C_4JInput::EKeyboardMode_Numeric);
|
||||
m_item4JData .SetKeyboardType(C_4JInput::EKeyboardMode_Numeric);
|
||||
|
||||
m_generatedXml.SetText( CollectItemRuleDefinition::generateXml(m_item).c_str() );
|
||||
|
||||
delete initData;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CScene_DebugItemEditor::OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandled)
|
||||
{
|
||||
ui.AnimateKeyPress(pInputData->UserIndex, pInputData->dwKeyCode);
|
||||
|
||||
switch(pInputData->dwKeyCode)
|
||||
{
|
||||
|
||||
case VK_PAD_B:
|
||||
case VK_PAD_START:
|
||||
case VK_PAD_BACK:
|
||||
// We need to send a packet to the server to update it's representation of this item
|
||||
if(m_slot != NULL && m_menu != NULL)
|
||||
{
|
||||
m_slot->set(m_item);
|
||||
|
||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||
shared_ptr<MultiplayerLocalPlayer> player = pMinecraft->localplayers[m_iPad];
|
||||
if(player != NULL && player->connection) player->connection->send( shared_ptr<ContainerSetSlotPacket>( new ContainerSetSlotPacket(m_menu->containerId, m_slot->index, m_item) ) );
|
||||
}
|
||||
// kill the crafting xui
|
||||
app.NavigateBack(m_iPad);
|
||||
|
||||
rfHandled = TRUE;
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CScene_DebugItemEditor::OnNotifyValueChanged( HXUIOBJ hObjSource, XUINotifyValueChanged *pNotifyValueChangedData, BOOL &bHandled)
|
||||
{
|
||||
if(m_item == NULL) m_item = shared_ptr<ItemInstance>( new ItemInstance(0,1,0) );
|
||||
if(hObjSource == m_itemId)
|
||||
{
|
||||
int id = 0;
|
||||
wstring value = m_itemId.GetText();
|
||||
if(!value.empty()) id = _fromString<int>( value );
|
||||
|
||||
// TODO Proper validation of the valid item ids
|
||||
if(id > 0 && Item::items[id] != NULL) m_item->id = id;
|
||||
}
|
||||
else if(hObjSource == m_itemAuxValue)
|
||||
{
|
||||
int auxVal = 0;
|
||||
wstring value = m_itemAuxValue.GetText();
|
||||
if(!value.empty()) auxVal = _fromString<int>( value );
|
||||
if(auxVal >= 0) m_item->setAuxValue( auxVal );
|
||||
}
|
||||
else if(hObjSource == m_itemCount)
|
||||
{
|
||||
int count = 0;
|
||||
wstring value = m_itemCount.GetText();
|
||||
if(!value.empty()) count = _fromString<int>( value );
|
||||
if(count > 0 && count <= Item::items[m_item->id]->getMaxStackSize()) m_item->count = count;
|
||||
}
|
||||
else if(hObjSource == m_item4JData)
|
||||
{
|
||||
int data = 0;
|
||||
wstring value = m_item4JData.GetText();
|
||||
if(!value.empty()) data = _fromString<int>( value );
|
||||
m_item->set4JData(data);
|
||||
}
|
||||
|
||||
m_icon->SetIcon(m_iPad, m_item->id,m_item->getAuxValue(),m_item->count,10,31,false,m_item->isFoil());
|
||||
|
||||
m_itemName.SetText( app.GetString( Item::items[m_item->id]->getDescriptionId(m_item) ) );
|
||||
|
||||
m_generatedXml.SetText( CollectItemRuleDefinition::generateXml(m_item).c_str() );
|
||||
return S_OK;
|
||||
}
|
||||
#endif
|
||||
57
Minecraft.Client/Common/XUI/XUI_DebugItemEditor.h
Normal file
57
Minecraft.Client/Common/XUI/XUI_DebugItemEditor.h
Normal file
@@ -0,0 +1,57 @@
|
||||
#pragma once
|
||||
using namespace std;
|
||||
#include "../media/xuiscene_debug_item_editor.h"
|
||||
|
||||
#include "XUI_Ctrl_CraftIngredientSlot.h"
|
||||
#include "XUI_Ctrl_4JEdit.h"
|
||||
#include "..\..\..\Minecraft.World\ItemInstance.h"
|
||||
|
||||
class CScene_DebugItemEditor : public CXuiSceneImpl
|
||||
{
|
||||
#ifdef _DEBUG_MENUS_ENABLED
|
||||
public:
|
||||
typedef struct _ItemEditorInput
|
||||
{
|
||||
int iPad;
|
||||
Slot *slot;
|
||||
AbstractContainerMenu *menu;
|
||||
} ItemEditorInput;
|
||||
private:
|
||||
int m_iPad;
|
||||
shared_ptr<ItemInstance> m_item;
|
||||
Slot *m_slot;
|
||||
AbstractContainerMenu *m_menu;
|
||||
|
||||
CXuiCtrlCraftIngredientSlot *m_icon;
|
||||
CXuiControl m_generatedXml, m_itemName;
|
||||
CXuiCtrl4JEdit m_itemId, m_itemAuxValue, m_itemCount, m_item4JData;
|
||||
|
||||
protected:
|
||||
// Message map. Here we tie messages to message handlers.
|
||||
XUI_BEGIN_MSG_MAP()
|
||||
XUI_ON_XM_INIT( OnInit )
|
||||
XUI_ON_XM_KEYDOWN(OnKeyDown)
|
||||
XUI_ON_XM_NOTIFY_VALUE_CHANGED( OnNotifyValueChanged )
|
||||
XUI_END_MSG_MAP()
|
||||
|
||||
// Control mapping to objects
|
||||
BEGIN_CONTROL_MAP()
|
||||
MAP_CONTROL(IDC_itemId, m_itemId)
|
||||
MAP_CONTROL(IDC_itemAuxValue, m_itemAuxValue)
|
||||
MAP_CONTROL(IDC_itemCount, m_itemCount)
|
||||
MAP_CONTROL(IDC_item4JData, m_item4JData)
|
||||
MAP_OVERRIDE(IDC_icon, m_icon)
|
||||
MAP_CONTROL(IDC_ruleXml, m_generatedXml)
|
||||
MAP_CONTROL(IDC_itemName, m_itemName)
|
||||
END_CONTROL_MAP()
|
||||
|
||||
HRESULT OnInit( XUIMessageInit* pInitData, BOOL& bHandled );
|
||||
HRESULT OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandled);
|
||||
HRESULT OnNotifyValueChanged( HXUIOBJ hObjSource, XUINotifyValueChanged *pNotifyValueChangedData, BOOL &bHandled);
|
||||
public:
|
||||
|
||||
// Define the class. The class name must match the ClassOverride property
|
||||
// set for the scene in the UI Authoring tool.
|
||||
XUI_IMPLEMENT_CLASS( CScene_DebugItemEditor, L"CScene_DebugItemEditor", XUI_CLASS_SCENE )
|
||||
#endif
|
||||
};
|
||||
391
Minecraft.Client/Common/XUI/XUI_DebugOverlay.cpp
Normal file
391
Minecraft.Client/Common/XUI/XUI_DebugOverlay.cpp
Normal file
@@ -0,0 +1,391 @@
|
||||
#include "stdafx.h"
|
||||
#include "..\..\Minecraft.h"
|
||||
#include "..\..\MultiplayerLocalPlayer.h"
|
||||
#include "..\..\MultiplayerLevel.h"
|
||||
#include "..\..\GameMode.h"
|
||||
#include "..\..\SurvivalMode.h"
|
||||
#include "..\..\CreativeMode.h"
|
||||
#include "ClientConnection.h"
|
||||
#include "MultiPlayerLocalPlayer.h"
|
||||
#include "..\..\..\Minecraft.World\ArrayWithLength.h"
|
||||
#include "..\..\..\Minecraft.World\com.mojang.nbt.h"
|
||||
#include "..\..\..\Minecraft.World\net.minecraft.world.entity.player.h"
|
||||
#include "..\..\..\Minecraft.World\net.minecraft.world.entity.animal.h"
|
||||
#include "..\..\..\Minecraft.World\net.minecraft.world.entity.monster.h"
|
||||
#include "..\..\..\Minecraft.World\net.minecraft.world.entity.boss.enderdragon.h"
|
||||
#include "..\..\..\Minecraft.World\net.minecraft.world.level.h"
|
||||
#include "..\..\..\Minecraft.World\net.minecraft.world.level.saveddata.h"
|
||||
#include "..\..\..\Minecraft.World\net.minecraft.world.level.chunk.storage.h"
|
||||
#include "..\..\..\Minecraft.World\net.minecraft.world.level.storage.h"
|
||||
#include "..\..\..\Minecraft.World\InputOutputStream.h"
|
||||
#include "..\..\..\Minecraft.World\ConsoleSaveFileIO.h"
|
||||
#include "..\..\..\Minecraft.World\net.minecraft.world.item.h"
|
||||
#include "..\..\..\Minecraft.World\net.minecraft.world.item.enchantment.h"
|
||||
#include "XUI_DebugOverlay.h"
|
||||
#include "..\..\..\Minecraft.Client\GameRenderer.h"
|
||||
#include "..\..\MinecraftServer.h"
|
||||
#include "..\..\Common\Tutorial\Tutorial.h"
|
||||
#include "..\..\..\Minecraft.World\net.minecraft.commands.common.h"
|
||||
#include "..\..\..\Minecraft.World\ConsoleSaveFileOriginal.h"
|
||||
|
||||
#ifdef _DEBUG_MENUS_ENABLED
|
||||
HRESULT CScene_DebugOverlay::OnInit( XUIMessageInit *pInitData, BOOL &bHandled )
|
||||
{
|
||||
MapChildControls();
|
||||
|
||||
m_items.InsertItems( 0, 512 );
|
||||
|
||||
for(unsigned int i = 0; i < Item::items.length; ++i)
|
||||
{
|
||||
if(Item::items[i] != NULL)
|
||||
{
|
||||
//m_items.InsertItems(m_items.GetItemCount(),1);
|
||||
m_itemIds.push_back(i);
|
||||
m_items.SetText( m_itemIds.size() - 1, app.GetString( Item::items[i]->getDescriptionId() ) );
|
||||
}
|
||||
}
|
||||
|
||||
m_enchantments.InsertItems( 0, Enchantment::validEnchantments.size() );
|
||||
for(unsigned int i = 0; i < Enchantment::validEnchantments.size(); ++i )
|
||||
{
|
||||
Enchantment *ench = Enchantment::validEnchantments.at(i);
|
||||
|
||||
m_enchantmentIds.push_back(ench->id);
|
||||
m_enchantments.SetText( i, app.GetString( ench->getDescriptionId() ) );
|
||||
}
|
||||
|
||||
m_mobs.InsertItems( 0, 21 );
|
||||
|
||||
m_mobs.SetText( m_mobFactories.size(), L"Chicken" );
|
||||
m_mobFactories.push_back(eTYPE_CHICKEN);
|
||||
m_mobs.SetText( m_mobFactories.size(), L"Cow" );
|
||||
m_mobFactories.push_back(eTYPE_COW);
|
||||
m_mobs.SetText( m_mobFactories.size(), L"Pig" );
|
||||
m_mobFactories.push_back(eTYPE_PIG);
|
||||
m_mobs.SetText( m_mobFactories.size(), L"Sheep" );
|
||||
m_mobFactories.push_back(eTYPE_SHEEP);
|
||||
m_mobs.SetText( m_mobFactories.size(), L"Squid" );
|
||||
m_mobFactories.push_back(eTYPE_SQUID);
|
||||
m_mobs.SetText( m_mobFactories.size(), L"Wolf" );
|
||||
m_mobFactories.push_back(eTYPE_WOLF);
|
||||
m_mobs.SetText( m_mobFactories.size(), L"Creeper" );
|
||||
m_mobFactories.push_back(eTYPE_CREEPER);
|
||||
m_mobs.SetText( m_mobFactories.size(), L"Ghast" );
|
||||
m_mobFactories.push_back(eTYPE_GHAST);
|
||||
m_mobs.SetText( m_mobFactories.size(), L"Pig Zombie" );
|
||||
m_mobFactories.push_back(eTYPE_PIGZOMBIE);
|
||||
m_mobs.SetText( m_mobFactories.size(), L"Skeleton" );
|
||||
m_mobFactories.push_back(eTYPE_SKELETON);
|
||||
m_mobs.SetText( m_mobFactories.size(), L"Slime" );
|
||||
m_mobFactories.push_back(eTYPE_SLIME);
|
||||
m_mobs.SetText( m_mobFactories.size(), L"Spider" );
|
||||
m_mobFactories.push_back(eTYPE_SPIDER);
|
||||
m_mobs.SetText( m_mobFactories.size(), L"Zombie" );
|
||||
m_mobFactories.push_back(eTYPE_ZOMBIE);
|
||||
m_mobs.SetText( m_mobFactories.size(), L"Enderman" );
|
||||
m_mobFactories.push_back(eTYPE_ENDERMAN);
|
||||
m_mobs.SetText( m_mobFactories.size(), L"Silverfish" );
|
||||
m_mobFactories.push_back(eTYPE_SILVERFISH);
|
||||
m_mobs.SetText( m_mobFactories.size(), L"Cave Spider" );
|
||||
m_mobFactories.push_back(eTYPE_CAVESPIDER);
|
||||
m_mobs.SetText( m_mobFactories.size(), L"Mooshroom" );
|
||||
m_mobFactories.push_back(eTYPE_MUSHROOMCOW);
|
||||
m_mobs.SetText( m_mobFactories.size(), L"Snow Golem" );
|
||||
m_mobFactories.push_back(eTYPE_SNOWMAN);
|
||||
m_mobs.SetText( m_mobFactories.size(), L"Ender Dragon" );
|
||||
m_mobFactories.push_back(eTYPE_ENDERDRAGON);
|
||||
m_mobs.SetText( m_mobFactories.size(), L"Blaze" );
|
||||
m_mobFactories.push_back(eTYPE_BLAZE);
|
||||
m_mobs.SetText( m_mobFactories.size(), L"Magma Cube" );
|
||||
m_mobFactories.push_back(eTYPE_LAVASLIME);
|
||||
|
||||
|
||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||
m_setTime.SetValue( pMinecraft->level->getLevelData()->getTime() % 24000 );
|
||||
m_setFov.SetValue( (int)pMinecraft->gameRenderer->GetFovVal());
|
||||
|
||||
XuiSetTimer(m_hObj,0,DEBUG_OVERLAY_UPDATE_TIME_PERIOD);
|
||||
|
||||
bHandled = TRUE;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
// Handler for the XM_NOTIFY message
|
||||
HRESULT CScene_DebugOverlay::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* pNotifyPressData, BOOL& rfHandled)
|
||||
{
|
||||
// This assumes all buttons can only be pressed with the A button
|
||||
ui.AnimateKeyPress(pNotifyPressData->UserIndex, VK_PAD_A);
|
||||
|
||||
unsigned int nIndex;
|
||||
|
||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||
|
||||
if ( hObjPressed == m_items )
|
||||
{
|
||||
nIndex = m_items.GetCurSel();
|
||||
if(nIndex<m_itemIds.size())
|
||||
{
|
||||
int id = m_itemIds[nIndex];
|
||||
//app.SetXuiServerAction(pNotifyPressData->UserIndex, eXuiServerAction_DropItem, (void *)id);
|
||||
ClientConnection *conn = Minecraft::GetInstance()->getConnection(ProfileManager.GetPrimaryPad());
|
||||
conn->send( GiveItemCommand::preparePacket(dynamic_pointer_cast<Player>(Minecraft::GetInstance()->localplayers[ProfileManager.GetPrimaryPad()]), id) );
|
||||
}
|
||||
}
|
||||
else if ( hObjPressed == m_mobs )
|
||||
{
|
||||
nIndex = m_mobs.GetCurSel();
|
||||
if(nIndex<m_mobFactories.size())
|
||||
{
|
||||
app.SetXuiServerAction(ProfileManager.GetPrimaryPad(),eXuiServerAction_SpawnMob,(void *)m_mobFactories[nIndex]);
|
||||
}
|
||||
}
|
||||
else if ( hObjPressed == m_enchantments )
|
||||
{
|
||||
nIndex = m_enchantments.GetCurSel();
|
||||
ClientConnection *conn = Minecraft::GetInstance()->getConnection(ProfileManager.GetPrimaryPad());
|
||||
conn->send( EnchantItemCommand::preparePacket(dynamic_pointer_cast<Player>(Minecraft::GetInstance()->localplayers[ProfileManager.GetPrimaryPad()]), m_enchantmentIds[nIndex]) );
|
||||
}
|
||||
/*else if( hObjPressed == m_saveToDisc ) // 4J-JEV: Doesn't look like we use this debug option anymore.
|
||||
{
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
pMinecraft->level->save(true, NULL);
|
||||
|
||||
int radius;
|
||||
m_chunkRadius.GetValue(&radius);
|
||||
if( radius > 0 )
|
||||
{
|
||||
SaveLimitedFile(radius);
|
||||
}
|
||||
else
|
||||
{
|
||||
pMinecraft->level->getLevelStorage()->getSaveFile()->DebugFlushToFile();
|
||||
}
|
||||
#endif
|
||||
}*/
|
||||
else if( hObjPressed == m_createSchematic )
|
||||
{
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
// load from the .xzp file
|
||||
const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL);
|
||||
|
||||
HXUIOBJ hScene;
|
||||
HRESULT hr;
|
||||
//const WCHAR XZP_SEPARATOR = L'#';
|
||||
const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string
|
||||
WCHAR szResourceLocator[ LOCATOR_SIZE ];
|
||||
|
||||
swprintf(szResourceLocator, LOCATOR_SIZE, L"section://%X,%ls#%ls",c_ModuleHandle,L"media", L"media/");
|
||||
hr = XuiSceneCreate(szResourceLocator,app.GetSceneName(eUIScene_DebugCreateSchematic,false, false), NULL, &hScene);
|
||||
this->NavigateForward(hScene);
|
||||
//app.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_DebugCreateSchematic);
|
||||
#endif
|
||||
}
|
||||
else if ( hObjPressed == m_setCamera )
|
||||
{
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
// load from the .xzp file
|
||||
const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL);
|
||||
|
||||
HXUIOBJ hScene;
|
||||
HRESULT hr;
|
||||
//const WCHAR XZP_SEPARATOR = L'#';
|
||||
const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string
|
||||
WCHAR szResourceLocator[ LOCATOR_SIZE ];
|
||||
|
||||
swprintf(szResourceLocator, LOCATOR_SIZE, L"section://%X,%ls#%ls",c_ModuleHandle,L"media", L"media/");
|
||||
hr = XuiSceneCreate(szResourceLocator,app.GetSceneName(eUIScene_DebugSetCamera, false, false), NULL, &hScene);
|
||||
this->NavigateForward(hScene);
|
||||
//app.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_DebugCreateSchematic);
|
||||
#endif
|
||||
}
|
||||
else if( hObjPressed == m_toggleRain )
|
||||
{
|
||||
//app.SetXuiServerAction(ProfileManager.GetPrimaryPad(),eXuiServerAction_ToggleRain);
|
||||
ClientConnection *conn = Minecraft::GetInstance()->getConnection(ProfileManager.GetPrimaryPad());
|
||||
conn->send( ToggleDownfallCommand::preparePacket() );
|
||||
}
|
||||
else if( hObjPressed == m_toggleThunder )
|
||||
{
|
||||
app.SetXuiServerAction(ProfileManager.GetPrimaryPad(),eXuiServerAction_ToggleThunder);
|
||||
}
|
||||
else if( hObjPressed == m_resetTutorial )
|
||||
{
|
||||
Tutorial::debugResetPlayerSavedProgress( ProfileManager.GetPrimaryPad() );
|
||||
}
|
||||
else if( hObjPressed == m_setDay )
|
||||
{
|
||||
ClientConnection *conn = Minecraft::GetInstance()->getConnection(ProfileManager.GetPrimaryPad());
|
||||
conn->send( TimeCommand::preparePacket(false) );
|
||||
}
|
||||
else if( hObjPressed == m_setNight )
|
||||
{
|
||||
ClientConnection *conn = Minecraft::GetInstance()->getConnection(ProfileManager.GetPrimaryPad());
|
||||
conn->send( TimeCommand::preparePacket(true) );
|
||||
}
|
||||
|
||||
rfHandled = TRUE;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CScene_DebugOverlay::OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandled)
|
||||
{
|
||||
ui.AnimateKeyPress(pInputData->UserIndex, pInputData->dwKeyCode);
|
||||
|
||||
|
||||
switch(pInputData->dwKeyCode)
|
||||
{
|
||||
|
||||
case VK_PAD_B:
|
||||
case VK_PAD_START:
|
||||
case VK_PAD_BACK:
|
||||
|
||||
// kill the crafting xui
|
||||
app.EnableDebugOverlay(false,pInputData->UserIndex);
|
||||
|
||||
rfHandled = TRUE;
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CScene_DebugOverlay::OnNotifyValueChanged( HXUIOBJ hObjSource, XUINotifyValueChanged *pNotifyValueChangedData, BOOL &bHandled)
|
||||
{
|
||||
if( hObjSource == m_setTime )
|
||||
{
|
||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||
|
||||
// Need to set the time on both levels to stop the flickering as the local level
|
||||
// tries to predict the time
|
||||
// Only works if we are on the host machine, but shouldn't break if not
|
||||
MinecraftServer::SetTime(pNotifyValueChangedData->nValue);
|
||||
pMinecraft->level->getLevelData()->setTime(pNotifyValueChangedData->nValue);
|
||||
}
|
||||
if( hObjSource == m_setFov )
|
||||
{
|
||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||
pMinecraft->gameRenderer->SetFovVal((float)pNotifyValueChangedData->nValue);
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CScene_DebugOverlay::OnTimer( XUIMessageTimer *pTimer, BOOL& bHandled )
|
||||
{
|
||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||
if(pMinecraft->level != NULL)
|
||||
{
|
||||
m_setTime.SetValue( pMinecraft->level->getLevelData()->getTime() % 24000 );
|
||||
m_setFov.SetValue( (int)pMinecraft->gameRenderer->GetFovVal());
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void CScene_DebugOverlay::SetSpawnToPlayerPos()
|
||||
{
|
||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||
|
||||
pMinecraft->level->getLevelData()->setXSpawn((int)pMinecraft->player->x);
|
||||
pMinecraft->level->getLevelData()->setYSpawn((int)pMinecraft->player->y);
|
||||
pMinecraft->level->getLevelData()->setZSpawn((int)pMinecraft->player->z);
|
||||
}
|
||||
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
void CScene_DebugOverlay::SaveLimitedFile(int chunkRadius)
|
||||
{
|
||||
unordered_map<File, RegionFile *, FileKeyHash, FileKeyEq> newFileCache;
|
||||
|
||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||
|
||||
ConsoleSaveFile *currentSave = pMinecraft->level->getLevelStorage()->getSaveFile();
|
||||
|
||||
// With a size of 0 but a value in the data pointer we should create a new save
|
||||
ConsoleSaveFileOriginal newSave( currentSave->getFilename(), NULL, 0, true );
|
||||
|
||||
// TODO Make this only happen for the new save
|
||||
//SetSpawnToPlayerPos();
|
||||
FileEntry *origFileEntry = currentSave->createFile( wstring( L"level.dat" ) );
|
||||
byteArray levelData( origFileEntry->getFileSize() );
|
||||
DWORD bytesRead;
|
||||
currentSave->setFilePointer(origFileEntry,0,NULL,FILE_BEGIN);
|
||||
currentSave->readFile(
|
||||
origFileEntry,
|
||||
levelData.data, // data buffer
|
||||
origFileEntry->getFileSize(), // number of bytes to read
|
||||
&bytesRead // number of bytes read
|
||||
);
|
||||
|
||||
FileEntry *newFileEntry = newSave.createFile( wstring( L"level.dat" ) );
|
||||
DWORD bytesWritten;
|
||||
newSave.writeFile( newFileEntry,
|
||||
levelData.data, // data buffer
|
||||
origFileEntry->getFileSize(), // number of bytes to write
|
||||
&bytesWritten // number of bytes written
|
||||
);
|
||||
|
||||
int playerChunkX = pMinecraft->player->xChunk;
|
||||
int playerChunkZ = pMinecraft->player->zChunk;
|
||||
|
||||
for(int xPos = playerChunkX - chunkRadius; xPos < playerChunkX + chunkRadius; ++xPos)
|
||||
{
|
||||
for(int zPos = playerChunkZ - chunkRadius; zPos < playerChunkZ + chunkRadius; ++zPos)
|
||||
{
|
||||
CompoundTag *chunkData=NULL;
|
||||
|
||||
DataInputStream *is = RegionFileCache::getChunkDataInputStream(currentSave, L"", xPos, zPos);
|
||||
if (is != NULL)
|
||||
{
|
||||
chunkData = NbtIo::read((DataInput *)is);
|
||||
is->deleteChildStream();
|
||||
delete is;
|
||||
}
|
||||
app.DebugPrintf("Processing chunk (%d, %d)\n", xPos, zPos);
|
||||
DataOutputStream *os = getChunkDataOutputStream(newFileCache, &newSave, L"", xPos, zPos);
|
||||
if(os != NULL)
|
||||
{
|
||||
NbtIo::write(chunkData, os);
|
||||
os->close();
|
||||
|
||||
// 4J Stu - getChunkDataOutputStream makes a new DataOutputStream that points to a new ChunkBuffer( ByteArrayOutputStream )
|
||||
// We should clean these up when we are done
|
||||
os->deleteChildStream();
|
||||
delete os;
|
||||
}
|
||||
if(chunkData != NULL)
|
||||
{
|
||||
delete chunkData;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
newSave.DebugFlushToFile();
|
||||
}
|
||||
#endif
|
||||
|
||||
RegionFile *CScene_DebugOverlay::getRegionFile(unordered_map<File, RegionFile *, FileKeyHash, FileKeyEq> &newFileCache, ConsoleSaveFile *saveFile, const wstring &prefix, int chunkX, int chunkZ) // 4J - TODO was synchronized
|
||||
{
|
||||
File file( prefix + wstring(L"r.") + _toString(chunkX>>5) + L"." + _toString(chunkZ>>5) + L".mcr" );
|
||||
|
||||
RegionFile *ref = NULL;
|
||||
AUTO_VAR(it, newFileCache.find(file));
|
||||
if( it != newFileCache.end() )
|
||||
ref = it->second;
|
||||
|
||||
// 4J Jev, put back in.
|
||||
if (ref != NULL)
|
||||
{
|
||||
return ref;
|
||||
}
|
||||
|
||||
RegionFile *reg = new RegionFile(saveFile, &file);
|
||||
newFileCache[file] = reg; // 4J - this was originally a softReferenc
|
||||
return reg;
|
||||
}
|
||||
|
||||
DataOutputStream *CScene_DebugOverlay::getChunkDataOutputStream(unordered_map<File, RegionFile *, FileKeyHash, FileKeyEq> &newFileCache, ConsoleSaveFile *saveFile, const wstring &prefix, int chunkX, int chunkZ)
|
||||
{
|
||||
RegionFile *r = getRegionFile(newFileCache, saveFile, prefix, chunkX, chunkZ);
|
||||
return r->getChunkDataOutputStream(chunkX & 31, chunkZ & 31);
|
||||
}
|
||||
#endif
|
||||
72
Minecraft.Client/Common/XUI/XUI_DebugOverlay.h
Normal file
72
Minecraft.Client/Common/XUI/XUI_DebugOverlay.h
Normal file
@@ -0,0 +1,72 @@
|
||||
#pragma once
|
||||
using namespace std;
|
||||
#include "../media/xuiscene_debugoverlay.h"
|
||||
|
||||
#define DEBUG_OVERLAY_UPDATE_TIME_PERIOD 10000
|
||||
|
||||
class RegionFile;
|
||||
class DataOutputStream;
|
||||
class ConsoleSaveFile;
|
||||
#include "..\..\..\Minecraft.World\File.h"
|
||||
#include "..\..\..\Minecraft.World\Entity.h"
|
||||
|
||||
class CScene_DebugOverlay : public CXuiSceneImpl
|
||||
{
|
||||
#ifdef _DEBUG_MENUS_ENABLED
|
||||
private:
|
||||
CXuiList m_items, m_mobs, m_enchantments;
|
||||
CXuiControl m_resetTutorial, m_createSchematic, m_toggleRain, m_toggleThunder, m_setCamera;
|
||||
CXuiControl m_setDay, m_setNight;
|
||||
CXuiSlider m_chunkRadius, m_setTime,m_setFov;
|
||||
vector<int> m_itemIds;
|
||||
vector<eINSTANCEOF> m_mobFactories;
|
||||
vector<int> m_enchantmentIds;
|
||||
|
||||
protected:
|
||||
// Message map. Here we tie messages to message handlers.
|
||||
XUI_BEGIN_MSG_MAP()
|
||||
XUI_ON_XM_INIT( OnInit )
|
||||
XUI_ON_XM_NOTIFY_PRESS_EX( OnNotifyPressEx )
|
||||
XUI_ON_XM_KEYDOWN(OnKeyDown)
|
||||
XUI_ON_XM_NOTIFY_VALUE_CHANGED( OnNotifyValueChanged )
|
||||
XUI_ON_XM_TIMER( OnTimer )
|
||||
XUI_END_MSG_MAP()
|
||||
|
||||
// Control mapping to objects
|
||||
BEGIN_CONTROL_MAP()
|
||||
MAP_CONTROL(IDC_ChunkRadius, m_chunkRadius)
|
||||
MAP_CONTROL(IDC_ResetTutorial, m_resetTutorial)
|
||||
MAP_CONTROL(IDC_CreateSchematic, m_createSchematic)
|
||||
MAP_CONTROL(IDC_ToggleRain, m_toggleRain)
|
||||
MAP_CONTROL(IDC_ToggleThunder, m_toggleThunder)
|
||||
MAP_CONTROL(IDC_SetDay, m_setDay)
|
||||
MAP_CONTROL(IDC_SetNight, m_setNight)
|
||||
MAP_CONTROL(IDC_SliderTime, m_setTime)
|
||||
MAP_CONTROL(IDC_SliderFov, m_setFov)
|
||||
MAP_CONTROL(IDC_MobList, m_mobs)
|
||||
MAP_CONTROL(IDC_EnchantmentsList, m_enchantments)
|
||||
MAP_CONTROL(IDC_ItemsList, m_items)
|
||||
MAP_CONTROL(IDC_SetCamera, m_setCamera)
|
||||
END_CONTROL_MAP()
|
||||
|
||||
HRESULT OnInit( XUIMessageInit* pInitData, BOOL& bHandled );
|
||||
HRESULT OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* pNotifyPressData, BOOL& rfHandled);
|
||||
HRESULT OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandled);
|
||||
HRESULT OnNotifyValueChanged( HXUIOBJ hObjSource, XUINotifyValueChanged *pNotifyValueChangedData, BOOL &bHandled);
|
||||
HRESULT OnTimer( XUIMessageTimer *pTimer, BOOL& bHandled );
|
||||
public:
|
||||
|
||||
// Define the class. The class name must match the ClassOverride property
|
||||
// set for the scene in the UI Authoring tool.
|
||||
XUI_IMPLEMENT_CLASS( CScene_DebugOverlay, L"CScene_DebugOverlay", XUI_CLASS_SCENE )
|
||||
|
||||
private:
|
||||
void SetSpawnToPlayerPos();
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
void SaveLimitedFile(int chunkRadius);
|
||||
#endif
|
||||
RegionFile *getRegionFile(unordered_map<File, RegionFile *, FileKeyHash, FileKeyEq> &newFileCache, ConsoleSaveFile *saveFile, const wstring &prefix, int chunkX, int chunkZ);
|
||||
|
||||
DataOutputStream *getChunkDataOutputStream(unordered_map<File, RegionFile *, FileKeyHash, FileKeyEq> &newFileCache, ConsoleSaveFile *saveFile, const wstring &prefix, int chunkX, int chunkZ);
|
||||
#endif
|
||||
};
|
||||
178
Minecraft.Client/Common/XUI/XUI_DebugSchematicCreator.cpp
Normal file
178
Minecraft.Client/Common/XUI/XUI_DebugSchematicCreator.cpp
Normal file
@@ -0,0 +1,178 @@
|
||||
#include "stdafx.h"
|
||||
#include "..\..\..\Minecraft.World\StringHelpers.h"
|
||||
#include "XUI_DebugSchematicCreator.h"
|
||||
#include "..\..\..\Minecraft.World\ChunkSource.h"
|
||||
#include "..\..\..\Minecraft.World\net.minecraft.world.level.h"
|
||||
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
HRESULT CScene_DebugSchematicCreator::OnInit( XUIMessageInit *pInitData, BOOL &bHandled )
|
||||
{
|
||||
MapChildControls();
|
||||
|
||||
m_startX .SetKeyboardType(C_4JInput::EKeyboardMode_Numeric);
|
||||
m_startY .SetKeyboardType(C_4JInput::EKeyboardMode_Numeric);
|
||||
m_startZ .SetKeyboardType(C_4JInput::EKeyboardMode_Numeric);
|
||||
m_endX .SetKeyboardType(C_4JInput::EKeyboardMode_Numeric);
|
||||
m_endY .SetKeyboardType(C_4JInput::EKeyboardMode_Numeric);
|
||||
m_endZ .SetKeyboardType(C_4JInput::EKeyboardMode_Numeric);
|
||||
|
||||
m_data = new ConsoleSchematicFile::XboxSchematicInitParam();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CScene_DebugSchematicCreator::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* pNotifyPressData, BOOL& rfHandled)
|
||||
{
|
||||
// This assumes all buttons can only be pressed with the A button
|
||||
ui.AnimateKeyPress(pNotifyPressData->UserIndex, VK_PAD_A);
|
||||
|
||||
if ( hObjPressed == m_createButton )
|
||||
{
|
||||
// We want the start to be even
|
||||
if(m_data->startX > 0 && m_data->startX%2 != 0)
|
||||
m_data->startX-=1;
|
||||
else if(m_data->startX < 0 && m_data->startX%2 !=0)
|
||||
m_data->startX-=1;
|
||||
if(m_data->startY < 0) m_data->startY = 0;
|
||||
else if(m_data->startY > 0 && m_data->startY%2 != 0)
|
||||
m_data->startY-=1;
|
||||
if(m_data->startZ > 0 && m_data->startZ%2 != 0)
|
||||
m_data->startZ-=1;
|
||||
else if(m_data->startZ < 0 && m_data->startZ%2 !=0)
|
||||
m_data->startZ-=1;
|
||||
|
||||
// We want the end to be odd to have a total size that is even
|
||||
if(m_data->endX > 0 && m_data->endX%2 == 0)
|
||||
m_data->endX+=1;
|
||||
else if(m_data->endX < 0 && m_data->endX%2 ==0)
|
||||
m_data->endX+=1;
|
||||
if(m_data->endY > Level::maxBuildHeight)
|
||||
m_data->endY = Level::maxBuildHeight;
|
||||
else if(m_data->endY > 0 && m_data->endY%2 == 0)
|
||||
m_data->endY+=1;
|
||||
else if(m_data->endY < 0 && m_data->endY%2 ==0)
|
||||
m_data->endY+=1;
|
||||
if(m_data->endZ > 0 && m_data->endZ%2 == 0)
|
||||
m_data->endZ+=1;
|
||||
else if(m_data->endZ < 0 && m_data->endZ%2 ==0)
|
||||
m_data->endZ+=1;
|
||||
|
||||
wstring value = m_name.GetText();
|
||||
if(!value.empty())
|
||||
{
|
||||
swprintf(m_data->name,64,L"%ls", value.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
swprintf(m_data->name,64,L"schematic");
|
||||
}
|
||||
|
||||
m_data->bSaveMobs = m_saveMobs.IsChecked();
|
||||
|
||||
#ifdef _XBOX
|
||||
if (m_useXboxCompr.IsChecked())
|
||||
m_data->compressionType = Compression::eCompressionType_LZXRLE;
|
||||
else
|
||||
#endif
|
||||
m_data->compressionType = Compression::eCompressionType_RLE;
|
||||
|
||||
app.SetXuiServerAction(ProfileManager.GetPrimaryPad(), eXuiServerAction_ExportSchematic, (void *)m_data);
|
||||
|
||||
NavigateBack();
|
||||
rfHandled = TRUE;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CScene_DebugSchematicCreator::OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandled)
|
||||
{
|
||||
ui.AnimateKeyPress(pInputData->UserIndex, pInputData->dwKeyCode);
|
||||
|
||||
switch(pInputData->dwKeyCode)
|
||||
{
|
||||
|
||||
case VK_PAD_B:
|
||||
case VK_PAD_START:
|
||||
case VK_PAD_BACK:
|
||||
NavigateBack();
|
||||
|
||||
rfHandled = TRUE;
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CScene_DebugSchematicCreator::OnNotifyValueChanged( HXUIOBJ hObjSource, XUINotifyValueChanged *pNotifyValueChangedData, BOOL &bHandled)
|
||||
{
|
||||
if(hObjSource == m_startX)
|
||||
{
|
||||
int iVal = 0;
|
||||
wstring value = m_startX.GetText();
|
||||
if(!value.empty()) iVal = _fromString<int>( value );
|
||||
|
||||
if( iVal >= (LEVEL_MAX_WIDTH * -16) || iVal < (LEVEL_MAX_WIDTH * 16))
|
||||
{
|
||||
m_data->startX = iVal;
|
||||
}
|
||||
}
|
||||
else if(hObjSource == m_startY)
|
||||
{
|
||||
int iVal = 0;
|
||||
wstring value = m_startY.GetText();
|
||||
if(!value.empty()) iVal = _fromString<int>( value );
|
||||
|
||||
if( iVal >= (LEVEL_MAX_WIDTH * -16) || iVal < (LEVEL_MAX_WIDTH * 16))
|
||||
{
|
||||
m_data->startY = iVal;
|
||||
}
|
||||
}
|
||||
else if(hObjSource == m_startZ)
|
||||
{
|
||||
int iVal = 0;
|
||||
wstring value = m_startZ.GetText();
|
||||
if(!value.empty()) iVal = _fromString<int>( value );
|
||||
|
||||
if( iVal >= (LEVEL_MAX_WIDTH * -16) || iVal < (LEVEL_MAX_WIDTH * 16))
|
||||
{
|
||||
m_data->startZ = iVal;
|
||||
}
|
||||
}
|
||||
else if(hObjSource == m_endX)
|
||||
{
|
||||
int iVal = 0;
|
||||
wstring value = m_endX.GetText();
|
||||
if(!value.empty()) iVal = _fromString<int>( value );
|
||||
|
||||
if( iVal >= (LEVEL_MAX_WIDTH * -16) || iVal < (LEVEL_MAX_WIDTH * 16))
|
||||
{
|
||||
m_data->endX = iVal;
|
||||
}
|
||||
}
|
||||
else if(hObjSource == m_endY)
|
||||
{
|
||||
int iVal = 0;
|
||||
wstring value = m_endY.GetText();
|
||||
if(!value.empty()) iVal = _fromString<int>( value );
|
||||
|
||||
if( iVal >= (LEVEL_MAX_WIDTH * -16) || iVal < (LEVEL_MAX_WIDTH * 16))
|
||||
{
|
||||
m_data->endY = iVal;
|
||||
}
|
||||
}
|
||||
else if(hObjSource == m_endZ)
|
||||
{
|
||||
int iVal = 0;
|
||||
wstring value = m_endZ.GetText();
|
||||
if(!value.empty()) iVal = _fromString<int>( value );
|
||||
|
||||
if( iVal >= (LEVEL_MAX_WIDTH * -16) || iVal < (LEVEL_MAX_WIDTH * 16))
|
||||
{
|
||||
m_data->endZ = iVal;
|
||||
}
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
#endif
|
||||
49
Minecraft.Client/Common/XUI/XUI_DebugSchematicCreator.h
Normal file
49
Minecraft.Client/Common/XUI/XUI_DebugSchematicCreator.h
Normal file
@@ -0,0 +1,49 @@
|
||||
#pragma once
|
||||
#include "..\Media\xuiscene_debug_schematic_create.h"
|
||||
#include "XUI_Ctrl_4JEdit.h"
|
||||
#include "..\..\Common\GameRules\ConsoleSchematicFile.h"
|
||||
|
||||
class CScene_DebugSchematicCreator : public CXuiSceneImpl
|
||||
{
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
private:
|
||||
CXuiControl m_createButton;
|
||||
CXuiCtrl4JEdit m_name, m_startX, m_startY, m_startZ, m_endX, m_endY, m_endZ;
|
||||
CXuiCheckbox m_saveMobs, m_useXboxCompr;
|
||||
|
||||
ConsoleSchematicFile::XboxSchematicInitParam *m_data;
|
||||
|
||||
protected:
|
||||
// Message map. Here we tie messages to message handlers.
|
||||
XUI_BEGIN_MSG_MAP()
|
||||
XUI_ON_XM_INIT( OnInit )
|
||||
XUI_ON_XM_NOTIFY_PRESS_EX( OnNotifyPressEx )
|
||||
XUI_ON_XM_KEYDOWN(OnKeyDown)
|
||||
XUI_ON_XM_NOTIFY_VALUE_CHANGED( OnNotifyValueChanged )
|
||||
XUI_END_MSG_MAP()
|
||||
|
||||
// Control mapping to objects
|
||||
BEGIN_CONTROL_MAP()
|
||||
MAP_CONTROL(IDC_CreateButton, m_createButton)
|
||||
MAP_CONTROL(IDC_Name, m_name)
|
||||
MAP_CONTROL(IDC_StartX, m_startX)
|
||||
MAP_CONTROL(IDC_StartY, m_startY)
|
||||
MAP_CONTROL(IDC_StartZ, m_startZ)
|
||||
MAP_CONTROL(IDC_EndX, m_endX)
|
||||
MAP_CONTROL(IDC_EndY, m_endY)
|
||||
MAP_CONTROL(IDC_EndZ, m_endZ)
|
||||
MAP_CONTROL(IDC_SaveMobs, m_saveMobs)
|
||||
MAP_CONTROL(IDC_UseXboxCompression, m_useXboxCompr)
|
||||
END_CONTROL_MAP()
|
||||
|
||||
HRESULT OnInit( XUIMessageInit* pInitData, BOOL& bHandled );
|
||||
HRESULT OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* pNotifyPressData, BOOL& rfHandled);
|
||||
HRESULT OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandled);
|
||||
HRESULT OnNotifyValueChanged( HXUIOBJ hObjSource, XUINotifyValueChanged *pNotifyValueChangedData, BOOL &bHandled);
|
||||
public:
|
||||
|
||||
// Define the class. The class name must match the ClassOverride property
|
||||
// set for the scene in the UI Authoring tool.
|
||||
XUI_IMPLEMENT_CLASS( CScene_DebugSchematicCreator, L"CScene_DebugSchematicCreator", XUI_CLASS_SCENE )
|
||||
#endif
|
||||
};
|
||||
152
Minecraft.Client/Common/XUI/XUI_DebugSetCamera.cpp
Normal file
152
Minecraft.Client/Common/XUI/XUI_DebugSetCamera.cpp
Normal file
@@ -0,0 +1,152 @@
|
||||
#include "stdafx.h"
|
||||
#include "..\..\..\Minecraft.World\StringHelpers.h"
|
||||
#include "XUI_DebugSetCamera.h"
|
||||
#include "..\..\..\Minecraft.World\ChunkSource.h"
|
||||
|
||||
// #include "..\..\Xbox\4JLibs\inc\4J_Input.h"
|
||||
|
||||
#include "..\..\Minecraft.h"
|
||||
#include "..\..\MultiplayerLocalPlayer.h"
|
||||
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
HRESULT CScene_DebugSetCamera::OnInit( XUIMessageInit *pInitData, BOOL &bHandled )
|
||||
{
|
||||
MapChildControls();
|
||||
|
||||
m_camX .SetKeyboardType(C_4JInput::EKeyboardMode_Numeric);
|
||||
m_camY .SetKeyboardType(C_4JInput::EKeyboardMode_Numeric);
|
||||
m_camZ .SetKeyboardType(C_4JInput::EKeyboardMode_Numeric);
|
||||
m_yRot .SetKeyboardType(C_4JInput::EKeyboardMode_Numeric);
|
||||
m_elevation .SetKeyboardType(C_4JInput::EKeyboardMode_Numeric);
|
||||
|
||||
int playerNo = 0;
|
||||
currentPosition = new DebugSetCameraPosition();
|
||||
|
||||
currentPosition->player = playerNo;
|
||||
|
||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||
if (pMinecraft != NULL)
|
||||
{
|
||||
Vec3 *vec = pMinecraft->localplayers[playerNo]->getPos(1.0);
|
||||
|
||||
currentPosition->m_camX = vec->x;
|
||||
currentPosition->m_camY = vec->y - 1.62;// pMinecraft->localplayers[playerNo]->getHeadHeight();
|
||||
currentPosition->m_camZ = vec->z;
|
||||
|
||||
currentPosition->m_yRot = pMinecraft->localplayers[playerNo]->yRot;
|
||||
currentPosition->m_elev = pMinecraft->localplayers[playerNo]->xRot;
|
||||
}
|
||||
|
||||
m_camX.SetKeyboardType(C_4JInput::EKeyboardMode_Full);
|
||||
m_camY.SetKeyboardType(C_4JInput::EKeyboardMode_Full);
|
||||
m_camZ.SetKeyboardType(C_4JInput::EKeyboardMode_Full);
|
||||
m_yRot.SetKeyboardType(C_4JInput::EKeyboardMode_Full);
|
||||
m_elevation.SetKeyboardType(C_4JInput::EKeyboardMode_Full);
|
||||
|
||||
m_camX.SetText((CONST WCHAR *) _toString<double>(currentPosition->m_camX).c_str());
|
||||
m_camY.SetText((CONST WCHAR *) _toString<double>(currentPosition->m_camY + 1.62).c_str());
|
||||
m_camZ.SetText((CONST WCHAR *) _toString<double>(currentPosition->m_camZ).c_str());
|
||||
|
||||
m_yRot.SetText((CONST WCHAR *) _toString<double>(currentPosition->m_yRot).c_str());
|
||||
m_elevation.SetText((CONST WCHAR *) _toString<double>(currentPosition->m_elev).c_str());
|
||||
|
||||
//fpp = new FreezePlayerParam();
|
||||
//fpp->player = playerNo;
|
||||
//fpp->freeze = true;
|
||||
|
||||
//m_lockPlayer.SetCheck( !fpp->freeze );
|
||||
|
||||
m_lockPlayer.SetCheck( app.GetFreezePlayers() );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CScene_DebugSetCamera::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* pNotifyPressData, BOOL& rfHandled)
|
||||
{
|
||||
// This assumes all buttons can only be pressed with the A button
|
||||
ui.AnimateKeyPress(pNotifyPressData->UserIndex, VK_PAD_A);
|
||||
|
||||
if (hObjPressed == m_teleport)
|
||||
{
|
||||
app.SetXuiServerAction( ProfileManager.GetPrimaryPad(),
|
||||
eXuiServerAction_SetCameraLocation,
|
||||
(void *)currentPosition);
|
||||
rfHandled = TRUE;
|
||||
}
|
||||
else if (hObjPressed == m_lockPlayer)
|
||||
{
|
||||
app.SetFreezePlayers( m_lockPlayer.IsChecked() );
|
||||
|
||||
rfHandled = TRUE;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CScene_DebugSetCamera::OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandled)
|
||||
{
|
||||
ui.AnimateKeyPress(pInputData->UserIndex, pInputData->dwKeyCode);
|
||||
switch(pInputData->dwKeyCode)
|
||||
{
|
||||
case VK_PAD_B:
|
||||
case VK_PAD_START:
|
||||
case VK_PAD_BACK:
|
||||
NavigateBack();
|
||||
|
||||
//delete currentPosition;
|
||||
//currentPosition = NULL;
|
||||
|
||||
rfHandled = TRUE;
|
||||
break;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CScene_DebugSetCamera::OnNotifyValueChanged( HXUIOBJ hObjSource, XUINotifyValueChanged *pNotifyValueChangedData, BOOL &bHandled)
|
||||
{
|
||||
|
||||
// Text Boxes
|
||||
if (hObjSource == m_camX)
|
||||
{
|
||||
double iVal = 0;
|
||||
wstring value = m_camX.GetText();
|
||||
if(!value.empty()) iVal = _fromString<double>( value );
|
||||
currentPosition->m_camX = iVal;
|
||||
bHandled = TRUE;
|
||||
}
|
||||
else if (hObjSource == m_camY)
|
||||
{
|
||||
double iVal = 0;
|
||||
wstring value = m_camY.GetText();
|
||||
if(!value.empty()) iVal = _fromString<double>( value );
|
||||
currentPosition->m_camY = iVal - 1.62;
|
||||
bHandled = TRUE;
|
||||
}
|
||||
else if (hObjSource == m_camZ)
|
||||
{
|
||||
double iVal = 0;
|
||||
wstring value = m_camZ.GetText();
|
||||
if(!value.empty()) iVal = _fromString<double>( value );
|
||||
currentPosition->m_camZ = iVal;
|
||||
bHandled = TRUE;
|
||||
}
|
||||
else if (hObjSource == m_yRot)
|
||||
{
|
||||
double iVal = 0;
|
||||
wstring value = m_yRot.GetText();
|
||||
if(!value.empty()) iVal = _fromString<double>( value );
|
||||
currentPosition->m_yRot = iVal;
|
||||
bHandled = TRUE;
|
||||
}
|
||||
else if (hObjSource == m_elevation)
|
||||
{
|
||||
double iVal = 0;
|
||||
wstring value = m_elevation.GetText();
|
||||
if(!value.empty()) iVal = _fromString<double>( value );
|
||||
currentPosition->m_elev = iVal;
|
||||
bHandled = TRUE;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
#endif
|
||||
54
Minecraft.Client/Common/XUI/XUI_DebugSetCamera.h
Normal file
54
Minecraft.Client/Common/XUI/XUI_DebugSetCamera.h
Normal file
@@ -0,0 +1,54 @@
|
||||
#pragma once
|
||||
#include "..\Media\xuiscene_debug_set_camera.h"
|
||||
#include "XUI_Ctrl_4JEdit.h"
|
||||
#include "..\..\Common\GameRules\ConsoleSchematicFile.h"
|
||||
|
||||
class CScene_DebugSetCamera : public CXuiSceneImpl
|
||||
{
|
||||
public:
|
||||
typedef struct _FreezePlayerParam
|
||||
{
|
||||
int player;
|
||||
bool freeze;
|
||||
} FreezePlayerParam;
|
||||
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
private:
|
||||
CXuiCtrl4JEdit m_camX, m_camY, m_camZ, m_yRot, m_elevation;
|
||||
CXuiCheckbox m_lockPlayer;
|
||||
CXuiControl m_teleport;
|
||||
|
||||
DebugSetCameraPosition *currentPosition;
|
||||
FreezePlayerParam *fpp;
|
||||
|
||||
protected:
|
||||
// Message map. Here we tie messages to message handlers.
|
||||
XUI_BEGIN_MSG_MAP()
|
||||
XUI_ON_XM_INIT( OnInit )
|
||||
XUI_ON_XM_NOTIFY_PRESS_EX( OnNotifyPressEx )
|
||||
XUI_ON_XM_KEYDOWN(OnKeyDown)
|
||||
XUI_ON_XM_NOTIFY_VALUE_CHANGED( OnNotifyValueChanged )
|
||||
XUI_END_MSG_MAP()
|
||||
|
||||
// Control mapping to objects
|
||||
BEGIN_CONTROL_MAP()
|
||||
MAP_CONTROL(IDC_CamX, m_camX)
|
||||
MAP_CONTROL(IDC_CamY, m_camY)
|
||||
MAP_CONTROL(IDC_CamZ, m_camZ)
|
||||
MAP_CONTROL(IDC_YRot, m_yRot)
|
||||
MAP_CONTROL(IDC_Elevation, m_elevation)
|
||||
MAP_CONTROL(IDC_LockPlayer, m_lockPlayer)
|
||||
MAP_CONTROL(IDC_Teleport, m_teleport)
|
||||
END_CONTROL_MAP()
|
||||
|
||||
HRESULT OnInit( XUIMessageInit* pInitData, BOOL& bHandled );
|
||||
HRESULT OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* pNotifyPressData, BOOL& rfHandled);
|
||||
HRESULT OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandled);
|
||||
HRESULT OnNotifyValueChanged( HXUIOBJ hObjSource, XUINotifyValueChanged *pNotifyValueChangedData, BOOL &bHandled);
|
||||
public:
|
||||
|
||||
// Define the class. The class name must match the ClassOverride property
|
||||
// set for the scene in the UI Authoring tool.
|
||||
XUI_IMPLEMENT_CLASS( CScene_DebugSetCamera, L"CScene_DebugSetCamera", XUI_CLASS_SCENE )
|
||||
#endif
|
||||
};
|
||||
73
Minecraft.Client/Common/XUI/XUI_DebugTips.cpp
Normal file
73
Minecraft.Client/Common/XUI/XUI_DebugTips.cpp
Normal file
@@ -0,0 +1,73 @@
|
||||
#include "stdafx.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include "XUI_DebugTips.h"
|
||||
#include "..\..\..\Minecraft.World\StringHelpers.h"
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Performs initialization tasks - retrieves controls.
|
||||
//----------------------------------------------------------------------------------
|
||||
HRESULT CScene_DebugTips::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
|
||||
{
|
||||
m_iPad = *(int *)pInitData->pvInitData;
|
||||
|
||||
m_bIgnoreInput = false;
|
||||
|
||||
MapChildControls();
|
||||
|
||||
// Display the tooltips
|
||||
//ui.SetTooltips( m_iPad, IDS_TOOLTIPS_SELECT);
|
||||
// display the next tip
|
||||
wstring wsText=app.FormatHTMLString(m_iPad,app.GetString(app.GetNextTip()));
|
||||
wchar_t startTags[64];
|
||||
swprintf(startTags,64,L"<font color=\"#%08x\" size=14><DIV ALIGN=CENTER>",app.GetHTMLColour(eHTMLColor_White));
|
||||
wsText= startTags + wsText + L"</DIV>";
|
||||
XuiControlSetText(m_tip,wsText.c_str());
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
HRESULT CScene_DebugTips::OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandled)
|
||||
{
|
||||
//ui.AnimateKeyPress(pInputData->UserIndex, pInputData->dwKeyCode);
|
||||
|
||||
|
||||
switch(pInputData->dwKeyCode)
|
||||
{
|
||||
case VK_PAD_A:
|
||||
{
|
||||
|
||||
|
||||
// next tip
|
||||
// display the next tip
|
||||
wstring wsText=app.FormatHTMLString(m_iPad,app.GetString(app.GetNextTip()));
|
||||
wchar_t startTags[64];
|
||||
swprintf(startTags,64,L"<font color=\"#%08x\" size=14><DIV ALIGN=CENTER>",app.GetHTMLColour(eHTMLColor_White));
|
||||
wsText= startTags + wsText + L"</DIV>";
|
||||
XuiControlSetText(m_tip,wsText.c_str());
|
||||
|
||||
rfHandled = TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case VK_PAD_B:
|
||||
case VK_PAD_START:
|
||||
case VK_ESCAPE:
|
||||
|
||||
app.NavigateBack(m_iPad);
|
||||
|
||||
rfHandled = TRUE;
|
||||
|
||||
break;
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
case VK_PAD_LTHUMB_PRESS:
|
||||
#ifdef _XBOX
|
||||
app.OverrideFontRenderer(true);
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
38
Minecraft.Client/Common/XUI/XUI_DebugTips.h
Normal file
38
Minecraft.Client/Common/XUI/XUI_DebugTips.h
Normal file
@@ -0,0 +1,38 @@
|
||||
#pragma once
|
||||
|
||||
#include "../media/xuiscene_DebugTips.h"
|
||||
|
||||
|
||||
|
||||
|
||||
class CScene_DebugTips : public CXuiSceneImpl
|
||||
{
|
||||
protected:
|
||||
// Control and Element wrapper objects.
|
||||
CXuiControl m_tip;
|
||||
|
||||
// Message map. Here we tie messages to message handlers.
|
||||
XUI_BEGIN_MSG_MAP()
|
||||
XUI_ON_XM_INIT( OnInit )
|
||||
XUI_ON_XM_KEYDOWN(OnKeyDown)
|
||||
XUI_END_MSG_MAP()
|
||||
|
||||
// Control mapping to objects
|
||||
BEGIN_CONTROL_MAP()
|
||||
MAP_CONTROL(IDC_Tip, m_tip)
|
||||
END_CONTROL_MAP()
|
||||
|
||||
HRESULT OnInit( XUIMessageInit* pInitData, BOOL& bHandled );
|
||||
HRESULT OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandled);
|
||||
public:
|
||||
|
||||
// Define the class. The class name must match the ClassOverride property
|
||||
// set for the scene in the UI Authoring tool.
|
||||
XUI_IMPLEMENT_CLASS( CScene_DebugTips, L"CScene_DebugTips", XUI_CLASS_SCENE )
|
||||
|
||||
private:
|
||||
bool m_bIgnoreInput;
|
||||
int m_iPad;
|
||||
D3DXVECTOR3 m_OriginalPosition;
|
||||
|
||||
};
|
||||
375
Minecraft.Client/Common/XUI/XUI_FullscreenProgress.cpp
Normal file
375
Minecraft.Client/Common/XUI/XUI_FullscreenProgress.cpp
Normal file
@@ -0,0 +1,375 @@
|
||||
// Minecraft.cpp : Defines the entry point for the application.
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include "..\..\Minecraft.h"
|
||||
#include "..\..\ProgressRenderer.h"
|
||||
#include "..\..\..\Minecraft.World\StringHelpers.h"
|
||||
#include "..\..\Common\Tutorial\TutorialMode.h"
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Performs initialization tasks - retrieves controls.
|
||||
//----------------------------------------------------------------------------------
|
||||
HRESULT CScene_FullscreenProgress::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
|
||||
{
|
||||
MapChildControls();
|
||||
|
||||
m_buttonConfirm.SetText( app.GetString( IDS_CONFIRM_OK ) );
|
||||
|
||||
LoadingInputParams *params = (LoadingInputParams *)pInitData->pvInitData;
|
||||
|
||||
m_CompletionData = params->completionData;
|
||||
m_iPad=params->completionData->iPad;
|
||||
m_cancelFunc = params->cancelFunc;
|
||||
m_cancelFuncParam = params->m_cancelFuncParam;
|
||||
m_completeFunc = params->completeFunc;
|
||||
m_completeFuncParam = params->m_completeFuncParam;
|
||||
m_bWasCancelled=false;
|
||||
|
||||
thread = new C4JThread(params->func, params->lpParam, "FullscreenProgress");
|
||||
thread->SetProcessor(3); // TODO 4J Stu - Make sure this is a good thread/core to use
|
||||
|
||||
m_threadCompleted = false;
|
||||
threadStarted = false;
|
||||
//ResumeThread( thread );
|
||||
if( CXuiSceneBase::GetPlayerBasePosition(m_iPad) != CXuiSceneBase::e_BaseScene_Fullscreen && CXuiSceneBase::GetPlayerBasePosition(m_iPad) != CXuiSceneBase::e_BaseScene_NotSet)
|
||||
{
|
||||
app.AdjustSplitscreenScene(m_hObj,&m_OriginalPosition,m_iPad,false);
|
||||
CXuiSceneBase::ShowLogo( m_iPad, FALSE );
|
||||
}
|
||||
else
|
||||
{
|
||||
CXuiSceneBase::ShowLogo( m_iPad, params->completionData->bShowLogo );
|
||||
}
|
||||
|
||||
CXuiSceneBase::ShowBackground( m_iPad, params->completionData->bShowBackground );
|
||||
ui.SetTooltips( m_iPad, -1, params->cancelText, -1, -1 );
|
||||
|
||||
// Clear the progress text
|
||||
Minecraft *pMinecraft=Minecraft::GetInstance();
|
||||
pMinecraft->progressRenderer->progressStart(-1);
|
||||
pMinecraft->progressRenderer->progressStage(-1);
|
||||
|
||||
// set the tip
|
||||
wstring wsText=app.FormatHTMLString(m_iPad,app.GetString(app.GetNextTip()));
|
||||
wchar_t startTags[64];
|
||||
swprintf(startTags,64,L"<font color=\"#%08x\" size=14><DIV ALIGN=CENTER>",app.GetHTMLColour(eHTMLColor_White));
|
||||
wsText= startTags + wsText + L"</DIV>";
|
||||
XuiControlSetText(m_tip, wsText.c_str());
|
||||
|
||||
m_tip.SetShow( m_CompletionData->bShowTips );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
// The framework calls this handler when the object is to be destroyed.
|
||||
HRESULT CScene_FullscreenProgress::OnDestroy()
|
||||
{
|
||||
if( thread != NULL && thread != INVALID_HANDLE_VALUE )
|
||||
delete thread;
|
||||
|
||||
if( m_CompletionData != NULL )
|
||||
delete m_CompletionData;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CScene_FullscreenProgress::OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandled)
|
||||
{
|
||||
ui.AnimateKeyPress(pInputData->UserIndex, pInputData->dwKeyCode);
|
||||
|
||||
switch(pInputData->dwKeyCode)
|
||||
{
|
||||
|
||||
case VK_PAD_B:
|
||||
case VK_ESCAPE:
|
||||
// 4J-JEV: Fix for Xbox360 #162749 - TU17: Save Upload: Content: UI: Player is presented with non-functional Tooltips after the Upload Save For Xbox One is completed.
|
||||
if( m_cancelFunc != NULL && !m_threadCompleted )
|
||||
{
|
||||
m_cancelFunc( m_cancelFuncParam );
|
||||
m_bWasCancelled=true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Updates the UI when the list selection changes.
|
||||
//----------------------------------------------------------------------------------
|
||||
HRESULT CScene_FullscreenProgress::OnNotifySelChanged( HXUIOBJ hObjSource, XUINotifySelChanged* pNotifySelChangedData, BOOL& bHandled )
|
||||
{
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Handler for the button press message.
|
||||
//----------------------------------------------------------------------------------
|
||||
HRESULT CScene_FullscreenProgress::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* pNotifyPressData, BOOL& rfHandled)
|
||||
{
|
||||
// This assumes all buttons can only be pressed with the A button
|
||||
ui.AnimateKeyPress(pNotifyPressData->UserIndex, VK_PAD_A);
|
||||
|
||||
if(m_threadCompleted == true && hObjPressed == m_buttonConfirm)
|
||||
{
|
||||
// if there's a complete function, call it
|
||||
if(m_completeFunc)
|
||||
{
|
||||
m_completeFunc(m_completeFuncParam);
|
||||
}
|
||||
switch(m_CompletionData->type)
|
||||
{
|
||||
case e_ProgressCompletion_NavigateBack:
|
||||
CXuiSceneBase::ShowBackground( m_CompletionData->iPad, FALSE );
|
||||
CXuiSceneBase::ShowBackground( m_CompletionData->iPad, TRUE );
|
||||
app.NavigateBack(m_CompletionData->iPad);
|
||||
// Show the other players scenes
|
||||
CXuiSceneBase::ShowOtherPlayersBaseScene(m_CompletionData->iPad, true);
|
||||
ui.UpdatePlayerBasePositions();
|
||||
break;
|
||||
case e_ProgressCompletion_NavigateBackToScene:
|
||||
CXuiSceneBase::ShowBackground( m_CompletionData->iPad, FALSE );
|
||||
CXuiSceneBase::ShowBackground( m_CompletionData->iPad, TRUE );
|
||||
CXuiSceneBase::ShowOtherPlayersBaseScene(m_CompletionData->iPad, true);
|
||||
// If the pause menu is still active, then navigate back
|
||||
// Otherwise close everything then navigate forwads to the pause menu
|
||||
if(app.IsSceneInStack(m_CompletionData->iPad, m_CompletionData->scene))
|
||||
{
|
||||
app.NavigateBack(m_CompletionData->iPad,false, m_CompletionData->scene);
|
||||
}
|
||||
else
|
||||
{
|
||||
app.CloseXuiScenesAndNavigateToScene(m_CompletionData->iPad,m_CompletionData->scene);
|
||||
}
|
||||
ui.UpdatePlayerBasePositions();
|
||||
break;
|
||||
case e_ProgressCompletion_CloseUIScenes:
|
||||
app.CloseXuiScenes(m_CompletionData->iPad);
|
||||
ui.UpdatePlayerBasePositions();
|
||||
break;
|
||||
case e_ProgressCompletion_CloseAllPlayersUIScenes:
|
||||
app.CloseAllPlayersXuiScenes();
|
||||
ui.UpdatePlayerBasePositions();
|
||||
break;
|
||||
case e_ProgressCompletion_NavigateToHomeMenu:
|
||||
app.NavigateToHomeMenu();
|
||||
ui.UpdatePlayerBasePositions();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CScene_FullscreenProgress::OnGetSourceDataText(XUIMessageGetSourceText *pGetSourceTextData, BOOL& bHandled)
|
||||
{
|
||||
// This gets called every frame, so use it to update our two text boxes
|
||||
|
||||
Minecraft *pMinecraft=Minecraft::GetInstance();
|
||||
|
||||
int title = pMinecraft->progressRenderer->getCurrentTitle();
|
||||
if(title >= 0)
|
||||
m_title.SetText( app.GetString( title ) );
|
||||
else
|
||||
m_title.SetText( L"" );
|
||||
|
||||
int status = pMinecraft->progressRenderer->getCurrentStatus();
|
||||
if(status >= 0)
|
||||
m_status.SetText( app.GetString( status ) );
|
||||
else
|
||||
m_status.SetText( L"" );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CScene_FullscreenProgress::OnTransitionStart( XUIMessageTransition *pTransition, BOOL& bHandled )
|
||||
{
|
||||
if(!threadStarted)
|
||||
{
|
||||
thread->Run();
|
||||
threadStarted = true;
|
||||
XuiSetTimer(m_hObj,TIMER_FULLSCREEN_PROGRESS,TIMER_FULLSCREEN_PROGRESS_TIME);
|
||||
XuiSetTimer(m_hObj,TIMER_FULLSCREEN_TIPS,TIMER_FULLSCREEN_TIPS_TIME);
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CScene_FullscreenProgress::OnTimer( XUIMessageTimer *pTimer, BOOL& bHandled )
|
||||
{
|
||||
int code = thread->GetExitCode();
|
||||
DWORD exitcode = *((DWORD *)&code);
|
||||
|
||||
//app.DebugPrintf("CScene_FullscreenProgress Timer %d\n",pTimer->nId);
|
||||
|
||||
if( exitcode != STILL_ACTIVE )
|
||||
{
|
||||
// 4J-PB - need to kill the timers whatever happens
|
||||
XuiKillTimer(m_hObj,TIMER_FULLSCREEN_PROGRESS);
|
||||
XuiKillTimer(m_hObj,TIMER_FULLSCREEN_TIPS);
|
||||
XuiControlSetText(m_tip,L"");
|
||||
|
||||
// hide the tips bar in cause we're waiting for the user to press ok
|
||||
m_tip.SetShow( FALSE );
|
||||
|
||||
// If we failed (currently used by network connection thread), navigate back
|
||||
if( exitcode != S_OK )
|
||||
{
|
||||
if( exitcode == ERROR_CANCELLED )
|
||||
{
|
||||
// Current thread cancelled for whatever reason
|
||||
// Currently used only for the CConsoleMinecraftApp::RemoteSaveThreadProc thread
|
||||
// Assume to just ignore this thread as something else is now running that will
|
||||
// cause another action
|
||||
}
|
||||
else
|
||||
{
|
||||
/*m_threadCompleted = true;
|
||||
m_buttonConfirm.SetShow( TRUE );
|
||||
m_buttonConfirm.SetFocus( m_CompletionData->iPad );
|
||||
m_CompletionData->type = e_ProgressCompletion_NavigateToHomeMenu;
|
||||
|
||||
int exitReasonStringId;
|
||||
switch( app.GetDisconnectReason() )
|
||||
{
|
||||
default:
|
||||
exitReasonStringId = IDS_CONNECTION_FAILED;
|
||||
}
|
||||
Minecraft *pMinecraft=Minecraft::GetInstance();
|
||||
pMinecraft->progressRenderer->progressStartNoAbort( exitReasonStringId );*/
|
||||
//app.NavigateBack(m_CompletionData->iPad);
|
||||
|
||||
UINT uiIDA[1];
|
||||
uiIDA[0]=IDS_CONFIRM_OK;
|
||||
StorageManager.RequestMessageBox( IDS_CONNECTION_FAILED, IDS_CONNECTION_LOST_SERVER, uiIDA,1,ProfileManager.GetPrimaryPad(),NULL,NULL, app.GetStringTable());
|
||||
|
||||
app.NavigateToHomeMenu();
|
||||
ui.UpdatePlayerBasePositions();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(( m_CompletionData->bRequiresUserAction == TRUE ) && (!m_bWasCancelled))
|
||||
{
|
||||
m_threadCompleted = true;
|
||||
m_buttonConfirm.SetShow( TRUE );
|
||||
m_buttonConfirm.SetFocus( ProfileManager.GetPrimaryPad() );
|
||||
ui.SetTooltips( m_iPad, IDS_TOOLTIPS_SELECT, -1, -1, -1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
if(m_bWasCancelled)
|
||||
{
|
||||
m_threadCompleted = true;
|
||||
}
|
||||
app.DebugPrintf("FullScreenProgress complete with action: ");
|
||||
switch(m_CompletionData->type)
|
||||
{
|
||||
case e_ProgressCompletion_AutosaveNavigateBack:
|
||||
app.DebugPrintf("e_ProgressCompletion_AutosaveNavigateBack\n");
|
||||
{
|
||||
// store these - they get wiped by the destroy caused by navigateback
|
||||
int iPad=m_CompletionData->iPad;
|
||||
//bool bAutosaveWasMenuDisplayed=m_CompletionData->bAutosaveWasMenuDisplayed;
|
||||
CXuiSceneBase::ShowBackground( iPad, FALSE );
|
||||
CXuiSceneBase::ShowLogo(iPad, FALSE );
|
||||
app.NavigateBack(iPad);
|
||||
|
||||
// 4J Stu - Fix for #65437 - Customer Encountered: Code: Settings: Autosave option doesn't work when the Host goes into idle state during gameplay.
|
||||
// Autosave obviously cannot occur if an ignore autosave menu is displayed, so even if we navigate back to a scene and not empty
|
||||
// then we still want to reset this flag which was set true by the navigate to the fullscreen progress
|
||||
app.SetIgnoreAutosaveMenuDisplayed(iPad, false);
|
||||
|
||||
// the navigate back leaves SetMenuDisplayed as true, but there may not have been a menu up when autosave was kicked off
|
||||
// if(bAutosaveWasMenuDisplayed==false)
|
||||
// {
|
||||
// app.SetMenuDisplayed(iPad,false);
|
||||
// }
|
||||
// Show the other players scenes
|
||||
CXuiSceneBase::ShowOtherPlayersBaseScene(iPad, true);
|
||||
// This just allows it to be shown
|
||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||
if(pMinecraft->localgameModes[ProfileManager.GetPrimaryPad()] != NULL) pMinecraft->localgameModes[ProfileManager.GetPrimaryPad()]->getTutorial()->showTutorialPopup(true);
|
||||
ui.UpdatePlayerBasePositions();
|
||||
}
|
||||
break;
|
||||
|
||||
case e_ProgressCompletion_NavigateBack:
|
||||
app.DebugPrintf("e_ProgressCompletion_NavigateBack\n");
|
||||
{
|
||||
// store these - they get wiped by the destroy caused by navigateback
|
||||
int iPad=m_CompletionData->iPad;
|
||||
|
||||
CXuiSceneBase::ShowBackground( iPad, FALSE );
|
||||
CXuiSceneBase::ShowBackground( iPad, TRUE );
|
||||
app.NavigateBack(iPad);
|
||||
// Show the other players scenes
|
||||
CXuiSceneBase::ShowOtherPlayersBaseScene(iPad, true);
|
||||
ui.UpdatePlayerBasePositions();
|
||||
}
|
||||
break;
|
||||
case e_ProgressCompletion_NavigateBackToScene:
|
||||
app.DebugPrintf("e_ProgressCompletion_NavigateBackToScene\n");
|
||||
CXuiSceneBase::ShowBackground( m_CompletionData->iPad, FALSE );
|
||||
CXuiSceneBase::ShowBackground( m_CompletionData->iPad, TRUE );
|
||||
CXuiSceneBase::ShowOtherPlayersBaseScene(m_CompletionData->iPad, true);
|
||||
// If the pause menu is still active, then navigate back
|
||||
// Otherwise close everything then navigate forwads to the pause menu
|
||||
if(app.IsSceneInStack(m_CompletionData->iPad, m_CompletionData->scene))
|
||||
{
|
||||
app.NavigateBack(m_CompletionData->iPad,false, m_CompletionData->scene);
|
||||
}
|
||||
else
|
||||
{
|
||||
app.CloseXuiScenesAndNavigateToScene(m_CompletionData->iPad,m_CompletionData->scene);
|
||||
}
|
||||
ui.UpdatePlayerBasePositions();
|
||||
break;
|
||||
case e_ProgressCompletion_CloseUIScenes:
|
||||
app.DebugPrintf("e_ProgressCompletion_CloseUIScenes\n");
|
||||
app.CloseXuiScenes(m_CompletionData->iPad);
|
||||
ui.UpdatePlayerBasePositions();
|
||||
break;
|
||||
case e_ProgressCompletion_CloseAllPlayersUIScenes:
|
||||
app.DebugPrintf("e_ProgressCompletion_CloseAllPlayersUIScenes\n");
|
||||
app.CloseAllPlayersXuiScenes();
|
||||
ui.UpdatePlayerBasePositions();
|
||||
break;
|
||||
case e_ProgressCompletion_NavigateToHomeMenu:
|
||||
app.DebugPrintf("e_ProgressCompletion_NavigateToHomeMenu\n");
|
||||
app.NavigateToHomeMenu();
|
||||
//ui.UpdatePlayerBasePositions();
|
||||
break;
|
||||
default:
|
||||
app.DebugPrintf("Default\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch(pTimer->nId)
|
||||
{
|
||||
case TIMER_FULLSCREEN_PROGRESS:
|
||||
break;
|
||||
case TIMER_FULLSCREEN_TIPS:
|
||||
{
|
||||
// display the next tip
|
||||
wstring wsText=app.FormatHTMLString(m_iPad,app.GetString(app.GetNextTip()));
|
||||
wchar_t startTags[64];
|
||||
swprintf(startTags,64,L"<font color=\"#%08x\" size=14><DIV ALIGN=CENTER>",app.GetHTMLColour(eHTMLColor_White));
|
||||
wsText= startTags + wsText + L"</DIV>";
|
||||
XuiControlSetText(m_tip,wsText.c_str());
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bHandled = TRUE;
|
||||
|
||||
return( S_OK );
|
||||
}
|
||||
68
Minecraft.Client/Common/XUI/XUI_FullscreenProgress.h
Normal file
68
Minecraft.Client/Common/XUI/XUI_FullscreenProgress.h
Normal file
@@ -0,0 +1,68 @@
|
||||
#pragma once
|
||||
#include "../media/xuiscene_fullscreenprogress.h"
|
||||
#include "..\..\..\Minecraft.World\C4JThread.h"
|
||||
|
||||
#define ERROR_FULLSCREENPROGRESS_
|
||||
|
||||
class CScene_FullscreenProgress : public CXuiSceneImpl
|
||||
{
|
||||
private:
|
||||
C4JThread* thread;
|
||||
bool threadStarted;
|
||||
UIFullscreenProgressCompletionData *m_CompletionData;
|
||||
|
||||
static const int TIMER_FULLSCREEN_PROGRESS = 0;
|
||||
static const int TIMER_FULLSCREEN_TIPS = 1;
|
||||
|
||||
static const int TIMER_FULLSCREEN_PROGRESS_TIME = 500;
|
||||
static const int TIMER_FULLSCREEN_TIPS_TIME = 7000;
|
||||
protected:
|
||||
// Control and Element wrapper objects.
|
||||
CXuiControl m_title, m_status, m_buttonConfirm, m_tip;
|
||||
|
||||
// Message map. Here we tie messages to message handlers.
|
||||
XUI_BEGIN_MSG_MAP()
|
||||
XUI_ON_XM_INIT( OnInit )
|
||||
XUI_ON_XM_DESTROY( OnDestroy )
|
||||
XUI_ON_XM_KEYDOWN(OnKeyDown)
|
||||
XUI_ON_XM_NOTIFY_SELCHANGED( OnNotifySelChanged )
|
||||
XUI_ON_XM_NOTIFY_PRESS_EX(OnNotifyPressEx)
|
||||
XUI_ON_XM_GET_SOURCE_TEXT(OnGetSourceDataText)
|
||||
XUI_ON_XM_TRANSITION_START( OnTransitionStart )
|
||||
XUI_ON_XM_TIMER( OnTimer )
|
||||
XUI_END_MSG_MAP()
|
||||
|
||||
// Control mapping to objects
|
||||
BEGIN_CONTROL_MAP()
|
||||
MAP_CONTROL(IDC_Title, m_title)
|
||||
MAP_CONTROL(IDC_Tip, m_tip)
|
||||
MAP_CONTROL(IDC_Status, m_status)
|
||||
MAP_CONTROL(IDC_ButtonConfirm, m_buttonConfirm)
|
||||
END_CONTROL_MAP()
|
||||
|
||||
|
||||
HRESULT OnInit( XUIMessageInit* pInitData, BOOL& bHandled );
|
||||
HRESULT OnDestroy();
|
||||
HRESULT OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandled);
|
||||
HRESULT OnNotifySelChanged( HXUIOBJ hObjSource, XUINotifySelChanged* pNotifySelChangedData, BOOL& bHandled );
|
||||
HRESULT OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* pNotifyPressData,BOOL& rfHandled);
|
||||
HRESULT OnGetSourceDataText(XUIMessageGetSourceText *pGetSourceTextData, BOOL& bHandled);
|
||||
HRESULT OnTransitionStart( XUIMessageTransition *pTransition, BOOL& bHandled );
|
||||
HRESULT OnTimer( XUIMessageTimer *pTimer, BOOL& bHandled );
|
||||
public:
|
||||
|
||||
// Define the class. The class name must match the ClassOverride property
|
||||
// set for the scene in the UI Authoring tool.
|
||||
XUI_IMPLEMENT_CLASS( CScene_FullscreenProgress, L"CScene_FullscreenProgress", XUI_CLASS_SCENE )
|
||||
|
||||
private:
|
||||
bool m_threadCompleted;
|
||||
int m_iPad;
|
||||
void (*m_cancelFunc)(LPVOID param);
|
||||
void (*m_completeFunc)(LPVOID param);
|
||||
LPVOID m_cancelFuncParam;
|
||||
LPVOID m_completeFuncParam;
|
||||
D3DXVECTOR3 m_OriginalPosition;
|
||||
bool m_bWasCancelled;
|
||||
|
||||
};
|
||||
464
Minecraft.Client/Common/XUI/XUI_HUD.cpp
Normal file
464
Minecraft.Client/Common/XUI/XUI_HUD.cpp
Normal file
@@ -0,0 +1,464 @@
|
||||
#include "stdafx.h"
|
||||
#include "XUI_HUD.h"
|
||||
#include "..\..\Minecraft.h"
|
||||
#include "..\..\Gui.h"
|
||||
#include "..\..\MultiplayerLocalPlayer.h"
|
||||
#include "..\..\..\Minecraft.World\net.minecraft.world.inventory.h"
|
||||
#include "..\..\..\Minecraft.World\Random.h"
|
||||
#include "..\..\..\Minecraft.World\net.minecraft.world.effect.h"
|
||||
#include "..\..\..\Minecraft.World\net.minecraft.world.level.material.h"
|
||||
|
||||
HRESULT CXuiSceneHud::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
|
||||
{
|
||||
m_iPad = *(int *)pInitData->pvInitData;
|
||||
|
||||
MapChildControls();
|
||||
|
||||
XuiElementGetPosition(m_hObj,&m_OriginalPosition);
|
||||
|
||||
m_tickCount = 0;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CXuiSceneHud::OnCustomMessage_Splitscreenplayer(bool bJoining, BOOL& bHandled)
|
||||
{
|
||||
bHandled=true;
|
||||
|
||||
app.ReloadHudScene(m_iPad, bJoining);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CXuiSceneHud::OnCustomMessage_TickScene()
|
||||
{
|
||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||
if(pMinecraft->localplayers[m_iPad] == NULL || pMinecraft->localgameModes[m_iPad] == NULL) return S_OK;
|
||||
|
||||
++m_tickCount;
|
||||
|
||||
int iGuiScale;
|
||||
|
||||
if(pMinecraft->localplayers[m_iPad]->m_iScreenSection == C4JRender::VIEWPORT_TYPE_FULLSCREEN)
|
||||
{
|
||||
iGuiScale=app.GetGameSettings(m_iPad,eGameSetting_UISize);
|
||||
}
|
||||
else
|
||||
{
|
||||
iGuiScale=app.GetGameSettings(m_iPad,eGameSetting_UISizeSplitscreen);
|
||||
}
|
||||
|
||||
int startFrame = 0;
|
||||
switch(iGuiScale)
|
||||
{
|
||||
case 0:
|
||||
XuiElementFindNamedFrame(m_hObj, L"ScaleSmall", &startFrame);
|
||||
break;
|
||||
case 1:
|
||||
XuiElementFindNamedFrame(m_hObj, L"Normal", &startFrame);
|
||||
break;
|
||||
case 2:
|
||||
XuiElementFindNamedFrame(m_hObj, L"ScaleLarge", &startFrame);
|
||||
break;
|
||||
}
|
||||
if(startFrame >= 0) XuiElementPlayTimeline( m_hObj, startFrame, startFrame, startFrame, FALSE, TRUE);
|
||||
|
||||
// Move the whole hud group if we are not in fullscreen
|
||||
if(pMinecraft->localplayers[m_iPad]->m_iScreenSection != C4JRender::VIEWPORT_TYPE_FULLSCREEN)
|
||||
{
|
||||
int iTooltipsYOffset = 0;
|
||||
// if tooltips are off, set the y offset to zero
|
||||
if(app.GetGameSettings(m_iPad,eGameSetting_Tooltips)==0)
|
||||
{
|
||||
switch(iGuiScale)
|
||||
{
|
||||
case 0:
|
||||
iTooltipsYOffset=28;//screenHeight/10;
|
||||
break;
|
||||
case 2:
|
||||
iTooltipsYOffset=28;//screenHeight/10;
|
||||
break;
|
||||
case 1:
|
||||
default:
|
||||
iTooltipsYOffset=28;//screenHeight/10;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
float fHeight, fWidth;
|
||||
GetBounds(&fWidth, &fHeight);
|
||||
|
||||
int iSafezoneYHalf = 0;
|
||||
switch(pMinecraft->localplayers[m_iPad]->m_iScreenSection)
|
||||
{
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_TOP:
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM:
|
||||
iSafezoneYHalf = -fHeight/10;// 5% (need to treat the whole screen is 2x this screen)
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_LEFT:
|
||||
iSafezoneYHalf = (fHeight/2)-(fHeight/10);// 5% (need to treat the whole screen is 2x this screen)
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT:
|
||||
iSafezoneYHalf = (fHeight/2)-(fHeight/10);// 5% (need to treat the whole screen is 2x this screen)
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT:
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT:
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT:
|
||||
iSafezoneYHalf = -fHeight/10; // 5% (the whole screen is 2x this screen)
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT:
|
||||
iSafezoneYHalf = -fHeight/10; // 5% (the whole screen is 2x this screen)
|
||||
break;
|
||||
};
|
||||
|
||||
D3DXVECTOR3 pos;
|
||||
m_hudGroup.GetPosition(&pos);
|
||||
pos.y = iTooltipsYOffset + iSafezoneYHalf;
|
||||
m_hudGroup.SetPosition(&pos);
|
||||
}
|
||||
|
||||
// Update inventory
|
||||
float opacity = 1.0f;
|
||||
GetOpacity(&opacity);
|
||||
int selected = pMinecraft->localplayers[m_iPad]->inventory->selected;
|
||||
for(unsigned int j = 0; j < 9; ++j)
|
||||
{
|
||||
m_hotbarIcon[j]->SetSlot(m_hotbarIcon[j]->m_hObj,pMinecraft->localplayers[m_iPad]->inventoryMenu->getSlot(InventoryMenu::USE_ROW_SLOT_START + j));
|
||||
m_hotbarIcon[j]->SetUserIndex(m_hotbarIcon[j]->m_hObj, m_iPad );
|
||||
|
||||
if(j == selected)
|
||||
{
|
||||
m_hotbarIcon[j]->SetEnable(FALSE); //Makes the selected overlay display
|
||||
}
|
||||
else
|
||||
{
|
||||
m_hotbarIcon[j]->SetEnable(TRUE); //Hides the selected overlay display
|
||||
}
|
||||
|
||||
m_hotbarIcon[j]->SetAlpha( m_hotbarIcon[j]->m_hObj, opacity );
|
||||
}
|
||||
|
||||
// Update xp progress
|
||||
if (pMinecraft->localgameModes[m_iPad]->canHurtPlayer())
|
||||
{
|
||||
int xpNeededForNextLevel = pMinecraft->localplayers[m_iPad]->getXpNeededForNextLevel();
|
||||
int progress = (int)(pMinecraft->localplayers[m_iPad]->experienceProgress *xpNeededForNextLevel);
|
||||
|
||||
m_ExperienceProgress.SetShow(TRUE);
|
||||
m_ExperienceProgress.SetRange(0,xpNeededForNextLevel);
|
||||
m_ExperienceProgress.SetValue(progress);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ExperienceProgress.SetShow(FALSE);
|
||||
}
|
||||
|
||||
// Update xp level
|
||||
if (pMinecraft->localgameModes[m_iPad]->hasExperience() && pMinecraft->localplayers[m_iPad]->experienceLevel > 0)
|
||||
{
|
||||
m_xpLevel.SetShow(TRUE);
|
||||
|
||||
wchar_t formatted[10];
|
||||
swprintf(formatted, 10, L"%d",pMinecraft->localplayers[m_iPad]->experienceLevel);
|
||||
|
||||
m_xpLevel.SetText(formatted);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_xpLevel.SetShow(FALSE);
|
||||
}
|
||||
|
||||
if (pMinecraft->localgameModes[m_iPad]->canHurtPlayer())
|
||||
{
|
||||
m_random.setSeed(m_tickCount * 312871);
|
||||
|
||||
// Update health
|
||||
int heartOffsetIndex = -1;
|
||||
if (pMinecraft->localplayers[m_iPad]->hasEffect(MobEffect::regeneration))
|
||||
{
|
||||
heartOffsetIndex = m_tickCount % 25;
|
||||
}
|
||||
|
||||
bool blink = pMinecraft->localplayers[m_iPad]->invulnerableTime / 3 % 2 == 1;
|
||||
if (pMinecraft->localplayers[m_iPad]->invulnerableTime < 10) blink = false;
|
||||
int iHealth = pMinecraft->localplayers[m_iPad]->getHealth();
|
||||
int iLastHealth = pMinecraft->localplayers[m_iPad]->lastHealth;
|
||||
bool bHasPoison = pMinecraft->localplayers[m_iPad]->hasEffect(MobEffect::poison);
|
||||
for (int icon = 0; icon < Player::MAX_HEALTH / 2; icon++)
|
||||
{
|
||||
if(blink)
|
||||
{
|
||||
if (icon * 2 + 1 < iLastHealth || icon * 2 + 1 < iHealth)
|
||||
{
|
||||
// Full
|
||||
if(bHasPoison)
|
||||
{
|
||||
m_healthIcon[icon].PlayVisualRange(L"FullPoisonFlash",NULL,L"FullPoisonFlash");
|
||||
}
|
||||
else
|
||||
{
|
||||
m_healthIcon[icon].PlayVisualRange(L"FullFlash",NULL,L"FullFlash");
|
||||
}
|
||||
}
|
||||
else if (icon * 2 + 1 == iLastHealth || icon * 2 + 1 == iHealth)
|
||||
{
|
||||
// Half
|
||||
if(bHasPoison)
|
||||
{
|
||||
m_healthIcon[icon].PlayVisualRange(L"HalfPoisonFlash",NULL,L"HalfPoisonFlash");
|
||||
}
|
||||
else
|
||||
{
|
||||
m_healthIcon[icon].PlayVisualRange(L"HalfFlash",NULL,L"HalfFlash");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Empty
|
||||
m_healthIcon[icon].PlayVisualRange(L"NormalFlash",NULL,L"NormalFlash");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (icon * 2 + 1 < iHealth)
|
||||
{
|
||||
// Full
|
||||
if(bHasPoison)
|
||||
{
|
||||
m_healthIcon[icon].PlayVisualRange(L"FullPoison",NULL,L"FullPoison");
|
||||
}
|
||||
else
|
||||
{
|
||||
m_healthIcon[icon].PlayVisualRange(L"Full",NULL,L"Full");
|
||||
}
|
||||
}
|
||||
else if (icon * 2 + 1 == iHealth)
|
||||
{
|
||||
// Half
|
||||
if(bHasPoison)
|
||||
{
|
||||
m_healthIcon[icon].PlayVisualRange(L"HalfPoison",NULL,L"HalfPoison");
|
||||
}
|
||||
else
|
||||
{
|
||||
m_healthIcon[icon].PlayVisualRange(L"Half",NULL,L"Half");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Empty
|
||||
m_healthIcon[icon].PlayVisualRange(L"Normal",NULL,L"Normal");
|
||||
}
|
||||
}
|
||||
|
||||
float yo = 0;
|
||||
if (iHealth <= 4)
|
||||
{
|
||||
yo = (float)m_random.nextInt(2) * (iGuiScale+1);
|
||||
}
|
||||
if (icon == heartOffsetIndex)
|
||||
{
|
||||
yo = -2.0f * (iGuiScale+1);
|
||||
}
|
||||
|
||||
D3DXVECTOR3 pos;
|
||||
m_healthIcon[icon].GetPosition(&pos);
|
||||
// TODO - 4J Stu - This should be scaled based on gui scale and overall size (ie full, split or 480)
|
||||
pos.y = yo;
|
||||
m_healthIcon[icon].SetPosition(&pos);
|
||||
|
||||
}
|
||||
|
||||
// Update food
|
||||
bool foodBlink = false;
|
||||
FoodData *foodData = pMinecraft->localplayers[m_iPad]->getFoodData();
|
||||
int food = foodData->getFoodLevel();
|
||||
int oldFood = foodData->getLastFoodLevel();
|
||||
bool hasHungerEffect = pMinecraft->localplayers[m_iPad]->hasEffect(MobEffect::hunger);
|
||||
int saturationLevel = pMinecraft->localplayers[m_iPad]->getFoodData()->getSaturationLevel();
|
||||
for (int icon = 0; icon < 10; icon++)
|
||||
{
|
||||
if(foodBlink)
|
||||
{
|
||||
if (icon * 2 + 1 < oldFood || icon * 2 + 1 < food)
|
||||
{
|
||||
// Full
|
||||
if(hasHungerEffect)
|
||||
{
|
||||
m_foodIcon[icon].PlayVisualRange(L"FullPoisonFlash",NULL,L"FullPoisonFlash");
|
||||
}
|
||||
else
|
||||
{
|
||||
m_foodIcon[icon].PlayVisualRange(L"FullFlash",NULL,L"FullFlash");
|
||||
}
|
||||
}
|
||||
else if (icon * 2 + 1 == oldFood || icon * 2 + 1 == food)
|
||||
{
|
||||
// Half
|
||||
if(hasHungerEffect)
|
||||
{
|
||||
m_foodIcon[icon].PlayVisualRange(L"HalfPoisonFlash",NULL,L"HalfPoisonFlash");
|
||||
}
|
||||
else
|
||||
{
|
||||
m_foodIcon[icon].PlayVisualRange(L"HalfFlash",NULL,L"HalfFlash");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Empty
|
||||
m_foodIcon[icon].PlayVisualRange(L"NormalFlash",NULL,L"NormalFlash");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (icon * 2 + 1 < food)
|
||||
{
|
||||
// Full
|
||||
if(hasHungerEffect)
|
||||
{
|
||||
m_foodIcon[icon].PlayVisualRange(L"FullPoison",NULL,L"FullPoison");
|
||||
}
|
||||
else
|
||||
{
|
||||
m_foodIcon[icon].PlayVisualRange(L"Full",NULL,L"Full");
|
||||
}
|
||||
}
|
||||
else if (icon * 2 + 1 == food)
|
||||
{
|
||||
// Half
|
||||
if(hasHungerEffect)
|
||||
{
|
||||
m_foodIcon[icon].PlayVisualRange(L"HalfPoison",NULL,L"HalfPoison");
|
||||
}
|
||||
else
|
||||
{
|
||||
m_foodIcon[icon].PlayVisualRange(L"Half",NULL,L"Half");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Empty
|
||||
if(hasHungerEffect)
|
||||
{
|
||||
m_foodIcon[icon].PlayVisualRange(L"NormalPoison",NULL,L"NormalPoison");
|
||||
}
|
||||
else
|
||||
{
|
||||
m_foodIcon[icon].PlayVisualRange(L"Normal",NULL,L"Normal");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
float yo = 0;
|
||||
if (saturationLevel <= 0)
|
||||
{
|
||||
if ((m_tickCount % (food * 3 + 1)) == 0)
|
||||
{
|
||||
yo = (float)(m_random.nextInt(3) - 1) * (iGuiScale+1);
|
||||
}
|
||||
}
|
||||
|
||||
D3DXVECTOR3 pos;
|
||||
m_foodIcon[icon].GetPosition(&pos);
|
||||
// TODO - 4J Stu - This should be scaled based on gui scale and overall size (ie full, split or 480)
|
||||
pos.y = yo;
|
||||
m_foodIcon[icon].SetPosition(&pos);
|
||||
}
|
||||
|
||||
// Update armour
|
||||
int armor = pMinecraft->localplayers[m_iPad]->getArmorValue();
|
||||
if(armor > 0)
|
||||
{
|
||||
m_armourGroup.SetShow(TRUE);
|
||||
for (int icon = 0; icon < 10; icon++)
|
||||
{
|
||||
if (icon * 2 + 1 < armor) m_armourIcon[icon].PlayVisualRange(L"Full",NULL,L"Full");
|
||||
else if (icon * 2 + 1 == armor) m_armourIcon[icon].PlayVisualRange(L"Half",NULL,L"Half");
|
||||
else if (icon * 2 + 1 > armor) m_armourIcon[icon].PlayVisualRange(L"Normal",NULL,L"Normal");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_armourGroup.SetShow(FALSE);
|
||||
}
|
||||
|
||||
// Update air
|
||||
if (pMinecraft->localplayers[m_iPad]->isUnderLiquid(Material::water))
|
||||
{
|
||||
m_airGroup.SetShow(TRUE);
|
||||
int count = (int) ceil((pMinecraft->localplayers[m_iPad]->getAirSupply() - 2) * 10.0f / Player::TOTAL_AIR_SUPPLY);
|
||||
int extra = (int) ceil((pMinecraft->localplayers[m_iPad]->getAirSupply()) * 10.0f / Player::TOTAL_AIR_SUPPLY) - count;
|
||||
for (int icon = 0; icon < 10; icon++)
|
||||
{
|
||||
// Air bubbles
|
||||
if (icon < count)
|
||||
{
|
||||
m_airIcon[icon].SetShow(TRUE);
|
||||
m_airIcon[icon].PlayVisualRange(L"Bubble",NULL,L"Bubble");
|
||||
}
|
||||
else if(icon < count + extra)
|
||||
{
|
||||
m_airIcon[icon].SetShow(TRUE);
|
||||
m_airIcon[icon].PlayVisualRange(L"Pop",NULL,L"Pop");
|
||||
}
|
||||
else m_airIcon[icon].SetShow(FALSE);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_airGroup.SetShow(FALSE);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_healthGroup.SetShow(FALSE);
|
||||
m_foodGroup.SetShow(FALSE);
|
||||
m_armourGroup.SetShow(FALSE);
|
||||
m_airGroup.SetShow(FALSE);
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CXuiSceneHud::OnCustomMessage_DLCInstalled()
|
||||
{
|
||||
// mounted DLC may have changed
|
||||
bool bPauseMenuDisplayed=false;
|
||||
bool bInGame=(Minecraft::GetInstance()->level!=NULL);
|
||||
// ignore this if we have menus up - they'll deal with it
|
||||
for(int i=0;i<XUSER_MAX_COUNT;i++)
|
||||
{
|
||||
if(app.IsPauseMenuDisplayed(i))
|
||||
{
|
||||
bPauseMenuDisplayed=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(bInGame && !bPauseMenuDisplayed)
|
||||
{
|
||||
app.StartInstallDLCProcess(ProfileManager.GetPrimaryPad());
|
||||
}
|
||||
|
||||
// this will send a CustomMessage_DLCMountingComplete when done
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
HRESULT CXuiSceneHud::OnCustomMessage_DLCMountingComplete()
|
||||
{
|
||||
// A join from invite may have installed the trial pack during the game.
|
||||
// Need to switch to the texture pack if it's not being used yet, and turn off background downloads
|
||||
|
||||
// what texture pack are we using?
|
||||
// TexturePack *tPack = Minecraft::GetInstance()->skins->getSelected();
|
||||
// if(tPack->getDLCParentPackId()!=app.GetRequiredTexturePackID())
|
||||
// {
|
||||
// app.DebugPrintf("DLC install finished, and the game is using a texture pack that isn't the required one\n");
|
||||
// }
|
||||
return S_OK;
|
||||
}
|
||||
129
Minecraft.Client/Common/XUI/XUI_HUD.h
Normal file
129
Minecraft.Client/Common/XUI/XUI_HUD.h
Normal file
@@ -0,0 +1,129 @@
|
||||
#pragma once
|
||||
#include "../media/xuiscene_hud.h"
|
||||
#include "XUI_CustomMessages.h"
|
||||
|
||||
#define CHAT_LINES_COUNT 10
|
||||
|
||||
class CXuiSceneHud : public CXuiSceneImpl
|
||||
{
|
||||
private:
|
||||
Random m_random;
|
||||
int m_tickCount;
|
||||
|
||||
protected:
|
||||
CXuiControl m_hudHolder; // Contains the HUD group to enable moving all elements together
|
||||
CXuiControl m_hudGroup; // Contains all the HUD elements except crosshair, in a group that scales
|
||||
CXuiControl m_hudScaleGroup; // Contains all the HUD elements except crosshair
|
||||
CXuiControl m_hotbarGroup;
|
||||
CXuiCtrlSlotItem *m_hotbarIcon[9];
|
||||
CXuiProgressBar m_ExperienceProgress;
|
||||
CXuiControl m_healthGroup;
|
||||
CXuiControl m_healthIcon[10];
|
||||
CXuiControl m_armourGroup;
|
||||
CXuiControl m_armourIcon[10];
|
||||
CXuiControl m_foodGroup;
|
||||
CXuiControl m_foodIcon[10];
|
||||
CXuiControl m_airGroup;
|
||||
CXuiControl m_airIcon[10];
|
||||
CXuiControl m_xpLevel;
|
||||
|
||||
D3DXVECTOR3 m_OriginalPosition;
|
||||
int m_iPad;
|
||||
|
||||
// Message map. Here we tie messages to message handlers.
|
||||
XUI_BEGIN_MSG_MAP()
|
||||
XUI_ON_XM_INIT( OnInit )
|
||||
XUI_ON_XM_SPLITSCREENPLAYER_MESSAGE(OnCustomMessage_Splitscreenplayer)
|
||||
XUI_ON_XM_CUSTOMTICKSCENE_MESSAGE(OnCustomMessage_TickScene)
|
||||
XUI_ON_XM_DLCINSTALLED_MESSAGE(OnCustomMessage_DLCInstalled)
|
||||
XUI_ON_XM_DLCLOADED_MESSAGE(OnCustomMessage_DLCMountingComplete)
|
||||
XUI_END_MSG_MAP()
|
||||
|
||||
BEGIN_CONTROL_MAP()
|
||||
MAP_CONTROL(IDC_HudHolder, m_hudHolder)
|
||||
BEGIN_MAP_CHILD_CONTROLS(m_hudHolder)
|
||||
MAP_CONTROL(IDC_HudGroup, m_hudGroup)
|
||||
BEGIN_MAP_CHILD_CONTROLS(m_hudGroup)
|
||||
MAP_CONTROL(IDC_HudScaleGroup, m_hudScaleGroup)
|
||||
BEGIN_MAP_CHILD_CONTROLS(m_hudScaleGroup)
|
||||
MAP_CONTROL(IDC_Hotbar, m_hotbarGroup)
|
||||
BEGIN_MAP_CHILD_CONTROLS(m_hotbarGroup)
|
||||
MAP_OVERRIDE(IDC_Inventory1, m_hotbarIcon[0])
|
||||
MAP_OVERRIDE(IDC_Inventory2, m_hotbarIcon[1])
|
||||
MAP_OVERRIDE(IDC_Inventory3, m_hotbarIcon[2])
|
||||
MAP_OVERRIDE(IDC_Inventory4, m_hotbarIcon[3])
|
||||
MAP_OVERRIDE(IDC_Inventory5, m_hotbarIcon[4])
|
||||
MAP_OVERRIDE(IDC_Inventory6, m_hotbarIcon[5])
|
||||
MAP_OVERRIDE(IDC_Inventory7, m_hotbarIcon[6])
|
||||
MAP_OVERRIDE(IDC_Inventory8, m_hotbarIcon[7])
|
||||
MAP_OVERRIDE(IDC_Inventory9, m_hotbarIcon[8])
|
||||
END_MAP_CHILD_CONTROLS()
|
||||
MAP_CONTROL(IDC_ExperienceProgress, m_ExperienceProgress)
|
||||
MAP_CONTROL(IDC_Health, m_healthGroup)
|
||||
BEGIN_MAP_CHILD_CONTROLS(m_healthGroup)
|
||||
MAP_CONTROL(IDC_Health0, m_healthIcon[0])
|
||||
MAP_CONTROL(IDC_Health1, m_healthIcon[1])
|
||||
MAP_CONTROL(IDC_Health2, m_healthIcon[2])
|
||||
MAP_CONTROL(IDC_Health3, m_healthIcon[3])
|
||||
MAP_CONTROL(IDC_Health4, m_healthIcon[4])
|
||||
MAP_CONTROL(IDC_Health5, m_healthIcon[5])
|
||||
MAP_CONTROL(IDC_Health6, m_healthIcon[6])
|
||||
MAP_CONTROL(IDC_Health7, m_healthIcon[7])
|
||||
MAP_CONTROL(IDC_Health8, m_healthIcon[8])
|
||||
MAP_CONTROL(IDC_Health9, m_healthIcon[9])
|
||||
END_MAP_CHILD_CONTROLS()
|
||||
MAP_CONTROL(IDC_Armour, m_armourGroup)
|
||||
BEGIN_MAP_CHILD_CONTROLS(m_armourGroup)
|
||||
MAP_CONTROL(IDC_Armour0, m_armourIcon[0])
|
||||
MAP_CONTROL(IDC_Armour1, m_armourIcon[1])
|
||||
MAP_CONTROL(IDC_Armour2, m_armourIcon[2])
|
||||
MAP_CONTROL(IDC_Armour3, m_armourIcon[3])
|
||||
MAP_CONTROL(IDC_Armour4, m_armourIcon[4])
|
||||
MAP_CONTROL(IDC_Armour5, m_armourIcon[5])
|
||||
MAP_CONTROL(IDC_Armour6, m_armourIcon[6])
|
||||
MAP_CONTROL(IDC_Armour7, m_armourIcon[7])
|
||||
MAP_CONTROL(IDC_Armour8, m_armourIcon[8])
|
||||
MAP_CONTROL(IDC_Armour9, m_armourIcon[9])
|
||||
END_MAP_CHILD_CONTROLS()
|
||||
MAP_CONTROL(IDC_Food, m_foodGroup)
|
||||
BEGIN_MAP_CHILD_CONTROLS(m_foodGroup)
|
||||
MAP_CONTROL(IDC_Food0, m_foodIcon[0])
|
||||
MAP_CONTROL(IDC_Food1, m_foodIcon[1])
|
||||
MAP_CONTROL(IDC_Food2, m_foodIcon[2])
|
||||
MAP_CONTROL(IDC_Food3, m_foodIcon[3])
|
||||
MAP_CONTROL(IDC_Food4, m_foodIcon[4])
|
||||
MAP_CONTROL(IDC_Food5, m_foodIcon[5])
|
||||
MAP_CONTROL(IDC_Food6, m_foodIcon[6])
|
||||
MAP_CONTROL(IDC_Food7, m_foodIcon[7])
|
||||
MAP_CONTROL(IDC_Food8, m_foodIcon[8])
|
||||
MAP_CONTROL(IDC_Food9, m_foodIcon[9])
|
||||
END_MAP_CHILD_CONTROLS()
|
||||
MAP_CONTROL(IDC_Air, m_airGroup)
|
||||
BEGIN_MAP_CHILD_CONTROLS(m_airGroup)
|
||||
MAP_CONTROL(IDC_Air0, m_airIcon[0])
|
||||
MAP_CONTROL(IDC_Air1, m_airIcon[1])
|
||||
MAP_CONTROL(IDC_Air2, m_airIcon[2])
|
||||
MAP_CONTROL(IDC_Air3, m_airIcon[3])
|
||||
MAP_CONTROL(IDC_Air4, m_airIcon[4])
|
||||
MAP_CONTROL(IDC_Air5, m_airIcon[5])
|
||||
MAP_CONTROL(IDC_Air6, m_airIcon[6])
|
||||
MAP_CONTROL(IDC_Air7, m_airIcon[7])
|
||||
MAP_CONTROL(IDC_Air8, m_airIcon[8])
|
||||
MAP_CONTROL(IDC_Air9, m_airIcon[9])
|
||||
END_MAP_CHILD_CONTROLS()
|
||||
MAP_CONTROL(IDC_XPLevel, m_xpLevel)
|
||||
END_MAP_CHILD_CONTROLS()
|
||||
END_MAP_CHILD_CONTROLS()
|
||||
END_MAP_CHILD_CONTROLS()
|
||||
END_CONTROL_MAP()
|
||||
|
||||
HRESULT OnInit( XUIMessageInit* pInitData, BOOL& bHandled );
|
||||
HRESULT OnCustomMessage_Splitscreenplayer(bool bJoining, BOOL& bHandled);
|
||||
HRESULT OnCustomMessage_TickScene();
|
||||
HRESULT OnCustomMessage_DLCInstalled();
|
||||
HRESULT OnCustomMessage_DLCMountingComplete();
|
||||
public:
|
||||
// Define the class. The class name must match the ClassOverride property
|
||||
// set for the scene in the UI Authoring tool.
|
||||
XUI_IMPLEMENT_CLASS( CXuiSceneHud, L"CXuiSceneHud", XUI_CLASS_SCENE )
|
||||
};
|
||||
462
Minecraft.Client/Common/XUI/XUI_HelpAndOptions.cpp
Normal file
462
Minecraft.Client/Common/XUI/XUI_HelpAndOptions.cpp
Normal file
@@ -0,0 +1,462 @@
|
||||
// Minecraft.cpp : Defines the entry point for the application.
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include "..\XUI\XUI_HelpAndOptions.h"
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Performs initialization tasks - retrieves controls.
|
||||
//----------------------------------------------------------------------------------
|
||||
HRESULT CScene_HelpAndOptions::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
|
||||
{
|
||||
m_iPad = *(int *)pInitData->pvInitData;
|
||||
bool bNotInGame=(Minecraft::GetInstance()->level==NULL);
|
||||
|
||||
MapChildControls();
|
||||
XuiControlSetText(m_Buttons[BUTTON_HAO_CHANGESKIN],app.GetString(IDS_CHANGE_SKIN));
|
||||
XuiControlSetText(m_Buttons[BUTTON_HAO_HOWTOPLAY],app.GetString(IDS_HOW_TO_PLAY));
|
||||
XuiControlSetText(m_Buttons[BUTTON_HAO_CONTROLS],app.GetString(IDS_CONTROLS));
|
||||
XuiControlSetText(m_Buttons[BUTTON_HAO_SETTINGS],app.GetString(IDS_SETTINGS));
|
||||
XuiControlSetText(m_Buttons[BUTTON_HAO_CREDITS],app.GetString(IDS_CREDITS));
|
||||
XuiControlSetText(m_Buttons[BUTTON_HAO_REINSTALL],app.GetString(IDS_REINSTALL_CONTENT));
|
||||
XuiControlSetText(m_Buttons[BUTTON_HAO_DEBUG],app.GetString(IDS_DEBUG_SETTINGS));
|
||||
|
||||
//if(app.GetTMSDLCInfoRead())
|
||||
{
|
||||
m_Timer.SetShow(FALSE);
|
||||
m_bIgnoreInput=false;
|
||||
|
||||
#ifndef _FINAL_BUILD
|
||||
if(!app.DebugSettingsOn())
|
||||
{
|
||||
m_Buttons[BUTTON_HAO_DEBUG].SetEnable(FALSE);
|
||||
m_Buttons[BUTTON_HAO_DEBUG].SetShow(FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Buttons[BUTTON_HAO_DEBUG].SetEnable(TRUE);
|
||||
m_Buttons[BUTTON_HAO_DEBUG].SetShow(TRUE);
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
// 4J-PB - do not need a storage device to see this menu - just need one when you choose to re-install them
|
||||
|
||||
// any content to be re-installed?
|
||||
if(m_iPad==ProfileManager.GetPrimaryPad() && bNotInGame)
|
||||
{
|
||||
// We should show the reinstall menu
|
||||
app.DebugPrintf("Reinstall Menu required...\n");
|
||||
m_Buttons[BUTTON_HAO_REINSTALL].SetEnable(TRUE);
|
||||
m_Buttons[BUTTON_HAO_REINSTALL].SetShow(TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Buttons[BUTTON_HAO_REINSTALL].SetEnable(FALSE);
|
||||
m_Buttons[BUTTON_HAO_REINSTALL].SetShow(FALSE);
|
||||
}
|
||||
|
||||
if(app.GetLocalPlayerCount()>1)
|
||||
{
|
||||
// no credits in splitscreen
|
||||
D3DXVECTOR3 vec;
|
||||
|
||||
m_Buttons[BUTTON_HAO_CREDITS].GetPosition(&vec);
|
||||
|
||||
m_Buttons[BUTTON_HAO_CREDITS].SetEnable(FALSE);
|
||||
m_Buttons[BUTTON_HAO_CREDITS].SetShow(FALSE);
|
||||
|
||||
m_Buttons[BUTTON_HAO_REINSTALL].SetPosition(&vec);
|
||||
|
||||
app.AdjustSplitscreenScene(m_hObj,&m_OriginalPosition,m_iPad,false);
|
||||
CXuiSceneBase::ShowLogo( m_iPad, FALSE );
|
||||
|
||||
if(ProfileManager.GetPrimaryPad()!=m_iPad)
|
||||
{
|
||||
m_Buttons[BUTTON_HAO_DEBUG].SetEnable(FALSE);
|
||||
m_Buttons[BUTTON_HAO_DEBUG].SetShow(FALSE);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(bNotInGame)
|
||||
{
|
||||
CXuiSceneBase::ShowLogo( DEFAULT_XUI_MENU_USER, TRUE );
|
||||
}
|
||||
else
|
||||
{
|
||||
CXuiSceneBase::ShowLogo( m_iPad, TRUE );
|
||||
}
|
||||
}
|
||||
// Display the tooltips
|
||||
|
||||
// if we're not in the game, we need to use basescene 0
|
||||
if(bNotInGame)
|
||||
{
|
||||
ui.SetTooltips( DEFAULT_XUI_MENU_USER, IDS_TOOLTIPS_SELECT,IDS_TOOLTIPS_BACK);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui.SetTooltips( m_iPad, IDS_TOOLTIPS_SELECT,IDS_TOOLTIPS_BACK);
|
||||
}
|
||||
|
||||
|
||||
if(!ProfileManager.IsFullVersion() )//|| ProfileManager.IsGuest(m_iPad))
|
||||
{
|
||||
// disable save button
|
||||
m_Buttons[BUTTON_HAO_CHANGESKIN].SetEnable(FALSE);
|
||||
m_Buttons[BUTTON_HAO_CHANGESKIN].EnableInput(FALSE);
|
||||
// set the focus to the second button
|
||||
|
||||
XuiElementSetUserFocus(m_Buttons[BUTTON_HAO_HOWTOPLAY].m_hObj, m_iPad);
|
||||
}
|
||||
}
|
||||
/*else
|
||||
{
|
||||
m_bIgnoreInput=true;
|
||||
m_Timer.SetShow(TRUE);
|
||||
|
||||
// hide all the buttons
|
||||
for(int i=0;i<BUTTONS_HAO_MAX;i++)
|
||||
{
|
||||
m_Buttons[i].SetEnable(FALSE);
|
||||
m_Buttons[i].SetShow(FALSE);
|
||||
}
|
||||
|
||||
if(bNotInGame)
|
||||
{
|
||||
ui.SetTooltips( DEFAULT_XUI_MENU_USER, -1,-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui.SetTooltips( m_iPad, -1,-1);
|
||||
}
|
||||
}*/
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
/*HRESULT CScene_HelpAndOptions::OnTMSDLCFileRetrieved( )
|
||||
{
|
||||
bool bNotInGame=(Minecraft::GetInstance()->level==NULL);
|
||||
m_Timer.SetShow(FALSE);
|
||||
m_bIgnoreInput=false;
|
||||
|
||||
// show all the buttons - except the debug settings and reinstall content
|
||||
m_Buttons[BUTTON_HAO_CHANGESKIN].SetEnable(TRUE);
|
||||
m_Buttons[BUTTON_HAO_CHANGESKIN].SetShow(TRUE);
|
||||
m_Buttons[BUTTON_HAO_HOWTOPLAY].SetEnable(TRUE);
|
||||
m_Buttons[BUTTON_HAO_HOWTOPLAY].SetShow(TRUE);
|
||||
m_Buttons[BUTTON_HAO_CONTROLS].SetEnable(TRUE);
|
||||
m_Buttons[BUTTON_HAO_CONTROLS].SetShow(TRUE);
|
||||
m_Buttons[BUTTON_HAO_SETTINGS].SetEnable(TRUE);
|
||||
m_Buttons[BUTTON_HAO_SETTINGS].SetShow(TRUE);
|
||||
m_Buttons[BUTTON_HAO_CREDITS].SetEnable(TRUE);
|
||||
m_Buttons[BUTTON_HAO_CREDITS].SetShow(TRUE);
|
||||
|
||||
|
||||
|
||||
#ifndef _FINAL_BUILD
|
||||
if(!app.DebugSettingsOn())
|
||||
{
|
||||
m_Buttons[BUTTON_HAO_DEBUG].SetEnable(FALSE);
|
||||
m_Buttons[BUTTON_HAO_DEBUG].SetShow(FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Buttons[BUTTON_HAO_DEBUG].SetEnable(TRUE);
|
||||
m_Buttons[BUTTON_HAO_DEBUG].SetShow(TRUE);
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
// 4J-PB - do not need a storage device to see this menu - just need one when you choose to re-install them
|
||||
|
||||
// any content to be re-installed?
|
||||
if(m_iPad==ProfileManager.GetPrimaryPad() && bNotInGame)
|
||||
{
|
||||
// We should show the reinstall menu
|
||||
app.DebugPrintf("Reinstall Menu required...\n");
|
||||
m_Buttons[BUTTON_HAO_REINSTALL].SetEnable(TRUE);
|
||||
m_Buttons[BUTTON_HAO_REINSTALL].SetShow(TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Buttons[BUTTON_HAO_REINSTALL].SetEnable(FALSE);
|
||||
m_Buttons[BUTTON_HAO_REINSTALL].SetShow(FALSE);
|
||||
}
|
||||
|
||||
if(app.GetLocalPlayerCount()>1)
|
||||
{
|
||||
// no credits in splitscreen
|
||||
D3DXVECTOR3 vec;
|
||||
|
||||
m_Buttons[BUTTON_HAO_CREDITS].GetPosition(&vec);
|
||||
|
||||
m_Buttons[BUTTON_HAO_CREDITS].SetEnable(FALSE);
|
||||
m_Buttons[BUTTON_HAO_CREDITS].SetShow(FALSE);
|
||||
|
||||
m_Buttons[BUTTON_HAO_REINSTALL].SetPosition(&vec);
|
||||
|
||||
app.AdjustSplitscreenScene(m_hObj,&m_OriginalPosition,m_iPad,false);
|
||||
CXuiSceneBase::ShowLogo( m_iPad, FALSE );
|
||||
|
||||
if(ProfileManager.GetPrimaryPad()!=m_iPad)
|
||||
{
|
||||
m_Buttons[BUTTON_HAO_DEBUG].SetEnable(FALSE);
|
||||
m_Buttons[BUTTON_HAO_DEBUG].SetShow(FALSE);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(bNotInGame)
|
||||
{
|
||||
CXuiSceneBase::ShowLogo( DEFAULT_XUI_MENU_USER, TRUE );
|
||||
}
|
||||
else
|
||||
{
|
||||
CXuiSceneBase::ShowLogo( m_iPad, TRUE );
|
||||
}
|
||||
}
|
||||
// Display the tooltips
|
||||
|
||||
// if we're not in the game, we need to use basescene 0
|
||||
if(bNotInGame)
|
||||
{
|
||||
ui.SetTooltips( DEFAULT_XUI_MENU_USER, IDS_TOOLTIPS_SELECT,IDS_TOOLTIPS_BACK);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui.SetTooltips( m_iPad, IDS_TOOLTIPS_SELECT,IDS_TOOLTIPS_BACK);
|
||||
}
|
||||
|
||||
|
||||
if(!ProfileManager.IsFullVersion() )//|| ProfileManager.IsGuest(m_iPad))
|
||||
{
|
||||
// disable save button
|
||||
m_Buttons[BUTTON_HAO_CHANGESKIN].SetEnable(FALSE);
|
||||
m_Buttons[BUTTON_HAO_CHANGESKIN].EnableInput(FALSE);
|
||||
// set the focus to the second button
|
||||
|
||||
XuiElementSetUserFocus(m_Buttons[BUTTON_HAO_HOWTOPLAY].m_hObj, m_iPad);
|
||||
}
|
||||
else
|
||||
{
|
||||
XuiElementSetUserFocus(m_Buttons[BUTTON_HAO_CHANGESKIN].m_hObj, m_iPad);
|
||||
}
|
||||
return S_OK;
|
||||
}*/
|
||||
|
||||
HRESULT CScene_HelpAndOptions::OnControlNavigate(XUIMessageControlNavigate *pControlNavigateData, BOOL& bHandled)
|
||||
{
|
||||
pControlNavigateData->hObjDest=XuiControlGetNavigation(pControlNavigateData->hObjSource,pControlNavigateData->nControlNavigate,TRUE,TRUE);
|
||||
|
||||
if(pControlNavigateData->hObjDest!=NULL)
|
||||
{
|
||||
bHandled=TRUE;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Handler for the button press message.
|
||||
//----------------------------------------------------------------------------------
|
||||
HRESULT CScene_HelpAndOptions::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* pNotifyPressData, BOOL& rfHandled)
|
||||
{
|
||||
// This assumes all buttons can only be pressed with the A button
|
||||
ui.AnimateKeyPress(pNotifyPressData->UserIndex, VK_PAD_A);
|
||||
|
||||
unsigned int uiButtonCounter=0;
|
||||
|
||||
while((uiButtonCounter<BUTTONS_HAO_MAX) && (m_Buttons[uiButtonCounter]!=hObjPressed)) uiButtonCounter++;
|
||||
|
||||
// Determine which button was pressed,
|
||||
// and call the appropriate function.
|
||||
|
||||
switch(uiButtonCounter)
|
||||
{
|
||||
case BUTTON_HAO_HOWTOPLAY:
|
||||
app.NavigateToScene(pNotifyPressData->UserIndex,eUIScene_HowToPlayMenu);
|
||||
break;
|
||||
case BUTTON_HAO_CONTROLS:
|
||||
app.NavigateToScene(pNotifyPressData->UserIndex,eUIScene_ControlsMenu);
|
||||
break;
|
||||
case BUTTON_HAO_SETTINGS:
|
||||
app.NavigateToScene(pNotifyPressData->UserIndex,eUIScene_SettingsMenu);
|
||||
break;
|
||||
case BUTTON_HAO_CHANGESKIN:
|
||||
app.NavigateToScene(pNotifyPressData->UserIndex,eUIScene_SkinSelectMenu);
|
||||
break;
|
||||
case BUTTON_HAO_CREDITS:
|
||||
app.NavigateToScene(pNotifyPressData->UserIndex,eUIScene_Credits);
|
||||
break;
|
||||
|
||||
case BUTTON_HAO_REINSTALL:
|
||||
app.NavigateToScene(pNotifyPressData->UserIndex,eUIScene_ReinstallMenu);
|
||||
break;
|
||||
|
||||
case BUTTON_HAO_DEBUG:
|
||||
app.NavigateToScene(pNotifyPressData->UserIndex,eUIScene_DebugOptions);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CScene_HelpAndOptions::OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandled)
|
||||
{
|
||||
if(m_bIgnoreInput) return S_OK;
|
||||
|
||||
// ignore a held down key to avoid skipping this scene if the user changes a setting and presses B for slightly too long
|
||||
if((pInputData->dwFlags&XUI_INPUT_FLAG_REPEAT)&&(pInputData->dwKeyCode==VK_PAD_B))
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
ui.AnimateKeyPress(pInputData->UserIndex, pInputData->dwKeyCode);
|
||||
|
||||
switch(pInputData->dwKeyCode)
|
||||
{
|
||||
|
||||
case VK_PAD_B:
|
||||
case VK_ESCAPE:
|
||||
BYTE userIndex = pInputData->UserIndex;
|
||||
if( !app.IsPauseMenuDisplayed(userIndex) )
|
||||
{
|
||||
// If we are not from a pause menu, then we are from the main menu
|
||||
userIndex = XUSER_INDEX_ANY;
|
||||
}
|
||||
|
||||
app.NavigateBack(userIndex);
|
||||
rfHandled = TRUE;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CScene_HelpAndOptions::OnNavReturn(HXUIOBJ hObj,BOOL& rfHandled)
|
||||
{
|
||||
bool bNotInGame=(Minecraft::GetInstance()->level==NULL);
|
||||
|
||||
if(bNotInGame)
|
||||
{
|
||||
ui.SetTooltips( DEFAULT_XUI_MENU_USER, IDS_TOOLTIPS_SELECT,IDS_TOOLTIPS_BACK);
|
||||
CXuiSceneBase::ShowLogo( DEFAULT_XUI_MENU_USER, TRUE );
|
||||
|
||||
if(m_iPad==ProfileManager.GetPrimaryPad() )//&&
|
||||
// StorageManager.GetSaveDeviceSelected(m_iPad) &&
|
||||
// !StorageManager.GetSaveDisabled() &&
|
||||
// ( ProfileManager.IsAwardsFlagSet(m_iPad,eAward_mine100Blocks) ||
|
||||
// ProfileManager.IsAwardsFlagSet(m_iPad,eAward_kill10Creepers) ||
|
||||
// ProfileManager.IsAwardsFlagSet(m_iPad,eAward_eatPorkChop) ||
|
||||
// ProfileManager.IsAwardsFlagSet(m_iPad,eAward_play100Days) ||
|
||||
// ProfileManager.IsAwardsFlagSet(m_iPad,eAward_arrowKillCreeper) ||
|
||||
// ProfileManager.IsAwardsFlagSet(m_iPad,eAward_socialPost)) )
|
||||
{
|
||||
// We should show the reinstall menu
|
||||
app.DebugPrintf("Reinstall Menu required...\n");
|
||||
m_Buttons[BUTTON_HAO_REINSTALL].SetEnable(TRUE);
|
||||
m_Buttons[BUTTON_HAO_REINSTALL].SetShow(TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Buttons[BUTTON_HAO_REINSTALL].SetEnable(FALSE);
|
||||
m_Buttons[BUTTON_HAO_REINSTALL].SetShow(FALSE);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
ui.SetTooltips( m_iPad, IDS_TOOLTIPS_SELECT,IDS_TOOLTIPS_BACK);
|
||||
if(app.GetLocalPlayerCount()>1)
|
||||
{
|
||||
CXuiSceneBase::ShowLogo( m_iPad, FALSE );
|
||||
}
|
||||
else
|
||||
{
|
||||
CXuiSceneBase::ShowLogo( m_iPad, TRUE );
|
||||
}
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
// int CScene_HelpAndOptions::ResetDefaultsDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result)
|
||||
// {
|
||||
// CScene_HelpAndOptions* pClass = (CScene_HelpAndOptions*)pParam;
|
||||
//
|
||||
// // results switched for this dialog
|
||||
// if(result==C4JStorage::EMessage_ResultDecline)
|
||||
// {
|
||||
// app.SetDefaultOptions(ProfileManager.GetDashboardProfileSettings(pClass->m_iPad),pClass->m_iPad);
|
||||
// // if the profile data has been changed, then force a profile write
|
||||
// // It seems we're allowed to break the 5 minute rule if it's the result of a user action
|
||||
// app.CheckGameSettingsChanged(true,iPad);
|
||||
// }
|
||||
// return 0;
|
||||
// }
|
||||
|
||||
HRESULT CScene_HelpAndOptions::OnTransitionStart( XUIMessageTransition *pTransition, BOOL& bHandled )
|
||||
{
|
||||
if(pTransition->dwTransAction==XUI_TRANSITION_ACTION_DESTROY ) return S_OK;
|
||||
|
||||
if(pTransition->dwTransType == XUI_TRANSITION_TO || pTransition->dwTransType == XUI_TRANSITION_BACKTO)
|
||||
{
|
||||
|
||||
// 4J-PB - Going to resize buttons if the text is too big to fit on any of them (Br-pt problem with the length of Unlock Full Game)
|
||||
XUIRect xuiRect;
|
||||
HXUIOBJ visual=NULL;
|
||||
HXUIOBJ text;
|
||||
float fMaxTextLen=0.0f;
|
||||
float fTextVisualLen;
|
||||
float fMaxButton;
|
||||
float fWidth,fHeight;
|
||||
|
||||
HRESULT hr=XuiControlGetVisual(m_Buttons[0].m_hObj,&visual);
|
||||
hr=XuiElementGetChildById(visual,L"text_Label",&text);
|
||||
hr=XuiElementGetBounds(text,&fTextVisualLen,&fHeight);
|
||||
m_Buttons[0].GetBounds(&fMaxButton,&fHeight);
|
||||
|
||||
|
||||
for(int i=0;i<BUTTONS_HAO_MAX;i++)
|
||||
{
|
||||
hr=XuiTextPresenterMeasureText(text, m_Buttons[i].GetText(), &xuiRect);
|
||||
if(xuiRect.right>fMaxTextLen) fMaxTextLen=xuiRect.right;
|
||||
}
|
||||
|
||||
if(fTextVisualLen<fMaxTextLen)
|
||||
{
|
||||
D3DXVECTOR3 vec;
|
||||
|
||||
// centre is vec.x+(fWidth/2)
|
||||
for(int i=0;i<BUTTONS_HAO_MAX;i++)
|
||||
{
|
||||
// need to resize and reposition the buttons
|
||||
m_Buttons[i].GetPosition(&vec);
|
||||
m_Buttons[i].GetBounds(&fWidth,&fHeight);
|
||||
vec.x= vec.x+(fWidth/2.0f)-(fMaxTextLen/2.0f);
|
||||
|
||||
m_Buttons[i].SetPosition(&vec);
|
||||
m_Buttons[i].SetBounds(fMaxButton+fMaxTextLen-fTextVisualLen,fHeight);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
HRESULT CScene_HelpAndOptions::OnCustomMessage_Splitscreenplayer(bool bJoining, BOOL& bHandled)
|
||||
{
|
||||
bHandled=true;
|
||||
return app.AdjustSplitscreenScene_PlayerChanged(m_hObj,&m_OriginalPosition,m_iPad,bJoining,false);
|
||||
}
|
||||
70
Minecraft.Client/Common/XUI/XUI_HelpAndOptions.h
Normal file
70
Minecraft.Client/Common/XUI/XUI_HelpAndOptions.h
Normal file
@@ -0,0 +1,70 @@
|
||||
#pragma once
|
||||
|
||||
#include "../media/xuiscene_helpandoptions.h"
|
||||
#include "XUI_CustomMessages.h"
|
||||
|
||||
#define BUTTON_HAO_CHANGESKIN 0
|
||||
#define BUTTON_HAO_HOWTOPLAY 1
|
||||
#define BUTTON_HAO_CONTROLS 2
|
||||
#define BUTTON_HAO_SETTINGS 3
|
||||
#define BUTTON_HAO_CREDITS 4
|
||||
#define BUTTON_HAO_REINSTALL 5
|
||||
#define BUTTON_HAO_DEBUG 6
|
||||
#define BUTTONS_HAO_MAX BUTTON_HAO_DEBUG + 1
|
||||
|
||||
|
||||
|
||||
class CScene_HelpAndOptions : public CXuiSceneImpl
|
||||
{
|
||||
protected:
|
||||
// Control and Element wrapper objects.
|
||||
CXuiScene m_Scene;
|
||||
CXuiControl m_Buttons[BUTTONS_HAO_MAX];
|
||||
CXuiElement m_Background;
|
||||
CXuiControl m_Timer;
|
||||
|
||||
// Message map. Here we tie messages to message handlers.
|
||||
XUI_BEGIN_MSG_MAP()
|
||||
XUI_ON_XM_INIT( OnInit )
|
||||
XUI_ON_XM_NOTIFY_PRESS_EX(OnNotifyPressEx)
|
||||
XUI_ON_XM_KEYDOWN(OnKeyDown)
|
||||
XUI_ON_XM_CONTROL_NAVIGATE( OnControlNavigate )
|
||||
XUI_ON_XM_NAV_RETURN(OnNavReturn)
|
||||
XUI_ON_XM_TRANSITION_START(OnTransitionStart)
|
||||
XUI_ON_XM_SPLITSCREENPLAYER_MESSAGE(OnCustomMessage_Splitscreenplayer)
|
||||
//XUI_ON_XM_TMS_DLCFILE_RETRIEVED_MESSAGE(OnTMSDLCFileRetrieved)
|
||||
XUI_END_MSG_MAP()
|
||||
|
||||
// Control mapping to objects
|
||||
BEGIN_CONTROL_MAP()
|
||||
MAP_CONTROL(IDC_XuiButton1, m_Buttons[BUTTON_HAO_CHANGESKIN])
|
||||
MAP_CONTROL(IDC_XuiButton2, m_Buttons[BUTTON_HAO_HOWTOPLAY ])
|
||||
MAP_CONTROL(IDC_XuiButton3, m_Buttons[BUTTON_HAO_CONTROLS ])
|
||||
MAP_CONTROL(IDC_XuiButton4, m_Buttons[BUTTON_HAO_SETTINGS ])
|
||||
MAP_CONTROL(IDC_XuiButton5, m_Buttons[BUTTON_HAO_CREDITS])
|
||||
MAP_CONTROL(IDC_XuiButton6, m_Buttons[BUTTON_HAO_REINSTALL])
|
||||
MAP_CONTROL(IDC_XuiButton7, m_Buttons[BUTTON_HAO_DEBUG])
|
||||
MAP_CONTROL(IDC_Timer, m_Timer)
|
||||
|
||||
END_CONTROL_MAP()
|
||||
|
||||
HRESULT OnInit( XUIMessageInit* pInitData, BOOL& bHandled );
|
||||
HRESULT OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* pNotifyPressData,BOOL& rfHandled);
|
||||
HRESULT OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandled);
|
||||
HRESULT OnNavReturn(HXUIOBJ hObj,BOOL& rfHandled);
|
||||
HRESULT OnCustomMessage_Splitscreenplayer(bool bJoining, BOOL& bHandled);
|
||||
HRESULT OnTransitionStart( XUIMessageTransition *pTransition, BOOL& bHandled );
|
||||
HRESULT OnControlNavigate(XUIMessageControlNavigate *pControlNavigateData, BOOL& bHandled);
|
||||
//HRESULT OnTMSDLCFileRetrieved( );
|
||||
public:
|
||||
|
||||
// Define the class. The class name must match the ClassOverride property
|
||||
// set for the scene in the UI Authoring tool.
|
||||
XUI_IMPLEMENT_CLASS( CScene_HelpAndOptions, L"CScene_HelpAndOptions", XUI_CLASS_SCENE )
|
||||
|
||||
private:
|
||||
|
||||
int m_iPad;
|
||||
bool m_bIgnoreInput;
|
||||
D3DXVECTOR3 m_OriginalPosition;
|
||||
};
|
||||
566
Minecraft.Client/Common/XUI/XUI_HelpControls.cpp
Normal file
566
Minecraft.Client/Common/XUI/XUI_HelpControls.cpp
Normal file
@@ -0,0 +1,566 @@
|
||||
#include "stdafx.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include "..\XUI\XUI_HelpControls.h"
|
||||
#include "XUI_Ctrl_4JList.h"
|
||||
|
||||
#include "..\..\..\Minecraft.World\net.minecraft.world.level.h"
|
||||
#include "..\..\..\Minecraft.World\LevelData.h"
|
||||
#include "..\..\MultiplayerLocalPlayer.h"
|
||||
|
||||
#define ALIGN_START 0
|
||||
#define ALIGN_END 1
|
||||
typedef struct
|
||||
{
|
||||
WCHAR wchName[20];
|
||||
int iAlign;
|
||||
D3DXVECTOR3 vPos;
|
||||
}
|
||||
CONTROLDETAILS;
|
||||
|
||||
LPCWSTR CScene_Controls::m_LayoutNameA[3]=
|
||||
{
|
||||
L"1",
|
||||
L"2",
|
||||
L"3",
|
||||
};
|
||||
CONTROLDETAILS controlDetailsA[MAX_CONTROLS]=
|
||||
{
|
||||
{
|
||||
L"FigA",ALIGN_END // _360_JOY_BUTTON_A
|
||||
},
|
||||
{
|
||||
L"FigB",ALIGN_END // _360_JOY_BUTTON_B
|
||||
},
|
||||
{
|
||||
L"FigX",ALIGN_END // _360_JOY_BUTTON_X
|
||||
},
|
||||
{
|
||||
L"FigY",ALIGN_END // _360_JOY_BUTTON_Y
|
||||
},
|
||||
{
|
||||
L"FigStart",ALIGN_END // _360_JOY_BUTTON_START
|
||||
},
|
||||
{
|
||||
L"FigBack",ALIGN_START // _360_JOY_BUTTON_BACK
|
||||
},
|
||||
{
|
||||
L"FigRB",ALIGN_END // _360_JOY_BUTTON_RB
|
||||
},
|
||||
{
|
||||
L"FigLB",ALIGN_START // _360_JOY_BUTTON_LB
|
||||
},
|
||||
{
|
||||
L"FigRStickButton",ALIGN_END // _360_JOY_BUTTON_RTHUMB
|
||||
},
|
||||
{
|
||||
L"FigLStickButton",ALIGN_START // _360_JOY_BUTTON_LTHUMB
|
||||
},
|
||||
// Move
|
||||
{
|
||||
L"FigRStick",ALIGN_END // _360_JOY_BUTTON_RSTICK_RIGHT
|
||||
},
|
||||
// Look
|
||||
{
|
||||
L"FigLStick",ALIGN_START // _360_JOY_BUTTON_LSTICK_RIGHT
|
||||
},
|
||||
{
|
||||
L"FigRT",ALIGN_END // RT
|
||||
},
|
||||
{
|
||||
L"FigLT",ALIGN_START // LT
|
||||
},
|
||||
{
|
||||
L"FigDpadR",ALIGN_START // DpadR
|
||||
},
|
||||
{
|
||||
L"FigDpadL",ALIGN_START // DpadL
|
||||
},
|
||||
{
|
||||
L"FigDpad",ALIGN_START // DpadL
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Performs initialization tasks - retrieves controls.
|
||||
//----------------------------------------------------------------------------------
|
||||
HRESULT CScene_Controls::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
|
||||
{
|
||||
MapChildControls();
|
||||
XuiControlSetText(m_SouthPaw,app.GetString(IDS_SOUTHPAW));
|
||||
XuiControlSetText(m_InvertLook,app.GetString(IDS_INVERT_LOOK));
|
||||
|
||||
m_iPad=*(int *)pInitData->pvInitData;
|
||||
// if we're not in the game, we need to use basescene 0
|
||||
bool bNotInGame=(Minecraft::GetInstance()->level==NULL);
|
||||
bool bSplitscreen=(app.GetLocalPlayerCount()>1);
|
||||
m_iCurrentTextIndex=0;
|
||||
m_bCreativeMode = !bNotInGame && Minecraft::GetInstance()->localplayers[m_iPad] && Minecraft::GetInstance()->localplayers[m_iPad]->abilities.mayfly;
|
||||
|
||||
if(!bNotInGame)
|
||||
{
|
||||
// disable the build ver display
|
||||
m_BuildVer.SetShow(FALSE);
|
||||
}
|
||||
|
||||
if(bSplitscreen)
|
||||
{
|
||||
app.AdjustSplitscreenScene(m_hObj,&m_OriginalPosition,m_iPad,32.0f);
|
||||
CXuiSceneBase::ShowLogo( m_iPad, FALSE );
|
||||
}
|
||||
else
|
||||
{
|
||||
if(bNotInGame)
|
||||
{
|
||||
CXuiSceneBase::ShowLogo( DEFAULT_XUI_MENU_USER, TRUE );
|
||||
}
|
||||
else
|
||||
{
|
||||
CXuiSceneBase::ShowLogo( m_iPad, TRUE );
|
||||
}
|
||||
}
|
||||
|
||||
// if we're not in the game, we need to use basescene 0
|
||||
if(bNotInGame)
|
||||
{
|
||||
ui.SetTooltips( DEFAULT_XUI_MENU_USER, IDS_TOOLTIPS_SELECT,IDS_TOOLTIPS_BACK);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui.SetTooltips( m_iPad, IDS_TOOLTIPS_SELECT,IDS_TOOLTIPS_BACK);
|
||||
}
|
||||
|
||||
m_iSchemeTextA[0]=IDS_CONTROLS_SCHEME0;
|
||||
m_iSchemeTextA[1]=IDS_CONTROLS_SCHEME1;
|
||||
m_iSchemeTextA[2]=IDS_CONTROLS_SCHEME2;
|
||||
|
||||
// get the figures
|
||||
HXUIOBJ hObj;
|
||||
HRESULT hr;
|
||||
|
||||
// turn off all the figures to start with
|
||||
for(int i=0;i<MAX_CONTROLS;i++)
|
||||
{
|
||||
m_FigA[i].GetChildById(controlDetailsA[i].wchName,&hObj);
|
||||
hr=XuiElementGetPosition(hObj,&controlDetailsA[i].vPos);
|
||||
if(controlDetailsA[i].iAlign==ALIGN_END)
|
||||
{
|
||||
float fW,fH;
|
||||
hr=XuiElementGetBounds(hObj,&fW,&fH);
|
||||
controlDetailsA[i].vPos.x+=fW;
|
||||
controlDetailsA[i].vPos.y+=fH;
|
||||
}
|
||||
|
||||
// if we're in splitscreen, half all the numbers
|
||||
if(bSplitscreen)
|
||||
{
|
||||
controlDetailsA[i].vPos.x/=2.0f;
|
||||
controlDetailsA[i].vPos.y/=2.0f;
|
||||
}
|
||||
m_FigA[i].SetShow(FALSE);
|
||||
m_TextPresenterA[i] = NULL;
|
||||
}
|
||||
|
||||
// fill out the layouts list
|
||||
VOID *pObj;
|
||||
XuiObjectFromHandle( m_SchemeList, &pObj );
|
||||
m_pLayoutList = (CXuiCtrl4JList *)pObj;
|
||||
CXuiCtrl4JList::LIST_ITEM_INFO ListInfo[3];
|
||||
ZeroMemory(ListInfo,sizeof(CXuiCtrl4JList::LIST_ITEM_INFO)*3);
|
||||
|
||||
for(int i=0;i<3;i++)
|
||||
{
|
||||
ListInfo[i].pwszText=m_LayoutNameA[i];
|
||||
ListInfo[i].hXuiBrush=NULL;
|
||||
ListInfo[i].fEnabled=TRUE;
|
||||
m_pLayoutList->AddData(ListInfo[i]);
|
||||
}
|
||||
|
||||
m_bIgnoreNotifies=true;
|
||||
m_bIgnoreNotifies=false;
|
||||
int iSelected=app.GetGameSettings(m_iPad,eGameSetting_ControlScheme);
|
||||
XuiControlSetText(m_SchemeList,app.GetString(IDS_CONTROLS_LAYOUT));
|
||||
hr=m_pLayoutList->SetCurSelVisible(iSelected);
|
||||
m_iCurrentNavigatedControlsLayout=iSelected;
|
||||
|
||||
LPWSTR layoutString = new wchar_t[ 128 ];
|
||||
swprintf( layoutString, 128, L"%ls : %ls", app.GetString( IDS_CURRENT_LAYOUT ),app.GetString(m_iSchemeTextA[iSelected]));
|
||||
XuiControlSetText(m_CurrentLayout,layoutString);
|
||||
|
||||
//PositionAllText(m_iPad);
|
||||
|
||||
swprintf( layoutString, 128, L"%ls%ls", VER_PRODUCTVERSION_STR_W,app.DLCInstallProcessCompleted()?L"_DLC":L" ");
|
||||
|
||||
m_BuildVer.SetText(layoutString);
|
||||
delete [] layoutString;
|
||||
|
||||
// Set check box initial states.
|
||||
BOOL bInvertLook = app.GetGameSettings(m_iPad,eGameSetting_ControlInvertLook);
|
||||
m_InvertLook.SetCheck( bInvertLook );
|
||||
|
||||
BOOL bSouthPaw = app.GetGameSettings(m_iPad,eGameSetting_ControlSouthPaw);
|
||||
m_SouthPaw.SetCheck( bSouthPaw );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
HRESULT CScene_Controls::OnTransitionStart( XUIMessageTransition *pTransition, BOOL& bHandled )
|
||||
{
|
||||
|
||||
if(pTransition->dwTransAction==XUI_TRANSITION_ACTION_DESTROY ) return S_OK;
|
||||
|
||||
if(pTransition->dwTransType == XUI_TRANSITION_TO || pTransition->dwTransType == XUI_TRANSITION_BACKTO)
|
||||
{
|
||||
int iSelected=app.GetGameSettings(m_iPad,eGameSetting_ControlScheme);
|
||||
// and update the highlight on the current selection
|
||||
m_pLayoutList->SetBorder(iSelected,TRUE);
|
||||
|
||||
PositionAllText(m_iPad);
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void CScene_Controls::PositionAllText(int iPad)
|
||||
{
|
||||
// turn off all the figures to start with
|
||||
for(int i=0;i<MAX_CONTROLS;i++)
|
||||
{
|
||||
m_FigA[i].SetShow(FALSE);
|
||||
}
|
||||
|
||||
m_iCurrentTextIndex=0;
|
||||
if(m_bCreativeMode)
|
||||
{
|
||||
PositionText(iPad,IDS_CONTROLS_JUMPFLY,MINECRAFT_ACTION_JUMP);
|
||||
}
|
||||
else
|
||||
{
|
||||
PositionText(iPad,IDS_CONTROLS_JUMP,MINECRAFT_ACTION_JUMP);
|
||||
}
|
||||
PositionText(iPad,IDS_CONTROLS_INVENTORY,MINECRAFT_ACTION_INVENTORY);
|
||||
PositionText(iPad,IDS_CONTROLS_PAUSE,MINECRAFT_ACTION_PAUSEMENU);
|
||||
if(m_bCreativeMode)
|
||||
{
|
||||
PositionText(iPad,IDS_CONTROLS_SNEAKFLY,MINECRAFT_ACTION_SNEAK_TOGGLE);
|
||||
}
|
||||
else
|
||||
{
|
||||
PositionText(iPad,IDS_CONTROLS_SNEAK,MINECRAFT_ACTION_SNEAK_TOGGLE);
|
||||
}
|
||||
PositionText(iPad,IDS_CONTROLS_USE,MINECRAFT_ACTION_USE);
|
||||
PositionText(iPad,IDS_CONTROLS_ACTION,MINECRAFT_ACTION_ACTION);
|
||||
PositionText(iPad,IDS_CONTROLS_HELDITEM,MINECRAFT_ACTION_RIGHT_SCROLL);
|
||||
PositionText(iPad,IDS_CONTROLS_HELDITEM,MINECRAFT_ACTION_LEFT_SCROLL);
|
||||
PositionText(iPad,IDS_CONTROLS_DROP,MINECRAFT_ACTION_DROP);
|
||||
PositionText(iPad,IDS_CONTROLS_CRAFTING,MINECRAFT_ACTION_CRAFTING);
|
||||
|
||||
PositionText(iPad,IDS_CONTROLS_THIRDPERSON,MINECRAFT_ACTION_RENDER_THIRD_PERSON);
|
||||
PositionText(iPad,IDS_CONTROLS_PLAYERS,MINECRAFT_ACTION_GAME_INFO);
|
||||
|
||||
// Swap for southpaw.
|
||||
if ( app.GetGameSettings(m_iPad,eGameSetting_ControlSouthPaw) )
|
||||
{
|
||||
// Move
|
||||
PositionText(iPad,IDS_CONTROLS_LOOK,MINECRAFT_ACTION_RIGHT);
|
||||
// Look
|
||||
PositionText(iPad,IDS_CONTROLS_MOVE,MINECRAFT_ACTION_LOOK_RIGHT);
|
||||
}
|
||||
else // Normal right handed.
|
||||
{
|
||||
// Move
|
||||
PositionText(iPad,IDS_CONTROLS_MOVE,MINECRAFT_ACTION_RIGHT);
|
||||
// Look
|
||||
PositionText(iPad,IDS_CONTROLS_LOOK,MINECRAFT_ACTION_LOOK_RIGHT);
|
||||
}
|
||||
|
||||
// If we're in controls mode 1, and creative mode show the dpad for Creative Mode
|
||||
if(m_bCreativeMode && (m_iCurrentNavigatedControlsLayout==0))
|
||||
{
|
||||
PositionTextDirect(iPad,IDS_CONTROLS_DPAD,16,true);
|
||||
}
|
||||
else
|
||||
{
|
||||
PositionTextDirect(iPad,IDS_CONTROLS_DPAD,16,false);
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT CScene_Controls::OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandled)
|
||||
{
|
||||
ui.AnimateKeyPress(pInputData->UserIndex, pInputData->dwKeyCode);
|
||||
|
||||
HRESULT hr=S_OK;
|
||||
|
||||
// Explicitly handle B button presses
|
||||
switch(pInputData->dwKeyCode)
|
||||
{
|
||||
|
||||
case VK_PAD_B:
|
||||
case VK_ESCAPE:
|
||||
|
||||
app.CheckGameSettingsChanged(true,pInputData->UserIndex);
|
||||
app.NavigateBack(pInputData->UserIndex);
|
||||
rfHandled = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
void CScene_Controls::PositionText(int iPad,int iTextID, unsigned char ucAction)
|
||||
{
|
||||
// position the text depending on the control id
|
||||
//int iTextWidth;
|
||||
XUIRect xuiRect;
|
||||
LPCWSTR pwchText;
|
||||
D3DXVECTOR3 vpos,vScale;
|
||||
HXUIOBJ hFigGroup;
|
||||
unsigned int uiVal=InputManager.GetGameJoypadMaps(m_iCurrentNavigatedControlsLayout,ucAction);
|
||||
|
||||
// get the visual of the fig group and use any scaling in it to adjust the text positions
|
||||
XuiElementGetChildById(m_hObj,L"FigGroup",&hFigGroup);
|
||||
XuiElementGetScale(hFigGroup,&vScale);
|
||||
|
||||
// check the width of the control with the text set in it
|
||||
if(m_TextPresenterA[m_iCurrentTextIndex]==NULL)
|
||||
{
|
||||
HXUIOBJ hObj=NULL;
|
||||
HRESULT hr=XuiControlGetVisual(m_TextA[m_iCurrentTextIndex].m_hObj,&hObj);
|
||||
hr=XuiElementGetChildById(hObj,L"Text",&m_TextPresenterA[m_iCurrentTextIndex]);
|
||||
}
|
||||
|
||||
pwchText=app.GetString(iTextID);
|
||||
HRESULT hr=XuiTextPresenterMeasureText(m_TextPresenterA[m_iCurrentTextIndex], pwchText, &xuiRect);
|
||||
m_TextA[m_iCurrentTextIndex].SetBounds(xuiRect.right,xuiRect.bottom);
|
||||
|
||||
int iControlDetailsIndex=0;
|
||||
switch(uiVal)
|
||||
{
|
||||
case _360_JOY_BUTTON_A:
|
||||
iControlDetailsIndex=0;
|
||||
break;
|
||||
case _360_JOY_BUTTON_B:
|
||||
iControlDetailsIndex=1;
|
||||
break;
|
||||
case _360_JOY_BUTTON_X:
|
||||
iControlDetailsIndex=2;
|
||||
break;
|
||||
case _360_JOY_BUTTON_Y:
|
||||
iControlDetailsIndex=3;
|
||||
break;
|
||||
case _360_JOY_BUTTON_START:
|
||||
iControlDetailsIndex=4;
|
||||
break;
|
||||
case _360_JOY_BUTTON_BACK:
|
||||
iControlDetailsIndex=5;
|
||||
break;
|
||||
case _360_JOY_BUTTON_RB:
|
||||
iControlDetailsIndex=6;
|
||||
break;
|
||||
case _360_JOY_BUTTON_LB:
|
||||
iControlDetailsIndex=7;
|
||||
break;
|
||||
case _360_JOY_BUTTON_RTHUMB:
|
||||
iControlDetailsIndex=8;
|
||||
break;
|
||||
case _360_JOY_BUTTON_LTHUMB:
|
||||
iControlDetailsIndex=9;
|
||||
break;
|
||||
// Look
|
||||
case _360_JOY_BUTTON_RSTICK_RIGHT:
|
||||
iControlDetailsIndex=10;
|
||||
break;
|
||||
// Move
|
||||
case _360_JOY_BUTTON_LSTICK_RIGHT:
|
||||
iControlDetailsIndex=11;
|
||||
break;
|
||||
case _360_JOY_BUTTON_RT:
|
||||
iControlDetailsIndex=12;
|
||||
break;
|
||||
// Move
|
||||
case _360_JOY_BUTTON_LT:
|
||||
iControlDetailsIndex=13;
|
||||
break;
|
||||
case _360_JOY_BUTTON_DPAD_RIGHT:
|
||||
iControlDetailsIndex=14;
|
||||
break;
|
||||
case _360_JOY_BUTTON_DPAD_LEFT:
|
||||
iControlDetailsIndex=15;
|
||||
break;
|
||||
}
|
||||
|
||||
hr=m_FigA[iControlDetailsIndex].SetShow(TRUE);
|
||||
// position the control depending on the text width
|
||||
|
||||
if(!RenderManager.IsHiDef() && !RenderManager.IsWidescreen())
|
||||
{
|
||||
// 480 mode - we need to scale the text positions
|
||||
if(controlDetailsA[iControlDetailsIndex].iAlign==ALIGN_END)
|
||||
{
|
||||
vpos.x=(controlDetailsA[iControlDetailsIndex].vPos.x + 5.0f)* vScale.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
vpos.x=(controlDetailsA[iControlDetailsIndex].vPos.x - 5.0f)* vScale.x - xuiRect.right;
|
||||
}
|
||||
|
||||
vpos.y=(controlDetailsA[iControlDetailsIndex].vPos.y * vScale.y) - (xuiRect.bottom/2.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(controlDetailsA[iControlDetailsIndex].iAlign==ALIGN_END)
|
||||
{
|
||||
vpos.x=(controlDetailsA[iControlDetailsIndex].vPos.x + 5.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
vpos.x=(controlDetailsA[iControlDetailsIndex].vPos.x - 5.0f) - xuiRect.right;
|
||||
}
|
||||
|
||||
vpos.y=(controlDetailsA[iControlDetailsIndex].vPos.y ) - (xuiRect.bottom/2.0f);
|
||||
}
|
||||
|
||||
vpos.x=floor(vpos.x);
|
||||
vpos.y=floor(vpos.y);
|
||||
vpos.z=0.0f;
|
||||
|
||||
m_TextA[m_iCurrentTextIndex].SetPosition(&vpos);
|
||||
m_TextA[m_iCurrentTextIndex].SetText(pwchText);
|
||||
m_TextA[m_iCurrentTextIndex].SetShow(TRUE);
|
||||
m_iCurrentTextIndex++;
|
||||
}
|
||||
|
||||
void CScene_Controls::PositionTextDirect(int iPad,int iTextID, int iControlDetailsIndex, bool bShow)
|
||||
{
|
||||
// position the text depending on the control id
|
||||
//int iTextWidth;
|
||||
XUIRect xuiRect;
|
||||
LPCWSTR pwchText;
|
||||
D3DXVECTOR3 vpos,vScale;
|
||||
HXUIOBJ hFigGroup;
|
||||
|
||||
if(bShow==false)
|
||||
{
|
||||
m_TextA[m_iCurrentTextIndex++].SetShow(FALSE);
|
||||
return;
|
||||
}
|
||||
// get the visual of the fig group and use any scaling in it to adjust the text positions
|
||||
XuiElementGetChildById(m_hObj,L"FigGroup",&hFigGroup);
|
||||
XuiElementGetScale(hFigGroup,&vScale);
|
||||
|
||||
// check the width of the control with the text set in it
|
||||
if(m_TextPresenterA[m_iCurrentTextIndex]==NULL)
|
||||
{
|
||||
HXUIOBJ hObj=NULL;
|
||||
HRESULT hr=XuiControlGetVisual(m_TextA[m_iCurrentTextIndex].m_hObj,&hObj);
|
||||
hr=XuiElementGetChildById(hObj,L"Text",&m_TextPresenterA[m_iCurrentTextIndex]);
|
||||
}
|
||||
|
||||
pwchText=app.GetString(iTextID);
|
||||
HRESULT hr=XuiTextPresenterMeasureText(m_TextPresenterA[m_iCurrentTextIndex], pwchText, &xuiRect);
|
||||
m_TextA[m_iCurrentTextIndex].SetBounds(xuiRect.right,xuiRect.bottom);
|
||||
|
||||
|
||||
|
||||
hr=m_FigA[iControlDetailsIndex].SetShow(TRUE);
|
||||
// position the control depending on the text width
|
||||
|
||||
if(!RenderManager.IsHiDef() && !RenderManager.IsWidescreen())
|
||||
{
|
||||
// 480 mode - we need to scale the text positions
|
||||
if(controlDetailsA[iControlDetailsIndex].iAlign==ALIGN_END)
|
||||
{
|
||||
vpos.x=(controlDetailsA[iControlDetailsIndex].vPos.x + 5.0f)* vScale.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
vpos.x=(controlDetailsA[iControlDetailsIndex].vPos.x - 5.0f)* vScale.x - xuiRect.right;
|
||||
}
|
||||
|
||||
vpos.y=(controlDetailsA[iControlDetailsIndex].vPos.y * vScale.y) - (xuiRect.bottom/2.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(controlDetailsA[iControlDetailsIndex].iAlign==ALIGN_END)
|
||||
{
|
||||
vpos.x=(controlDetailsA[iControlDetailsIndex].vPos.x + 5.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
vpos.x=(controlDetailsA[iControlDetailsIndex].vPos.x - 5.0f) - xuiRect.right;
|
||||
}
|
||||
|
||||
vpos.y=(controlDetailsA[iControlDetailsIndex].vPos.y ) - (xuiRect.bottom/2.0f);
|
||||
}
|
||||
|
||||
vpos.x=floor(vpos.x);
|
||||
vpos.y=floor(vpos.y);
|
||||
vpos.z=0.0f;
|
||||
|
||||
m_TextA[m_iCurrentTextIndex].SetPosition(&vpos);
|
||||
m_TextA[m_iCurrentTextIndex].SetText(pwchText);
|
||||
m_TextA[m_iCurrentTextIndex].SetShow(TRUE);
|
||||
m_iCurrentTextIndex++;
|
||||
}
|
||||
|
||||
HRESULT CScene_Controls::OnNotifySelChanged( HXUIOBJ hObjSource, XUINotifySelChanged* pNotifySelChangedData, BOOL& bHandled )
|
||||
{
|
||||
if( ( !m_bIgnoreNotifies )&&( hObjSource==m_pLayoutList->m_hObj ) )
|
||||
{
|
||||
m_iCurrentNavigatedControlsLayout=pNotifySelChangedData->iItem;
|
||||
PositionAllText(m_iPad);
|
||||
}
|
||||
if(pNotifySelChangedData->iOldItem!=-1 && hObjSource==m_SchemeList )
|
||||
{
|
||||
CXuiSceneBase::PlayUISFX(eSFX_Focus);
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
HRESULT CScene_Controls::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* pNotifyPressData,BOOL& rfHandled)
|
||||
{
|
||||
// This assumes all buttons can only be pressed with the A button
|
||||
ui.AnimateKeyPress(pNotifyPressData->UserIndex, VK_PAD_A);
|
||||
|
||||
// Handle check box changes.
|
||||
if ( hObjPressed == m_InvertLook.m_hObj )
|
||||
{
|
||||
BOOL bIsChecked = m_InvertLook.IsChecked();
|
||||
app.SetGameSettings(m_iPad,eGameSetting_ControlInvertLook,(unsigned char)( bIsChecked ) );
|
||||
}
|
||||
else if ( hObjPressed == m_SouthPaw.m_hObj )
|
||||
{
|
||||
BOOL bIsChecked = m_SouthPaw.IsChecked();
|
||||
app.SetGameSettings(m_iPad,eGameSetting_ControlSouthPaw,(unsigned char)( bIsChecked ) );
|
||||
PositionAllText(m_iPad);
|
||||
}
|
||||
else if( hObjPressed == m_SchemeList)
|
||||
{
|
||||
// check what's been selected
|
||||
app.SetGameSettings(m_iPad,eGameSetting_ControlScheme,(unsigned char)m_SchemeList.GetCurSel());
|
||||
LPWSTR layoutString = new wchar_t[ 128 ];
|
||||
swprintf( layoutString, 128, L"%ls : %ls", app.GetString( IDS_CURRENT_LAYOUT ),app.GetString(m_iSchemeTextA[m_SchemeList.GetCurSel()]) );
|
||||
|
||||
XuiControlSetText(m_CurrentLayout,layoutString);
|
||||
delete [] layoutString;
|
||||
// and update the highlight on the current selection
|
||||
for(int i=0;i<m_pLayoutList->GetItemCount();i++)
|
||||
{
|
||||
m_pLayoutList->SetBorder(i,FALSE);
|
||||
}
|
||||
m_pLayoutList->SetBorder(m_SchemeList.GetCurSel(),TRUE);
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CScene_Controls::OnCustomMessage_Splitscreenplayer(bool bJoining, BOOL& bHandled)
|
||||
{
|
||||
bHandled=true;
|
||||
return app.AdjustSplitscreenScene_PlayerChanged(m_hObj,&m_OriginalPosition,m_iPad,bJoining,32.0f);
|
||||
}
|
||||
115
Minecraft.Client/Common/XUI/XUI_HelpControls.h
Normal file
115
Minecraft.Client/Common/XUI/XUI_HelpControls.h
Normal file
@@ -0,0 +1,115 @@
|
||||
#pragma once
|
||||
|
||||
#include "../media/xuiscene_controls.h"
|
||||
#include "XUI_CustomMessages.h"
|
||||
|
||||
class CXuiCtrl4JList;
|
||||
|
||||
|
||||
|
||||
#define MAX_CONTROLS 17
|
||||
class CScene_Controls : public CXuiSceneImpl
|
||||
{
|
||||
protected:
|
||||
// Control and Element wrapper objects.
|
||||
CXuiControl m_TextA[MAX_CONTROLS];
|
||||
HXUIOBJ m_TextPresenterA[MAX_CONTROLS];
|
||||
CXuiElement m_FigA[MAX_CONTROLS];
|
||||
CXuiList m_SchemeList;
|
||||
CXuiElement m_Group;
|
||||
CXuiControl m_BuildVer;
|
||||
CXuiControl m_CurrentLayout;
|
||||
CXuiCheckbox m_InvertLook;
|
||||
CXuiCheckbox m_SouthPaw;
|
||||
static LPCWSTR m_LayoutNameA[3];
|
||||
|
||||
// Message map. Here we tie messages to message handlers.
|
||||
XUI_BEGIN_MSG_MAP()
|
||||
XUI_ON_XM_INIT( OnInit )
|
||||
XUI_ON_XM_KEYDOWN(OnKeyDown)
|
||||
XUI_ON_XM_NOTIFY_SELCHANGED( OnNotifySelChanged )
|
||||
XUI_ON_XM_NOTIFY_PRESS_EX(OnNotifyPressEx)
|
||||
XUI_ON_XM_SPLITSCREENPLAYER_MESSAGE(OnCustomMessage_Splitscreenplayer)
|
||||
XUI_ON_XM_TRANSITION_START(OnTransitionStart)
|
||||
|
||||
XUI_END_MSG_MAP()
|
||||
|
||||
// Control mapping to objects
|
||||
BEGIN_CONTROL_MAP()
|
||||
MAP_CONTROL(IDC_SchemeList, m_SchemeList)
|
||||
MAP_CONTROL(IDC_CurrentLayout, m_CurrentLayout)
|
||||
|
||||
MAP_CONTROL(IDC_XuiBuildVer, m_BuildVer)
|
||||
MAP_CONTROL(IDC_XuiLabel1, m_TextA[0])
|
||||
MAP_CONTROL(IDC_XuiLabel2, m_TextA[1])
|
||||
MAP_CONTROL(IDC_XuiLabel3, m_TextA[2])
|
||||
MAP_CONTROL(IDC_XuiLabel4, m_TextA[3])
|
||||
MAP_CONTROL(IDC_XuiLabel5, m_TextA[4])
|
||||
MAP_CONTROL(IDC_XuiLabel6, m_TextA[5])
|
||||
MAP_CONTROL(IDC_XuiLabel7, m_TextA[6])
|
||||
MAP_CONTROL(IDC_XuiLabel8, m_TextA[7])
|
||||
MAP_CONTROL(IDC_XuiLabel9, m_TextA[8])
|
||||
MAP_CONTROL(IDC_XuiLabel10, m_TextA[9])
|
||||
MAP_CONTROL(IDC_XuiLabel11, m_TextA[10])
|
||||
MAP_CONTROL(IDC_XuiLabel12, m_TextA[11])
|
||||
MAP_CONTROL(IDC_XuiLabel13, m_TextA[12])
|
||||
MAP_CONTROL(IDC_XuiLabel14, m_TextA[13])
|
||||
MAP_CONTROL(IDC_XuiLabel15, m_TextA[14])
|
||||
MAP_CONTROL(IDC_XuiLabel16, m_TextA[15])
|
||||
MAP_CONTROL(IDC_XuiLabel17, m_TextA[16])
|
||||
MAP_CONTROL(IDC_FigGroup, m_Group)
|
||||
MAP_CONTROL(IDC_InvertLook, m_InvertLook)
|
||||
MAP_CONTROL(IDC_SouthPaw, m_SouthPaw)
|
||||
BEGIN_MAP_CHILD_CONTROLS(m_Group)
|
||||
MAP_CONTROL(IDC_A, m_FigA[0])
|
||||
MAP_CONTROL(IDC_B, m_FigA[1])
|
||||
MAP_CONTROL(IDC_X, m_FigA[2])
|
||||
MAP_CONTROL(IDC_Y, m_FigA[3])
|
||||
MAP_CONTROL(IDC_Start, m_FigA[4])
|
||||
MAP_CONTROL(IDC_Back, m_FigA[5])
|
||||
MAP_CONTROL(IDC_RB, m_FigA[6])
|
||||
MAP_CONTROL(IDC_LB, m_FigA[7])
|
||||
MAP_CONTROL(IDC_RStickButton, m_FigA[8])
|
||||
MAP_CONTROL(IDC_LStickButton, m_FigA[9])
|
||||
MAP_CONTROL(IDC_RStick, m_FigA[10])
|
||||
MAP_CONTROL(IDC_LStick, m_FigA[11])
|
||||
MAP_CONTROL(IDC_RT, m_FigA[12])
|
||||
MAP_CONTROL(IDC_LT, m_FigA[13])
|
||||
MAP_CONTROL(IDC_DpadR, m_FigA[14])
|
||||
MAP_CONTROL(IDC_DpadL, m_FigA[15])
|
||||
MAP_CONTROL(IDC_Dpad, m_FigA[16])
|
||||
END_MAP_CHILD_CONTROLS()
|
||||
END_CONTROL_MAP()
|
||||
|
||||
HRESULT OnInit( XUIMessageInit* pInitData, BOOL& bHandled );
|
||||
HRESULT OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandled);
|
||||
HRESULT OnNotifySelChanged( HXUIOBJ hObjSource, XUINotifySelChanged* pNotifySelChangedData, BOOL& bHandled );
|
||||
HRESULT OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* pNotifyPressData,BOOL& rfHandled);
|
||||
HRESULT OnCustomMessage_Splitscreenplayer(bool bJoining, BOOL& bHandled);
|
||||
HRESULT OnTransitionStart( XUIMessageTransition *pTransition, BOOL& bHandled );
|
||||
|
||||
|
||||
void PositionText(int iPad,int iTextID, unsigned char ucAction);
|
||||
void PositionTextDirect(int iPad,int iTextID, int iControlDetailsIndex, bool bShow);
|
||||
void PositionAllText(int iPad);
|
||||
|
||||
|
||||
int m_iCurrentTextIndex;
|
||||
int m_iCurrentNavigatedControlsLayout;
|
||||
int m_iSchemeTextA[3];
|
||||
int m_nItems;
|
||||
int m_iPad;
|
||||
CXuiCtrl4JList *m_pLayoutList;
|
||||
bool m_bIgnoreNotifies;
|
||||
D3DXVECTOR3 m_OriginalPosition;
|
||||
bool m_bCreativeMode;
|
||||
|
||||
public:
|
||||
|
||||
// Define the class. The class name must match the ClassOverride property
|
||||
// set for the scene in the UI Authoring tool.
|
||||
XUI_IMPLEMENT_CLASS( CScene_Controls, L"CScene_Controls", XUI_CLASS_SCENE )
|
||||
|
||||
|
||||
|
||||
};
|
||||
688
Minecraft.Client/Common/XUI/XUI_HelpCredits.cpp
Normal file
688
Minecraft.Client/Common/XUI/XUI_HelpCredits.cpp
Normal file
@@ -0,0 +1,688 @@
|
||||
#include "stdafx.h"
|
||||
#include <assert.h>
|
||||
#include "XUI_HelpCredits.h"
|
||||
|
||||
SCreditTextItemDef CScene_Credits::gs_aCreditDefs[MAX_CREDIT_STRINGS] =
|
||||
{
|
||||
{ L"MOJANG", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eExtraLargeText },
|
||||
{ L"", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText }, // extra blank line
|
||||
{ L"%s", IDS_CREDITS_ORIGINALDESIGN, NO_TRANSLATED_STRING,eLargeText },
|
||||
{ L"Markus Persson", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText }, // extra blank line
|
||||
{ L"%s", IDS_CREDITS_PMPROD, NO_TRANSLATED_STRING,eLargeText },
|
||||
{ L"Daniel Kaplan", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText }, // extra blank line
|
||||
{ L"%s", IDS_CREDITS_RESTOFMOJANG, NO_TRANSLATED_STRING,eMediumText },
|
||||
{ L"%s", IDS_CREDITS_LEADPC, NO_TRANSLATED_STRING,eLargeText },
|
||||
{ L"Jens Bergensten", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"%s", IDS_CREDITS_JON_KAGSTROM, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"%s", IDS_CREDITS_CEO, NO_TRANSLATED_STRING,eLargeText },
|
||||
{ L"Carl Manneh", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"%s", IDS_CREDITS_DOF, NO_TRANSLATED_STRING,eLargeText },
|
||||
{ L"Lydia Winters", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"%s", IDS_CREDITS_WCW, NO_TRANSLATED_STRING,eLargeText },
|
||||
{ L"Karin Severinsson", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"%s", IDS_CREDITS_CUSTOMERSUPPORT, NO_TRANSLATED_STRING,eLargeText },
|
||||
{ L"Marc Watson", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText }, // extra blank line
|
||||
{ L"%s", IDS_CREDITS_DESPROG, NO_TRANSLATED_STRING,eLargeText },
|
||||
{ L"Aron Nieminen", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText }, // extra blank line
|
||||
{ L"%s", IDS_CREDITS_CHIEFARCHITECT, NO_TRANSLATED_STRING,eLargeText },
|
||||
{ L"Daniel Frisk", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"%s", IDS_CREDITS_CODENINJA, NO_TRANSLATED_STRING,eLargeText },
|
||||
{ L"%s", IDS_CREDITS_TOBIAS_MOLLSTAM, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"%s", IDS_CREDITS_OFFICEDJ, NO_TRANSLATED_STRING,eLargeText },
|
||||
{ L"Kristoffer Jelbring", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"%s", IDS_CREDITS_DEVELOPER, NO_TRANSLATED_STRING,eLargeText },
|
||||
{ L"Leonard Axelsson", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"%s", IDS_CREDITS_BULLYCOORD, NO_TRANSLATED_STRING,eLargeText },
|
||||
{ L"Jakob Porser", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"%s", IDS_CREDITS_ARTDEVELOPER, NO_TRANSLATED_STRING,eLargeText },
|
||||
{ L"Junkboy", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"%s", IDS_CREDITS_EXPLODANIM, NO_TRANSLATED_STRING,eLargeText },
|
||||
{ L"Mattis Grahm", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"%s", IDS_CREDITS_CONCEPTART, NO_TRANSLATED_STRING,eLargeText },
|
||||
{ L"Henrik Petterson", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"%s", IDS_CREDITS_CRUNCHER, NO_TRANSLATED_STRING,eLargeText },
|
||||
{ L"Patrick Geuder", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"%s", IDS_CREDITS_MUSICANDSOUNDS, NO_TRANSLATED_STRING,eLargeText },
|
||||
{ L"Daniel Rosenfeld (C418)", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText }, // extra blank line
|
||||
{ L"4J Studios", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eExtraLargeText },
|
||||
{ L"%s", IDS_CREDITS_PROGRAMMING, NO_TRANSLATED_STRING,eLargeText },
|
||||
{ L"Paddy Burns", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Richard Reavy", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Stuart Ross", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"James Vaughan", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Mark Hughes", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Thomas Kronberg", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Ian le Bruce", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Andy West", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Gordon McLean", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"%s", IDS_CREDITS_ART, NO_TRANSLATED_STRING,eLargeText },
|
||||
{ L"David Keningale", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Pat McGovern", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Alan Redmond", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Julian Laing", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Caitlin Goodale", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Scott Sutherland", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Chris Reeves", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Kate Wright", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Michael Hansen", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Kate Flavell", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Donald Robertson", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Jamie Keddie", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Thomas Naylor", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Brian Lindsay", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Hannah Watts", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Rebecca O'Neil", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"%s", IDS_CREDITS_QA, NO_TRANSLATED_STRING,eLargeText },
|
||||
{ L"Steven Gary Woodward", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Richard Black", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"George Vaughan", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText }, // extra blank line
|
||||
{ L"%s", IDS_CREDITS_SPECIALTHANKS, NO_TRANSLATED_STRING,eLargeText },
|
||||
{ L"Chris van der Kuyl", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Roni Percy", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Anne Clarke", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Anthony Kent", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Microsoft Studios", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eExtraLargeText },
|
||||
{ L"", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText }, // extra blank line
|
||||
{ L"", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText }, // extra blank line
|
||||
|
||||
{ L"Xbox LIVE Arcade Team", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eExtraLargeText },
|
||||
{ L"", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText }, // extra blank line
|
||||
{ L"%s", IDS_CREDITS_LEADPRODUCER, NO_TRANSLATED_STRING,eLargeText },
|
||||
{ L"Roger Carpenter", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"%s", IDS_CREDITS_PRODUCER, NO_TRANSLATED_STRING,eLargeText },
|
||||
{ L"Stuart Platt", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Riccardo Lenzi", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"%s", IDS_CREDITS_LEADTESTER, NO_TRANSLATED_STRING,eLargeText },
|
||||
{ L"Bill Brown (Insight Global)", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Brandon McCurry (Insight Global)", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Hakim Ronaque, Joe Dunavant", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Paul Loynd, Jeffery Stephens", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Rial Lerum (Xtreme Consulting Group Inc)", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"%s", IDS_CREDITS_DESIGNTEAM, NO_TRANSLATED_STRING,eLargeText },
|
||||
{ L"Craig Leigh", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"%s", IDS_CREDITS_DEVELOPMENTTEAM, NO_TRANSLATED_STRING,eLargeText },
|
||||
{ L"Scott Guest", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Jeff \"Dextor\" Blazier", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Yukie Yamaguchi", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Jason Hewitt", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"%s", IDS_CREDITS_RELEASEMANAGEMENT, NO_TRANSLATED_STRING,eLargeText },
|
||||
{ L"Josh Mulanax", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Shogo Ishii (TekSystems)", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Tyler Keenan (Xtreme Consulting Group Inc)", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Joshua Bullard (TekSystems)", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"%s", IDS_CREDITS_EXECPRODUCER, NO_TRANSLATED_STRING,eLargeText },
|
||||
{ L"Mark Coates", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Avi Ben-Menahem", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Earnest Yuen", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"%s", IDS_CREDITS_XBLADIRECTOR, NO_TRANSLATED_STRING,eLargeText },
|
||||
{ L"Ted Woolsey", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"%s", IDS_CREDITS_BIZDEV, NO_TRANSLATED_STRING,eLargeText },
|
||||
{ L"Cherie Lutz", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Peter Zetterberg", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"%s", IDS_CREDITS_PORTFOLIODIRECTOR, NO_TRANSLATED_STRING,eLargeText },
|
||||
{ L"Chris Charla", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"%s", IDS_CREDITS_PRODUCTMANAGER, NO_TRANSLATED_STRING,eLargeText },
|
||||
{ L"Daniel McConnell", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"%s", IDS_CREDITS_MARKETING, NO_TRANSLATED_STRING,eLargeText },
|
||||
{ L"Brandon Wells", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Michael Wolf", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"John Dongelmans", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"%s", IDS_CREDITS_COMMUNITYMANAGER, NO_TRANSLATED_STRING,eLargeText },
|
||||
{ L"Alex Hebert", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"%s", IDS_CREDITS_REDMONDLOC, NO_TRANSLATED_STRING,eLargeText },
|
||||
{ L"Zeb Wedell", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Gabriella Mittiga (Pactera)", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Scott Fielding (Global Studio Consulting)", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Yong Zhao (Hisoft Envisage Inc)", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Shogo Ishii (Insight Global)", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"%s", IDS_CREDITS_EUROPELOC, NO_TRANSLATED_STRING,eLargeText },
|
||||
{ L"Gerard Dunne", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Ricardo Cordoba", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Magali Lucchini", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Malika Kherfi", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Lizzy Untermann", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Ian Walsh", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Alfonsina Mossello (Keywords International Ltd)", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Marika Mauri (Keywords International Ltd)", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Nobuhiro Izumisawa (Keywords International Ltd)", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Sebastien Faucon (Keywords International Ltd)", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Jose Manuel Martinez (Keywords International Ltd)", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Montse Garcia (Keywords International Ltd)", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"%s", IDS_CREDITS_ASIALOC, NO_TRANSLATED_STRING,eLargeText },
|
||||
{ L"Takashi Sasaki", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Changseon Ha", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Shinya Muto (Zip Global Corporation)", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Hiroshi Hosoda (Zip Global Corporation)", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Natsuko Kudo (Zip Global Corporation)", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Yong-Hong Park (Zip Global Corporation)", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Yuko Yoshida (Zip Global Corporation)", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"%s", IDS_CREDITS_USERRESEARCH, NO_TRANSLATED_STRING,eLargeText },
|
||||
{ L"", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText }, // extra blank line
|
||||
{ L"User Research Lead", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eLargeText },
|
||||
{ L"Tim Nichols", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText }, // extra blank line
|
||||
{ L"User Research Engineer", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eLargeText },
|
||||
{ L"Michael Medlock", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Kristie Fisher", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText }, // extra blank line
|
||||
{ L"%s", IDS_CREDITS_MGSCENTRAL, NO_TRANSLATED_STRING,eLargeText },
|
||||
{ L"", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText }, // extra blank line
|
||||
{ L"Test Team Lead", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eLargeText },
|
||||
{ L"Dan Smith", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"%s", IDS_CREDITS_MILESTONEACCEPT, NO_TRANSLATED_STRING,eLargeText },
|
||||
{ L"Justin Davis (VMC)", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Microsoft Studios Sentient Development Team", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eLargeText },
|
||||
{ L"Ellery Charlson", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Frank Klier", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Jason Ronald", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Cullen Waters", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Steve Jackson", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Barath Vasudevan", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Derek Mantey", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Henry Sterchi", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Scott Fintel", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Soren Hannibal Nielsen", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Meetali Goel (Aditi)", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Uladzimir Sadouski (Volt)", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"%s", IDS_CREDITS_SPECIALTHANKS, NO_TRANSLATED_STRING,eLargeText },
|
||||
{ L"Brianna Witherspoon (Nytec Inc)", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Jim Pekola (Xtreme Consulting Group Inc)", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Chris Henry", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Matt Golz", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Chris Gaffney (Volt)", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Jared Barnhill (Aditi)", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Laura Hawkins", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"2nd Cavalry", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"GTO Bug Bash Team", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Oliver Miyashita", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Kevin Salcedo", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Nick Bodenham", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Chris Giggins", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Ben Board", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Peter Choi", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Andy Su (CompuCom Systems Inc.)", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"David Boker ", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Josh Bliggenstorfer", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Paul Amer", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Louise Smith", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Karin Behland (Aquent LLC)", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"John Bruno", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Phil Spencer", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"John Smith", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Christi Davisson", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Jacob Farley (Aditi)", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Chad Stringer (Collabera)", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Rick Rispoli (Collabera)", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Test by Experis", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eExtraLargeText },
|
||||
{ L"%s", IDS_CREDITS_TESTMANAGER, NO_TRANSLATED_STRING,eLargeText },
|
||||
{ L"Matt Brown", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Gavin Kennedy", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"%s", IDS_CREDITS_SRTESTLEAD, NO_TRANSLATED_STRING,eLargeText },
|
||||
{ L"Lloyd Bell", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Tim Attuquayefio", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"%s", IDS_CREDITS_TESTLEAD, NO_TRANSLATED_STRING,eLargeText },
|
||||
{ L"Byron R. Monzon", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Marta Alombro", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"%s", IDS_CREDITS_SDET, NO_TRANSLATED_STRING,eLargeText },
|
||||
{ L"Valeriy Novytskyy", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"%s", IDS_CREDITS_PROJECT, NO_TRANSLATED_STRING,eLargeText },
|
||||
{ L"Allyson Burk", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"David Scott", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"John Shearer", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"%s", IDS_CREDITS_ADDITIONALSTE, NO_TRANSLATED_STRING,eLargeText },
|
||||
{ L"Chris Merritt", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Kimberlee Lyles", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Eric Ranz", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Russ Allen", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"%s", IDS_CREDITS_TESTASSOCIATES, NO_TRANSLATED_STRING,eLargeText },
|
||||
{ L"Michael Arvat", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Josh Breese", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"April Culberson", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Jason Fox", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Clayton K. Hopper", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Matthew Howells", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Alan Hume", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Jacob Martin", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Kevin Lourigan", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Tyler Lovemark", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"%s", IDS_CREDITS_RISE_LUGO, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Ryan Naegeli", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Isaac Price", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Masha Reutovski", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Brad Shockey", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Jonathan Tote", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Marc Williams", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Gillian Williams", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Jeffrey Woito", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Tyler Young", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Jae Yslas", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Amanda Swalling", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Ben Dienes", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Chris Kent", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Dustin Lukas", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Emily Lovering", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Nick Fowler", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
// EVEN MORE CREDITS
|
||||
{ L"Test by Lionbridge", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eExtraLargeText },
|
||||
{ L"", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText }, // extra blank line
|
||||
{ L"%s", IDS_CREDITS_TESTMANAGER, NO_TRANSLATED_STRING,eLargeText },
|
||||
{ L"Blazej Zawadzki", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"David Hickey", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"%s", IDS_CREDITS_TESTLEAD, NO_TRANSLATED_STRING,eLargeText },
|
||||
{ L"Jakub Garwacki", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Kamil Lahti", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Mariusz Gelnicki", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Karol Falak", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Lukasz Watroba", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"%s", IDS_CREDITS_PROJECT, NO_TRANSLATED_STRING,eLargeText },
|
||||
{ L"Artur Grochowski", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Grzegorz Kohorewicz", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Lukasz Derewonko", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Michal Celej", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Senior Test Engineers", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eLargeText },
|
||||
{ L"Jakub Rybacki", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Mateusz Szymanski", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Arkadiusz Szczytowski", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Rafal Rawski", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
|
||||
{ L"%s", IDS_CREDITS_TESTASSOCIATES, NO_TRANSLATED_STRING,eLargeText },
|
||||
{ L"Adrian Klepacki", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Arkadiusz Kala", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Arkadiusz Sykula", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Bartlomiej Kmita", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Jakub Malinowski", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Jan Prejs", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Maciej Urlo", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Maciej Wygoda", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Marcin Piasecki", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Marcin Piotrowski", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Marek Latacz", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Michal Biernat", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Michal Krupinski", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Michal Warchal", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Michal Wascinski", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Michal Zbrzezniak", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Milosz Maciejewicz", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Przemyslaw Malinowski", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Tomasz Dabrowicz", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Tomasz Trzebiatowski", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
|
||||
{ L"Adam Bogucki", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Aleksander Pietraszak", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Arkadiusz Szczytowski", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Blazej Kohorewicz", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Damian Mielnik", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Dariusz Nowakowski", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Dominik Rzeznicki", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Jacek Piotrowski", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Jakub Rybacki", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Jakub Wozniakowski", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Jaroslaw Radzio", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Kamil Dabrowski", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Kamil Kaczor", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Karolina Szymanska", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Konrad Mady", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Krzysztof Galazka", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Ludwik Miszta", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Lukasz Kwiatkowski", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Marcin Krzysiak", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Mateusz Szymanski", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Michal Maslany", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Michal Nyszka", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Norbert Jankowski", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Piotr Daszewski", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Radoslaw Kozlowski", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Tomasz Kalowski", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"%s", IDS_CREDITS_SPECIALTHANKS, NO_TRANSLATED_STRING,eLargeText },
|
||||
{ L"Adam Keating", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Jerzy Tyminski", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Paulina Sliwinska", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Sean Kellogg", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
|
||||
{ L"Test by Shield", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eExtraLargeText },
|
||||
{ L"", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText }, // extra blank line
|
||||
{ L"GTO Shared Service Test Manager", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eLargeText },
|
||||
{ L"Natahri Felton", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Shield Test Lead", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eLargeText },
|
||||
{ L"Matt Giddings", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Shield IT Support", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eLargeText },
|
||||
{ L"David Grant (Compucom Systems Inc)", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Primary Team", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eLargeText },
|
||||
{ L"Alex Chen (CompuCom Systems Inc)", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Alex Hunte (CompuCom Systems Inc)", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Brian Boye (CompuCom Systems Inc)", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Bridgette Cummins (CompuCom Systems Inc)", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Chris Carleson (Volt)", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Christopher Hermey (CompuCom Systems Inc)", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"David Hendrickson (CompuCom Systems Inc)", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Ioana Preda (CompuCom Systems Inc)", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Jessica Jenkins (CompuCom Systems Inc)", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Johnathan Ochs (CompuCom Systems Inc)", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Michael Upham (CompuCom Systems Inc)", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Nicholas Johansson (CompuCom Systems Inc)", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Nicholas Starner (CompuCom Systems Inc)", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Torr Vickers (Volt)", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
{ L"Victoria Bruder (CompuCom Systems Inc)", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
|
||||
|
||||
};
|
||||
|
||||
// Table tells us how many text elements of each type are available in the scene.
|
||||
static const int gs_aNumTextElements[ eNumTextTypes ] =
|
||||
{
|
||||
3, // CScene_Credits::eExtraLargeText
|
||||
5, // CScene_Credits::eLargeText
|
||||
5, // CScene_Credits::eMediumText
|
||||
15 // CScene_Credits::eSmallText
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Performs initialization tasks - retrieves controls.
|
||||
//----------------------------------------------------------------------------------
|
||||
HRESULT CScene_Credits::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
|
||||
{
|
||||
int iPad = *(int *)pInitData->pvInitData;
|
||||
|
||||
MapChildControls();
|
||||
|
||||
// if we're not in the game, we need to use basescene 0
|
||||
if(Minecraft::GetInstance()->level==NULL)
|
||||
{
|
||||
iPad=0;
|
||||
}
|
||||
|
||||
ui.SetTooltips( iPad, -1, IDS_TOOLTIPS_BACK);
|
||||
|
||||
if(!RenderManager.IsHiDef() && !RenderManager.IsWidescreen())
|
||||
{
|
||||
CREDITS_SCREEN_MIN_Y = 200.0f/1.5f; // Y pos at which credits are removed from top of screen.
|
||||
CREDITS_SCREEN_MAX_Y = 630.0f/1.5f; // Y pos at which credits appear at bottom of screen.
|
||||
CREDITS_FADE_HEIGHT = 100.0f/1.5f; // Height over which credits fade in or fade out.
|
||||
gs_aLineSpace[eExtraLargeText]=53.0f;
|
||||
gs_aLineSpace[eLargeText]=46.0f;
|
||||
gs_aLineSpace[eMediumText]=40.0f;
|
||||
gs_aLineSpace[eSmallText]=21.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
CREDITS_SCREEN_MIN_Y = 200.0f; // Y pos at which credits are removed from top of screen.
|
||||
CREDITS_SCREEN_MAX_Y = 630.0f; // Y pos at which credits appear at bottom of screen.
|
||||
CREDITS_FADE_HEIGHT = 100.0f; // Height over which credits fade in or fade out.
|
||||
gs_aLineSpace[eExtraLargeText]=80.0f;
|
||||
gs_aLineSpace[eLargeText]=70.0f;
|
||||
gs_aLineSpace[eMediumText]=60.0f;
|
||||
gs_aLineSpace[eSmallText]=32.0f;
|
||||
}
|
||||
|
||||
|
||||
// Init text elements.
|
||||
int iIDTag = 1;
|
||||
LPWSTR idString = new wchar_t[ 32 ];
|
||||
|
||||
for ( int i = 0; i < eNumTextTypes; ++i )
|
||||
{
|
||||
m_aTextTypes[ i ].m_iNextFreeElement = 0;
|
||||
m_aTextTypes[ i ].m_iNumUsedElements = 0;
|
||||
m_aTextTypes[ i ].m_iMaxElements = gs_aNumTextElements[ i ];
|
||||
m_aTextTypes[ i ].m_appTextElements = new CXuiControl* [ m_aTextTypes[ i ].m_iMaxElements ];
|
||||
|
||||
for ( int j = 0; j < m_aTextTypes[ i ].m_iMaxElements; ++j )
|
||||
{
|
||||
swprintf( idString, 32, L"XuiText%d", iIDTag );
|
||||
++iIDTag;
|
||||
|
||||
HXUIOBJ text;
|
||||
GetChildById( idString, &text );
|
||||
|
||||
VOID* pTextObj;
|
||||
XuiObjectFromHandle( text, &pTextObj );
|
||||
m_aTextTypes[ i ].m_appTextElements[ j ] = (CXuiControl *)pTextObj;
|
||||
m_aTextTypes[ i ].m_appTextElements[ j ]->SetShow( false );
|
||||
}
|
||||
}
|
||||
delete [] idString;
|
||||
|
||||
// How many lines of text are in the credits?
|
||||
|
||||
m_iNumTextDefs = MAX_CREDIT_STRINGS;//sizeof( gs_aCreditDefs ) / sizeof( SCreditTextItemDef );
|
||||
|
||||
// Are there any additional lines needed for the DLC credits?
|
||||
m_iNumTextDefs+=app.GetDLCCreditsCount();
|
||||
|
||||
m_iCurrDefIndex = -1;
|
||||
m_fMoveSinceLastDef = 0.0f;
|
||||
m_fMoveToNextDef = 0.0f;
|
||||
|
||||
// Add timer to tick credits update at 60Hz
|
||||
HRESULT timerResult = SetTimer( CREDITS_TICK_TIMER_ID, ( 1000 / 60 ) );
|
||||
assert( timerResult == S_OK );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CScene_Credits::OnDestroy()
|
||||
{
|
||||
// Free up memory that we allocated.
|
||||
for ( int i = 0; i < eNumTextTypes; ++i )
|
||||
{
|
||||
delete [] m_aTextTypes[ i ].m_appTextElements;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CScene_Credits::OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandled)
|
||||
{
|
||||
ui.AnimateKeyPress(pInputData->UserIndex, pInputData->dwKeyCode);
|
||||
|
||||
HRESULT hr=S_OK;
|
||||
|
||||
// Explicitly handle B button presses
|
||||
switch(pInputData->dwKeyCode)
|
||||
{
|
||||
|
||||
case VK_PAD_B:
|
||||
case VK_ESCAPE:
|
||||
app.NavigateBack(pInputData->UserIndex);
|
||||
rfHandled = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT CScene_Credits::OnControlNavigate(XUIMessageControlNavigate *pControlNavigateData, BOOL& bHandled)
|
||||
{
|
||||
// ignore any joypads other than the main
|
||||
BYTE bFocusUser=XuiElementGetFocusUser(pControlNavigateData->hObjSource);
|
||||
// get the user from the control
|
||||
/*if(!=ProfileManager.GetLockedProfile())
|
||||
{
|
||||
bHandled=true;
|
||||
return S_OK;
|
||||
}*/
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Handler for the button press message.
|
||||
//----------------------------------------------------------------------------------
|
||||
HRESULT CScene_Credits::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* pNotifyPressData, BOOL& rfHandled)
|
||||
{
|
||||
// This assumes all buttons can only be pressed with the A button
|
||||
ui.AnimateKeyPress(pNotifyPressData->UserIndex, VK_PAD_A);
|
||||
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
HRESULT CScene_Credits::OnTimer( XUIMessageTimer *pTimer, BOOL& bHandled )
|
||||
{
|
||||
// Update pointer from stick input on timer.
|
||||
if ( pTimer->nId == CREDITS_TICK_TIMER_ID )
|
||||
{
|
||||
D3DXVECTOR3 vTextPos;
|
||||
|
||||
// Do we need to spawn a new item?
|
||||
if ( ( m_iCurrDefIndex == -1 ) || ( m_fMoveSinceLastDef >= m_fMoveToNextDef ) )
|
||||
{
|
||||
const SCreditTextItemDef* pDef;
|
||||
|
||||
// Time to create next text item.
|
||||
++m_iCurrDefIndex;
|
||||
|
||||
// Wrap back to start.
|
||||
if ( m_iCurrDefIndex >= m_iNumTextDefs )
|
||||
{
|
||||
m_iCurrDefIndex = 0;
|
||||
}
|
||||
|
||||
if(m_iCurrDefIndex >= MAX_CREDIT_STRINGS)
|
||||
{
|
||||
// DLC credit
|
||||
pDef = app.GetDLCCredits(m_iCurrDefIndex-MAX_CREDIT_STRINGS);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Get text def for this item.
|
||||
pDef = &( gs_aCreditDefs[ m_iCurrDefIndex ] );
|
||||
}
|
||||
|
||||
int iNewTextType = ( int )( pDef->m_eType );
|
||||
STextType* pTextType = &( m_aTextTypes[ iNewTextType ] );
|
||||
|
||||
// Are there any text elements available for this item?
|
||||
if ( pTextType->m_iNumUsedElements < pTextType->m_iMaxElements )
|
||||
{
|
||||
// Get the correct text element to use.
|
||||
CXuiControl* pElement = pTextType->m_appTextElements[ pTextType->m_iNextFreeElement ];
|
||||
|
||||
// Set up the new text element.
|
||||
if ( pDef->m_iStringID[0] == NO_TRANSLATED_STRING )
|
||||
{
|
||||
pElement->SetText( pDef->m_Text );
|
||||
}
|
||||
else // using additional translated string.
|
||||
{
|
||||
LPWSTR creditsString = new wchar_t[ 128 ];
|
||||
if(pDef->m_iStringID[1]!=NO_TRANSLATED_STRING)
|
||||
{
|
||||
swprintf( creditsString, 128, pDef->m_Text, app.GetString( pDef->m_iStringID[0] ), app.GetString( pDef->m_iStringID[1] ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
swprintf( creditsString, 128, pDef->m_Text, app.GetString( pDef->m_iStringID[0] ) );
|
||||
}
|
||||
pElement->SetText( creditsString );
|
||||
delete [] creditsString;
|
||||
}
|
||||
|
||||
pElement->SetShow( true );
|
||||
pElement->SetOpacity( 0.0f );
|
||||
|
||||
pElement->GetPosition( &vTextPos );
|
||||
vTextPos.y = CREDITS_SCREEN_MAX_Y;
|
||||
pElement->SetPosition( &vTextPos );
|
||||
|
||||
// Set next free element of this type.
|
||||
++( pTextType->m_iNextFreeElement );
|
||||
|
||||
if ( pTextType->m_iNextFreeElement >= pTextType->m_iMaxElements )
|
||||
{
|
||||
pTextType->m_iNextFreeElement = 0;
|
||||
}
|
||||
|
||||
++pTextType->m_iNumUsedElements;
|
||||
|
||||
int iNextDef = m_iCurrDefIndex + 1;
|
||||
if ( iNextDef == m_iNumTextDefs )
|
||||
{
|
||||
// Large space before looping back to start of credits.
|
||||
m_fMoveToNextDef = 400.0f;
|
||||
}
|
||||
else if ( iNextDef < MAX_CREDIT_STRINGS )
|
||||
{
|
||||
// Determine space to next item.
|
||||
m_fMoveToNextDef = gs_aLineSpace[ gs_aCreditDefs[ iNextDef ].m_eType ];
|
||||
}
|
||||
else
|
||||
{
|
||||
// Determine space to next item.
|
||||
m_fMoveToNextDef = gs_aLineSpace[app.GetDLCCredits(iNextDef-MAX_CREDIT_STRINGS)->m_eType];
|
||||
}
|
||||
|
||||
m_fMoveSinceLastDef = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
// Scroll up every active text element.
|
||||
for ( int i = 0; i < eNumTextTypes; ++i )
|
||||
{
|
||||
STextType* pTextType = &( m_aTextTypes[ i ] );
|
||||
|
||||
// Process in reverse order from latest one back (so that we can easily remove oldest if it has scrolled off the top).
|
||||
int iElementIndex = pTextType->m_iNextFreeElement;
|
||||
|
||||
--iElementIndex;
|
||||
if ( iElementIndex < 0 )
|
||||
{
|
||||
iElementIndex = pTextType->m_iMaxElements - 1;
|
||||
}
|
||||
|
||||
// For each element that it is use
|
||||
for ( int j = 0; j < pTextType->m_iNumUsedElements; ++j )
|
||||
{
|
||||
// Get the actual element.
|
||||
CXuiControl* pElement = pTextType->m_appTextElements[ iElementIndex ];
|
||||
|
||||
// Scroll element up.
|
||||
pElement->GetPosition( &vTextPos );
|
||||
vTextPos.y -= 1.0f;
|
||||
pElement->SetPosition( &vTextPos );
|
||||
|
||||
// Is it off the top?
|
||||
if ( vTextPos.y < CREDITS_SCREEN_MIN_Y )
|
||||
{
|
||||
// Remove it.
|
||||
pElement->SetShow( false );
|
||||
--( pTextType->m_iNumUsedElements );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Set transparency to fade in at bottom or out at top.
|
||||
float fOpacity = 1.0f;
|
||||
if ( vTextPos.y < ( CREDITS_SCREEN_MIN_Y + CREDITS_FADE_HEIGHT ) )
|
||||
{
|
||||
fOpacity = ( vTextPos.y - CREDITS_SCREEN_MIN_Y ) / CREDITS_FADE_HEIGHT;
|
||||
}
|
||||
else if ( vTextPos.y > ( CREDITS_SCREEN_MAX_Y - CREDITS_FADE_HEIGHT ) )
|
||||
{
|
||||
fOpacity = ( CREDITS_SCREEN_MAX_Y - vTextPos.y ) / CREDITS_FADE_HEIGHT;
|
||||
}
|
||||
pElement->SetOpacity( fOpacity );
|
||||
}
|
||||
|
||||
// Determine next element index.
|
||||
--iElementIndex;
|
||||
if ( iElementIndex < 0 )
|
||||
{
|
||||
iElementIndex = pTextType->m_iMaxElements - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_fMoveSinceLastDef += 1.0f;
|
||||
|
||||
// This message has been dealt with, don't pass it on further.
|
||||
bHandled = TRUE;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
73
Minecraft.Client/Common/XUI/XUI_HelpCredits.h
Normal file
73
Minecraft.Client/Common/XUI/XUI_HelpCredits.h
Normal file
@@ -0,0 +1,73 @@
|
||||
#pragma once
|
||||
|
||||
#define CREDITS_TICK_TIMER_ID (6) // Arbitrary timer ID used to tick credits for scrolling.
|
||||
|
||||
#define MAX_CREDIT_STRINGS 360
|
||||
// 213
|
||||
|
||||
#include "..\UI\UIStructs.h"
|
||||
|
||||
class CScene_Credits : public CXuiSceneImpl
|
||||
{
|
||||
protected:
|
||||
// Control and Element wrapper objects.
|
||||
|
||||
// Message map. Here we tie messages to message handlers.
|
||||
XUI_BEGIN_MSG_MAP()
|
||||
XUI_ON_XM_INIT( OnInit )
|
||||
XUI_ON_XM_KEYDOWN(OnKeyDown)
|
||||
XUI_ON_XM_NOTIFY_PRESS_EX(OnNotifyPressEx)
|
||||
XUI_ON_XM_CONTROL_NAVIGATE(OnControlNavigate)
|
||||
XUI_ON_XM_TIMER( OnTimer )
|
||||
XUI_ON_XM_DESTROY( OnDestroy )
|
||||
XUI_END_MSG_MAP()
|
||||
|
||||
// Control mapping to objects
|
||||
BEGIN_CONTROL_MAP()
|
||||
|
||||
END_CONTROL_MAP()
|
||||
|
||||
HRESULT OnInit( XUIMessageInit* pInitData, BOOL& bHandled );
|
||||
HRESULT OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandled);
|
||||
HRESULT OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* pNotifyPressData,BOOL& rfHandled);
|
||||
HRESULT OnControlNavigate(XUIMessageControlNavigate *pControlNavigateData, BOOL& bHandled);
|
||||
HRESULT OnTimer( XUIMessageTimer *pTimer, BOOL& bHandled );
|
||||
HRESULT OnDestroy();
|
||||
|
||||
private:
|
||||
|
||||
|
||||
struct STextType
|
||||
{
|
||||
// Array of pointers to text elements.
|
||||
CXuiControl** m_appTextElements;
|
||||
|
||||
int m_iNextFreeElement;
|
||||
int m_iNumUsedElements;
|
||||
int m_iMaxElements;
|
||||
};
|
||||
|
||||
STextType m_aTextTypes[ eNumTextTypes ];
|
||||
|
||||
int m_iCurrDefIndex; // Index of last created text def.
|
||||
float m_fMoveSinceLastDef; // How far have credits scrolled since we last created a new text item.
|
||||
float m_fMoveToNextDef; // How far we need to move before starting next text item.
|
||||
int m_iNumTextDefs; // Total number of text defs in the credits.
|
||||
|
||||
float CREDITS_SCREEN_MIN_Y;// ( 200.0f ) // Y pos at which credits are removed from top of screen.
|
||||
float CREDITS_SCREEN_MAX_Y;// ( 630.0f ) // Y pos at which credits appear at bottom of screen.
|
||||
float CREDITS_FADE_HEIGHT;// ( 100.0f ) // Height over which credits fade in or fade out.
|
||||
|
||||
float gs_aLineSpace[ eNumTextTypes ];
|
||||
|
||||
public:
|
||||
static SCreditTextItemDef gs_aCreditDefs[MAX_CREDIT_STRINGS];
|
||||
|
||||
// Define the class. The class name must match the ClassOverride property
|
||||
// set for the scene in the UI Authoring tool.
|
||||
XUI_IMPLEMENT_CLASS( CScene_Credits, L"CScene_Credits", XUI_CLASS_SCENE )
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
238
Minecraft.Client/Common/XUI/XUI_HelpHowToPlay.cpp
Normal file
238
Minecraft.Client/Common/XUI/XUI_HelpHowToPlay.cpp
Normal file
@@ -0,0 +1,238 @@
|
||||
#include "stdafx.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include "..\XUI\XUI_HelpHowToPlay.h"
|
||||
#include "..\..\..\Minecraft.World\StringHelpers.h"
|
||||
|
||||
static SHowToPlayPageDef gs_aPageDefs[ eHowToPlay_NumPages ] =
|
||||
{
|
||||
{ eHowToPlay_WhatsNew, IDS_HOW_TO_PLAY_WHATSNEW, eHowToPlay_ImageNone, 0, 0}, // eHowToPlay_WhatsNew
|
||||
{ eHowToPlay_TextBasics, IDS_HOW_TO_PLAY_BASICS, eHowToPlay_ImageNone, 0, 0}, // eHowToPlay_Basics
|
||||
{ eHowToPlay_TextMultiplayer, IDS_HOW_TO_PLAY_MULTIPLAYER, eHowToPlay_ImageNone, 0, 0}, // eHowToPlay_Multiplayer
|
||||
{ eHowToPlay_TextHUD, IDS_HOW_TO_PLAY_HUD, eHowToPlay_ImageHUD, 0, 0}, // eHowToPlay_HUD
|
||||
{ eHowToPlay_TextCreative, IDS_HOW_TO_PLAY_CREATIVE, eHowToPlay_ImageCreative, eHowToPlay_LabelCreativeInventory, 1}, // eHowToPlay_Creative
|
||||
{ eHowToPlay_TextInventory, IDS_HOW_TO_PLAY_INVENTORY, eHowToPlay_ImageInventory, eHowToPlay_LabelIInventory, 1}, // eHowToPlay_Inventory
|
||||
{ eHowToPlay_TextSmallChest, IDS_HOW_TO_PLAY_CHEST, eHowToPlay_ImageChest, eHowToPlay_LabelSCInventory, 2}, // eHowToPlay_Chest
|
||||
{ eHowToPlay_TextLargeChest, IDS_HOW_TO_PLAY_LARGECHEST, eHowToPlay_ImageLargeChest, eHowToPlay_LabelLCInventory, 2}, // eHowToPlay_LargeChest
|
||||
{ eHowToPlay_TextEnderchest, IDS_HOW_TO_PLAY_ENDERCHEST, eHowToPlay_ImageEnderChest, 0, 0}, // eHowToPlay_EnderChest
|
||||
{ eHowToPlay_TextCrafting, IDS_HOW_TO_PLAY_CRAFTING, eHowToPlay_ImageInventoryCrafting, eHowToPlay_LabelCItem, 3}, // eHowToPlay_InventoryCrafting
|
||||
{ eHowToPlay_TextCraftTable, IDS_HOW_TO_PLAY_CRAFT_TABLE, eHowToPlay_ImageCraftingTable, eHowToPlay_LabelCTItem, 3}, // eHowToPlay_CraftTable
|
||||
{ eHowToPlay_TextFurnace, IDS_HOW_TO_PLAY_FURNACE, eHowToPlay_ImageFurnace, eHowToPlay_LabelFFuel, 4}, // eHowToPlay_Furnace
|
||||
{ eHowToPlay_TextDispenser, IDS_HOW_TO_PLAY_DISPENSER, eHowToPlay_ImageDispenser, eHowToPlay_LabelDText, 2}, // eHowToPlay_Dispenser
|
||||
{ eHowToPlay_TextBrewing, IDS_HOW_TO_PLAY_BREWING, eHowToPlay_ImageBrewing, eHowToPlay_LabelBBrew, 2}, // eHowToPlay_Brewing
|
||||
{ eHowToPlay_TextEnchantment, IDS_HOW_TO_PLAY_ENCHANTMENT, eHowToPlay_ImageEnchantment, eHowToPlay_LabelEEnchant, 2}, // eHowToPlay_Enchantment
|
||||
{ eHowToPlay_TextAnvil, IDS_HOW_TO_PLAY_ANVIL, eHowToPlay_ImageAnvil, eHowToPlay_LabelAnvil_Inventory, 3}, // eHowToPlay_Anvil
|
||||
{ eHowToPlay_TextFarmingAnimals,IDS_HOW_TO_PLAY_FARMANIMALS, eHowToPlay_ImageFarmingAnimals, 0, 0}, // eHowToPlay_Farming
|
||||
{ eHowToPlay_TextBreeding, IDS_HOW_TO_PLAY_BREEDANIMALS, eHowToPlay_ImageBreeding, 0, 0}, // eHowToPlay_Breeding
|
||||
{ eHowToPlay_TextTrading, IDS_HOW_TO_PLAY_TRADING, eHowToPlay_ImageTrading, eHowToPlay_LabelTrading_Inventory, 5}, // eHowToPlay_Trading
|
||||
{ eHowToPlay_TextNetherPortal, IDS_HOW_TO_PLAY_NETHERPORTAL, eHowToPlay_ImageNetherPortal, 0, 0}, // eHowToPlay_NetherPortal
|
||||
{ eHowToPlay_TextTheEnd, IDS_HOW_TO_PLAY_THEEND, eHowToPlay_ImageTheEnd, 0, 0}, // eHowToPlay_TheEnd
|
||||
{ eHowToPlay_TextSocialMedia, IDS_HOW_TO_PLAY_SOCIALMEDIA, eHowToPlay_ImageNone, 0, 0}, // eHowToPlay_SocialMedia
|
||||
{ eHowToPlay_TextBanList, IDS_HOW_TO_PLAY_BANLIST, eHowToPlay_ImageNone, 0, 0}, // eHowToPlay_BanList
|
||||
{ eHowToPlay_TextHostOptions, IDS_HOW_TO_PLAY_HOSTOPTIONS, eHowToPlay_ImageNone, 0, 0}, // eHowToPlay_HostOptions
|
||||
};
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Performs initialization tasks - retrieves controls.
|
||||
//----------------------------------------------------------------------------------
|
||||
HRESULT CScene_HowToPlay::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
|
||||
{
|
||||
// Extract pad and required page from init data. We just put the data into the pointer rather than using it as an address.
|
||||
size_t uiInitData = ( size_t )( pInitData->pvInitData );
|
||||
|
||||
m_iPad = ( int )( ( short )( uiInitData & 0xFFFF ) );
|
||||
EHowToPlayPage eStartPage = ( EHowToPlayPage )( ( uiInitData >> 16 ) & 0xFFF ); // Ignores MSB which is set to 1!
|
||||
|
||||
TelemetryManager->RecordMenuShown(m_iPad, eUIScene_HowToPlay, (ETelemetry_HowToPlay_SubMenuId)eStartPage);
|
||||
|
||||
MapChildControls();
|
||||
|
||||
wstring wsTemp, inventoryString = app.GetString(IDS_INVENTORY);
|
||||
XuiControlSetText(m_aLabelControls[ eHowToPlay_LabelCTItem],app.GetString(IDS_ITEM_HATCHET_WOOD));
|
||||
XuiControlSetText(m_aLabelControls[ eHowToPlay_LabelCTGroup],app.GetString(IDS_GROUPNAME_TOOLS));
|
||||
XuiControlSetText(m_aLabelControls[ eHowToPlay_LabelCTInventory3x3],inventoryString.c_str());
|
||||
XuiControlSetText(m_aLabelControls[ eHowToPlay_LabelCItem],app.GetString(IDS_TILE_WORKBENCH));
|
||||
XuiControlSetText(m_aLabelControls[ eHowToPlay_LabelCGroup],app.GetString(IDS_GROUPNAME_STRUCTURES));
|
||||
XuiControlSetText(m_aLabelControls[ eHowToPlay_LabelCInventory2x2],inventoryString.c_str());
|
||||
XuiControlSetText(m_aLabelControls[ eHowToPlay_LabelFFuel],app.GetString(IDS_FUEL));
|
||||
XuiControlSetText(m_aLabelControls[ eHowToPlay_LabelFInventory],inventoryString.c_str());
|
||||
XuiControlSetText(m_aLabelControls[ eHowToPlay_LabelFIngredient],app.GetString(IDS_INGREDIENT));
|
||||
XuiControlSetText(m_aLabelControls[ eHowToPlay_LabelFChest],app.GetString(IDS_FURNACE));
|
||||
XuiControlSetText(m_aLabelControls[ eHowToPlay_LabelLCInventory],inventoryString.c_str());
|
||||
XuiControlSetText(m_aLabelControls[ eHowToPlay_LabelCreativeInventory],app.GetString(IDS_GROUPNAME_BUILDING_BLOCKS));
|
||||
XuiControlSetText(m_aLabelControls[ eHowToPlay_LabelLCChest],app.GetString(IDS_CHEST));
|
||||
XuiControlSetText(m_aLabelControls[ eHowToPlay_LabelSCInventory],inventoryString.c_str());
|
||||
XuiControlSetText(m_aLabelControls[ eHowToPlay_LabelSCChest],app.GetString(IDS_CHEST));
|
||||
XuiControlSetText(m_aLabelControls[ eHowToPlay_LabelIInventory],inventoryString.c_str());
|
||||
XuiControlSetText(m_aLabelControls[ eHowToPlay_LabelDInventory],inventoryString.c_str());
|
||||
XuiControlSetText(m_aLabelControls[ eHowToPlay_LabelDText],app.GetString(IDS_DISPENSER));
|
||||
XuiControlSetText(m_aLabelControls[ eHowToPlay_LabelEEnchant],app.GetString(IDS_ENCHANT));
|
||||
XuiControlSetText(m_aLabelControls[ eHowToPlay_LabelEInventory],inventoryString.c_str());
|
||||
XuiControlSetText(m_aLabelControls[ eHowToPlay_LabelBBrew],app.GetString(IDS_BREWING_STAND));
|
||||
XuiControlSetText(m_aLabelControls[ eHowToPlay_LabelBInventory],inventoryString.c_str());
|
||||
XuiControlSetText(m_aLabelControls[ eHowToPlay_LabelAnvil_Inventory], inventoryString.c_str());
|
||||
|
||||
wsTemp = app.GetString(IDS_REPAIR_COST);
|
||||
wsTemp.replace( wsTemp.find(L"%d"), 2, wstring(L"8") );
|
||||
XuiControlSetText(m_aLabelControls[ eHowToPlay_LabelAnvil_Cost], wsTemp.c_str());
|
||||
|
||||
XuiControlSetText(m_aLabelControls[ eHowToPlay_LabelAnvil_ARepairAndName], app.GetString(IDS_REPAIR_AND_NAME));
|
||||
XuiControlSetText(m_aLabelControls[ eHowToPlay_LabelTrading_Inventory], inventoryString.c_str());
|
||||
//XuiControlSetText(m_aLabelControls[ eHowToPlay_LabelTrading_Offer2], app.GetString(IDS_ITEM_HATCHET_DIAMOND));
|
||||
XuiControlSetText(m_aLabelControls[ eHowToPlay_LabelTrading_Offer1], app.GetString(IDS_ITEM_EMERALD));
|
||||
XuiControlSetText(m_aLabelControls[ eHowToPlay_LabelTrading_NeededForTrade], app.GetString(IDS_REQUIRED_ITEMS_FOR_TRADE));
|
||||
|
||||
wsTemp = app.GetString(IDS_VILLAGER_OFFERS_ITEM);
|
||||
wsTemp = replaceAll(wsTemp,L"{*VILLAGER_TYPE*}",app.GetString(IDS_VILLAGER_PRIEST));
|
||||
wsTemp.replace(wsTemp.find(L"%s"),2, app.GetString(IDS_TILE_LIGHT_GEM));
|
||||
XuiControlSetText(m_aLabelControls[ eHowToPlay_LabelTrading_VillagerOffers], wsTemp.c_str());
|
||||
|
||||
if(app.GetLocalPlayerCount()>1)
|
||||
{
|
||||
app.AdjustSplitscreenScene(m_hObj,&m_OriginalPosition,m_iPad);
|
||||
}
|
||||
|
||||
|
||||
StartPage( eStartPage );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CScene_HowToPlay::OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandled)
|
||||
{
|
||||
ui.AnimateKeyPress(pInputData->UserIndex, pInputData->dwKeyCode);
|
||||
|
||||
// Explicitly handle B button presses
|
||||
switch(pInputData->dwKeyCode)
|
||||
{
|
||||
case VK_PAD_B:
|
||||
case VK_ESCAPE:
|
||||
{
|
||||
app.NavigateBack(pInputData->UserIndex);
|
||||
rfHandled = TRUE;
|
||||
}
|
||||
break;
|
||||
case VK_PAD_A:
|
||||
{
|
||||
// Next page
|
||||
int iNextPage = ( int )( m_eCurrPage ) + 1;
|
||||
if ( iNextPage != eHowToPlay_NumPages )
|
||||
{
|
||||
StartPage( ( EHowToPlayPage )( iNextPage ) );
|
||||
CXuiSceneBase::PlayUISFX(eSFX_Press);
|
||||
}
|
||||
rfHandled = TRUE;
|
||||
}
|
||||
break;
|
||||
case VK_PAD_X:
|
||||
{
|
||||
// Next page
|
||||
int iPrevPage = ( int )( m_eCurrPage ) - 1;
|
||||
if ( iPrevPage >= 0 )
|
||||
{
|
||||
StartPage( ( EHowToPlayPage )( iPrevPage ) );
|
||||
CXuiSceneBase::PlayUISFX(eSFX_Press);
|
||||
}
|
||||
rfHandled = TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
void CScene_HowToPlay::StartPage( EHowToPlayPage ePage )
|
||||
{
|
||||
int iBaseSceneUser;
|
||||
// if we're not in the game, we need to use basescene 0
|
||||
if(Minecraft::GetInstance()->level==NULL)
|
||||
{
|
||||
iBaseSceneUser=DEFAULT_XUI_MENU_USER;
|
||||
}
|
||||
else
|
||||
{
|
||||
iBaseSceneUser=m_iPad;
|
||||
}
|
||||
m_eCurrPage = ePage;
|
||||
|
||||
// Turn off everything.
|
||||
for ( int i = 0; i < eHowToPlay_NumTexts; ++i )
|
||||
{
|
||||
m_aTextControls[ i ].SetShow( FALSE );
|
||||
}
|
||||
for ( int i = 0; i < eHowToPlay_NumImages; ++i )
|
||||
{
|
||||
m_aImageControls[ i ].SetShow( FALSE );
|
||||
}
|
||||
for ( int i = 0; i < eHowToPlay_NumLabels; ++i )
|
||||
{
|
||||
m_aLabelControls[ i ].SetShow( FALSE );
|
||||
}
|
||||
|
||||
// Turn on just what we need for this screen.
|
||||
SHowToPlayPageDef* pDef = &( gs_aPageDefs[ m_eCurrPage ] );
|
||||
|
||||
if ( pDef->m_iTextControlIndex != eHowToPlay_TextNone )
|
||||
{
|
||||
// Replace button identifiers in the text with actual button images.
|
||||
wstring replacedText = app.FormatHTMLString(m_iPad, app.GetString( pDef->m_iTextStringID ));
|
||||
|
||||
// 4J-PB - replace the title with the platform specific title, and the platform name
|
||||
replacedText = replaceAll(replacedText,L"{*PLATFORM_NAME*}",app.GetString(IDS_PLATFORM_NAME));
|
||||
replacedText = replaceAll(replacedText,L"{*BACK_BUTTON*}",app.GetString(IDS_BACK_BUTTON));
|
||||
replacedText = replaceAll(replacedText,L"{*DISABLES_ACHIEVEMENTS*}",app.GetString(IDS_HOST_OPTION_DISABLES_ACHIEVEMENTS));
|
||||
|
||||
// Set the text colour
|
||||
wstring finalText(replacedText.c_str() );
|
||||
wchar_t startTags[64];
|
||||
swprintf(startTags,64,L"<font color=\"#%08x\">",app.GetHTMLColour(eHTMLColor_White));
|
||||
finalText = startTags + finalText;
|
||||
|
||||
// Set the text in the xui scene.
|
||||
m_aTextControls[ pDef->m_iTextControlIndex ].SetText( finalText.c_str() );
|
||||
|
||||
// Make it visible.
|
||||
m_aTextControls[ pDef->m_iTextControlIndex ].SetShow( TRUE );
|
||||
|
||||
XuiElementSetUserFocus(m_aTextControls[ pDef->m_iTextControlIndex ].m_hObj, m_iPad);
|
||||
}
|
||||
|
||||
if(pDef->m_iLabelCount!=0)
|
||||
{
|
||||
for(int i=pDef->m_iLabelStartIndex;i<(pDef->m_iLabelStartIndex+pDef->m_iLabelCount);i++)
|
||||
{
|
||||
m_aLabelControls[i].SetShow( TRUE );
|
||||
}
|
||||
}
|
||||
|
||||
if ( pDef->m_iImageControlIndex != eHowToPlay_ImageNone )
|
||||
{
|
||||
m_aImageControls[ pDef->m_iImageControlIndex ].SetShow( TRUE );
|
||||
}
|
||||
|
||||
// Tool tips.
|
||||
int iPage = ( int )( m_eCurrPage );
|
||||
if ( iPage == 0 )
|
||||
{
|
||||
// No previous page.
|
||||
ui.SetTooltips( iBaseSceneUser, IDS_HOW_TO_PLAY_NEXT, IDS_TOOLTIPS_BACK, -1 );
|
||||
}
|
||||
else if ( ( iPage + 1 ) == eHowToPlay_NumPages )
|
||||
{
|
||||
// No next page.
|
||||
ui.SetTooltips( iBaseSceneUser, -1, IDS_TOOLTIPS_BACK, IDS_HOW_TO_PLAY_PREV );
|
||||
}
|
||||
else
|
||||
{
|
||||
ui.SetTooltips( iBaseSceneUser, IDS_HOW_TO_PLAY_NEXT, IDS_TOOLTIPS_BACK, IDS_HOW_TO_PLAY_PREV );
|
||||
}
|
||||
|
||||
TelemetryManager->RecordMenuShown(m_iPad, eUIScene_HowToPlay, (ETelemetry_HowToPlay_SubMenuId)ePage);
|
||||
}
|
||||
|
||||
HRESULT CScene_HowToPlay::OnCustomMessage_Splitscreenplayer(bool bJoining, BOOL& bHandled)
|
||||
{
|
||||
bHandled=true;
|
||||
return app.AdjustSplitscreenScene_PlayerChanged(m_hObj,&m_OriginalPosition,m_iPad,bJoining);
|
||||
}
|
||||
217
Minecraft.Client/Common/XUI/XUI_HelpHowToPlay.h
Normal file
217
Minecraft.Client/Common/XUI/XUI_HelpHowToPlay.h
Normal file
@@ -0,0 +1,217 @@
|
||||
#pragma once
|
||||
|
||||
#include "../media/xuiscene_howtoplay.h"
|
||||
#include "XUI_CustomMessages.h"
|
||||
|
||||
enum EHowToPlayTextControls
|
||||
{
|
||||
eHowToPlay_TextNone = -1,
|
||||
eHowToPlay_TextWhatsNew = 0,
|
||||
eHowToPlay_TextBasics,
|
||||
eHowToPlay_TextMultiplayer,
|
||||
eHowToPlay_TextHUD,
|
||||
eHowToPlay_TextCreative,
|
||||
eHowToPlay_TextInventory,
|
||||
eHowToPlay_TextSmallChest,
|
||||
eHowToPlay_TextLargeChest,
|
||||
eHowToPlay_TextEnderchest,
|
||||
eHowToPlay_TextCrafting,
|
||||
eHowToPlay_TextCraftTable,
|
||||
eHowToPlay_TextFurnace,
|
||||
eHowToPlay_TextDispenser,
|
||||
eHowToPlay_TextBrewing,
|
||||
eHowToPlay_TextEnchantment,
|
||||
eHowToPlay_TextAnvil,
|
||||
eHowToPlay_TextFarmingAnimals,
|
||||
eHowToPlay_TextBreeding,
|
||||
eHowToPlay_TextTrading,
|
||||
eHowToPlay_TextNetherPortal,
|
||||
eHowToPlay_TextTheEnd,
|
||||
eHowToPlay_TextSocialMedia,
|
||||
eHowToPlay_TextBanList,
|
||||
eHowToPlay_TextHostOptions,
|
||||
eHowToPlay_NumTexts
|
||||
};
|
||||
|
||||
enum EHowToPlayImageControls
|
||||
{
|
||||
eHowToPlay_ImageNone = -1,
|
||||
eHowToPlay_ImageHUD = 0,
|
||||
eHowToPlay_ImageCreative,
|
||||
eHowToPlay_ImageInventory,
|
||||
eHowToPlay_ImageChest,
|
||||
eHowToPlay_ImageLargeChest,
|
||||
eHowToPlay_ImageEnderChest,
|
||||
eHowToPlay_ImageInventoryCrafting,
|
||||
eHowToPlay_ImageCraftingTable,
|
||||
eHowToPlay_ImageFurnace,
|
||||
eHowToPlay_ImageDispenser,
|
||||
eHowToPlay_ImageBrewing,
|
||||
eHowToPlay_ImageEnchantment,
|
||||
eHowToPlay_ImageAnvil,
|
||||
eHowToPlay_ImageFarmingAnimals,
|
||||
eHowToPlay_ImageBreeding,
|
||||
eHowToPlay_ImageTrading,
|
||||
eHowToPlay_ImageNetherPortal,
|
||||
eHowToPlay_ImageTheEnd,
|
||||
eHowToPlay_NumImages
|
||||
};
|
||||
|
||||
enum EHowToPlayLabelControls
|
||||
{
|
||||
eHowToPlay_LabelNone = -1,
|
||||
eHowToPlay_LabelIInventory =0,
|
||||
eHowToPlay_LabelSCInventory ,
|
||||
eHowToPlay_LabelSCChest ,
|
||||
eHowToPlay_LabelLCInventory ,
|
||||
eHowToPlay_LabelLCChest ,
|
||||
eHowToPlay_LabelCItem ,
|
||||
eHowToPlay_LabelCGroup ,
|
||||
eHowToPlay_LabelCInventory2x2 ,
|
||||
eHowToPlay_LabelCTItem ,
|
||||
eHowToPlay_LabelCTGroup ,
|
||||
eHowToPlay_LabelCTInventory3x3 ,
|
||||
eHowToPlay_LabelFFuel ,
|
||||
eHowToPlay_LabelFInventory ,
|
||||
eHowToPlay_LabelFIngredient ,
|
||||
eHowToPlay_LabelFChest ,
|
||||
eHowToPlay_LabelDText ,
|
||||
eHowToPlay_LabelDInventory ,
|
||||
eHowToPlay_LabelCreativeInventory,
|
||||
eHowToPlay_LabelEEnchant,
|
||||
eHowToPlay_LabelEInventory,
|
||||
eHowToPlay_LabelBBrew,
|
||||
eHowToPlay_LabelBInventory,
|
||||
eHowToPlay_LabelAnvil_Inventory,
|
||||
eHowToPlay_LabelAnvil_Cost,
|
||||
eHowToPlay_LabelAnvil_ARepairAndName,
|
||||
eHowToPlay_LabelTrading_Inventory,
|
||||
eHowToPlay_LabelTrading_Offer2,
|
||||
eHowToPlay_LabelTrading_Offer1,
|
||||
eHowToPlay_LabelTrading_NeededForTrade,
|
||||
eHowToPlay_LabelTrading_VillagerOffers,
|
||||
eHowToPlay_NumLabels
|
||||
};
|
||||
|
||||
struct SHowToPlayPageDef
|
||||
{
|
||||
int m_iTextControlIndex; // eHowToPlay_TextNone if not used.
|
||||
int m_iTextStringID; // -1 if not used.
|
||||
int m_iImageControlIndex; // eHowToPlay_ImageNone if not used.
|
||||
int m_iLabelStartIndex; // index of the labels if there are any for the page
|
||||
int m_iLabelCount;
|
||||
};
|
||||
|
||||
class CScene_HowToPlay : public CXuiSceneImpl
|
||||
{
|
||||
protected:
|
||||
int m_iPad;
|
||||
D3DXVECTOR3 m_OriginalPosition;
|
||||
EHowToPlayPage m_eCurrPage;
|
||||
|
||||
// Control and Element wrapper objects.
|
||||
CXuiHtmlElement m_aTextControls[ eHowToPlay_NumTexts ];
|
||||
CXuiControl m_aImageControls[ eHowToPlay_NumImages ];
|
||||
CXuiControl m_aLabelControls[ eHowToPlay_NumLabels ];
|
||||
|
||||
// Message map. Here we tie messages to message handlers.
|
||||
XUI_BEGIN_MSG_MAP()
|
||||
XUI_ON_XM_INIT( OnInit )
|
||||
XUI_ON_XM_KEYDOWN(OnKeyDown)
|
||||
XUI_ON_XM_SPLITSCREENPLAYER_MESSAGE(OnCustomMessage_Splitscreenplayer)
|
||||
XUI_END_MSG_MAP()
|
||||
|
||||
// Control mapping to objects
|
||||
BEGIN_CONTROL_MAP()
|
||||
MAP_CONTROL(IDC_XuiHtmlControlMultiplayer, m_aTextControls[ eHowToPlay_TextMultiplayer ] )
|
||||
MAP_CONTROL(IDC_XuiHtmlControlBasics, m_aTextControls[ eHowToPlay_TextBasics ] )
|
||||
MAP_CONTROL(IDC_XuiHtmlControlHUD, m_aTextControls[ eHowToPlay_TextHUD ] )
|
||||
MAP_CONTROL(IDC_XuiHtmlControlCreative, m_aTextControls[ eHowToPlay_TextCreative ] )
|
||||
MAP_CONTROL(IDC_XuiHtmlControlInventory, m_aTextControls[ eHowToPlay_TextInventory ] )
|
||||
MAP_CONTROL(IDC_XuiHtmlControlChest, m_aTextControls[ eHowToPlay_TextSmallChest ] )
|
||||
MAP_CONTROL(IDC_XuiHtmlControlLargeChest, m_aTextControls[ eHowToPlay_TextLargeChest ] )
|
||||
MAP_CONTROL(IDC_XuiHtmlControlEnderchest, m_aTextControls[ eHowToPlay_TextEnderchest ] )
|
||||
MAP_CONTROL(IDC_XuiHtmlControlCrafting, m_aTextControls[ eHowToPlay_TextCrafting ] )
|
||||
MAP_CONTROL(IDC_XuiHtmlControlCraftingTable, m_aTextControls[ eHowToPlay_TextCraftTable ] )
|
||||
MAP_CONTROL(IDC_XuiHtmlControlFurnace, m_aTextControls[ eHowToPlay_TextFurnace ] )
|
||||
MAP_CONTROL(IDC_XuiHtmlControlDispenser, m_aTextControls[ eHowToPlay_TextDispenser ] )
|
||||
MAP_CONTROL(IDC_XuiHtmlControlBrewing, m_aTextControls[ eHowToPlay_TextBrewing ] )
|
||||
MAP_CONTROL(IDC_XuiHtmlControlEnchantment, m_aTextControls[ eHowToPlay_TextEnchantment ] )
|
||||
MAP_CONTROL(IDC_XuiHtmlControlAnvil, m_aTextControls[ eHowToPlay_TextAnvil ] )
|
||||
MAP_CONTROL(IDC_XuiHtmlControlFarmingAnimals, m_aTextControls[ eHowToPlay_TextFarmingAnimals ] )
|
||||
MAP_CONTROL(IDC_XuiHtmlControlBreeding, m_aTextControls[ eHowToPlay_TextBreeding ] )
|
||||
MAP_CONTROL(IDC_XuiHtmlControlTrading, m_aTextControls[ eHowToPlay_TextTrading ] )
|
||||
MAP_CONTROL(IDC_XuiHtmlControlNetherPortal, m_aTextControls[ eHowToPlay_TextNetherPortal ] )
|
||||
MAP_CONTROL(IDC_XuiHtmlControlTheEnd, m_aTextControls[ eHowToPlay_TextTheEnd ] )
|
||||
MAP_CONTROL(IDC_XuiHtmlControlSocialMedia, m_aTextControls[ eHowToPlay_TextSocialMedia ] )
|
||||
MAP_CONTROL(IDC_XuiHtmlControlBanList, m_aTextControls[ eHowToPlay_TextBanList ] )
|
||||
MAP_CONTROL(IDC_XuiHtmlControlWhatsNew, m_aTextControls[ eHowToPlay_TextWhatsNew ] )
|
||||
MAP_CONTROL(IDC_XuiHtmlControlHostOptions, m_aTextControls[ eHowToPlay_TextHostOptions] )
|
||||
|
||||
MAP_CONTROL(IDC_XuiImageHUD, m_aImageControls[ eHowToPlay_ImageHUD ] )
|
||||
MAP_CONTROL(IDC_XuiImageCreative, m_aImageControls[ eHowToPlay_ImageCreative ] )
|
||||
MAP_CONTROL(IDC_XuiImageInventory, m_aImageControls[ eHowToPlay_ImageInventory ] )
|
||||
MAP_CONTROL(IDC_XuiImageChest, m_aImageControls[ eHowToPlay_ImageChest ] )
|
||||
MAP_CONTROL(IDC_XuiImageLargeChest, m_aImageControls[ eHowToPlay_ImageLargeChest ] )
|
||||
MAP_CONTROL(IDC_XuiImageEnderchest, m_aImageControls[ eHowToPlay_ImageEnderChest ] )
|
||||
MAP_CONTROL(IDC_XuiImageCrafting, m_aImageControls[ eHowToPlay_ImageInventoryCrafting ] )
|
||||
MAP_CONTROL(IDC_XuiImageCraftingTable, m_aImageControls[ eHowToPlay_ImageCraftingTable ] )
|
||||
MAP_CONTROL(IDC_XuiImageFurnace, m_aImageControls[ eHowToPlay_ImageFurnace ] )
|
||||
MAP_CONTROL(IDC_XuiImageDispenser, m_aImageControls[ eHowToPlay_ImageDispenser ] )
|
||||
MAP_CONTROL(IDC_XuiImageBrewing, m_aImageControls[ eHowToPlay_ImageBrewing ] )
|
||||
MAP_CONTROL(IDC_XuiImageEnchantment, m_aImageControls[ eHowToPlay_ImageEnchantment ] )
|
||||
MAP_CONTROL(IDC_XuiImageAnvil, m_aImageControls[ eHowToPlay_ImageAnvil ] )
|
||||
MAP_CONTROL(IDC_XuiImageBreeding, m_aImageControls[ eHowToPlay_ImageBreeding ] )
|
||||
MAP_CONTROL(IDC_XuiImageFarmingAnimals, m_aImageControls[ eHowToPlay_ImageFarmingAnimals ] )
|
||||
MAP_CONTROL(IDC_XuiImageTrading, m_aImageControls[ eHowToPlay_ImageTrading ] )
|
||||
MAP_CONTROL(IDC_XuiImageNetherPortal, m_aImageControls[ eHowToPlay_ImageNetherPortal ] )
|
||||
MAP_CONTROL(IDC_XuiImageTheEnd, m_aImageControls[ eHowToPlay_ImageTheEnd ] )
|
||||
|
||||
MAP_CONTROL(IDC_CTItem, m_aLabelControls[ eHowToPlay_LabelCTItem ] )
|
||||
MAP_CONTROL(IDC_CTGroup, m_aLabelControls[ eHowToPlay_LabelCTGroup ] )
|
||||
MAP_CONTROL(IDC_CTInventory3x3, m_aLabelControls[ eHowToPlay_LabelCTInventory3x3 ] )
|
||||
MAP_CONTROL(IDC_CItem, m_aLabelControls[ eHowToPlay_LabelCItem ] )
|
||||
MAP_CONTROL(IDC_CGroup, m_aLabelControls[ eHowToPlay_LabelCGroup ] )
|
||||
MAP_CONTROL(IDC_CInventory, m_aLabelControls[ eHowToPlay_LabelCInventory2x2 ] )
|
||||
MAP_CONTROL(IDC_FFuel, m_aLabelControls[ eHowToPlay_LabelFFuel ] )
|
||||
MAP_CONTROL(IDC_FInventory, m_aLabelControls[ eHowToPlay_LabelFInventory ] )
|
||||
MAP_CONTROL(IDC_FIngredient, m_aLabelControls[ eHowToPlay_LabelFIngredient ] )
|
||||
MAP_CONTROL(IDC_FChest, m_aLabelControls[ eHowToPlay_LabelFChest ] )
|
||||
MAP_CONTROL(IDC_LCInventory, m_aLabelControls[ eHowToPlay_LabelLCInventory ] )
|
||||
MAP_CONTROL(IDC_CIGroup, m_aLabelControls[ eHowToPlay_LabelCreativeInventory ] )
|
||||
MAP_CONTROL(IDC_LCChest, m_aLabelControls[ eHowToPlay_LabelLCChest ] )
|
||||
MAP_CONTROL(IDC_SCInventory, m_aLabelControls[ eHowToPlay_LabelSCInventory ] )
|
||||
MAP_CONTROL(IDC_SCChest, m_aLabelControls[ eHowToPlay_LabelSCChest ] )
|
||||
MAP_CONTROL(IDC_IInventory, m_aLabelControls[ eHowToPlay_LabelIInventory ] )
|
||||
MAP_CONTROL(IDC_DInventory, m_aLabelControls[ eHowToPlay_LabelDInventory ] )
|
||||
MAP_CONTROL(IDC_DText, m_aLabelControls[ eHowToPlay_LabelDText ] )
|
||||
MAP_CONTROL(IDC_EEnchant, m_aLabelControls[ eHowToPlay_LabelEEnchant ] )
|
||||
MAP_CONTROL(IDC_EInventory, m_aLabelControls[ eHowToPlay_LabelEInventory ] )
|
||||
MAP_CONTROL(IDC_BBrew, m_aLabelControls[ eHowToPlay_LabelBBrew ] )
|
||||
MAP_CONTROL(IDC_BInventory, m_aLabelControls[ eHowToPlay_LabelBInventory ] )
|
||||
MAP_CONTROL(IDC_AInventory, m_aLabelControls[ eHowToPlay_LabelAnvil_Inventory ] )
|
||||
MAP_CONTROL(IDC_ACost, m_aLabelControls[ eHowToPlay_LabelAnvil_Cost ] )
|
||||
MAP_CONTROL(IDC_ARepairAndName, m_aLabelControls[ eHowToPlay_LabelAnvil_ARepairAndName ] )
|
||||
MAP_CONTROL(IDC_TInventory, m_aLabelControls[ eHowToPlay_LabelTrading_Inventory ] )
|
||||
//MAP_CONTROL(IDC_TOffer2Label, m_aLabelControls[ eHowToPlay_LabelTrading_Offer2 ] )
|
||||
MAP_CONTROL(IDC_TOffer1Label, m_aLabelControls[ eHowToPlay_LabelTrading_Offer1 ] )
|
||||
MAP_CONTROL(IDC_TNeededForTrade, m_aLabelControls[ eHowToPlay_LabelTrading_NeededForTrade ] )
|
||||
MAP_CONTROL(IDC_TVillagerOffers, m_aLabelControls[ eHowToPlay_LabelTrading_VillagerOffers ] )
|
||||
|
||||
|
||||
END_CONTROL_MAP()
|
||||
|
||||
HRESULT OnInit( XUIMessageInit* pInitData, BOOL& bHandled );
|
||||
HRESULT OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandled);
|
||||
HRESULT OnCustomMessage_Splitscreenplayer(bool bJoining, BOOL& bHandled);
|
||||
|
||||
void StartPage( EHowToPlayPage ePage );
|
||||
public:
|
||||
|
||||
// Define the class. The class name must match the ClassOverride property
|
||||
// set for the scene in the UI Authoring tool.
|
||||
XUI_IMPLEMENT_CLASS( CScene_HowToPlay, L"CScene_HowToPlay", XUI_CLASS_SCENE )
|
||||
|
||||
|
||||
|
||||
};
|
||||
38
Minecraft.Client/Common/XUI/XUI_Helper.h
Normal file
38
Minecraft.Client/Common/XUI/XUI_Helper.h
Normal file
@@ -0,0 +1,38 @@
|
||||
#pragma once
|
||||
|
||||
#define BEGIN_CONTROL_MAP() \
|
||||
HRESULT MapChildControls() \
|
||||
{ \
|
||||
HRESULT hr = S_OK; \
|
||||
CXuiElement e = m_hObj; \
|
||||
|
||||
|
||||
|
||||
#define MAP_CONTROL(name, member) \
|
||||
hr = e.GetChildById(name, &member); \
|
||||
assert(hr==0); \
|
||||
|
||||
#define BEGIN_MAP_CHILD_CONTROLS( member ) \
|
||||
{ \
|
||||
CXuiElement tempE = e; \
|
||||
e = member; \
|
||||
|
||||
#define END_MAP_CHILD_CONTROLS() \
|
||||
e = tempE; \
|
||||
} \
|
||||
|
||||
|
||||
#define MAP_OVERRIDE(name, member) \
|
||||
{ \
|
||||
HXUIOBJ h; \
|
||||
hr = e.GetChildById(name, &h); \
|
||||
assert(hr==0); \
|
||||
hr = XuiObjectFromHandle(h, reinterpret_cast<PVOID*>(&member)); \
|
||||
assert(hr==0); \
|
||||
} \
|
||||
|
||||
|
||||
#define END_CONTROL_MAP() \
|
||||
return hr; \
|
||||
} \
|
||||
|
||||
232
Minecraft.Client/Common/XUI/XUI_HowToPlayMenu.cpp
Normal file
232
Minecraft.Client/Common/XUI/XUI_HowToPlayMenu.cpp
Normal file
@@ -0,0 +1,232 @@
|
||||
#include "stdafx.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include "..\XUI\XUI_HowToPlayMenu.h"
|
||||
#include "..\XUI\XUI_HelpHowToPlay.h"
|
||||
|
||||
// strings for buttons in the list
|
||||
unsigned int CScene_HowToPlayMenu::m_uiHTPButtonNameA[]=
|
||||
{
|
||||
IDS_HOW_TO_PLAY_MENU_WHATSNEW, // eHTPButton_WhatsNew
|
||||
IDS_HOW_TO_PLAY_MENU_BASICS, // eHTPButton_Basics,
|
||||
IDS_HOW_TO_PLAY_MENU_MULTIPLAYER, // eHTPButton_Multiplayer
|
||||
IDS_HOW_TO_PLAY_MENU_HUD, // eHTPButton_Hud,
|
||||
IDS_HOW_TO_PLAY_MENU_CREATIVE, // eHTPButton_Creative,
|
||||
IDS_HOW_TO_PLAY_MENU_INVENTORY, // eHTPButton_Inventory,
|
||||
IDS_HOW_TO_PLAY_MENU_CHESTS, // eHTPButton_Chest,
|
||||
IDS_HOW_TO_PLAY_MENU_CRAFTING, // eHTPButton_Crafting,
|
||||
IDS_HOW_TO_PLAY_MENU_FURNACE, // eHTPButton_Furnace,
|
||||
IDS_HOW_TO_PLAY_MENU_DISPENSER, // eHTPButton_Dispenser,
|
||||
|
||||
IDS_HOW_TO_PLAY_MENU_BREWING, // eHTPButton_Brewing,
|
||||
IDS_HOW_TO_PLAY_MENU_ENCHANTMENT, // eHTPButton_Enchantment,
|
||||
IDS_HOW_TO_PLAY_MENU_ANVIL,
|
||||
IDS_HOW_TO_PLAY_MENU_FARMANIMALS, // eHTPButton_Breeding,
|
||||
IDS_HOW_TO_PLAY_MENU_BREEDANIMALS, // eHTPButton_Breeding,
|
||||
IDS_HOW_TO_PLAY_MENU_TRADING,
|
||||
|
||||
IDS_HOW_TO_PLAY_MENU_NETHERPORTAL, // eHTPButton_NetherPortal,
|
||||
IDS_HOW_TO_PLAY_MENU_THEEND, // eHTPButton_TheEnd,
|
||||
IDS_HOW_TO_PLAY_MENU_SOCIALMEDIA, // eHTPButton_SocialMedia,
|
||||
IDS_HOW_TO_PLAY_MENU_BANLIST, // eHTPButton_BanningLevels,
|
||||
IDS_HOW_TO_PLAY_MENU_HOSTOPTIONS, // eHTPButton_HostOptions,
|
||||
};
|
||||
|
||||
// mapping the buttons to a scene value
|
||||
unsigned int CScene_HowToPlayMenu::m_uiHTPSceneA[]=
|
||||
{
|
||||
eHowToPlay_WhatsNew,
|
||||
eHowToPlay_Basics,
|
||||
eHowToPlay_Multiplayer,
|
||||
eHowToPlay_HUD,
|
||||
eHowToPlay_Creative,
|
||||
eHowToPlay_Inventory,
|
||||
eHowToPlay_Chest,
|
||||
eHowToPlay_InventoryCrafting,
|
||||
eHowToPlay_Furnace,
|
||||
eHowToPlay_Dispenser,
|
||||
|
||||
eHowToPlay_Brewing,
|
||||
eHowToPlay_Enchantment,
|
||||
eHowToPlay_Anvil,
|
||||
eHowToPlay_FarmingAnimals,
|
||||
eHowToPlay_Breeding,
|
||||
eHowToPlay_Trading,
|
||||
|
||||
eHowToPlay_NetherPortal,
|
||||
eHowToPlay_TheEnd,
|
||||
eHowToPlay_SocialMedia,
|
||||
eHowToPlay_BanList,
|
||||
eHowToPlay_HostOptions,
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Performs initialization tasks - retrieves controls.
|
||||
//----------------------------------------------------------------------------------
|
||||
HRESULT CScene_HowToPlayMenu::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
|
||||
{
|
||||
m_iPad = *(int *)pInitData->pvInitData;
|
||||
// if we're not in the game, we need to use basescene 0
|
||||
bool bNotInGame=(Minecraft::GetInstance()->level==NULL);
|
||||
bool bSplitscreen= app.GetLocalPlayerCount()>1;
|
||||
m_ButtonList=NULL;
|
||||
|
||||
//MapChildControls();
|
||||
|
||||
//m_iButtons=0;
|
||||
if(bSplitscreen)
|
||||
{
|
||||
app.AdjustSplitscreenScene(m_hObj,&m_OriginalPosition,m_iPad, false);
|
||||
}
|
||||
|
||||
// 4J-PB - changing all versions to use a list of buttons, since we're adding some
|
||||
// We're going to use a list of buttons here
|
||||
CXuiElement e = m_hObj;
|
||||
HRESULT hr = e.GetChildById(L"HowToListButtons", &m_ButtonList);
|
||||
m_iButtons=eHTPButton_Max;
|
||||
for(int i=0;i<eHTPButton_Max;i++)
|
||||
{
|
||||
//m_Buttons[i].SetShow(FALSE);
|
||||
//m_Buttons[i].SetEnable(FALSE);
|
||||
m_ButtonList.InsertItems( m_ButtonList.GetItemCount(), 1 );
|
||||
}
|
||||
|
||||
// set the focus to the list
|
||||
m_ButtonList.SetFocus(m_iPad);
|
||||
|
||||
if((!RenderManager.IsHiDef() && !RenderManager.IsWidescreen()) || bSplitscreen)
|
||||
{
|
||||
if(bNotInGame)
|
||||
{
|
||||
CXuiSceneBase::ShowLogo( DEFAULT_XUI_MENU_USER, FALSE );
|
||||
}
|
||||
else
|
||||
{
|
||||
CXuiSceneBase::ShowLogo( m_iPad, FALSE );
|
||||
}
|
||||
}
|
||||
else if(bNotInGame)
|
||||
{
|
||||
CXuiSceneBase::ShowLogo( DEFAULT_XUI_MENU_USER, TRUE );
|
||||
}
|
||||
else
|
||||
{
|
||||
CXuiSceneBase::ShowLogo( m_iPad, TRUE );
|
||||
}
|
||||
// Display the tooltips
|
||||
// if we're not in the game, we need to use basescene 0
|
||||
if(bNotInGame)
|
||||
{
|
||||
ui.SetTooltips( DEFAULT_XUI_MENU_USER, IDS_TOOLTIPS_SELECT,IDS_TOOLTIPS_BACK);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui.SetTooltips( m_iPad, IDS_TOOLTIPS_SELECT,IDS_TOOLTIPS_BACK);
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CScene_HowToPlayMenu::OnGetSourceDataText(XUIMessageGetSourceText *pGetSourceTextData, BOOL& bHandled)
|
||||
{
|
||||
if( pGetSourceTextData->bItemData )
|
||||
{
|
||||
if( pGetSourceTextData->iItem < (int)eHTPButton_Max )
|
||||
{
|
||||
pGetSourceTextData->szText = app.GetString(m_uiHTPButtonNameA[pGetSourceTextData->iItem]);//m_Buttons[pGetSourceTextData->iItem].GetText();
|
||||
pGetSourceTextData->bDisplay = TRUE;
|
||||
|
||||
bHandled = TRUE;
|
||||
}
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CScene_HowToPlayMenu::OnGetItemCountAll(XUIMessageGetItemCount *pGetItemCountData, BOOL& bHandled)
|
||||
{
|
||||
pGetItemCountData->cItems = m_iButtons;
|
||||
bHandled = TRUE;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
HRESULT CScene_HowToPlayMenu::OnNotifySelChanged(HXUIOBJ hObjSource, XUINotifySelChanged *pNotifySelChangedData, BOOL& bHandled)
|
||||
{
|
||||
// In a list, we need to play the 'focus' sound ourselves
|
||||
if((pNotifySelChangedData->iOldItem!=-1) && m_ButtonList && (hObjSource==m_ButtonList.m_hObj))
|
||||
{
|
||||
CXuiSceneBase::PlayUISFX(eSFX_Focus);
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
//----------------------------------------------------------------------------------
|
||||
// Handler for the button press message.
|
||||
//----------------------------------------------------------------------------------
|
||||
HRESULT CScene_HowToPlayMenu::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* pNotifyPressData, BOOL& rfHandled)
|
||||
{
|
||||
// This assumes all buttons can only be pressed with the A button
|
||||
ui.AnimateKeyPress(pNotifyPressData->UserIndex, VK_PAD_A);
|
||||
unsigned int uiInitData;
|
||||
unsigned int uiButtonCounter=0;
|
||||
|
||||
// 4J-PB - now using a list for all resolutions
|
||||
//if((!RenderManager.IsHiDef() && !RenderManager.IsWidescreen()) || app.GetLocalPlayerCount()>1)
|
||||
{
|
||||
if(hObjPressed==m_ButtonList && m_ButtonList.TreeHasFocus() && (m_ButtonList.GetItemCount() > 0) && (m_ButtonList.GetCurSel() < (int)eHTPButton_Max) )
|
||||
{
|
||||
uiButtonCounter=m_ButtonList.GetCurSel();
|
||||
}
|
||||
}
|
||||
/*else
|
||||
{
|
||||
while((uiButtonCounter<BUTTONS_HTP_MAX) && (m_Buttons[uiButtonCounter]!=hObjPressed)) uiButtonCounter++;
|
||||
}*/
|
||||
|
||||
// Determine which button was pressed,
|
||||
// and call the appropriate function.
|
||||
|
||||
uiInitData = ( ( 1 << 31 ) | ( m_uiHTPSceneA[uiButtonCounter] << 16 ) | ( short )( m_iPad ) );
|
||||
if(app.GetLocalPlayerCount()>1)
|
||||
{
|
||||
app.NavigateToScene(pNotifyPressData->UserIndex,eUIScene_HowToPlay, ( void* )( uiInitData ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
app.NavigateToScene(pNotifyPressData->UserIndex,eUIScene_HowToPlay, ( void* )( uiInitData ) );
|
||||
}
|
||||
|
||||
rfHandled=TRUE;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CScene_HowToPlayMenu::OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandled)
|
||||
{
|
||||
ui.AnimateKeyPress(pInputData->UserIndex, pInputData->dwKeyCode);
|
||||
|
||||
switch(pInputData->dwKeyCode)
|
||||
{
|
||||
|
||||
case VK_PAD_B:
|
||||
case VK_ESCAPE:
|
||||
app.NavigateBack(pInputData->UserIndex);
|
||||
rfHandled = TRUE;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CScene_HowToPlayMenu::OnNavReturn(HXUIOBJ hObj,BOOL& rfHandled)
|
||||
{
|
||||
ui.SetTooltips( m_iPad, IDS_TOOLTIPS_SELECT,IDS_TOOLTIPS_BACK);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CScene_HowToPlayMenu::OnCustomMessage_Splitscreenplayer(bool bJoining, BOOL& bHandled)
|
||||
{
|
||||
bHandled=true;
|
||||
return app.AdjustSplitscreenScene_PlayerChanged(m_hObj,&m_OriginalPosition,m_iPad,bJoining,false);
|
||||
}
|
||||
76
Minecraft.Client/Common/XUI/XUI_HowToPlayMenu.h
Normal file
76
Minecraft.Client/Common/XUI/XUI_HowToPlayMenu.h
Normal file
@@ -0,0 +1,76 @@
|
||||
#pragma once
|
||||
|
||||
#include "../media/xuiscene_howtoplay_menu.h"
|
||||
#include "XUI_CustomMessages.h"
|
||||
|
||||
class CScene_HowToPlayMenu : public CXuiSceneImpl
|
||||
{
|
||||
protected:
|
||||
|
||||
enum eHTPButton
|
||||
{
|
||||
eHTPButton_WhatsNew = 0,
|
||||
eHTPButton_Basics,
|
||||
eHTPButton_Multiplayer,
|
||||
eHTPButton_Hud,
|
||||
eHTPButton_Creative,
|
||||
eHTPButton_Inventory,
|
||||
eHTPButton_Chest,
|
||||
eHTPButton_Crafting,
|
||||
eHTPButton_Furnace,
|
||||
eHTPButton_Dispenser,
|
||||
eHTPButton_Brewing,
|
||||
eHTPButton_Enchantment,
|
||||
eHTPButton_Anvil,
|
||||
eHTPButton_FarmingAnimals,
|
||||
eHTPButton_Breeding,
|
||||
eHTPButton_Trading,
|
||||
eHTPButton_NetherPortal,
|
||||
eHTPButton_TheEnd,
|
||||
eHTPButton_SocialMedia,
|
||||
eHTPButton_BanningLevels,
|
||||
eHTPButton_HostOptions,
|
||||
eHTPButton_Max,
|
||||
};
|
||||
|
||||
// Control and Element wrapper objects.
|
||||
CXuiScene m_Scene;
|
||||
CXuiElement m_Background;
|
||||
CXuiList m_ButtonList;
|
||||
|
||||
// Message map. Here we tie messages to message handlers.
|
||||
XUI_BEGIN_MSG_MAP()
|
||||
XUI_ON_XM_INIT( OnInit )
|
||||
XUI_ON_XM_NOTIFY_PRESS_EX(OnNotifyPressEx)
|
||||
XUI_ON_XM_KEYDOWN(OnKeyDown)
|
||||
XUI_ON_XM_NAV_RETURN(OnNavReturn)
|
||||
XUI_ON_XM_SPLITSCREENPLAYER_MESSAGE(OnCustomMessage_Splitscreenplayer)
|
||||
XUI_ON_XM_GET_SOURCE_TEXT(OnGetSourceDataText)
|
||||
XUI_ON_XM_GET_ITEMCOUNT_ALL(OnGetItemCountAll)
|
||||
XUI_ON_XM_NOTIFY_SELCHANGED(OnNotifySelChanged)
|
||||
|
||||
XUI_END_MSG_MAP()
|
||||
|
||||
HRESULT OnInit( XUIMessageInit* pInitData, BOOL& bHandled );
|
||||
HRESULT OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* pNotifyPressData,BOOL& rfHandled);
|
||||
HRESULT OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandled);
|
||||
HRESULT OnNavReturn(HXUIOBJ hObj,BOOL& rfHandled);
|
||||
HRESULT OnCustomMessage_Splitscreenplayer(bool bJoining, BOOL& bHandled);
|
||||
HRESULT OnGetSourceDataText(XUIMessageGetSourceText *pGetSourceTextData, BOOL& bHandled);
|
||||
HRESULT OnGetItemCountAll(XUIMessageGetItemCount *pGetItemCountData, BOOL& bHandled);
|
||||
HRESULT OnNotifySelChanged(HXUIOBJ hObjSource, XUINotifySelChanged *pNotifySelChangedData, BOOL& bHandled);
|
||||
|
||||
public:
|
||||
|
||||
// Define the class. The class name must match the ClassOverride property
|
||||
// set for the scene in the UI Authoring tool.
|
||||
XUI_IMPLEMENT_CLASS( CScene_HowToPlayMenu, L"CScene_HowToPlayMenu", XUI_CLASS_SCENE )
|
||||
|
||||
private:
|
||||
|
||||
int m_iPad;
|
||||
D3DXVECTOR3 m_OriginalPosition;
|
||||
static unsigned int m_uiHTPButtonNameA[eHTPButton_Max];
|
||||
static unsigned int m_uiHTPSceneA[eHTPButton_Max];
|
||||
int m_iButtons;
|
||||
};
|
||||
150
Minecraft.Client/Common/XUI/XUI_InGameHostOptions.cpp
Normal file
150
Minecraft.Client/Common/XUI/XUI_InGameHostOptions.cpp
Normal file
@@ -0,0 +1,150 @@
|
||||
#include "stdafx.h"
|
||||
#include "XUI_MultiGameCreate.h"
|
||||
#include "XUI_InGameHostOptions.h"
|
||||
#include "..\..\Minecraft.h"
|
||||
#include "..\..\MultiPlayerLocalPlayer.h"
|
||||
#include "..\..\ClientConnection.h"
|
||||
#include "..\..\..\Minecraft.World\net.minecraft.network.h"
|
||||
#include "..\..\..\Minecraft.World\net.minecraft.network.packet.h"
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Performs initialization tasks - retrieves controls.
|
||||
//----------------------------------------------------------------------------------
|
||||
HRESULT CScene_InGameHostOptions::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
|
||||
{
|
||||
m_iPad = *(int *)pInitData->pvInitData;
|
||||
|
||||
MapChildControls();
|
||||
|
||||
m_focusElement = m_CheckboxFireSpreads.m_hObj;
|
||||
|
||||
XuiControlSetText(m_CheckboxFireSpreads,app.GetString(IDS_FIRE_SPREADS));
|
||||
XuiControlSetText(m_CheckboxTNTExplodes,app.GetString(IDS_TNT_EXPLODES));
|
||||
|
||||
if(app.GetLocalPlayerCount()>1)
|
||||
{
|
||||
app.AdjustSplitscreenScene(m_hObj,&m_OriginalPosition,m_iPad);
|
||||
}
|
||||
|
||||
m_CheckboxFireSpreads.SetEnable(TRUE);
|
||||
m_CheckboxTNTExplodes.SetEnable(TRUE);
|
||||
m_CheckboxFireSpreads.SetCheck((app.GetGameHostOption(eGameHostOption_FireSpreads)!=0)?TRUE:FALSE);
|
||||
m_CheckboxTNTExplodes.SetCheck((app.GetGameHostOption(eGameHostOption_TNT)!=0)?TRUE:FALSE);
|
||||
|
||||
INetworkPlayer *localPlayer = g_NetworkManager.GetLocalPlayerByUserIndex( m_iPad );
|
||||
unsigned int privs = app.GetPlayerPrivileges(localPlayer->GetSmallId());
|
||||
if ( app.GetGameHostOption(eGameHostOption_CheatsEnabled)
|
||||
&& Player::getPlayerGamePrivilege(privs,Player::ePlayerGamePrivilege_CanTeleport)
|
||||
&& (g_NetworkManager.GetPlayerCount() > 1) )
|
||||
{
|
||||
m_buttonTeleportToPlayer.SetText(app.GetString(IDS_TELEPORT_TO_PLAYER));
|
||||
m_buttonTeleportToMe.SetText(app.GetString(IDS_TELEPORT_TO_ME));
|
||||
}
|
||||
else
|
||||
{
|
||||
removeControl(m_buttonTeleportToPlayer, true);
|
||||
removeControl(m_buttonTeleportToMe, true);
|
||||
}
|
||||
|
||||
ui.SetTooltips( m_iPad, IDS_TOOLTIPS_SELECT,IDS_TOOLTIPS_BACK);
|
||||
|
||||
CXuiSceneBase::ShowLogo( m_iPad, FALSE );
|
||||
|
||||
|
||||
//SentientManager.RecordMenuShown(m_iPad, eUIScene_CreateWorldMenu, 0);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
HRESULT CScene_InGameHostOptions::OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandled)
|
||||
{
|
||||
ui.AnimateKeyPress(pInputData->UserIndex, pInputData->dwKeyCode);
|
||||
|
||||
// Explicitly handle B button presses
|
||||
switch(pInputData->dwKeyCode)
|
||||
{
|
||||
case VK_PAD_B:
|
||||
case VK_ESCAPE:
|
||||
{
|
||||
unsigned int hostOptions = app.GetGameHostOption(eGameHostOption_All);
|
||||
app.SetGameHostOption(hostOptions,eGameHostOption_FireSpreads,m_CheckboxFireSpreads.IsChecked());
|
||||
app.SetGameHostOption(hostOptions,eGameHostOption_TNT,m_CheckboxTNTExplodes.IsChecked());
|
||||
|
||||
// Send update settings packet to server
|
||||
if(hostOptions != app.GetGameHostOption(eGameHostOption_All) )
|
||||
{
|
||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||
shared_ptr<MultiplayerLocalPlayer> player = pMinecraft->localplayers[m_iPad];
|
||||
if(player != NULL && player->connection)
|
||||
{
|
||||
player->connection->send( shared_ptr<ServerSettingsChangedPacket>( new ServerSettingsChangedPacket( ServerSettingsChangedPacket::HOST_IN_GAME_SETTINGS, hostOptions) ) );
|
||||
}
|
||||
}
|
||||
|
||||
app.NavigateBack(pInputData->UserIndex);
|
||||
rfHandled = TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Handler for the button press message.
|
||||
//----------------------------------------------------------------------------------
|
||||
HRESULT CScene_InGameHostOptions::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* pNotifyPressData, BOOL& rfHandled)
|
||||
{
|
||||
// This assumes all buttons can only be pressed with the A button
|
||||
ui.AnimateKeyPress(pNotifyPressData->UserIndex, VK_PAD_A);
|
||||
|
||||
if(hObjPressed == m_buttonTeleportToPlayer || hObjPressed == m_buttonTeleportToMe)
|
||||
{
|
||||
TeleportMenuInitData *initData = new TeleportMenuInitData();
|
||||
initData->iPad = m_iPad;
|
||||
initData->teleportToPlayer = false;
|
||||
if( hObjPressed == m_buttonTeleportToPlayer )
|
||||
{
|
||||
initData->teleportToPlayer = true;
|
||||
}
|
||||
ui.NavigateToScene(m_iPad,eUIScene_TeleportMenu,(void*)initData);
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void CScene_InGameHostOptions::removeControl(HXUIOBJ hObjToRemove, bool center)
|
||||
{
|
||||
D3DXVECTOR3 pos;
|
||||
float fControlHeight, fTempHeight, fWidth;
|
||||
|
||||
bool changeFocus = m_focusElement == hObjToRemove;
|
||||
|
||||
XuiElementGetBounds(hObjToRemove,&fWidth,&fControlHeight);
|
||||
|
||||
// Hide this control
|
||||
XuiControlSetEnable(hObjToRemove, FALSE);
|
||||
XuiElementSetShow(hObjToRemove, FALSE);
|
||||
|
||||
// Move future downwards nav up
|
||||
HXUIOBJ controlToMove = hObjToRemove;
|
||||
while(controlToMove = XuiControlGetNavigation(controlToMove, XUI_CONTROL_NAVIGATE_DOWN, FALSE, TRUE) )
|
||||
{
|
||||
if(changeFocus && XuiElementIsShown(controlToMove))
|
||||
{
|
||||
m_focusElement = controlToMove;
|
||||
XuiElementSetUserFocus( controlToMove, m_iPad );
|
||||
changeFocus = FALSE;
|
||||
}
|
||||
XuiElementGetPosition(controlToMove, &pos);
|
||||
pos.y -= fControlHeight;
|
||||
XuiElementSetPosition(controlToMove, &pos);
|
||||
}
|
||||
|
||||
// Resize and move scene
|
||||
GetBounds(&fWidth, &fTempHeight);
|
||||
SetBounds(fWidth, fTempHeight - fControlHeight);
|
||||
|
||||
GetPosition(&pos);
|
||||
pos.y += fControlHeight/2;
|
||||
SetPosition(&pos);
|
||||
}
|
||||
45
Minecraft.Client/Common/XUI/XUI_InGameHostOptions.h
Normal file
45
Minecraft.Client/Common/XUI/XUI_InGameHostOptions.h
Normal file
@@ -0,0 +1,45 @@
|
||||
#pragma once
|
||||
#include "..\Media\xuiscene_ingame_host_options.h"
|
||||
|
||||
class CScene_InGameHostOptions : public CXuiSceneImpl
|
||||
{
|
||||
protected:
|
||||
CXuiScene m_GameOptionsGroup;
|
||||
CXuiCheckbox m_CheckboxFireSpreads;
|
||||
CXuiCheckbox m_CheckboxTNTExplodes;
|
||||
CXuiControl m_buttonTeleportToPlayer, m_buttonTeleportToMe;
|
||||
|
||||
XUI_BEGIN_MSG_MAP()
|
||||
XUI_ON_XM_INIT( OnInit )
|
||||
XUI_ON_XM_KEYDOWN(OnKeyDown)
|
||||
XUI_ON_XM_NOTIFY_PRESS_EX(OnNotifyPressEx)
|
||||
XUI_END_MSG_MAP()
|
||||
|
||||
BEGIN_CONTROL_MAP()
|
||||
MAP_CONTROL(IDC_GameOptions, m_GameOptionsGroup)
|
||||
BEGIN_MAP_CHILD_CONTROLS(m_GameOptionsGroup)
|
||||
MAP_CONTROL(IDC_CheckboxFireSpreads, m_CheckboxFireSpreads)
|
||||
MAP_CONTROL(IDC_CheckboxTNT, m_CheckboxTNTExplodes)
|
||||
MAP_CONTROL(IDC_ButtonTeleportToPlayer, m_buttonTeleportToPlayer)
|
||||
MAP_CONTROL(IDC_ButtonTeleportPlayerToMe, m_buttonTeleportToMe)
|
||||
END_MAP_CHILD_CONTROLS()
|
||||
END_CONTROL_MAP()
|
||||
|
||||
|
||||
HRESULT OnInit( XUIMessageInit* pInitData, BOOL& bHandled );
|
||||
HRESULT OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandled);
|
||||
HRESULT OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* pNotifyPressData, BOOL& rfHandled);
|
||||
|
||||
public:
|
||||
|
||||
// Define the class. The class name must match the ClassOverride property
|
||||
// set for the scene in the UI Authoring tool.
|
||||
XUI_IMPLEMENT_CLASS( CScene_InGameHostOptions, L"CScene_InGameHostOptions", XUI_CLASS_SCENE )
|
||||
|
||||
private:
|
||||
int m_iPad;
|
||||
D3DXVECTOR3 m_OriginalPosition;
|
||||
HXUIOBJ m_focusElement; // Only used for the remove control process
|
||||
|
||||
void removeControl(HXUIOBJ hObjToRemove, bool center);
|
||||
};
|
||||
537
Minecraft.Client/Common/XUI/XUI_InGameInfo.cpp
Normal file
537
Minecraft.Client/Common/XUI/XUI_InGameInfo.cpp
Normal file
@@ -0,0 +1,537 @@
|
||||
#include "stdafx.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include "XUI_InGameInfo.h"
|
||||
#include "..\..\ServerPlayer.h"
|
||||
#include "..\..\PlayerConnection.h"
|
||||
#include "..\..\PlayerList.h"
|
||||
#include "..\..\MinecraftServer.h"
|
||||
#include "..\..\..\Minecraft.World\StringHelpers.h"
|
||||
#include "..\..\PlayerRenderer.h"
|
||||
#include "XUI_InGamePlayerOptions.h"
|
||||
#include "..\..\Minecraft.h"
|
||||
#include "..\..\MultiPlayerLocalPlayer.h"
|
||||
#include "..\..\ClientConnection.h"
|
||||
#include "..\..\..\Minecraft.World\net.minecraft.network.packet.h"
|
||||
#include "..\..\Xbox\Network\NetworkPlayerXbox.h"
|
||||
|
||||
#define IGNORE_KEYPRESS_TIMERID 0
|
||||
#define TOOLTIP_TIMERID 1
|
||||
#define IGNORE_KEYPRESS_TIME 100
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Performs initialization tasks - retrieves controls.
|
||||
//----------------------------------------------------------------------------------
|
||||
HRESULT CScene_InGameInfo::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
|
||||
{
|
||||
m_bIgnoreKeyPresses=true;
|
||||
m_iPad = *(int *)pInitData->pvInitData;
|
||||
|
||||
MapChildControls();
|
||||
|
||||
XuiControlSetText(m_gameOptionsButton,app.GetString(IDS_HOST_OPTIONS));
|
||||
XuiControlSetText(m_title,app.GetString(IDS_PLAYERS_INVITE));
|
||||
|
||||
if(app.GetLocalPlayerCount()>1)
|
||||
{
|
||||
app.AdjustSplitscreenScene(m_hObj,&m_OriginalPosition,m_iPad);
|
||||
}
|
||||
|
||||
DWORD playerCount = g_NetworkManager.GetPlayerCount();
|
||||
|
||||
m_playersCount = 0;
|
||||
for(DWORD i = 0; i < playerCount; ++i)
|
||||
{
|
||||
INetworkPlayer *player = g_NetworkManager.GetPlayerByIndex( i );
|
||||
|
||||
if( player != NULL )
|
||||
{
|
||||
m_players[i] = player->GetSmallId();
|
||||
++m_playersCount;
|
||||
}
|
||||
}
|
||||
|
||||
g_NetworkManager.RegisterPlayerChangedCallback(m_iPad, &CScene_InGameInfo::OnPlayerChanged, this);
|
||||
|
||||
INetworkPlayer *thisPlayer = g_NetworkManager.GetLocalPlayerByUserIndex( m_iPad );
|
||||
m_isHostPlayer = false;
|
||||
if(thisPlayer != NULL) m_isHostPlayer = thisPlayer->IsHost() == TRUE;
|
||||
|
||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||
shared_ptr<MultiplayerLocalPlayer> localPlayer = pMinecraft->localplayers[m_iPad];
|
||||
if(!m_isHostPlayer && !localPlayer->isModerator() )
|
||||
{
|
||||
m_gameOptionsButton.SetEnable(FALSE);
|
||||
m_gameOptionsButton.SetShow(FALSE);
|
||||
playersList.SetFocus(m_iPad);
|
||||
}
|
||||
|
||||
int keyX = IDS_TOOLTIPS_INVITE_FRIENDS;
|
||||
XPARTY_USER_LIST partyList;
|
||||
if((XPartyGetUserList( &partyList ) != XPARTY_E_NOT_IN_PARTY ) && (partyList.dwUserCount>1))
|
||||
{
|
||||
keyX = IDS_TOOLTIPS_INVITE_PARTY;
|
||||
}
|
||||
if(g_NetworkManager.IsLocalGame()) keyX = -1;
|
||||
|
||||
int keyA = -1;
|
||||
ui.SetTooltips( m_iPad, keyA,IDS_TOOLTIPS_BACK,keyX,-1);
|
||||
|
||||
|
||||
CXuiSceneBase::ShowDarkOverlay( m_iPad, TRUE );
|
||||
|
||||
SetTimer( TOOLTIP_TIMERID , INGAME_INFO_TOOLTIP_TIMER );
|
||||
|
||||
// get rid of the quadrant display if it's on
|
||||
CXuiSceneBase::HidePressStart();
|
||||
|
||||
SetTimer(IGNORE_KEYPRESS_TIMERID,IGNORE_KEYPRESS_TIME);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CScene_InGameInfo::OnDestroy()
|
||||
{
|
||||
XuiKillTimer(m_hObj,TOOLTIP_TIMERID);
|
||||
g_NetworkManager.UnRegisterPlayerChangedCallback(m_iPad, &CScene_InGameInfo::OnPlayerChanged, this);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Updates the UI when the list selection changes.
|
||||
//----------------------------------------------------------------------------------
|
||||
HRESULT CScene_InGameInfo::OnNotifySelChanged( HXUIOBJ hObjSource, XUINotifySelChanged* pNotifySelChangedData, BOOL& bHandled )
|
||||
{
|
||||
if( hObjSource == playersList)
|
||||
{
|
||||
updateTooltips();
|
||||
|
||||
bHandled = TRUE;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CScene_InGameInfo::OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandled)
|
||||
{
|
||||
if(m_bIgnoreKeyPresses) return S_OK;
|
||||
|
||||
// 4J-PB - ignore repeats to stop the scene displaying and quitting right away if you hold the back button down
|
||||
if((pInputData->dwKeyCode==VK_PAD_BACK) &&(pInputData->dwFlags&XUI_INPUT_FLAG_REPEAT ))
|
||||
{
|
||||
rfHandled = TRUE;
|
||||
return S_OK;
|
||||
}
|
||||
ui.AnimateKeyPress(pInputData->UserIndex, pInputData->dwKeyCode);
|
||||
|
||||
HRESULT hr = S_OK;
|
||||
switch(pInputData->dwKeyCode)
|
||||
{
|
||||
|
||||
case VK_PAD_B:
|
||||
case VK_PAD_BACK:
|
||||
case VK_ESCAPE:
|
||||
CXuiSceneBase::PlayUISFX(eSFX_Back);
|
||||
app.CloseXuiScenes(pInputData->UserIndex);
|
||||
rfHandled = TRUE;
|
||||
|
||||
break;
|
||||
case VK_PAD_Y:
|
||||
if(playersList.TreeHasFocus() && (playersList.GetItemCount() > 0) && (playersList.GetCurSel() < m_playersCount) )
|
||||
{
|
||||
INetworkPlayer *player = g_NetworkManager.GetPlayerBySmallId(m_players[playersList.GetCurSel()]);
|
||||
if( player != NULL )
|
||||
{
|
||||
PlayerUID xuid = ((NetworkPlayerXbox *)player)->GetUID();
|
||||
if( xuid != INVALID_XUID )
|
||||
hr = XShowGamerCardUI(pInputData->UserIndex, xuid);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case VK_PAD_X:
|
||||
{
|
||||
if(!g_NetworkManager.IsLocalGame())
|
||||
{
|
||||
XPARTY_USER_LIST partyList;
|
||||
if((XPartyGetUserList( &partyList ) != XPARTY_E_NOT_IN_PARTY) && (partyList.dwUserCount>1))
|
||||
{
|
||||
hr = XShowPartyUI( pInputData->UserIndex );
|
||||
}
|
||||
else
|
||||
{
|
||||
hr = XShowFriendsUI( pInputData->UserIndex );
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Handler for the button press message.
|
||||
//----------------------------------------------------------------------------------
|
||||
HRESULT CScene_InGameInfo::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* pNotifyPressData, BOOL& rfHandled)
|
||||
{
|
||||
// This assumes all buttons can only be pressed with the A button
|
||||
ui.AnimateKeyPress(pNotifyPressData->UserIndex, VK_PAD_A);
|
||||
|
||||
if( hObjPressed == playersList )
|
||||
{
|
||||
INetworkPlayer *selectedPlayer = g_NetworkManager.GetPlayerBySmallId( m_players[ playersList.GetCurSel() ] );
|
||||
|
||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||
shared_ptr<MultiplayerLocalPlayer> localPlayer = pMinecraft->localplayers[m_iPad];
|
||||
|
||||
bool isOp = m_isHostPlayer || localPlayer->isModerator();
|
||||
bool cheats = app.GetGameHostOption(eGameHostOption_CheatsEnabled) != 0;
|
||||
bool trust = app.GetGameHostOption(eGameHostOption_TrustPlayers) != 0;
|
||||
|
||||
if( isOp && selectedPlayer != NULL && playersList.TreeHasFocus() && (playersList.GetItemCount() > 0) && (playersList.GetCurSel() < m_playersCount) )
|
||||
{
|
||||
bool editingHost = selectedPlayer->IsHost();
|
||||
if( (cheats && (m_isHostPlayer || !editingHost ) )
|
||||
|| (!trust && (m_isHostPlayer || !editingHost))
|
||||
|| (m_isHostPlayer && !editingHost)
|
||||
#if (!defined(_CONTENT_PACKAGE) && !defined(_FINAL_BUILD) && defined(_DEBUG_MENUS_ENABLED))
|
||||
|| (m_isHostPlayer && editingHost)
|
||||
#endif
|
||||
)
|
||||
{
|
||||
InGamePlayerOptionsInitData *pInitData = new InGamePlayerOptionsInitData();
|
||||
pInitData->iPad = m_iPad;
|
||||
pInitData->networkSmallId = m_players[ playersList.GetCurSel() ];
|
||||
pInitData->playerPrivileges = app.GetPlayerPrivileges(m_players[ playersList.GetCurSel() ] );
|
||||
app.NavigateToScene(m_iPad,eUIScene_InGamePlayerOptionsMenu,pInitData);
|
||||
}
|
||||
else if(selectedPlayer->IsLocal() != TRUE && selectedPlayer->IsSameSystem(g_NetworkManager.GetHostPlayer()) != TRUE)
|
||||
{
|
||||
// Only ops will hit this, can kick anyone not local and not local to the host
|
||||
BYTE *smallId = new BYTE();
|
||||
*smallId = m_players[playersList.GetCurSel()];
|
||||
UINT uiIDA[2];
|
||||
uiIDA[0]=IDS_CONFIRM_OK;
|
||||
uiIDA[1]=IDS_CONFIRM_CANCEL;
|
||||
|
||||
StorageManager.RequestMessageBox(IDS_UNLOCK_KICK_PLAYER_TITLE, IDS_UNLOCK_KICK_PLAYER, uiIDA, 2, m_iPad,&CScene_InGameInfo::KickPlayerReturned,smallId,app.GetStringTable());
|
||||
}
|
||||
}
|
||||
}
|
||||
else if( hObjPressed == m_gameOptionsButton )
|
||||
{
|
||||
app.NavigateToScene(pNotifyPressData->UserIndex,eUIScene_InGameHostOptionsMenu);
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CScene_InGameInfo::OnTimer(XUIMessageTimer *pData,BOOL& rfHandled)
|
||||
{
|
||||
if(pData->nId==IGNORE_KEYPRESS_TIMERID)
|
||||
{
|
||||
XuiKillTimer(m_hObj,IGNORE_KEYPRESS_TIMERID);
|
||||
m_bIgnoreKeyPresses=false;
|
||||
}
|
||||
else
|
||||
{
|
||||
updateTooltips();
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CScene_InGameInfo::OnTransitionStart( XUIMessageTransition *pTransition, BOOL& bHandled )
|
||||
{
|
||||
if(pTransition->dwTransType == XUI_TRANSITION_FROM)
|
||||
{
|
||||
KillTimer( TOOLTIP_TIMERID );
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CScene_InGameInfo::OnTransitionEnd( XUIMessageTransition *pTransition, BOOL& bHandled )
|
||||
{
|
||||
if(pTransition->dwTransType == XUI_TRANSITION_BACKTO)
|
||||
{
|
||||
SetTimer( TOOLTIP_TIMERID , INGAME_INFO_TOOLTIP_TIMER );
|
||||
g_NetworkManager.RegisterPlayerChangedCallback(m_iPad, &CScene_InGameInfo::OnPlayerChanged, this);
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CScene_InGameInfo::OnNotifySetFocus( HXUIOBJ hObjSource, XUINotifyFocus *pNotifyFocusData, BOOL& bHandled )
|
||||
{
|
||||
updateTooltips();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void CScene_InGameInfo::OnPlayerChanged(void *callbackParam, INetworkPlayer *pPlayer, bool leaving)
|
||||
{
|
||||
CScene_InGameInfo *scene = (CScene_InGameInfo *)callbackParam;
|
||||
bool playerFound = false;
|
||||
|
||||
for(int i = 0; i < scene->m_playersCount; ++i)
|
||||
{
|
||||
if(playerFound)
|
||||
{
|
||||
scene->m_players[i-1] = scene->m_players[i];
|
||||
}
|
||||
else if( scene->m_players[i] == pPlayer->GetSmallId() )
|
||||
{
|
||||
if( scene->playersList.GetCurSel() == scene->playersList.GetItemCount() - 1 )
|
||||
{
|
||||
scene->playersList.SetCurSel( scene->playersList.GetItemCount() - 2 );
|
||||
}
|
||||
// Player removed
|
||||
playerFound = true;
|
||||
}
|
||||
}
|
||||
|
||||
if( playerFound )
|
||||
{
|
||||
--scene->m_playersCount;
|
||||
scene->playersList.DeleteItems( scene->playersList.GetItemCount() - 1, 1 );
|
||||
}
|
||||
|
||||
if( !playerFound )
|
||||
{
|
||||
// Player added
|
||||
scene->m_players[scene->m_playersCount] = pPlayer->GetSmallId();
|
||||
++scene->m_playersCount;
|
||||
scene->playersList.InsertItems( scene->playersList.GetItemCount(), 1 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
HRESULT CScene_InGameInfo::OnGetSourceDataText(XUIMessageGetSourceText *pGetSourceTextData, BOOL& bHandled)
|
||||
{
|
||||
if( pGetSourceTextData->bItemData )
|
||||
{
|
||||
if( pGetSourceTextData->iItem < m_playersCount )
|
||||
{
|
||||
INetworkPlayer *player = g_NetworkManager.GetPlayerBySmallId( m_players[pGetSourceTextData->iItem] );
|
||||
if( player != NULL )
|
||||
{
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
if(app.DebugSettingsOn() && (app.GetGameSettingsDebugMask()&(1L<<eDebugSetting_DebugLeaderboards)))
|
||||
{
|
||||
pGetSourceTextData->szText = L"WWWWWWWWWWWWWWWW";
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
pGetSourceTextData->szText = player->GetOnlineName();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pGetSourceTextData->szText = L"";
|
||||
}
|
||||
|
||||
HRESULT hr;
|
||||
HXUIOBJ hButton, hVisual, hPlayerIcon, hVoiceIcon;
|
||||
hButton = playersList.GetItemControl(pGetSourceTextData->iItem);
|
||||
hr=XuiControlGetVisual(hButton,&hVisual);
|
||||
|
||||
// Set the players icon
|
||||
hr=XuiElementGetChildById(hVisual,L"IconGroup",&hPlayerIcon);
|
||||
short colourIndex = app.GetPlayerColour( m_players[pGetSourceTextData->iItem] );
|
||||
int playFrame = 0;
|
||||
switch(colourIndex)
|
||||
{
|
||||
case 1:
|
||||
XuiElementFindNamedFrame(hPlayerIcon, L"P1", &playFrame);
|
||||
break;
|
||||
case 2:
|
||||
XuiElementFindNamedFrame(hPlayerIcon, L"P2", &playFrame);
|
||||
break;
|
||||
case 3:
|
||||
XuiElementFindNamedFrame(hPlayerIcon, L"P3", &playFrame);
|
||||
break;
|
||||
case 4:
|
||||
XuiElementFindNamedFrame(hPlayerIcon, L"P4", &playFrame);
|
||||
break;
|
||||
case 5:
|
||||
XuiElementFindNamedFrame(hPlayerIcon, L"P5", &playFrame);
|
||||
break;
|
||||
case 6:
|
||||
XuiElementFindNamedFrame(hPlayerIcon, L"P6", &playFrame);
|
||||
break;
|
||||
case 7:
|
||||
XuiElementFindNamedFrame(hPlayerIcon, L"P7", &playFrame);
|
||||
break;
|
||||
case 8:
|
||||
XuiElementFindNamedFrame(hPlayerIcon, L"P8", &playFrame);
|
||||
break;
|
||||
case 9:
|
||||
XuiElementFindNamedFrame(hPlayerIcon, L"P9", &playFrame);
|
||||
break;
|
||||
case 10:
|
||||
XuiElementFindNamedFrame(hPlayerIcon, L"P10", &playFrame);
|
||||
break;
|
||||
case 11:
|
||||
XuiElementFindNamedFrame(hPlayerIcon, L"P11", &playFrame);
|
||||
break;
|
||||
case 12:
|
||||
XuiElementFindNamedFrame(hPlayerIcon, L"P12", &playFrame);
|
||||
break;
|
||||
case 13:
|
||||
XuiElementFindNamedFrame(hPlayerIcon, L"P13", &playFrame);
|
||||
break;
|
||||
case 14:
|
||||
XuiElementFindNamedFrame(hPlayerIcon, L"P14", &playFrame);
|
||||
break;
|
||||
case 15:
|
||||
XuiElementFindNamedFrame(hPlayerIcon, L"P15", &playFrame);
|
||||
break;
|
||||
case 0:
|
||||
default:
|
||||
XuiElementFindNamedFrame(hPlayerIcon, L"P0", &playFrame);
|
||||
break;
|
||||
};
|
||||
if(playFrame < 0) playFrame = 0;
|
||||
XuiElementPlayTimeline(hPlayerIcon,playFrame,playFrame,playFrame,FALSE,FALSE);
|
||||
|
||||
// Set the voice icon
|
||||
hr=XuiElementGetChildById(hVisual,L"VoiceGroup",&hVoiceIcon);
|
||||
|
||||
playFrame = -1;
|
||||
if(player != NULL && player->HasVoice() )
|
||||
{
|
||||
if( player->IsMutedByLocalUser(m_iPad) )
|
||||
{
|
||||
// Muted image
|
||||
XuiElementFindNamedFrame(hVoiceIcon, L"Muted", &playFrame);
|
||||
}
|
||||
else if( player->IsTalking() )
|
||||
{
|
||||
// Talking image
|
||||
XuiElementFindNamedFrame(hVoiceIcon, L"Speaking", &playFrame);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Not talking image
|
||||
XuiElementFindNamedFrame(hVoiceIcon, L"NotSpeaking", &playFrame);
|
||||
}
|
||||
}
|
||||
|
||||
if(playFrame < 0)
|
||||
{
|
||||
XuiElementFindNamedFrame(hVoiceIcon, L"Normal", &playFrame);
|
||||
}
|
||||
XuiElementPlayTimeline(hVoiceIcon,playFrame,playFrame,playFrame,FALSE,FALSE);
|
||||
|
||||
pGetSourceTextData->bDisplay = TRUE;
|
||||
|
||||
bHandled = TRUE;
|
||||
}
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CScene_InGameInfo::OnGetSourceDataImage(XUIMessageGetSourceImage *pGetSourceImageData,BOOL& bHandled)
|
||||
{
|
||||
if( pGetSourceImageData->bItemData )
|
||||
{
|
||||
if( pGetSourceImageData->iItem < m_playersCount )
|
||||
{
|
||||
bHandled = TRUE;
|
||||
}
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CScene_InGameInfo::OnGetItemCountAll(XUIMessageGetItemCount *pGetItemCountData, BOOL& bHandled)
|
||||
{
|
||||
pGetItemCountData->cItems = m_playersCount;
|
||||
bHandled = TRUE;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void CScene_InGameInfo::updateTooltips()
|
||||
{
|
||||
int keyX = IDS_TOOLTIPS_INVITE_FRIENDS;
|
||||
int ikeyY = -1;
|
||||
|
||||
XPARTY_USER_LIST partyList;
|
||||
if((XPartyGetUserList( &partyList ) != XPARTY_E_NOT_IN_PARTY ) && (partyList.dwUserCount>1))
|
||||
{
|
||||
keyX = IDS_TOOLTIPS_INVITE_PARTY;
|
||||
}
|
||||
if(g_NetworkManager.IsLocalGame()) keyX = -1;
|
||||
|
||||
INetworkPlayer *selectedPlayer = g_NetworkManager.GetPlayerBySmallId( m_players[ playersList.GetCurSel() ] );
|
||||
|
||||
int keyA = -1;
|
||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||
shared_ptr<MultiplayerLocalPlayer> localPlayer = pMinecraft->localplayers[m_iPad];
|
||||
|
||||
bool isOp = m_isHostPlayer || localPlayer->isModerator();
|
||||
bool cheats = app.GetGameHostOption(eGameHostOption_CheatsEnabled) != 0;
|
||||
bool trust = app.GetGameHostOption(eGameHostOption_TrustPlayers) != 0;
|
||||
|
||||
if( isOp )
|
||||
{
|
||||
if(m_gameOptionsButton.HasFocus())
|
||||
{
|
||||
keyA = IDS_TOOLTIPS_SELECT;
|
||||
}
|
||||
else if( selectedPlayer != NULL)
|
||||
{
|
||||
bool editingHost = selectedPlayer->IsHost();
|
||||
if( (cheats && (m_isHostPlayer || !editingHost ) ) || (!trust && (m_isHostPlayer || !editingHost))
|
||||
#if (!defined(_CONTENT_PACKAGE) && !defined(_FINAL_BUILD) && defined(_DEBUG_MENUS_ENABLED))
|
||||
|| (m_isHostPlayer && editingHost)
|
||||
#endif
|
||||
)
|
||||
{
|
||||
keyA = IDS_TOOLTIPS_PRIVILEGES;
|
||||
}
|
||||
else if(selectedPlayer->IsLocal() != TRUE && selectedPlayer->IsSameSystem(g_NetworkManager.GetHostPlayer()) != TRUE)
|
||||
{
|
||||
// Only ops will hit this, can kick anyone not local and not local to the host
|
||||
keyA = IDS_TOOLTIPS_KICK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!m_gameOptionsButton.HasFocus())
|
||||
{
|
||||
// if the player is me, then view gamer profile
|
||||
if(selectedPlayer != NULL && selectedPlayer->IsLocal() && selectedPlayer->GetUserIndex()==m_iPad)
|
||||
{
|
||||
ikeyY = IDS_TOOLTIPS_VIEW_GAMERPROFILE;
|
||||
}
|
||||
else
|
||||
{
|
||||
ikeyY = IDS_TOOLTIPS_VIEW_GAMERCARD;
|
||||
}
|
||||
}
|
||||
ui.SetTooltips( m_iPad, keyA,IDS_TOOLTIPS_BACK,keyX,ikeyY);
|
||||
}
|
||||
|
||||
|
||||
HRESULT CScene_InGameInfo::OnCustomMessage_Splitscreenplayer(bool bJoining, BOOL& bHandled)
|
||||
{
|
||||
bHandled=true;
|
||||
return app.AdjustSplitscreenScene_PlayerChanged(m_hObj,&m_OriginalPosition,m_iPad,bJoining);
|
||||
}
|
||||
|
||||
int CScene_InGameInfo::KickPlayerReturned(void *pParam,int iPad,C4JStorage::EMessageResult result)
|
||||
{
|
||||
BYTE smallId = *(BYTE *)pParam;
|
||||
delete pParam;
|
||||
|
||||
if(result==C4JStorage::EMessage_ResultAccept)
|
||||
{
|
||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||
shared_ptr<MultiplayerLocalPlayer> localPlayer = pMinecraft->localplayers[iPad];
|
||||
if(localPlayer != NULL && localPlayer->connection)
|
||||
{
|
||||
localPlayer->connection->send( shared_ptr<KickPlayerPacket>( new KickPlayerPacket(smallId) ) );
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
84
Minecraft.Client/Common/XUI/XUI_InGameInfo.h
Normal file
84
Minecraft.Client/Common/XUI/XUI_InGameInfo.h
Normal file
@@ -0,0 +1,84 @@
|
||||
#pragma once
|
||||
using namespace std;
|
||||
#include "../media/xuiscene_ingameinfo.h"
|
||||
#include "XUI_CustomMessages.h"
|
||||
|
||||
class INetworkPlayer;
|
||||
|
||||
#define INGAME_INFO_TOOLTIP_TIMER 1000
|
||||
|
||||
#define VOICE_ICON_DATA_ID 0
|
||||
#define MAP_ICON_DATA_ID 1
|
||||
#define OPS_ICON_DATA_ID 2
|
||||
|
||||
class CScene_InGameInfo : public CXuiSceneImpl
|
||||
{
|
||||
protected:
|
||||
// Control and Element wrapper objects.
|
||||
CXuiList playersList;
|
||||
CXuiControl m_gameOptionsButton;
|
||||
CXuiControl m_title;
|
||||
|
||||
// Message map. Here we tie messages to message handlers.
|
||||
XUI_BEGIN_MSG_MAP()
|
||||
XUI_ON_XM_INIT( OnInit )
|
||||
XUI_ON_XM_DESTROY( OnDestroy )
|
||||
XUI_ON_XM_NOTIFY_SELCHANGED( OnNotifySelChanged )
|
||||
XUI_ON_XM_NOTIFY_PRESS_EX(OnNotifyPressEx)
|
||||
XUI_ON_XM_KEYDOWN(OnKeyDown)
|
||||
XUI_ON_XM_TIMER( OnTimer )
|
||||
XUI_ON_XM_TRANSITION_START( OnTransitionStart )
|
||||
XUI_ON_XM_TRANSITION_END( OnTransitionEnd )
|
||||
XUI_ON_XM_NOTIFY_SET_FOCUS( OnNotifySetFocus )
|
||||
|
||||
XUI_ON_XM_GET_SOURCE_TEXT(OnGetSourceDataText)
|
||||
XUI_ON_XM_GET_SOURCE_IMAGE(OnGetSourceDataImage)
|
||||
XUI_ON_XM_GET_ITEMCOUNT_ALL(OnGetItemCountAll)
|
||||
XUI_ON_XM_SPLITSCREENPLAYER_MESSAGE(OnCustomMessage_Splitscreenplayer)
|
||||
XUI_END_MSG_MAP()
|
||||
|
||||
// Control mapping to objects
|
||||
BEGIN_CONTROL_MAP()
|
||||
MAP_CONTROL(IDC_GamePlayers, playersList)
|
||||
MAP_CONTROL(IDC_GameOptionsButton, m_gameOptionsButton)
|
||||
MAP_CONTROL(IDC_Title, m_title)
|
||||
END_CONTROL_MAP()
|
||||
|
||||
HRESULT OnInit( XUIMessageInit* pInitData, BOOL& bHandled );
|
||||
HRESULT OnDestroy();
|
||||
HRESULT OnNotifySelChanged( HXUIOBJ hObjSource, XUINotifySelChanged* pNotifySelChangedData, BOOL& bHandled );
|
||||
HRESULT OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* pNotifyPressData, BOOL& rfHandled);
|
||||
HRESULT OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandled);
|
||||
HRESULT OnTimer(XUIMessageTimer *pData,BOOL& rfHandled);
|
||||
HRESULT OnTransitionStart( XUIMessageTransition *pTransition, BOOL& bHandled );
|
||||
HRESULT OnTransitionEnd( XUIMessageTransition *pTransition, BOOL& bHandled );
|
||||
HRESULT OnNotifySetFocus( HXUIOBJ hObjSource, XUINotifyFocus *pNotifyFocusData, BOOL& bHandled );
|
||||
|
||||
HRESULT OnCustomMessage_Splitscreenplayer(bool bJoining, BOOL& bHandled);
|
||||
|
||||
HRESULT OnGetSourceDataText(XUIMessageGetSourceText *pGetSourceTextData, BOOL& bHandled);
|
||||
HRESULT OnGetSourceDataImage(XUIMessageGetSourceImage *pGetSourceImageData,BOOL& bHandled);
|
||||
HRESULT OnGetItemCountAll(XUIMessageGetItemCount *pGetItemCountData, BOOL& bHandled);
|
||||
|
||||
public:
|
||||
|
||||
// Define the class. The class name must match the ClassOverride property
|
||||
// set for the scene in the UI Authoring tool.
|
||||
XUI_IMPLEMENT_CLASS( CScene_InGameInfo, L"CScene_InGameInfo", XUI_CLASS_SCENE )
|
||||
|
||||
static void OnPlayerChanged(void *callbackParam, INetworkPlayer *pPlayer, bool leaving);
|
||||
|
||||
private:
|
||||
bool m_isHostPlayer;
|
||||
int m_iPad;
|
||||
D3DXVECTOR3 m_OriginalPosition;
|
||||
|
||||
int m_playersCount;
|
||||
BYTE m_players[MINECRAFT_NET_MAX_PLAYERS]; // An array of QNet small-id's
|
||||
bool m_bIgnoreKeyPresses;
|
||||
|
||||
void updateTooltips();
|
||||
|
||||
public:
|
||||
static int KickPlayerReturned(void *pParam,int iPad,C4JStorage::EMessageResult result);
|
||||
};
|
||||
499
Minecraft.Client/Common/XUI/XUI_InGamePlayerOptions.cpp
Normal file
499
Minecraft.Client/Common/XUI/XUI_InGamePlayerOptions.cpp
Normal file
@@ -0,0 +1,499 @@
|
||||
#include "stdafx.h"
|
||||
#include "XUI_MultiGameCreate.h"
|
||||
#include "XUI_InGamePlayerOptions.h"
|
||||
#include "..\..\Minecraft.h"
|
||||
#include "..\..\MultiPlayerLocalPlayer.h"
|
||||
#include "..\..\ClientConnection.h"
|
||||
#include "..\..\..\Minecraft.World\net.minecraft.network.h"
|
||||
#include "..\..\..\Minecraft.World\net.minecraft.network.packet.h"
|
||||
#include "..\..\..\Minecraft.World\net.minecraft.world.entity.player.h"
|
||||
#include "XUI_InGameInfo.h"
|
||||
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Performs initialization tasks - retrieves controls.
|
||||
//----------------------------------------------------------------------------------
|
||||
HRESULT CScene_InGamePlayerOptions::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
|
||||
{
|
||||
m_iPad = *(int *)pInitData->pvInitData;
|
||||
|
||||
InGamePlayerOptionsInitData *initData = (InGamePlayerOptionsInitData *)pInitData->pvInitData;
|
||||
m_iPad = initData->iPad;
|
||||
m_networkSmallId = initData->networkSmallId;
|
||||
m_playerPrivileges = initData->playerPrivileges;
|
||||
|
||||
MapChildControls();
|
||||
|
||||
m_focusElement = m_checkboxes[eControl_BuildAndMine].m_hObj;
|
||||
|
||||
m_TeleportGroup.SetShow(false);
|
||||
|
||||
INetworkPlayer *localPlayer = g_NetworkManager.GetLocalPlayerByUserIndex( m_iPad );
|
||||
INetworkPlayer *editingPlayer = g_NetworkManager.GetPlayerBySmallId(m_networkSmallId);
|
||||
|
||||
if(editingPlayer != NULL)
|
||||
{
|
||||
m_Gamertag.SetText(editingPlayer->GetOnlineName());
|
||||
}
|
||||
|
||||
bool trustPlayers = app.GetGameHostOption(eGameHostOption_TrustPlayers) != 0;
|
||||
bool cheats = app.GetGameHostOption(eGameHostOption_CheatsEnabled) != 0;
|
||||
m_editingSelf = (localPlayer != NULL && localPlayer == editingPlayer);
|
||||
|
||||
if( m_editingSelf || trustPlayers || editingPlayer->IsHost())
|
||||
{
|
||||
removeControl( m_checkboxes[eControl_BuildAndMine], true );
|
||||
removeControl( m_checkboxes[eControl_UseDoorsAndSwitches], true );
|
||||
removeControl( m_checkboxes[eControl_UseContainers], true );
|
||||
removeControl( m_checkboxes[eControl_AttackPlayers], true );
|
||||
removeControl( m_checkboxes[eControl_AttackAnimals], true );
|
||||
}
|
||||
else
|
||||
{
|
||||
bool checked = (Player::getPlayerGamePrivilege(m_playerPrivileges, Player::ePlayerGamePrivilege_CannotMine)==0 && Player::getPlayerGamePrivilege(m_playerPrivileges, Player::ePlayerGamePrivilege_CannotBuild)==0);
|
||||
m_checkboxes[eControl_BuildAndMine].SetText( app.GetString(IDS_CAN_BUILD_AND_MINE) );
|
||||
m_checkboxes[eControl_BuildAndMine].SetCheck(checked);
|
||||
|
||||
checked = (Player::getPlayerGamePrivilege(m_playerPrivileges, Player::ePlayerGamePrivilege_CanUseDoorsAndSwitches)!=0);
|
||||
m_checkboxes[eControl_UseDoorsAndSwitches].SetText( app.GetString(IDS_CAN_USE_DOORS_AND_SWITCHES) );
|
||||
m_checkboxes[eControl_UseDoorsAndSwitches].SetCheck(checked);
|
||||
|
||||
checked = (Player::getPlayerGamePrivilege(m_playerPrivileges, Player::ePlayerGamePrivilege_CanUseContainers)!=0);
|
||||
m_checkboxes[eControl_UseContainers].SetText( app.GetString(IDS_CAN_OPEN_CONTAINERS) );
|
||||
m_checkboxes[eControl_UseContainers].SetCheck(checked);
|
||||
|
||||
checked = Player::getPlayerGamePrivilege(m_playerPrivileges, Player::ePlayerGamePrivilege_CannotAttackPlayers)==0;
|
||||
m_checkboxes[eControl_AttackPlayers].SetText( app.GetString(IDS_CAN_ATTACK_PLAYERS) );
|
||||
m_checkboxes[eControl_AttackPlayers].SetCheck(checked);
|
||||
|
||||
checked = Player::getPlayerGamePrivilege(m_playerPrivileges, Player::ePlayerGamePrivilege_CannotAttackAnimals)==0;
|
||||
m_checkboxes[eControl_AttackAnimals].SetText( app.GetString(IDS_CAN_ATTACK_ANIMALS) );
|
||||
m_checkboxes[eControl_AttackAnimals].SetCheck(checked);
|
||||
}
|
||||
|
||||
if(m_editingSelf)
|
||||
{
|
||||
#if (defined(_CONTENT_PACKAGE) || defined(_FINAL_BUILD) && !defined(_DEBUG_MENUS_ENABLED))
|
||||
removeControl( m_checkboxes[eControl_Op], true );
|
||||
#else
|
||||
m_checkboxes[eControl_Op].SetText(L"DEBUG: Creative");
|
||||
m_checkboxes[eControl_Op].SetCheck(Player::getPlayerGamePrivilege(m_playerPrivileges,Player::ePlayerGamePrivilege_CreativeMode));
|
||||
#endif
|
||||
|
||||
removeControl( m_buttonKick, true );
|
||||
removeControl( m_checkboxes[eControl_CheatTeleport], true );
|
||||
|
||||
if(cheats)
|
||||
{
|
||||
bool canBeInvisible = Player::getPlayerGamePrivilege(m_playerPrivileges, Player::ePlayerGamePrivilege_CanToggleInvisible) != 0;
|
||||
m_checkboxes[eControl_HostInvisible].SetEnable(canBeInvisible);
|
||||
bool checked = canBeInvisible && (Player::getPlayerGamePrivilege(m_playerPrivileges, Player::ePlayerGamePrivilege_Invisible)!=0 && Player::getPlayerGamePrivilege(m_playerPrivileges, Player::ePlayerGamePrivilege_Invulnerable)!=0);
|
||||
m_checkboxes[eControl_HostInvisible].SetText( app.GetString(IDS_INVISIBLE) );
|
||||
m_checkboxes[eControl_HostInvisible].SetCheck(checked);
|
||||
|
||||
bool inCreativeMode = Player::getPlayerGamePrivilege(m_playerPrivileges,Player::ePlayerGamePrivilege_CreativeMode) != 0;
|
||||
if(inCreativeMode)
|
||||
{
|
||||
removeControl( m_checkboxes[eControl_HostFly], true );
|
||||
removeControl( m_checkboxes[eControl_HostHunger], true );
|
||||
}
|
||||
else
|
||||
{
|
||||
bool canFly = Player::getPlayerGamePrivilege(m_playerPrivileges,Player::ePlayerGamePrivilege_CanToggleFly);
|
||||
bool canChangeHunger = Player::getPlayerGamePrivilege(m_playerPrivileges,Player::ePlayerGamePrivilege_CanToggleClassicHunger);
|
||||
|
||||
m_checkboxes[eControl_HostFly].SetEnable(canFly);
|
||||
checked = canFly && Player::getPlayerGamePrivilege(m_playerPrivileges, Player::ePlayerGamePrivilege_CanFly)!=0;
|
||||
m_checkboxes[eControl_HostFly].SetText( app.GetString(IDS_CAN_FLY) );
|
||||
m_checkboxes[eControl_HostFly].SetCheck(checked);
|
||||
|
||||
m_checkboxes[eControl_HostHunger].SetEnable(canChangeHunger);
|
||||
checked = canChangeHunger && Player::getPlayerGamePrivilege(m_playerPrivileges, Player::ePlayerGamePrivilege_ClassicHunger)!=0;
|
||||
m_checkboxes[eControl_HostHunger].SetText( app.GetString(IDS_DISABLE_EXHAUSTION) );
|
||||
m_checkboxes[eControl_HostHunger].SetCheck(checked);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
removeControl( m_checkboxes[eControl_HostInvisible], true );
|
||||
removeControl( m_checkboxes[eControl_HostFly], true );
|
||||
removeControl( m_checkboxes[eControl_HostHunger], true );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(localPlayer->IsHost())
|
||||
{
|
||||
// Only host can make people moderators, or enable teleporting for them
|
||||
m_checkboxes[eControl_Op].SetText( app.GetString(IDS_MODERATOR) );
|
||||
m_checkboxes[eControl_Op].SetCheck(Player::getPlayerGamePrivilege(m_playerPrivileges, Player::ePlayerGamePrivilege_Op)!=0);
|
||||
}
|
||||
else
|
||||
{
|
||||
removeControl( m_checkboxes[eControl_Op], true );
|
||||
}
|
||||
|
||||
if(localPlayer->IsHost() && cheats)
|
||||
{
|
||||
m_checkboxes[eControl_HostInvisible].SetEnable(true);
|
||||
bool checked = Player::getPlayerGamePrivilege(m_playerPrivileges, Player::ePlayerGamePrivilege_CanToggleInvisible)!=0;
|
||||
m_checkboxes[eControl_HostInvisible].SetText( app.GetString(IDS_CAN_INVISIBLE) );
|
||||
m_checkboxes[eControl_HostInvisible].SetCheck(checked);
|
||||
|
||||
|
||||
bool inCreativeMode = Player::getPlayerGamePrivilege(m_playerPrivileges,Player::ePlayerGamePrivilege_CreativeMode) != 0;
|
||||
if(inCreativeMode)
|
||||
{
|
||||
removeControl( m_checkboxes[eControl_HostFly], true );
|
||||
removeControl( m_checkboxes[eControl_HostHunger], true );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_checkboxes[eControl_HostFly].SetEnable(true);
|
||||
checked = Player::getPlayerGamePrivilege(m_playerPrivileges, Player::ePlayerGamePrivilege_CanToggleFly)!=0;
|
||||
m_checkboxes[eControl_HostFly].SetText( app.GetString(IDS_CAN_FLY) );
|
||||
m_checkboxes[eControl_HostFly].SetCheck(checked);
|
||||
|
||||
m_checkboxes[eControl_HostHunger].SetEnable(true);
|
||||
checked = Player::getPlayerGamePrivilege(m_playerPrivileges, Player::ePlayerGamePrivilege_CanToggleClassicHunger)!=0;
|
||||
m_checkboxes[eControl_HostHunger].SetText( app.GetString(IDS_CAN_DISABLE_EXHAUSTION) );
|
||||
m_checkboxes[eControl_HostHunger].SetCheck(checked);
|
||||
}
|
||||
|
||||
checked = Player::getPlayerGamePrivilege(m_playerPrivileges, Player::ePlayerGamePrivilege_CanTeleport)!=0;
|
||||
m_checkboxes[eControl_CheatTeleport].SetText(app.GetString(IDS_ENABLE_TELEPORT));
|
||||
m_checkboxes[eControl_CheatTeleport].SetCheck(checked);
|
||||
}
|
||||
else
|
||||
{
|
||||
removeControl( m_checkboxes[eControl_HostInvisible], true );
|
||||
removeControl( m_checkboxes[eControl_HostFly], true );
|
||||
removeControl( m_checkboxes[eControl_HostHunger], true );
|
||||
removeControl( m_checkboxes[eControl_CheatTeleport], true );
|
||||
}
|
||||
|
||||
// Can only kick people if they are not local, and not local to the host
|
||||
if(editingPlayer->IsLocal() != TRUE && editingPlayer->IsSameSystem(g_NetworkManager.GetHostPlayer()) != TRUE)
|
||||
{
|
||||
m_buttonKick.SetText( app.GetString(IDS_KICK_PLAYER));
|
||||
}
|
||||
else
|
||||
{
|
||||
removeControl( m_buttonKick, true );
|
||||
}
|
||||
}
|
||||
|
||||
if(app.GetLocalPlayerCount()>1)
|
||||
{
|
||||
app.AdjustSplitscreenScene(m_hObj,&m_OriginalPosition,m_iPad);
|
||||
}
|
||||
|
||||
ui.SetTooltips( m_iPad, IDS_TOOLTIPS_SELECT,IDS_TOOLTIPS_BACK);
|
||||
|
||||
CXuiSceneBase::ShowLogo( m_iPad, FALSE );
|
||||
|
||||
g_NetworkManager.RegisterPlayerChangedCallback(m_iPad, &CScene_InGamePlayerOptions::OnPlayerChanged, this);
|
||||
|
||||
//SentientManager.RecordMenuShown(m_iPad, eUIScene_CreateWorldMenu, 0);
|
||||
|
||||
resetCheatCheckboxes();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CScene_InGamePlayerOptions::OnDestroy()
|
||||
{
|
||||
g_NetworkManager.UnRegisterPlayerChangedCallback(m_iPad, &CScene_InGameInfo::OnPlayerChanged, this);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
HRESULT CScene_InGamePlayerOptions::OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandled)
|
||||
{
|
||||
ui.AnimateKeyPress(pInputData->UserIndex, pInputData->dwKeyCode);
|
||||
|
||||
// Explicitly handle B button presses
|
||||
switch(pInputData->dwKeyCode)
|
||||
{
|
||||
case VK_PAD_B:
|
||||
case VK_ESCAPE:
|
||||
{
|
||||
bool trustPlayers = app.GetGameHostOption(eGameHostOption_TrustPlayers) != 0;
|
||||
bool cheats = app.GetGameHostOption(eGameHostOption_CheatsEnabled) != 0;
|
||||
if(m_editingSelf)
|
||||
{
|
||||
#if (defined(_CONTENT_PACKAGE) || defined(_FINAL_BUILD) && !defined(_DEBUG_MENUS_ENABLED))
|
||||
#else
|
||||
Player::setPlayerGamePrivilege(m_playerPrivileges,Player::ePlayerGamePrivilege_CreativeMode,m_checkboxes[eControl_Op].IsChecked());
|
||||
#endif
|
||||
if(cheats)
|
||||
{
|
||||
bool canBeInvisible = Player::getPlayerGamePrivilege(m_playerPrivileges, Player::ePlayerGamePrivilege_CanToggleInvisible) != 0;
|
||||
if(canBeInvisible) Player::setPlayerGamePrivilege(m_playerPrivileges,Player::ePlayerGamePrivilege_Invisible,m_checkboxes[eControl_HostInvisible].IsChecked());
|
||||
if(canBeInvisible) Player::setPlayerGamePrivilege(m_playerPrivileges,Player::ePlayerGamePrivilege_Invulnerable,m_checkboxes[eControl_HostInvisible].IsChecked());
|
||||
|
||||
bool inCreativeMode = Player::getPlayerGamePrivilege(m_playerPrivileges,Player::ePlayerGamePrivilege_CreativeMode) != 0;
|
||||
if(!inCreativeMode)
|
||||
{
|
||||
bool canFly = Player::getPlayerGamePrivilege(m_playerPrivileges,Player::ePlayerGamePrivilege_CanToggleFly);
|
||||
bool canChangeHunger = Player::getPlayerGamePrivilege(m_playerPrivileges,Player::ePlayerGamePrivilege_CanToggleClassicHunger);
|
||||
|
||||
if(canFly) Player::setPlayerGamePrivilege(m_playerPrivileges,Player::ePlayerGamePrivilege_CanFly,m_checkboxes[eControl_HostFly].IsChecked());
|
||||
if(canChangeHunger) Player::setPlayerGamePrivilege(m_playerPrivileges,Player::ePlayerGamePrivilege_ClassicHunger,m_checkboxes[eControl_HostHunger].IsChecked());
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
INetworkPlayer *editingPlayer = g_NetworkManager.GetPlayerBySmallId(m_networkSmallId);
|
||||
if(!trustPlayers && (editingPlayer != NULL && !editingPlayer->IsHost() ) )
|
||||
{
|
||||
Player::setPlayerGamePrivilege(m_playerPrivileges,Player::ePlayerGamePrivilege_CannotMine,!m_checkboxes[eControl_BuildAndMine].IsChecked());
|
||||
Player::setPlayerGamePrivilege(m_playerPrivileges,Player::ePlayerGamePrivilege_CannotBuild,!m_checkboxes[eControl_BuildAndMine].IsChecked());
|
||||
Player::setPlayerGamePrivilege(m_playerPrivileges,Player::ePlayerGamePrivilege_CannotAttackPlayers,!m_checkboxes[eControl_AttackPlayers].IsChecked());
|
||||
Player::setPlayerGamePrivilege(m_playerPrivileges,Player::ePlayerGamePrivilege_CannotAttackAnimals, !m_checkboxes[eControl_AttackAnimals].IsChecked());
|
||||
Player::setPlayerGamePrivilege(m_playerPrivileges,Player::ePlayerGamePrivilege_CanUseDoorsAndSwitches, m_checkboxes[eControl_UseDoorsAndSwitches].IsChecked());
|
||||
Player::setPlayerGamePrivilege(m_playerPrivileges,Player::ePlayerGamePrivilege_CanUseContainers, m_checkboxes[eControl_UseContainers].IsChecked());
|
||||
}
|
||||
|
||||
INetworkPlayer *localPlayer = g_NetworkManager.GetLocalPlayerByUserIndex( m_iPad );
|
||||
|
||||
if(localPlayer->IsHost())
|
||||
{
|
||||
if(cheats)
|
||||
{
|
||||
Player::setPlayerGamePrivilege(m_playerPrivileges,Player::ePlayerGamePrivilege_CanToggleInvisible,m_checkboxes[eControl_HostInvisible].IsChecked());
|
||||
Player::setPlayerGamePrivilege(m_playerPrivileges,Player::ePlayerGamePrivilege_CanToggleFly,m_checkboxes[eControl_HostFly].IsChecked());
|
||||
Player::setPlayerGamePrivilege(m_playerPrivileges,Player::ePlayerGamePrivilege_CanToggleClassicHunger,m_checkboxes[eControl_HostHunger].IsChecked());
|
||||
Player::setPlayerGamePrivilege(m_playerPrivileges,Player::ePlayerGamePrivilege_CanTeleport,m_checkboxes[eControl_CheatTeleport].IsChecked());
|
||||
}
|
||||
|
||||
Player::setPlayerGamePrivilege(m_playerPrivileges,Player::ePlayerGamePrivilege_Op,m_checkboxes[eControl_Op].IsChecked());
|
||||
}
|
||||
}
|
||||
unsigned int originalPrivileges = app.GetPlayerPrivileges(m_networkSmallId);
|
||||
if(originalPrivileges != m_playerPrivileges)
|
||||
{
|
||||
// Send update settings packet to server
|
||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||
shared_ptr<MultiplayerLocalPlayer> player = pMinecraft->localplayers[m_iPad];
|
||||
if(player != NULL && player->connection)
|
||||
{
|
||||
player->connection->send( shared_ptr<PlayerInfoPacket>( new PlayerInfoPacket( m_networkSmallId, -1, m_playerPrivileges) ) );
|
||||
}
|
||||
}
|
||||
|
||||
app.NavigateBack(pInputData->UserIndex);
|
||||
rfHandled = TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CScene_InGamePlayerOptions::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* pNotifyPressData, BOOL& rfHandled)
|
||||
{
|
||||
//HRESULT hr = S_OK;
|
||||
// This assumes all buttons can only be pressed with the A button
|
||||
ui.AnimateKeyPress(pNotifyPressData->UserIndex, VK_PAD_A);
|
||||
|
||||
if( hObjPressed == m_buttonKick )
|
||||
{
|
||||
BYTE *smallId = new BYTE();
|
||||
*smallId = m_networkSmallId;
|
||||
UINT uiIDA[2];
|
||||
uiIDA[0]=IDS_CONFIRM_OK;
|
||||
uiIDA[1]=IDS_CONFIRM_CANCEL;
|
||||
|
||||
StorageManager.RequestMessageBox(IDS_UNLOCK_KICK_PLAYER_TITLE, IDS_UNLOCK_KICK_PLAYER, uiIDA, 2, m_iPad,&CScene_InGamePlayerOptions::KickPlayerReturned,smallId,app.GetStringTable());
|
||||
}
|
||||
else if (hObjPressed == m_checkboxes[eControl_Op] )
|
||||
{
|
||||
resetCheatCheckboxes();
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CScene_InGamePlayerOptions::OnControlNavigate(XUIMessageControlNavigate *pControlNavigateData, BOOL& bHandled)
|
||||
{
|
||||
pControlNavigateData->hObjDest=XuiControlGetNavigation(pControlNavigateData->hObjSource,pControlNavigateData->nControlNavigate,TRUE,TRUE);
|
||||
|
||||
if(pControlNavigateData->hObjDest!=NULL)
|
||||
{
|
||||
bHandled=TRUE;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
int CScene_InGamePlayerOptions::KickPlayerReturned(void *pParam,int iPad,C4JStorage::EMessageResult result)
|
||||
{
|
||||
BYTE smallId = *(BYTE *)pParam;
|
||||
delete pParam;
|
||||
|
||||
if(result==C4JStorage::EMessage_ResultAccept)
|
||||
{
|
||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||
shared_ptr<MultiplayerLocalPlayer> localPlayer = pMinecraft->localplayers[iPad];
|
||||
if(localPlayer != NULL && localPlayer->connection)
|
||||
{
|
||||
localPlayer->connection->send( shared_ptr<KickPlayerPacket>( new KickPlayerPacket(smallId) ) );
|
||||
}
|
||||
|
||||
// Fix for #61494 - [CRASH]: TU7: Code: Multiplayer: Title may crash while kicking a player from an online game.
|
||||
// We cannot do a navigate back here is this actually occurs on a thread other than the main thread. On rare occasions this can clash
|
||||
// with the XUI render and causes a crash. The OnPlayerChanged event should perform the navigate back on the main thread
|
||||
//app.NavigateBack(iPad);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void CScene_InGamePlayerOptions::OnPlayerChanged(void *callbackParam, INetworkPlayer *pPlayer, bool leaving)
|
||||
{
|
||||
CScene_InGamePlayerOptions *scene = (CScene_InGamePlayerOptions *)callbackParam;
|
||||
|
||||
HXUIOBJ hBackScene = scene->GetBackScene();
|
||||
CScene_InGameInfo* infoScene;
|
||||
VOID *pObj;
|
||||
XuiObjectFromHandle( hBackScene, &pObj );
|
||||
infoScene = (CScene_InGameInfo *)pObj;
|
||||
if(infoScene != NULL) CScene_InGameInfo::OnPlayerChanged(infoScene,pPlayer,leaving);
|
||||
|
||||
if(leaving && pPlayer != NULL && pPlayer->GetSmallId() == scene->m_networkSmallId)
|
||||
{
|
||||
app.NavigateBack(scene->m_iPad);
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT CScene_InGamePlayerOptions::OnTransitionStart( XUIMessageTransition *pTransition, BOOL& bHandled )
|
||||
{
|
||||
if(pTransition->dwTransType == XUI_TRANSITION_TO || pTransition->dwTransType == XUI_TRANSITION_BACKTO)
|
||||
{
|
||||
INetworkPlayer *editingPlayer = g_NetworkManager.GetPlayerBySmallId(m_networkSmallId);
|
||||
if(editingPlayer != NULL)
|
||||
{
|
||||
short colourIndex = app.GetPlayerColour( m_networkSmallId );
|
||||
switch(colourIndex)
|
||||
{
|
||||
case 1:
|
||||
m_Icon.PlayVisualRange(L"P1",NULL,L"P1");
|
||||
break;
|
||||
case 2:
|
||||
m_Icon.PlayVisualRange(L"P2",NULL,L"P2");
|
||||
break;
|
||||
case 3:
|
||||
m_Icon.PlayVisualRange(L"P3",NULL,L"P3");
|
||||
break;
|
||||
case 4:
|
||||
m_Icon.PlayVisualRange(L"P4",NULL,L"P4");
|
||||
break;
|
||||
case 5:
|
||||
m_Icon.PlayVisualRange(L"P5",NULL,L"P5");
|
||||
break;
|
||||
case 6:
|
||||
m_Icon.PlayVisualRange(L"P6",NULL,L"P6");
|
||||
break;
|
||||
case 7:
|
||||
m_Icon.PlayVisualRange(L"P7",NULL,L"P7");
|
||||
break;
|
||||
case 8:
|
||||
m_Icon.PlayVisualRange(L"P8",NULL,L"P8");
|
||||
break;
|
||||
case 9:
|
||||
m_Icon.PlayVisualRange(L"P9",NULL,L"P9");
|
||||
break;
|
||||
case 10:
|
||||
m_Icon.PlayVisualRange(L"P10",NULL,L"P10");
|
||||
break;
|
||||
case 11:
|
||||
m_Icon.PlayVisualRange(L"P11",NULL,L"P11");
|
||||
break;
|
||||
case 12:
|
||||
m_Icon.PlayVisualRange(L"P12",NULL,L"P12");
|
||||
break;
|
||||
case 13:
|
||||
m_Icon.PlayVisualRange(L"P13",NULL,L"P13");
|
||||
break;
|
||||
case 14:
|
||||
m_Icon.PlayVisualRange(L"P14",NULL,L"P14");
|
||||
break;
|
||||
case 15:
|
||||
m_Icon.PlayVisualRange(L"P15",NULL,L"P15");
|
||||
break;
|
||||
case 0:
|
||||
default:
|
||||
m_Icon.PlayVisualRange(L"P0",NULL,L"P0");
|
||||
break;
|
||||
};
|
||||
}
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void CScene_InGamePlayerOptions::removeControl(HXUIOBJ hObjToRemove, bool center)
|
||||
{
|
||||
D3DXVECTOR3 pos;
|
||||
float fControlHeight, fTempHeight, fWidth;
|
||||
|
||||
bool changeFocus = m_focusElement == hObjToRemove;
|
||||
|
||||
XuiElementGetBounds(hObjToRemove,&fWidth,&fControlHeight);
|
||||
|
||||
// Hide this control
|
||||
XuiControlSetEnable(hObjToRemove, FALSE);
|
||||
XuiElementSetShow(hObjToRemove, FALSE);
|
||||
|
||||
// Move future downwards nav up
|
||||
HXUIOBJ controlToMove = hObjToRemove;
|
||||
while(controlToMove = XuiControlGetNavigation(controlToMove, XUI_CONTROL_NAVIGATE_DOWN, FALSE, TRUE) )
|
||||
{
|
||||
if(changeFocus && XuiElementIsShown(controlToMove))
|
||||
{
|
||||
m_focusElement = controlToMove;
|
||||
XuiElementSetUserFocus( controlToMove, m_iPad );
|
||||
changeFocus = FALSE;
|
||||
}
|
||||
XuiElementGetPosition(controlToMove, &pos);
|
||||
pos.y -= fControlHeight;
|
||||
XuiElementSetPosition(controlToMove, &pos);
|
||||
}
|
||||
|
||||
// Resize and move scene
|
||||
GetBounds(&fWidth, &fTempHeight);
|
||||
SetBounds(fWidth, fTempHeight - fControlHeight);
|
||||
|
||||
GetPosition(&pos);
|
||||
pos.y += fControlHeight/2;
|
||||
SetPosition(&pos);
|
||||
}
|
||||
|
||||
void CScene_InGamePlayerOptions::resetCheatCheckboxes()
|
||||
{
|
||||
bool isModerator = m_checkboxes[eControl_Op].IsChecked();
|
||||
//bool cheatsEnabled = app.GetGameHostOption(eGameHostOption_CheatsEnabled) != 0;
|
||||
|
||||
if (!m_editingSelf)
|
||||
{
|
||||
m_checkboxes[eControl_HostInvisible].SetEnable(isModerator);
|
||||
m_checkboxes[eControl_HostInvisible].SetCheck( isModerator
|
||||
&& (Player::getPlayerGamePrivilege(m_playerPrivileges, Player::ePlayerGamePrivilege_CanToggleInvisible) != 0) );
|
||||
|
||||
// NOT CREATIVE MODE.
|
||||
{
|
||||
m_checkboxes[eControl_HostFly].SetEnable(isModerator);
|
||||
m_checkboxes[eControl_HostFly].SetCheck( isModerator
|
||||
&& (Player::getPlayerGamePrivilege(m_playerPrivileges, Player::ePlayerGamePrivilege_CanToggleFly) != 0) );
|
||||
|
||||
m_checkboxes[eControl_HostHunger].SetEnable(isModerator);
|
||||
m_checkboxes[eControl_HostHunger].SetCheck( isModerator
|
||||
&& (Player::getPlayerGamePrivilege(m_playerPrivileges, Player::ePlayerGamePrivilege_CanToggleClassicHunger) != 0) );
|
||||
}
|
||||
|
||||
m_checkboxes[eControl_CheatTeleport].SetEnable(isModerator);
|
||||
m_checkboxes[eControl_CheatTeleport].SetCheck( isModerator
|
||||
&& (Player::getPlayerGamePrivilege(m_playerPrivileges, Player::ePlayerGamePrivilege_CanTeleport) != 0) );
|
||||
}
|
||||
}
|
||||
96
Minecraft.Client/Common/XUI/XUI_InGamePlayerOptions.h
Normal file
96
Minecraft.Client/Common/XUI/XUI_InGamePlayerOptions.h
Normal file
@@ -0,0 +1,96 @@
|
||||
#pragma once
|
||||
#include "..\Media\xuiscene_ingame_player_options.h"
|
||||
|
||||
class CScene_InGamePlayerOptions : public CXuiSceneImpl
|
||||
{
|
||||
private:
|
||||
enum EControls
|
||||
{
|
||||
// Checkboxes
|
||||
eControl_BuildAndMine,
|
||||
eControl_UseDoorsAndSwitches,
|
||||
eControl_UseContainers,
|
||||
eControl_AttackPlayers,
|
||||
eControl_AttackAnimals,
|
||||
eControl_Op,
|
||||
eControl_CheatTeleport,
|
||||
eControl_HostFly,
|
||||
eControl_HostHunger,
|
||||
eControl_HostInvisible,
|
||||
|
||||
eControl_CHECKBOXES_COUNT,
|
||||
|
||||
// Others
|
||||
eControl_Kick = eControl_CHECKBOXES_COUNT,
|
||||
};
|
||||
|
||||
protected:
|
||||
HXUIOBJ m_focusElement; // Only used for the remove control process
|
||||
|
||||
CXuiControl m_Icon;
|
||||
CXuiControl m_Gamertag;
|
||||
CXuiScene m_TeleportGroup;
|
||||
CXuiControl m_buttonKick;
|
||||
CXuiCheckbox m_checkboxes[eControl_CHECKBOXES_COUNT];
|
||||
|
||||
XUI_BEGIN_MSG_MAP()
|
||||
XUI_ON_XM_INIT( OnInit )
|
||||
XUI_ON_XM_DESTROY( OnDestroy )
|
||||
XUI_ON_XM_KEYDOWN(OnKeyDown)
|
||||
XUI_ON_XM_NOTIFY_PRESS_EX(OnNotifyPressEx)
|
||||
XUI_ON_XM_CONTROL_NAVIGATE( OnControlNavigate )
|
||||
XUI_ON_XM_TRANSITION_START( OnTransitionStart )
|
||||
XUI_END_MSG_MAP()
|
||||
|
||||
BEGIN_CONTROL_MAP()
|
||||
MAP_CONTROL(IDC_Icon, m_Icon)
|
||||
MAP_CONTROL(IDC_Gamertag, m_Gamertag)
|
||||
|
||||
MAP_CONTROL(IDC_CheckboxBuildAndMine, m_checkboxes[eControl_BuildAndMine])
|
||||
MAP_CONTROL(IDC_CheckboxAttackPlayers, m_checkboxes[eControl_AttackPlayers])
|
||||
MAP_CONTROL(IDC_CheckboxAttackAnimals, m_checkboxes[eControl_AttackAnimals])
|
||||
MAP_CONTROL(IDC_CheckboxUseContainers, m_checkboxes[eControl_UseContainers])
|
||||
MAP_CONTROL(IDC_CheckboxUseDoorsAndSwitches, m_checkboxes[eControl_UseDoorsAndSwitches])
|
||||
MAP_CONTROL(IDC_CheckboxOp, m_checkboxes[eControl_Op])
|
||||
MAP_CONTROL(IDC_CheckboxTeleport, m_checkboxes[eControl_CheatTeleport])
|
||||
MAP_CONTROL(IDC_CheckboxHostInvisible, m_checkboxes[eControl_HostInvisible])
|
||||
MAP_CONTROL(IDC_CheckboxHostFly, m_checkboxes[eControl_HostFly])
|
||||
MAP_CONTROL(IDC_CheckboxHostHunger, m_checkboxes[eControl_HostHunger])
|
||||
|
||||
MAP_CONTROL(IDC_ButtonKick, m_buttonKick)
|
||||
END_CONTROL_MAP()
|
||||
|
||||
|
||||
HRESULT OnInit( XUIMessageInit* pInitData, BOOL& bHandled );
|
||||
HRESULT OnDestroy();
|
||||
HRESULT OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandled);
|
||||
HRESULT OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* pNotifyPressData, BOOL& rfHandled);
|
||||
HRESULT OnControlNavigate(XUIMessageControlNavigate *pControlNavigateData, BOOL& bHandled);
|
||||
HRESULT OnTransitionStart( XUIMessageTransition *pTransition, BOOL& bHandled );
|
||||
|
||||
public:
|
||||
|
||||
// Define the class. The class name must match the ClassOverride property
|
||||
// set for the scene in the UI Authoring tool.
|
||||
XUI_IMPLEMENT_CLASS( CScene_InGamePlayerOptions, L"CScene_InGamePlayerOptions", XUI_CLASS_SCENE )
|
||||
|
||||
static void OnPlayerChanged(void *callbackParam, INetworkPlayer *pPlayer, bool leaving);
|
||||
|
||||
private:
|
||||
bool m_editingSelf;
|
||||
int m_iPad;
|
||||
BYTE m_networkSmallId;
|
||||
unsigned int m_playerPrivileges;
|
||||
D3DXVECTOR3 m_OriginalPosition;
|
||||
|
||||
void removeControl(HXUIOBJ hObjToRemove, bool center);
|
||||
|
||||
/** 4J-JEV:
|
||||
For enabling/disabling 'Can Fly', 'Can Teleport', 'Can Disable Hunger' etc
|
||||
used after changing the moderator checkbox.
|
||||
*/
|
||||
void resetCheatCheckboxes();
|
||||
|
||||
public:
|
||||
static int KickPlayerReturned(void *pParam,int iPad,C4JStorage::EMessageResult result);
|
||||
};
|
||||
153
Minecraft.Client/Common/XUI/XUI_Intro.cpp
Normal file
153
Minecraft.Client/Common/XUI/XUI_Intro.cpp
Normal file
@@ -0,0 +1,153 @@
|
||||
// Minecraft.cpp : Defines the entry point for the application.
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include "..\XUI\XUI_Intro.h"
|
||||
|
||||
#define TIMELINE_NORMAL 0
|
||||
#define TIMELINE_ESRBFADE 1
|
||||
#define TIMELINE_LOGOSFADE 2
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Performs initialization tasks - retrieves controls.
|
||||
//----------------------------------------------------------------------------------
|
||||
HRESULT CScene_Intro::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
|
||||
{
|
||||
MapChildControls();
|
||||
|
||||
// We may need to display a ratings image for a while at the start...
|
||||
m_bWantsToSkip=false;
|
||||
m_iTimeline=TIMELINE_NORMAL;
|
||||
|
||||
// 4J-PB - We can't check to see if the version is a trial or full game until after 5 seconds...
|
||||
// The reason that this is a requirement is that there is a problem that occasionally happens *only* in the production
|
||||
// environment (not partnernet or cert), where if you don<6F>t wait 5 seconds, you can run into an issue where the timing
|
||||
// of the call fails and the game is always identified as being the trial version even if you have upgraded to the full version.
|
||||
// -Joe Dunavant
|
||||
|
||||
// start a timer for the required 5 seconds, plus an extra bit to allow the lib timer to enable the xcontent license check call
|
||||
#ifdef _CONTENT_PACKAGE
|
||||
m_bSkippable=false;
|
||||
XuiSetTimer( m_hObj,0,5200);
|
||||
#else
|
||||
m_bSkippable=true;
|
||||
#endif
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Handler for the button press message.
|
||||
//----------------------------------------------------------------------------------
|
||||
HRESULT CScene_Intro::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* pNotifyPressData, BOOL& rfHandled)
|
||||
{
|
||||
// This assumes all buttons can only be pressed with the A button
|
||||
ui.AnimateKeyPress(pNotifyPressData->UserIndex, VK_PAD_A);
|
||||
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CScene_Intro::OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandled)
|
||||
{
|
||||
ui.AnimateKeyPress(pInputData->UserIndex, pInputData->dwKeyCode);
|
||||
|
||||
static bool bPressed=false;
|
||||
|
||||
if(bPressed==false)
|
||||
{
|
||||
if(m_bSkippable)
|
||||
{
|
||||
// stop the animation
|
||||
XuiElementStopTimeline(m_hObj,TRUE);
|
||||
app.NavigateToScene(XUSER_INDEX_ANY,eUIScene_SaveMessage);
|
||||
app.SetIntroRunning(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_bWantsToSkip=true;
|
||||
}
|
||||
|
||||
bPressed=true;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CScene_Intro::OnTimelineEnd(HXUIOBJ hObjSource, BOOL& bHandled)
|
||||
{
|
||||
int nStart, nEnd;
|
||||
|
||||
if(m_bSkippable && m_bWantsToSkip)
|
||||
{
|
||||
// straight to the game
|
||||
app.NavigateToScene(XUSER_INDEX_ANY,eUIScene_SaveMessage);
|
||||
app.SetIntroRunning(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
switch(m_iTimeline)
|
||||
{
|
||||
case TIMELINE_NORMAL:
|
||||
{
|
||||
// 4J-PB - lots of discussions over this because Brazil is in the NA region. This is what I have been advised to do...
|
||||
//if(ProfileManager.RegionIsNorthAmerica())
|
||||
if(ProfileManager.LocaleIsUSorCanada())
|
||||
{
|
||||
m_iTimeline=TIMELINE_ESRBFADE;
|
||||
XuiElementFindNamedFrame( m_hObj, L"ESRBFade", &nStart );
|
||||
XuiElementFindNamedFrame( m_hObj, L"ESRBFadeEnd", &nEnd );
|
||||
XuiElementPlayTimeline( m_hObj, nStart, nStart, nEnd, FALSE, TRUE );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_iTimeline=TIMELINE_LOGOSFADE;
|
||||
XuiElementFindNamedFrame( m_hObj, L"StartFade", &nStart );
|
||||
XuiElementFindNamedFrame( m_hObj, L"EndFade", &nEnd );
|
||||
XuiElementPlayTimeline( m_hObj, nStart, nStart, nEnd, FALSE, TRUE );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case TIMELINE_ESRBFADE:
|
||||
if(m_bWantsToSkip && m_bSkippable)
|
||||
{
|
||||
app.NavigateToScene(XUSER_INDEX_ANY,eUIScene_SaveMessage);
|
||||
app.SetIntroRunning(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_iTimeline=TIMELINE_LOGOSFADE;
|
||||
XuiElementFindNamedFrame( m_hObj, L"StartFade", &nStart );
|
||||
XuiElementFindNamedFrame( m_hObj, L"EndFade", &nEnd );
|
||||
XuiElementPlayTimeline( m_hObj, nStart, nStart, nEnd, FALSE, TRUE );
|
||||
}
|
||||
break;
|
||||
case TIMELINE_LOGOSFADE:
|
||||
app.NavigateToScene(XUSER_INDEX_ANY,eUIScene_SaveMessage);
|
||||
app.SetIntroRunning(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
HRESULT CScene_Intro::OnTimer(XUIMessageTimer *pData,BOOL& rfHandled)
|
||||
{
|
||||
HRESULT hr=XuiKillTimer(m_hObj,0);
|
||||
m_bSkippable=true;
|
||||
|
||||
if(m_bWantsToSkip)
|
||||
{
|
||||
// stop the animation
|
||||
XuiElementStopTimeline(m_hObj,TRUE);
|
||||
app.NavigateToScene(XUSER_INDEX_ANY,eUIScene_SaveMessage);
|
||||
app.SetIntroRunning(false);
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
44
Minecraft.Client/Common/XUI/XUI_Intro.h
Normal file
44
Minecraft.Client/Common/XUI/XUI_Intro.h
Normal file
@@ -0,0 +1,44 @@
|
||||
#pragma once
|
||||
|
||||
#include "../media/xuiscene_intro.h"
|
||||
|
||||
class CScene_Intro : public CXuiSceneImpl
|
||||
{
|
||||
protected:
|
||||
CXuiScene m_Scene;
|
||||
CXuiControl m_4jlogo;
|
||||
CXuiElement m_grpXbox;
|
||||
|
||||
XUI_BEGIN_MSG_MAP()
|
||||
XUI_ON_XM_INIT( OnInit )
|
||||
XUI_ON_XM_KEYDOWN(OnKeyDown)
|
||||
XUI_ON_XM_NOTIFY_PRESS_EX(OnNotifyPressEx)
|
||||
XUI_ON_XM_TIMELINE_END(OnTimelineEnd)
|
||||
XUI_ON_XM_TIMER( OnTimer )
|
||||
XUI_END_MSG_MAP()
|
||||
|
||||
BEGIN_CONTROL_MAP()
|
||||
//MAP_CONTROL(IDC_LogoGroup, m_grpXbox)
|
||||
//BEGIN_MAP_CHILD_CONTROLS(m_grpXbox)
|
||||
MAP_CONTROL(IDC_Logo4J, m_4jlogo)
|
||||
//END_MAP_CHILD_CONTROLS()
|
||||
|
||||
END_CONTROL_MAP()
|
||||
|
||||
|
||||
HRESULT OnInit( XUIMessageInit* pInitData, BOOL& bHandled );
|
||||
HRESULT OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* pNotifyPressData,BOOL& rfHandled);
|
||||
HRESULT OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandled);
|
||||
HRESULT OnTimelineEnd(HXUIOBJ hObjSource, BOOL& bHandled);
|
||||
HRESULT OnTimer(XUIMessageTimer *pData,BOOL& rfHandled);
|
||||
|
||||
bool m_bSkippable;
|
||||
bool m_bWantsToSkip;
|
||||
int m_iTimeline;
|
||||
public:
|
||||
|
||||
// Define the class. The class name must match the ClassOverride property
|
||||
// set for the scene in the UI Authoring tool.
|
||||
XUI_IMPLEMENT_CLASS( CScene_Intro, L"CScene_Intro", XUI_CLASS_SCENE )
|
||||
|
||||
};
|
||||
1202
Minecraft.Client/Common/XUI/XUI_Leaderboards.cpp
Normal file
1202
Minecraft.Client/Common/XUI/XUI_Leaderboards.cpp
Normal file
File diff suppressed because it is too large
Load Diff
169
Minecraft.Client/Common/XUI/XUI_Leaderboards.h
Normal file
169
Minecraft.Client/Common/XUI/XUI_Leaderboards.h
Normal file
@@ -0,0 +1,169 @@
|
||||
#pragma once
|
||||
#include "XUI_Helper.h"
|
||||
#include "../media/xuiscene_leaderboards.h"
|
||||
|
||||
#include "..\Leaderboards\LeaderboardManager.h"
|
||||
|
||||
class CXuiCtrlCraftIngredientSlot;
|
||||
|
||||
class CScene_Leaderboards : public CXuiSceneImpl, public LeaderboardReadListener
|
||||
{
|
||||
private:
|
||||
// 4J Stu - Because the kills leaderboard doesn't a peaceful entry there are some special
|
||||
// handling to make it skip that. We have re-arranged the order of the leaderboards so
|
||||
// I am making this in case we do it again.
|
||||
// 4J Stu - Made it a member of the class, rather than a #define
|
||||
static const int LEADERBOARD_KILLS_POSITION = 3;
|
||||
|
||||
static const int NUM_LEADERBOARDS = 4;//6; //Number of leaderboards
|
||||
static const int NUM_ENTRIES = 101; //Cache up to this many entries
|
||||
static const int READ_SIZE = 15; //Read this many entries at a time
|
||||
|
||||
// static LPCWSTR FLAG_ICON_PATHS[37];
|
||||
int m_iPad;
|
||||
|
||||
bool m_bPopulatedOnce;
|
||||
|
||||
static const int LEADERBOARD_HEADERS[NUM_LEADERBOARDS][4];
|
||||
|
||||
static const int TitleIcons[NUM_LEADERBOARDS][7];
|
||||
static LPCWSTR m_TitleIconNameA[7];
|
||||
static LPCWSTR m_TextColumnNameA[7];
|
||||
HXUIOBJ m_hTextEntryA[7];
|
||||
|
||||
struct LeaderboardDescriptor {
|
||||
DWORD m_viewId;
|
||||
DWORD m_columnCount;
|
||||
WORD m_columnIds[8];
|
||||
|
||||
LeaderboardDescriptor(DWORD viewId, DWORD columnCount, WORD columnId_0, WORD columnId_1, WORD columnId_2, WORD columnId_3, WORD columnId_4, WORD columnId_5, WORD columnId_6, WORD columnId_7)
|
||||
{
|
||||
m_viewId = viewId;
|
||||
m_columnCount = columnCount;
|
||||
m_columnIds[0] = columnId_0;
|
||||
m_columnIds[1] = columnId_1;
|
||||
m_columnIds[2] = columnId_2;
|
||||
m_columnIds[3] = columnId_3;
|
||||
m_columnIds[4] = columnId_4;
|
||||
m_columnIds[5] = columnId_5;
|
||||
m_columnIds[6] = columnId_6;
|
||||
m_columnIds[7] = columnId_7;
|
||||
}
|
||||
};
|
||||
|
||||
static const LeaderboardDescriptor LEADERBOARD_DESCRIPTORS[NUM_LEADERBOARDS][4];
|
||||
|
||||
struct LeaderboardEntry {
|
||||
PlayerUID m_xuid;
|
||||
DWORD m_rank;
|
||||
WCHAR m_wcRank[12];
|
||||
WCHAR m_gamerTag[XUSER_NAME_SIZE+1];
|
||||
//int m_locale;
|
||||
unsigned int m_columns[7];
|
||||
WCHAR m_wcColumns[7][12];
|
||||
bool m_bPlayer; //Is the player
|
||||
bool m_bOnline; //Is online
|
||||
bool m_bFriend; //Is friend
|
||||
bool m_bRequestedFriend; //Friend request sent but not answered
|
||||
};
|
||||
|
||||
struct Leaderboard {
|
||||
DWORD m_totalEntryCount; //Either total number of entries in leaderboard, or total number of results for a friends query
|
||||
DWORD m_entryStartIndex; //Index of first entry
|
||||
DWORD m_currentEntryCount; //Current number of entries
|
||||
LeaderboardEntry m_entries[NUM_ENTRIES];
|
||||
DWORD m_numColumns;
|
||||
};
|
||||
|
||||
Leaderboard m_leaderboard; //All leaderboard data for the currently selected filter
|
||||
|
||||
unsigned int m_currentLeaderboard; //The current leaderboard selected for view
|
||||
|
||||
#ifdef _XBOX
|
||||
LeaderboardManager::EFilterMode m_currentFilter; //The current filter selected
|
||||
#endif
|
||||
unsigned int m_currentDifficulty; //The current difficulty selected
|
||||
|
||||
unsigned int m_newEntryIndex; //Index of the first entry being read
|
||||
unsigned int m_newReadSize; //Number of entries in the current read operation
|
||||
|
||||
int m_newTop; //Index of the element that should be at the top of the list
|
||||
int m_newSel; //Index of the element that should be selected in the list
|
||||
|
||||
XONLINE_FRIEND* m_friends; //Current player's friends
|
||||
unsigned int m_numFriends; //Count of friends
|
||||
PlayerUID* m_filteredFriends; //List of all friend XUIDs (and player's), only counting actual friends, not pending
|
||||
unsigned int m_numFilteredFriends; //Count of filtered friends
|
||||
|
||||
CXuiList m_listGamers; //The XUI list showing the leaderboard info
|
||||
CXuiControl m_textLeaderboard; //The XUI text box showing the current leaderboard name
|
||||
CXuiControl m_textInfo; //The XUI text box showing info messages (loading, no results, etc.)
|
||||
CXuiControl m_textFilter; //The XUI text box showing the current filter
|
||||
CXuiControl m_textEntries; //The XUI text box showing the total number of entries in this leaderboard
|
||||
CXuiCtrlCraftIngredientSlot *m_pHTitleIconSlots[7];
|
||||
float m_fTitleIconXPositions[7];
|
||||
float m_fTextXPositions[7];
|
||||
|
||||
XUI_BEGIN_MSG_MAP()
|
||||
XUI_ON_XM_INIT( OnInit )
|
||||
XUI_ON_XM_DESTROY( OnDestroy )
|
||||
XUI_ON_XM_KEYDOWN( OnKeyDown )
|
||||
XUI_ON_XM_GET_ITEMCOUNT_ALL(OnGetItemCountAll)
|
||||
XUI_ON_XM_GET_SOURCE_TEXT(OnGetSourceDataText)
|
||||
XUI_ON_XM_GET_SOURCE_IMAGE(OnGetSourceDataImage)
|
||||
XUI_ON_XM_NOTIFY_SELCHANGED(OnNotifySelChanged)
|
||||
XUI_ON_XM_NOTIFY_SET_FOCUS(OnNotifySetFocus)
|
||||
|
||||
XUI_END_MSG_MAP()
|
||||
|
||||
BEGIN_CONTROL_MAP()
|
||||
MAP_CONTROL(IDC_XuiListGamers, m_listGamers)
|
||||
MAP_CONTROL(IDC_XuiTextLeaderboard, m_textLeaderboard)
|
||||
MAP_CONTROL(IDC_XuiTextInfo, m_textInfo)
|
||||
MAP_CONTROL(IDC_XuiTextFilter, m_textFilter)
|
||||
MAP_CONTROL(IDC_XuiTextEntries, m_textEntries)
|
||||
END_CONTROL_MAP()
|
||||
|
||||
HRESULT OnInit(XUIMessageInit* pInitData, BOOL& bHandled);
|
||||
HRESULT OnDestroy();
|
||||
HRESULT OnKeyDown(XUIMessageInput* pInputData, BOOL& bHandled);
|
||||
HRESULT OnGetItemCountAll(XUIMessageGetItemCount *pGetItemCountData, BOOL& bHandled);
|
||||
HRESULT OnGetSourceDataText(XUIMessageGetSourceText *pGetSourceTextData, BOOL& bHandled);
|
||||
HRESULT OnGetSourceDataImage(XUIMessageGetSourceImage* pGetImage, BOOL& bHandled);
|
||||
HRESULT OnNotifySetFocus(HXUIOBJ hObjSource, XUINotifyFocus *pNotifyFocusData, BOOL& bHandled);
|
||||
HRESULT OnNotifySelChanged(HXUIOBJ hObjSource, XUINotifySelChanged *pNotifySelChangedData, BOOL& bHandled);
|
||||
|
||||
//Start a read request with the current parameters
|
||||
void ReadStats(int startIndex);
|
||||
|
||||
//Callback function called when stats read completes, userdata contains pointer to instance of CScene_Leaderboards
|
||||
virtual bool OnStatsReadComplete(bool success, int numResults, LeaderboardManager::ViewOut results);
|
||||
|
||||
//Copy the stats from the raw m_stats structure into the m_leaderboards structure
|
||||
int m_numStats;
|
||||
PXUSER_STATS_READ_RESULTS m_stats;
|
||||
bool RetrieveStats();
|
||||
|
||||
//Populate the XUI leaderboard with the contents of m_leaderboards
|
||||
void PopulateLeaderboard(bool noResults);
|
||||
|
||||
//Copy a leaderboard entry from the stats row
|
||||
void CopyLeaderboardEntry(PXUSER_STATS_ROW statsRow, LeaderboardEntry* leaderboardEntry, bool isDistanceLeaderboard);
|
||||
|
||||
//Set the header text of the leaderboard
|
||||
void SetLeaderboardHeader();
|
||||
|
||||
// Set the title icons
|
||||
int SetLeaderboardTitleIcons();
|
||||
void ClearLeaderboardTitlebar();
|
||||
void Reposition(int iNumber);
|
||||
void RepositionText(int iNumber);
|
||||
void UpdateTooltips();
|
||||
|
||||
protected:
|
||||
bool m_isProcessingStatsRead;
|
||||
bool m_bReady;
|
||||
public:
|
||||
|
||||
XUI_IMPLEMENT_CLASS( CScene_Leaderboards, L"CScene_Leaderboards", XUI_CLASS_SCENE )
|
||||
};
|
||||
1686
Minecraft.Client/Common/XUI/XUI_LoadSettings.cpp
Normal file
1686
Minecraft.Client/Common/XUI/XUI_LoadSettings.cpp
Normal file
File diff suppressed because it is too large
Load Diff
154
Minecraft.Client/Common/XUI/XUI_LoadSettings.h
Normal file
154
Minecraft.Client/Common/XUI/XUI_LoadSettings.h
Normal file
@@ -0,0 +1,154 @@
|
||||
#pragma once
|
||||
#include "../media/xuiscene_load_settings.h"
|
||||
#include "XUI_Ctrl_SliderWrapper.h"
|
||||
#include "XUI_Ctrl_4JIcon.h"
|
||||
#include "XUI_CustomMessages.h"
|
||||
#include "XUI_MultiGameLaunchMoreOptions.h"
|
||||
|
||||
class CScene_LoadGameSettings : public CXuiSceneImpl
|
||||
{
|
||||
public:
|
||||
typedef struct
|
||||
{
|
||||
unsigned int uiLen;
|
||||
unsigned int uiCode;
|
||||
}
|
||||
PNG_CHUNK;
|
||||
protected:
|
||||
// Control and Element wrapper objects.
|
||||
CXuiScene m_MainScene;
|
||||
CXuiScene m_TexturePackDetails;
|
||||
CXuiControl m_GameName;
|
||||
CXuiControl m_GameSeed;
|
||||
CXuiControl m_GameCreatedMode;
|
||||
CXuiControl m_ButtonLoad;
|
||||
CXuiControl m_ButtonGameMode;
|
||||
CXuiControl m_MoreOptions;
|
||||
CXuiCtrl4JIcon m_GameIcon;
|
||||
CXuiCtrlSliderWrapper m_SliderDifficulty;
|
||||
CXuiCtrl4JList *m_pTexturePacksList;
|
||||
CXuiControl m_texturePackTitle, m_texturePackDescription;
|
||||
CXuiCtrl4JIcon *m_texturePackIcon, *m_texturePackComparison;
|
||||
|
||||
// Message map. Here we tie messages to message handlers.
|
||||
XUI_BEGIN_MSG_MAP()
|
||||
XUI_ON_XM_INIT( OnInit )
|
||||
XUI_ON_XM_NOTIFY_PRESS_EX(OnNotifyPressEx)
|
||||
XUI_ON_XM_CONTROL_NAVIGATE( OnControlNavigate )
|
||||
XUI_ON_XM_KEYDOWN(OnKeyDown)
|
||||
XUI_ON_XM_NOTIFY_VALUE_CHANGED(OnNotifyValueChanged)
|
||||
XUI_ON_XM_GET_SOURCE_IMAGE(OnGetSourceDataImage)
|
||||
XUI_ON_XM_TRANSITION_START(OnTransitionStart)
|
||||
XUI_ON_XM_TRANSITION_END(OnTransitionEnd)
|
||||
XUI_ON_XM_FONTRENDERERCHANGE_MESSAGE(OnFontRendererChange)
|
||||
XUI_ON_XM_NOTIFY_SELCHANGED( OnNotifySelChanged )
|
||||
XUI_ON_XM_TIMER( OnTimer )
|
||||
XUI_ON_XM_NOTIFY_KILL_FOCUS( OnNotifyKillFocus )
|
||||
XUI_ON_XM_DESTROY( OnDestroy )
|
||||
XUI_ON_XM_DLCINSTALLED_MESSAGE(OnCustomMessage_DLCInstalled)
|
||||
XUI_ON_XM_DLCLOADED_MESSAGE(OnCustomMessage_DLCMountingComplete)
|
||||
XUI_ON_XM_NAV_RETURN(OnNavReturn)
|
||||
XUI_END_MSG_MAP()
|
||||
|
||||
// Control mapping to objects
|
||||
BEGIN_CONTROL_MAP()
|
||||
MAP_CONTROL(IDC_MainScene, m_MainScene)
|
||||
BEGIN_MAP_CHILD_CONTROLS(m_MainScene)
|
||||
MAP_CONTROL(IDC_XuiLoadSettings, m_ButtonLoad)
|
||||
MAP_CONTROL(IDC_XuiGameModeToggle, m_ButtonGameMode)
|
||||
MAP_CONTROL(IDC_XuiMoreOptions, m_MoreOptions)
|
||||
MAP_CONTROL(IDC_XuiGameIcon, m_GameIcon);
|
||||
MAP_CONTROL(IDC_XuiGameName, m_GameName)
|
||||
MAP_CONTROL(IDC_XuiGameSeed, m_GameSeed)
|
||||
MAP_CONTROL(IDC_XuiCreatedMode, m_GameCreatedMode)
|
||||
MAP_CONTROL(IDC_XuiSliderDifficulty, m_SliderDifficulty)
|
||||
MAP_OVERRIDE(IDC_TexturePacksList, m_pTexturePacksList)
|
||||
//MAP_CONTROL(IDC_XuiGameMode, m_GameMode)
|
||||
END_MAP_CHILD_CONTROLS()
|
||||
MAP_CONTROL(IDC_TexturePackDetails, m_TexturePackDetails)
|
||||
BEGIN_MAP_CHILD_CONTROLS(m_TexturePackDetails)
|
||||
MAP_CONTROL(IDC_TexturePackName, m_texturePackTitle)
|
||||
MAP_CONTROL(IDC_TexturePackDescription, m_texturePackDescription)
|
||||
MAP_OVERRIDE(IDC_Icon, m_texturePackIcon)
|
||||
MAP_OVERRIDE(IDC_ComparisonPic, m_texturePackComparison)
|
||||
END_MAP_CHILD_CONTROLS()
|
||||
END_CONTROL_MAP()
|
||||
|
||||
HRESULT OnInit( XUIMessageInit* pInitData, BOOL& bHandled );
|
||||
HRESULT OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* pNotifyPressData, BOOL& rfHandled);
|
||||
HRESULT OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandled);
|
||||
HRESULT OnGetSourceDataImage(XUIMessageGetSourceImage *pGetSourceImageData,BOOL& bHandled);
|
||||
HRESULT OnNotifyValueChanged( HXUIOBJ hObjSource, XUINotifyValueChanged* pNotifyValueChanged, BOOL& bHandled );
|
||||
HRESULT OnTransitionStart( XUIMessageTransition *pTransition, BOOL& bHandled );
|
||||
HRESULT OnTransitionEnd( XUIMessageTransition *pTransition, BOOL& bHandled );
|
||||
HRESULT OnFontRendererChange();
|
||||
HRESULT OnControlNavigate(XUIMessageControlNavigate *pControlNavigateData, BOOL& bHandled);
|
||||
HRESULT OnNotifySelChanged( HXUIOBJ hObjSource, XUINotifySelChanged* pNotifySelChangedData, BOOL& bHandled );
|
||||
HRESULT OnTimer( XUIMessageTimer *pTimer, BOOL& bHandled );
|
||||
HRESULT OnNotifyKillFocus(HXUIOBJ hObjSource, XUINotifyFocus *pNotifyFocusData, BOOL& bHandled);
|
||||
HRESULT OnDestroy();
|
||||
HRESULT OnCustomMessage_DLCInstalled();
|
||||
HRESULT OnCustomMessage_DLCMountingComplete();
|
||||
HRESULT OnNavReturn(HXUIOBJ hObj,BOOL& rfHandled);
|
||||
|
||||
|
||||
static int LoadSaveDataReturned(void *pParam,bool bContinue);
|
||||
static int LoadSaveDataForNameChangeReturned(void *pParam,bool bContinue);
|
||||
static int DeviceRemovedDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result);
|
||||
static void StartGameFromSave(CScene_LoadGameSettings* pClass, DWORD dwLocalUsersMask);
|
||||
static int StartGame_SignInReturned(void *pParam,bool bContinue, int iPad);
|
||||
static int DeviceSelectReturned(void *pParam,bool bContinue);
|
||||
static int ConfirmLoadReturned(void *pParam,int iPad,C4JStorage::EMessageResult result);
|
||||
static int DeleteSaveDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result);
|
||||
static int DeleteSaveDataReturned(void *pParam,bool bSuccess);
|
||||
static int CheckResetNetherReturned(void *pParam,int iPad,C4JStorage::EMessageResult result);
|
||||
static int TexturePackDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result);
|
||||
|
||||
static int Progress(void *pParam,float fProgress);
|
||||
|
||||
void LoadLevelGen(LevelGenerationOptions *levelGen);
|
||||
|
||||
HRESULT LaunchGame(void);
|
||||
public:
|
||||
static unsigned char szPNG[8];
|
||||
|
||||
// Define the class. The class name must match the ClassOverride property
|
||||
// set for the scene in the UI Authoring tool.
|
||||
XUI_IMPLEMENT_CLASS( CScene_LoadGameSettings, L"CScene_LoadGameSettings", XUI_CLASS_SCENE )
|
||||
|
||||
private:
|
||||
static int UnlockTexturePackReturned(void *pParam,int iPad,C4JStorage::EMessageResult result);
|
||||
void UpdateTexturePackDescription(int index);
|
||||
void ClearTexturePackDescription();
|
||||
void UpdateCurrentTexturePack();
|
||||
|
||||
bool m_bIgnoreInput;
|
||||
HXUIBRUSH m_hXuiBrush;
|
||||
HXUIBRUSH m_hTexturePackIconBrush;
|
||||
HXUIBRUSH m_hTexturePackComparisonBrush;
|
||||
|
||||
int m_iPad;
|
||||
int m_iSaveGameInfoIndex;
|
||||
bool m_bMultiplayerAllowed;
|
||||
static int m_iDifficultyTitleSettingA[4];
|
||||
int m_CurrentDifficulty;
|
||||
bool m_bHasBeenInCreative;
|
||||
bool m_bSetup;
|
||||
bool m_texturePackDescDisplayed;
|
||||
|
||||
DWORD m_dwSaveFileC;
|
||||
#ifdef _XBOX
|
||||
C4JStorage::CACHEINFOSTRUCT *m_InfoA;
|
||||
#endif
|
||||
unsigned char m_szSeed[50];
|
||||
XCONTENT_DATA m_XContentData;
|
||||
LaunchMoreOptionsMenuInitData m_MoreOptionsParams;
|
||||
bool m_bGameModeSurvival;
|
||||
unsigned int m_currentTexturePackIndex;
|
||||
DLCPack * m_pDLCPack;
|
||||
LevelGenerationOptions *m_levelGen;
|
||||
|
||||
int m_iTexturePacksNotInstalled;
|
||||
int *m_iConfigA; // track the texture packs that we don't have installed
|
||||
LoadMenuInitData *m_params;
|
||||
};
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user