Ejemplo n.º 1
0
void ZGameClient::OnClanResponseClanInfo(void* pBlob)
{
	int nCount = MGetBlobArrayCount(pBlob);
	if(nCount != 1) return;

	MTD_ClanInfo* pClanInfo = (MTD_ClanInfo*)MGetBlobArrayElement(pBlob, 0);
	
	// 이미 emblem을 가지고 있었으면 emblem interface 에 통보해준다
	int nOldClanID = ZGetNetRepository()->GetClanInfo()->nCLID;

	// repository에 클랜정보를 보관한다
	memcpy(ZGetNetRepository()->GetClanInfo(),pClanInfo,sizeof(MTD_ClanInfo));

//	mlog("OnClanResponseClanInfo : ");

	// emblem interface 에 통보한다
	ZGetEmblemInterface()->AddClanInfo(pClanInfo->nCLID);	

	if(nOldClanID!=0) {
		ZGetEmblemInterface()->DeleteClanInfo(nOldClanID);
	}

	ZIDLResource* pRes = ZApplication::GetGameInterface()->GetIDLResource();

	MPicture* pPicture= (MPicture*)pRes->FindWidget( "Lobby_ClanInfoEmblem" );
	if ( pPicture)
		pPicture->SetBitmap( ZGetEmblemInterface()->GetClanEmblem2( pClanInfo->nCLID));

	// 클랜 이름
	MLabel* pLabel = (MLabel*)pRes->FindWidget("Lobby_ClanInfoName");
	pLabel->SetText(ZGetNetRepository()->GetClanInfo()->szClanName);

	// 접속된 사람수
	char szCount[16];
	sprintf(szCount,"%d",ZGetNetRepository()->GetClanInfo()->nConnedMember);

	char szOutput[256];
//	ZTranslateMessage(szOutput,MSG_LOBBY_CLAN_DETAIL,2,
//		ZGetNetRepository()->GetClanInfo()->szMaster,szCount);
	ZTransMsg(szOutput,MSG_LOBBY_CLAN_DETAIL,2,
		ZGetNetRepository()->GetClanInfo()->szMaster,szCount);

	pLabel = (MLabel*)pRes->FindWidget("Lobby_ClanInfoDetail");
	pLabel->SetText(szOutput);


	sprintf(szOutput,"%d/%d",ZGetNetRepository()->GetClanInfo()->nWins,ZGetNetRepository()->GetClanInfo()->nLosses);
	ZBmNumLabel *pNumLabel = (ZBmNumLabel*)pRes->FindWidget("Lobby_ClanInfoWinLose");
	pNumLabel->SetText(szOutput);

	sprintf(szOutput,"%d", ZGetNetRepository()->GetClanInfo()->nPoint);
	pNumLabel = (ZBmNumLabel*)pRes->FindWidget("Lobby_ClanInfoPoints");
	pNumLabel->SetText(szOutput);

	pNumLabel = (ZBmNumLabel*)pRes->FindWidget("Lobby_ClanInfoTotalPoints");
	//		sprintf(szOutput,"%d",ZGetNetRepository()->GetClanInfo()->nWins,ZGetNetRepository()->GetClanInfo()->nXP);
	//		pNumLabel->SetText(szOutput);
	pNumLabel->SetNumber(ZGetNetRepository()->GetClanInfo()->nTotalPoint,true);

	int nRanking = pClanInfo->nRanking;

	pNumLabel = (ZBmNumLabel*)pRes->FindWidget("Lobby_ClanInfoRanking");
	pNumLabel->SetIndexOffset(16);	// 아래쪽 색다른 글씨로 찍는다
	MWidget *pUnranked = pRes->FindWidget("Lobby_ClanInfoUnranked");
	if(nRanking == 0) {
		pNumLabel->Show(false);
		if ( pUnranked)
			pUnranked->Show(true);
	}else
	{
		pNumLabel->Show(true);
		pNumLabel->SetNumber(nRanking);
		if ( pUnranked)
			pUnranked->Show(false);
	}

	/*
	// UI상에 보여줘야 하지만 지금은 준비가 안되어있는 관계로 채팅창에 뿌린다.

	char szText[256];
	sprintf(szText, "클랜명: %s", pClanInfo->szClanName);
	ZChatOutput(MCOLOR(ZCOLOR_CHAT_CLANMSG), szText);


	sprintf(szText, "레벨: %d", pClanInfo->nLevel);
	ZChatOutput(MCOLOR(ZCOLOR_CHAT_CLANMSG), szText);

	sprintf(szText, "경험치: %d", pClanInfo->nXP);
	ZChatOutput(MCOLOR(ZCOLOR_CHAT_CLANMSG), szText);

	sprintf(szText, "포인트: %d", pClanInfo->nPoint);
	ZChatOutput(MCOLOR(ZCOLOR_CHAT_CLANMSG), szText);

	sprintf(szText, "마스터: %s", pClanInfo->szMaster);
	ZChatOutput(MCOLOR(ZCOLOR_CHAT_CLANMSG), szText);

	sprintf(szText, "전적: %d승 %d패", pClanInfo->nWins, pClanInfo->nLoses);
	ZChatOutput(MCOLOR(ZCOLOR_CHAT_CLANMSG), szText);

	sprintf(szText, "클랜원정보: 총 %d명중 %d명 접속함", pClanInfo->nTotalMemberCount, pClanInfo->nConnedMember);
	ZChatOutput(MCOLOR(ZCOLOR_CHAT_CLANMSG), szText);
	*/
}