sType -> sMetricsGroup; remove loading from Node attributes and instead use lua methods
This commit is contained in:
@@ -11,57 +11,31 @@ void TextBanner::LoadFromNode( const XNode* pNode )
|
|||||||
{
|
{
|
||||||
m_bInitted = true;
|
m_bInitted = true;
|
||||||
|
|
||||||
{
|
|
||||||
const XNode *pTitleNode = pNode->GetChild( "Title" );
|
|
||||||
if( pTitleNode == NULL )
|
|
||||||
RageException::Throw( "%s: TextBanner: missing the Title child", ActorUtil::GetWhere(pNode).c_str() );
|
|
||||||
m_textTitle.LoadFromNode( pTitleNode );
|
|
||||||
this->AddChild( &m_textTitle );
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
const XNode *pSubtitleNode = pNode->GetChild( "Subtitle" );
|
|
||||||
if( pSubtitleNode == NULL )
|
|
||||||
RageException::Throw( "%s: TextBanner: missing the Subtitle child", ActorUtil::GetWhere(pNode).c_str() );
|
|
||||||
m_textSubTitle.LoadFromNode( pSubtitleNode );
|
|
||||||
this->AddChild( &m_textSubTitle );
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
const XNode *pArtistNode = pNode->GetChild( "Artist" );
|
|
||||||
if( pArtistNode == NULL )
|
|
||||||
RageException::Throw( "%s: TextBanner: missing the Artist child", ActorUtil::GetWhere(pNode).c_str() );
|
|
||||||
m_textArtist.LoadFromNode( pArtistNode );
|
|
||||||
this->AddChild( &m_textArtist );
|
|
||||||
}
|
|
||||||
|
|
||||||
pNode->GetAttrValue( "ArtistPrependString", m_sArtistPrependString );
|
|
||||||
|
|
||||||
ActorFrame::LoadFromNode( pNode );
|
ActorFrame::LoadFromNode( pNode );
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextBanner::Load( RString sType )
|
void TextBanner::Load( RString sMetricsGroup )
|
||||||
{
|
{
|
||||||
m_bInitted = true;
|
m_bInitted = true;
|
||||||
|
|
||||||
m_textTitle.SetName( "Title" );
|
m_textTitle.SetName( "Title" );
|
||||||
m_textTitle.LoadFromFont( THEME->GetPathF(sType,"text") );
|
m_textTitle.LoadFromFont( THEME->GetPathF(sMetricsGroup,"text") );
|
||||||
this->AddChild( &m_textTitle );
|
this->AddChild( &m_textTitle );
|
||||||
|
|
||||||
m_textSubTitle.SetName( "Subtitle" );
|
m_textSubTitle.SetName( "Subtitle" );
|
||||||
m_textSubTitle.LoadFromFont( THEME->GetPathF(sType,"text") );
|
m_textSubTitle.LoadFromFont( THEME->GetPathF(sMetricsGroup,"text") );
|
||||||
this->AddChild( &m_textSubTitle );
|
this->AddChild( &m_textSubTitle );
|
||||||
|
|
||||||
m_textArtist.SetName( "Artist" );
|
m_textArtist.SetName( "Artist" );
|
||||||
m_textArtist.LoadFromFont( THEME->GetPathF(sType,"text") );
|
m_textArtist.LoadFromFont( THEME->GetPathF(sMetricsGroup,"text") );
|
||||||
this->AddChild( &m_textArtist );
|
this->AddChild( &m_textArtist );
|
||||||
|
|
||||||
AddCommand( "AfterSet", THEME->GetMetricA(sType,"AfterSetCommand") );
|
AddCommand( "AfterSet", THEME->GetMetricA(sMetricsGroup,"AfterSetCommand") );
|
||||||
m_sArtistPrependString = THEME->GetMetric(sType,"ArtistPrependString");
|
m_sArtistPrependString = THEME->GetMetric(sMetricsGroup,"ArtistPrependString");
|
||||||
|
|
||||||
ActorUtil::LoadAllCommandsAndOnCommand( m_textTitle, sType );
|
ActorUtil::LoadAllCommandsAndOnCommand( m_textTitle, sMetricsGroup );
|
||||||
ActorUtil::LoadAllCommandsAndOnCommand( m_textSubTitle, sType );
|
ActorUtil::LoadAllCommandsAndOnCommand( m_textSubTitle, sMetricsGroup );
|
||||||
ActorUtil::LoadAllCommandsAndOnCommand( m_textArtist, sType );
|
ActorUtil::LoadAllCommandsAndOnCommand( m_textArtist, sMetricsGroup );
|
||||||
}
|
}
|
||||||
|
|
||||||
TextBanner::TextBanner()
|
TextBanner::TextBanner()
|
||||||
@@ -115,13 +89,13 @@ void TextBanner::SetFromSong( const Song *pSong )
|
|||||||
class LunaTextBanner: public Luna<TextBanner>
|
class LunaTextBanner: public Luna<TextBanner>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
static int Load( T* p, lua_State *L ) { p->Load( SArg(1) ); return 0; }
|
||||||
static int SetFromSong( T* p, lua_State *L )
|
static int SetFromSong( T* p, lua_State *L )
|
||||||
{
|
{
|
||||||
Song *pSong = Luna<Song>::check(L,1);
|
Song *pSong = Luna<Song>::check(L,1);
|
||||||
p->SetFromSong( pSong );
|
p->SetFromSong( pSong );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int SetFromString( T* p, lua_State *L )
|
static int SetFromString( T* p, lua_State *L )
|
||||||
{
|
{
|
||||||
RString sDisplayTitle = SArg(1);
|
RString sDisplayTitle = SArg(1);
|
||||||
@@ -136,6 +110,7 @@ public:
|
|||||||
|
|
||||||
LunaTextBanner()
|
LunaTextBanner()
|
||||||
{
|
{
|
||||||
|
ADD_METHOD( Load );
|
||||||
ADD_METHOD( SetFromSong );
|
ADD_METHOD( SetFromSong );
|
||||||
ADD_METHOD( SetFromString );
|
ADD_METHOD( SetFromString );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ public:
|
|||||||
virtual TextBanner *Copy() const;
|
virtual TextBanner *Copy() const;
|
||||||
|
|
||||||
void LoadFromNode( const XNode* pNode );
|
void LoadFromNode( const XNode* pNode );
|
||||||
void Load( RString sType ); // load metrics
|
void Load( RString sMetricsGroup ); // load metrics
|
||||||
void SetFromSong( const Song *pSong );
|
void SetFromSong( const Song *pSong );
|
||||||
void SetFromString(
|
void SetFromString(
|
||||||
const RString &sDisplayTitle, const RString &sTranslitTitle,
|
const RString &sDisplayTitle, const RString &sTranslitTitle,
|
||||||
|
|||||||
Reference in New Issue
Block a user