Exemple #1
0
bool TeamData::ChangeCaptain(const CGUID& CapID)
{
	CPlayer *pMainPlayer = GetGame()->GetMainPlayer();
	if(pMainPlayer->GetCaptainID() == CapID)
	{
		//GetGame()->GetCGuiEx()->GetMainBarPageEx()->AddChatWords(CStringReading::LoadString(eIDS_TEAM,eIDS_TEAM_CAPED23));
		return false;
	}
	// 自己被设置成队长
	if(pMainPlayer->GetExID() == CapID)
	{
		//GetGame()->GetCGuiEx()->GetMainBarPageEx()->AddChatWords(CStringReading::LoadString(eIDS_TEAM,eIDS_TEAM_CAPSELF));
		FireUIUpdate();
		return true;
	}
	vector<tagTeam>::iterator it = m_vectorTeam.begin();
	for(; it!=m_vectorTeam.end(); ++it)
	{
		// 队友存在
		if((*it).PlayerID == CapID)
		{
			tagTeam sTeam = (*it);
			m_vectorTeam.erase(it);
			m_vectorTeam.insert(m_vectorTeam.begin(),sTeam);
			/////////////////////////////////////////////////
			// zhaohang  2010/6/17 
			////////////////////////////////////////////////
			FireUIUpdate();
			return true;
		}
	}
	return false;
}
Exemple #2
0
bool TeamData::AddTeamMember(tagWSMemberInfo& sWSMemberInfo)
{
	// 队员信息结构
	tagTeam sTeam;
	sTeam.strPlayerName = sWSMemberInfo.szName;
	sTeam.PlayerID = sWSMemberInfo.guid;
	sTeam.lSex = sWSMemberInfo.lSex;
	CPlayer* player = GetGame()->GetMainPlayer();
	//队长排第一位
	if( sWSMemberInfo.guid == player->GetCaptainID())
	{
		m_vectorTeam.insert(m_vectorTeam.begin(),sTeam);
		FireUIUpdate();
		return true;
	}
	else
	{
		m_vectorTeam.push_back(sTeam);
		FireUIUpdate();
		return true;
	}
}