RoomInfo box

This commit is contained in:
Josh Allen
2005-09-19 19:08:14 +00:00
parent 3be5b8ac0b
commit dd33512012
2 changed files with 71 additions and 0 deletions
+54
View File
@@ -22,6 +22,8 @@
#define ROOMSPACEY THEME->GetMetricF(m_sName,"RoomsSpacingY") #define ROOMSPACEY THEME->GetMetricF(m_sName,"RoomsSpacingY")
#define ROOMLOWERBOUND THEME->GetMetricF(m_sName,"RoomsLowerBound") #define ROOMLOWERBOUND THEME->GetMetricF(m_sName,"RoomsLowerBound")
#define ROOMUPPERBOUND THEME->GetMetricF(m_sName,"RoomsUpperBound") #define ROOMUPPERBOUND THEME->GetMetricF(m_sName,"RoomsUpperBound")
#define INFOBOXWIDTH THEME->GetMetricF(m_sName,"InfoBoxWidth")
#define INFOBOXHEIGHT THEME->GetMetricF(m_sName,"InfoBoxHeight")
AutoScreenMessage( SM_SMOnlinePack ) AutoScreenMessage( SM_SMOnlinePack )
AutoScreenMessage( SM_BackFromRoomName ) AutoScreenMessage( SM_BackFromRoomName )
@@ -31,6 +33,7 @@ REGISTER_SCREEN_CLASS( ScreenNetRoom );
ScreenNetRoom::ScreenNetRoom( const CString& sName ) : ScreenNetSelectBase( sName ) ScreenNetRoom::ScreenNetRoom( const CString& sName ) : ScreenNetSelectBase( sName )
{ {
GAMESTATE->FinishStage(); GAMESTATE->FinishStage();
m_RoomInfoState = LOCKED;
} }
void ScreenNetRoom::Init() void ScreenNetRoom::Init()
@@ -64,13 +67,36 @@ void ScreenNetRoom::Init()
this->MoveToHead( &m_RoomWheel ); this->MoveToHead( &m_RoomWheel );
ON_COMMAND( m_RoomWheel ); ON_COMMAND( m_RoomWheel );
m_roomInfo.SetName("InfoBox");
m_roomInfo.SetWidth( INFOBOXWIDTH );
m_roomInfo.SetHeight( INFOBOXHEIGHT );
SET_XY( m_roomInfo );
m_roomInfo.SetHidden( true );
OFF_COMMAND( m_roomInfo );
this->AddChild(&m_roomInfo);
m_roomInfo.SetDrawOrder(1);
NSMAN->ReportNSSOnOff(7); NSMAN->ReportNSSOnOff(7);
} }
void ScreenNetRoom::Input( const InputEventPlus &input ) void ScreenNetRoom::Input( const InputEventPlus &input )
{ {
if (((input.MenuI.button == MENU_BUTTON_LEFT) || (input.MenuI.button == MENU_BUTTON_RIGHT)) && (input.type == IET_RELEASE)) if (((input.MenuI.button == MENU_BUTTON_LEFT) || (input.MenuI.button == MENU_BUTTON_RIGHT)) && (input.type == IET_RELEASE))
{
m_RoomWheel.Move(0); m_RoomWheel.Move(0);
m_deployDelay.Touch();
m_RoomInfoState = CLOSED;
LOG->Info("touched");
}
if (((input.MenuI.button == MENU_BUTTON_LEFT) || (input.MenuI.button == MENU_BUTTON_RIGHT)) && (input.type != IET_RELEASE))
{
if (m_roomInfo.GetHidden())
m_roomInfo.SetHidden(false);
RetractInfoBox();
m_RoomInfoState = LOCKED; //Force a lock so the info box does not deploy from a quick pause in scrolling
}
ScreenNetSelectBase::Input( input ); ScreenNetSelectBase::Input( input );
} }
@@ -158,6 +184,12 @@ void ScreenNetRoom::TweenOffScreen()
void ScreenNetRoom::Update( float fDeltaTime ) void ScreenNetRoom::Update( float fDeltaTime )
{ {
ScreenNetSelectBase::Update( fDeltaTime ); ScreenNetSelectBase::Update( fDeltaTime );
if (m_deployDelay.PeekDeltaTime() >= 1.5)
DeployInfoBox();
if (m_retractDelay.PeekDeltaTime() >= 5)
RetractInfoBox();
} }
void ScreenNetRoom::MenuStart( PlayerNumber pn ) void ScreenNetRoom::MenuStart( PlayerNumber pn )
@@ -195,13 +227,16 @@ void ScreenNetRoom::MenuLeft( PlayerNumber pn, const InputEventType type )
{ {
if (type == IET_FIRST_PRESS) if (type == IET_FIRST_PRESS)
m_RoomWheel.Move(-1); m_RoomWheel.Move(-1);
ScreenNetSelectBase::MenuLeft( pn ); ScreenNetSelectBase::MenuLeft( pn );
} }
void ScreenNetRoom::MenuRight( PlayerNumber pn, const InputEventType type ) void ScreenNetRoom::MenuRight( PlayerNumber pn, const InputEventType type )
{ {
if (type == IET_FIRST_PRESS) if (type == IET_FIRST_PRESS)
{
m_RoomWheel.Move(1); m_RoomWheel.Move(1);
}
ScreenNetSelectBase::MenuRight( pn ); ScreenNetSelectBase::MenuRight( pn );
} }
@@ -267,6 +302,25 @@ void ScreenNetRoom::CreateNewRoom( const CString& rName, const CString& rDesc )
NSMAN->SendSMOnline( ); NSMAN->SendSMOnline( );
} }
void ScreenNetRoom::DeployInfoBox()
{
if (m_RoomInfoState == CLOSED)
{
SET_XY_AND_ON_COMMAND( m_roomInfo );
m_retractDelay.Touch();
m_RoomInfoState = OPEN;
}
}
void ScreenNetRoom::RetractInfoBox()
{
if (m_RoomInfoState == OPEN)
{
OFF_COMMAND( m_roomInfo );
m_RoomInfoState = LOCKED;
}
}
#endif #endif
/* /*
+17
View File
@@ -8,6 +8,13 @@
#include <vector> #include <vector>
#include "RoomWheel.h" #include "RoomWheel.h"
enum RoomInfoState
{
OPEN = 0,
CLOSED,
LOCKED
};
class RoomData { class RoomData {
public: public:
void SetName( const CString& name ) { m_name = name; } void SetName( const CString& name ) { m_name = name; }
@@ -45,6 +52,9 @@ private:
void MenuRight( PlayerNumber pn, const InputEventType type ); void MenuRight( PlayerNumber pn, const InputEventType type );
void CreateNewRoom( const CString& rName, const CString& rDesc ); void CreateNewRoom( const CString& rName, const CString& rDesc );
void DeployInfoBox();
void RetractInfoBox();
RageSound m_soundChangeSel; RageSound m_soundChangeSel;
BitmapText m_textTitle; BitmapText m_textTitle;
@@ -57,6 +67,13 @@ private:
CString m_newRoomName, m_newRoomDesc; CString m_newRoomName, m_newRoomDesc;
RoomWheel m_RoomWheel; RoomWheel m_RoomWheel;
Quad m_roomInfo;
RageTimer m_deployDelay;
RageTimer m_retractDelay;
RoomInfoState m_RoomInfoState;
}; };
#endif #endif