[ScreenNetEvaluation] add GetNumActivePlayers() binding, as well as UpdateNetEvalStats message (has one param, ActivePlayerIndex).

This commit is contained in:
AJ Kelly
2010-03-09 03:21:22 -06:00
parent 74d7895ccd
commit fbd156c00f
2 changed files with 31 additions and 6 deletions
+25 -6
View File
@@ -33,16 +33,13 @@ void ScreenNetEvaluation::Init()
m_pActivePlayer = pn;
}
if( m_pActivePlayer == PLAYER_1 )
m_iShowSide = 2;
else
m_iShowSide = 1;
m_iShowSide = (m_pActivePlayer == PLAYER_1) ? 2 : 1;
m_rectUsersBG.SetWidth( USERSBG_WIDTH );
m_rectUsersBG.SetHeight( USERSBG_HEIGHT );
m_rectUsersBG.RunCommands( USERSBG_COMMAND );
// XXX: The name should be ssprintf( "UsersBG%d", m_iShowSide ) and then
// then LOAD_ALL_COMMANDS_AND_SET_XY_AND_ON_COMMAND should be used.
// XXX: The name should be set with m_iShowSide and then
// LOAD_ALL_COMMANDS_AND_SET_XY_AND_ON_COMMAND should be used. -aj
m_rectUsersBG.SetName( "UsersBG" );
m_rectUsersBG.SetXY(
@@ -206,8 +203,30 @@ void ScreenNetEvaluation::UpdateStats()
}
m_textPlayerOptions[m_pActivePlayer].SetText( NSMAN->m_EvalPlayerData[m_iCurrentPlayer].playerOptions );
// broadcast a message so themes know that the active player has changed. -aj
Message msg("UpdateNetEvalStats");
msg.SetParam( "ActivePlayerIndex", m_pActivePlayer );
MESSAGEMAN->Broadcast(msg);
}
// lua start
#include "LuaBinding.h"
class LunaScreenNetEvaluation: public Luna<ScreenNetEvaluation>
{
public:
static int GetNumActivePlayers( T* p, lua_State *L ) { lua_pushnumber( L, p->GetNumActivePlayers() ); return 1; }
LunaScreenNetEvaluation()
{
ADD_METHOD( GetNumActivePlayers );
}
};
LUA_REGISTER_DERIVED_CLASS( ScreenNetEvaluation, ScreenEvaluation )
// lua end
#endif
/*
+6
View File
@@ -10,6 +10,12 @@ class ScreenNetEvaluation: public ScreenEvaluation
public:
virtual void Init();
// sm-ssc:
int GetNumActivePlayers(){ return m_iActivePlayers; }
// Lua
virtual void PushSelf( lua_State *L );
protected:
virtual void MenuLeft( const InputEventPlus &input );
virtual void MenuUp( const InputEventPlus &input );