539 lines
13 KiB
C++
539 lines
13 KiB
C++
|
|
|
|||
|
|
#include "DDZ_PrivateEndNode.h"
|
|||
|
|
|
|||
|
|
#include "cocostudio/CocoStudio.h"
|
|||
|
|
#include "ui/CocosGUI.h"
|
|||
|
|
#include "GameDefine.h"
|
|||
|
|
#include "ImagicDownManager.h"
|
|||
|
|
#include "JniFun.h"
|
|||
|
|
|
|||
|
|
USING_NS_CC;
|
|||
|
|
using namespace ui;
|
|||
|
|
using namespace std;
|
|||
|
|
|
|||
|
|
#define SETCTRLTEXT(pNode, ctrl, str) \
|
|||
|
|
{ \
|
|||
|
|
Text* pText = (Text*)pNode->getChildByName(ctrl);\
|
|||
|
|
if (pText) pText->setString(str);\
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
DDZPrivateEndNode::DDZPrivateEndNode()
|
|||
|
|
{
|
|||
|
|
m_ImageViewBg = nullptr; // <20><><EFBFBD>ڵ<EFBFBD>
|
|||
|
|
m_btnleave = nullptr; // <20>û<EFBFBD><C3BB>뿪
|
|||
|
|
m_btnShow = nullptr; // <20><><EFBFBD><EFBFBD>
|
|||
|
|
|
|||
|
|
zeromemory(m_pPlayNode, sizeof(m_pPlayNode)); // <20><><EFBFBD>ҽ<EFBFBD><D2BD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
DDZPrivateEndNode::~DDZPrivateEndNode()
|
|||
|
|
{
|
|||
|
|
for (int i = 0; i < DDZ_GAME_PLAYER; i++)
|
|||
|
|
{
|
|||
|
|
if (nullptr == m_pPlayNode[i]) continue;
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>
|
|||
|
|
auto listScore = (ListView*)m_pPlayNode[i]->getChildByName("ListView");
|
|||
|
|
ASSERT(listScore);
|
|||
|
|
if (listScore)
|
|||
|
|
{
|
|||
|
|
listScore->removeAllItems();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
bool DDZPrivateEndNode::init()
|
|||
|
|
{
|
|||
|
|
if (!Node::init()) {
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
auto rootNode = static_cast<Node*>(CSLoader::createNodeWithVisibleSize("Games/DDZ/PrivateEndScene.csb"));
|
|||
|
|
ASSERT(rootNode != nullptr);
|
|||
|
|
this->addChild(rootNode);
|
|||
|
|
|
|||
|
|
m_ImageViewBg = (ImageView*)rootNode->getChildByName("ImageBg");
|
|||
|
|
ASSERT(m_ImageViewBg != nullptr);
|
|||
|
|
|
|||
|
|
m_txtRoomID = (Text*)m_ImageViewBg->getChildByName("txtRoomID");
|
|||
|
|
ASSERT(m_txtRoomID != nullptr);
|
|||
|
|
m_txtRoomID->setString("");
|
|||
|
|
|
|||
|
|
m_txtTime = (Text*)m_ImageViewBg->getChildByName("txtTime");
|
|||
|
|
ASSERT(m_txtTime != nullptr);
|
|||
|
|
m_txtTime->setString("");
|
|||
|
|
|
|||
|
|
// <20>뿪<EFBFBD><EBBFAA>ť
|
|||
|
|
m_btnleave = (Button*)m_ImageViewBg->getChildByName("btnClose");
|
|||
|
|
ASSERT(m_btnleave);
|
|||
|
|
m_btnleave->addClickEventListener([=](Ref *pSender){
|
|||
|
|
Director::getInstance()->getEventDispatcher()->dispatchCustomEvent(LEAVE_GAME);
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD>
|
|||
|
|
m_btnShow = (Button*)m_ImageViewBg->getChildByName("btnShow");
|
|||
|
|
ASSERT(m_btnShow);
|
|||
|
|
m_btnShow->addClickEventListener([=](Ref *pSender){
|
|||
|
|
Director::getInstance()->getEventDispatcher()->dispatchCustomEvent(WEIXIN_SHOW);
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD>
|
|||
|
|
for (WORD i = 0; i < DDZ_GAME_PLAYER; i++)
|
|||
|
|
{
|
|||
|
|
m_pPlayNode[i] = (Layout*)m_ImageViewBg->getChildByName(StringUtils::format("FileNode_%d", i));
|
|||
|
|
ASSERT(m_pPlayNode[i]);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void DDZPrivateEndNode::SetRoomID(std::string strRoomID)
|
|||
|
|
{
|
|||
|
|
if (m_txtRoomID != nullptr)
|
|||
|
|
{
|
|||
|
|
m_txtRoomID->setString(strRoomID);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
std::string DDZPrivateEndNode::getcurrTime()
|
|||
|
|
{
|
|||
|
|
struct tm* tm;
|
|||
|
|
time_t timep;
|
|||
|
|
time(&timep);
|
|||
|
|
tm = localtime(&timep);
|
|||
|
|
return StringUtils::format("%02d-%02d-%02d %02d:%02d", 1900+tm->tm_year, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//void DDZPrivateEndNode::ShowGameResult(DDZ_CMD_S_Private_End_Info* pNetInfo, GamePlayer* players[DDZ_GAME_PLAYER])
|
|||
|
|
void DDZPrivateEndNode::ShowGameResult(DDZ_CMD_S_Private_End_Info* pNetInfo, GamePlayer* players[DDZ_GAME_PLAYER],
|
|||
|
|
bool bUnionScore, SCORE lGameGold, SCORE lScoreMultiple)
|
|||
|
|
{
|
|||
|
|
if (pNetInfo == nullptr) return;
|
|||
|
|
|
|||
|
|
// <20><>ǰʱ<C7B0><CAB1>;
|
|||
|
|
if (m_txtTime != nullptr)
|
|||
|
|
{
|
|||
|
|
std::string strSystemTime = JniFun::getDataTime();
|
|||
|
|
m_txtTime->setString(strSystemTime);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// Ѱ<>Ҵ<EFBFBD>Ӯ<EFBFBD><D3AE>;
|
|||
|
|
SCORE lMaxScore = 0;
|
|||
|
|
for (int i = 0; i < DDZ_GAME_PLAYER; i++)
|
|||
|
|
{
|
|||
|
|
GamePlayer* pPlayer = players[i];
|
|||
|
|
if (nullptr == pPlayer) continue;
|
|||
|
|
|
|||
|
|
// <20>ҵ<EFBFBD><D2B5><EFBFBD>Ӯ<EFBFBD><D3AE>;
|
|||
|
|
if (lMaxScore < pNetInfo->lAllScore[i])
|
|||
|
|
{
|
|||
|
|
lMaxScore = pNetInfo->lAllScore[i];
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD>ֳ<EFBFBD><D6B3><EFBFBD><EFBFBD><EFBFBD>˰<EFBFBD><CBB0>;
|
|||
|
|
SCORE lRevenue = 0;
|
|||
|
|
if (bUnionScore)
|
|||
|
|
{
|
|||
|
|
// ͳ<>ƴ<EFBFBD>Ӯ<EFBFBD><D3AE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
|
int iMaxScoreCount = 0;
|
|||
|
|
for (int j = 0; j < DDZ_GAME_PLAYER; j++)
|
|||
|
|
{
|
|||
|
|
if ((lMaxScore > 0) && (pNetInfo->lAllScore[j] == lMaxScore))
|
|||
|
|
{
|
|||
|
|
iMaxScoreCount++;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (iMaxScoreCount > 0)
|
|||
|
|
{
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>;
|
|||
|
|
lRevenue = floor(lGameGold / iMaxScoreCount);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//SCORE lMaxScore = 0;
|
|||
|
|
for (int i = 0; i < DDZ_GAME_PLAYER; i++)
|
|||
|
|
{
|
|||
|
|
GamePlayer* pPlayer = players[i];
|
|||
|
|
if (nullptr == pPlayer) continue;
|
|||
|
|
if (nullptr == m_pPlayNode[i]) continue;
|
|||
|
|
|
|||
|
|
// ͷ<><CDB7>;
|
|||
|
|
Sprite* pHead = (Sprite*)m_pPlayNode[i]->getChildByName("Head");
|
|||
|
|
if (pHead)
|
|||
|
|
{
|
|||
|
|
ImagicDownManager::Instance().addDown(pHead, pPlayer->GetHeadHttp(), pPlayer->GetGameID());
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
SETCTRLTEXT(m_pPlayNode[i], "txtUserName", pPlayer->GetNickName()); // <20><><EFBFBD><EFBFBD>;
|
|||
|
|
SETCTRLTEXT(m_pPlayNode[i], "txtGameID", StringUtils::format("ID:%d", pPlayer->GetGameID())); // ID;
|
|||
|
|
SETCTRLTEXT(m_pPlayNode[i], "txtAllScore", utility::ScoreToString(pNetInfo->lAllScore[i])); // <20>ܻ<EFBFBD><DCBB><EFBFBD>;
|
|||
|
|
|
|||
|
|
Sprite* pCreate = (Sprite*)m_pPlayNode[i]->getChildByName("create");
|
|||
|
|
if (pCreate) pCreate->setVisible(0 == i);
|
|||
|
|
|
|||
|
|
// <20>Dz<EFBFBD><C7B2>Ǵ<EFBFBD>Ӯ<EFBFBD><D3AE>;
|
|||
|
|
bool bMaxWinUser = false;
|
|||
|
|
if ((lMaxScore > 0) && (lMaxScore == pNetInfo->lAllScore[i]))
|
|||
|
|
{
|
|||
|
|
bMaxWinUser = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// <20><>Ӯ<EFBFBD><D3AE>;
|
|||
|
|
auto winicon = (Sprite*)m_pPlayNode[i]->getChildByName("win");
|
|||
|
|
if (winicon) winicon->setVisible(bMaxWinUser);
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD>ֻ<EFBFBD><D6BB><EFBFBD>;
|
|||
|
|
if (bUnionScore)
|
|||
|
|
{
|
|||
|
|
SCORE lUnionScore = pNetInfo->lAllScore[i] * lScoreMultiple;
|
|||
|
|
|
|||
|
|
if (bMaxWinUser)
|
|||
|
|
{
|
|||
|
|
if (lUnionScore > lRevenue)
|
|||
|
|
{
|
|||
|
|
lUnionScore -= lRevenue;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
lUnionScore = 0;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
SETCTRLTEXT(m_pPlayNode[i], "txtUnionScore", utility::ScoreToString(lUnionScore)); // <20>ܻ<EFBFBD><DCBB><EFBFBD>;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
SETCTRLTEXT(m_pPlayNode[i], "txtUnionScore", ""); // <20>ܻ<EFBFBD><DCBB><EFBFBD>;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>;
|
|||
|
|
auto listScore = (ListView*)m_pPlayNode[i]->getChildByName("ListView");
|
|||
|
|
ASSERT(listScore);
|
|||
|
|
if (listScore)
|
|||
|
|
{
|
|||
|
|
// <20><><EFBFBD>ֽڵ<D6BD>;
|
|||
|
|
auto ListItem = (Layout*)m_pPlayNode[i]->getChildByName("Item");
|
|||
|
|
ASSERT(ListItem);
|
|||
|
|
|
|||
|
|
for (int j = 0; j < pNetInfo->cbFinishCout; j++)
|
|||
|
|
{
|
|||
|
|
auto tmp = (Layout*)ListItem->clone();
|
|||
|
|
if (tmp == nullptr)continue;
|
|||
|
|
|
|||
|
|
auto txtTitle = (Text*)tmp->getChildByName("txtTitle");
|
|||
|
|
if (txtTitle)
|
|||
|
|
{
|
|||
|
|
std::string strTitle = StringUtils::format("<EFBFBD><EFBFBD>%d<><64>", j + 1);
|
|||
|
|
txtTitle->setString(utility::a_u8(strTitle));
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
auto txtScore = (Text*)tmp->getChildByName("txtScore");
|
|||
|
|
if (txtScore)
|
|||
|
|
{
|
|||
|
|
std::string strScore = utility::ScoreToString(pNetInfo->lDetails[i][j]);
|
|||
|
|
txtScore->setString(strScore);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
listScore->pushBackCustomItem(tmp);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
ListItem->setVisible(false);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//// <20><>Ӯ<EFBFBD><D3AE>;
|
|||
|
|
//if (lMaxScore > 0)
|
|||
|
|
//{
|
|||
|
|
// for (int i = 0; i < DDZ_GAME_PLAYER; i++)
|
|||
|
|
// {
|
|||
|
|
// if (lMaxScore==pNetInfo->lAllScore[i])
|
|||
|
|
// {
|
|||
|
|
// auto winicon = (Sprite*)m_pPlayNode[i]->getChildByName("win");
|
|||
|
|
// if (winicon)
|
|||
|
|
// {
|
|||
|
|
// winicon->setVisible(true);
|
|||
|
|
// }
|
|||
|
|
// }
|
|||
|
|
// }
|
|||
|
|
//}
|
|||
|
|
|
|||
|
|
this->setVisible(false);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void DDZPrivateEndNode::ShowGameResult(DDZ_CMD_S_Private_End_Info* pNetInfo, GamePlayer* players[DDZ_GAME_PLAYER],
|
|||
|
|
uint8 cbBaseScore)
|
|||
|
|
{
|
|||
|
|
if (pNetInfo == nullptr) return;
|
|||
|
|
|
|||
|
|
// <20><>ǰʱ<C7B0><CAB1>;
|
|||
|
|
if (m_txtTime != nullptr)
|
|||
|
|
{
|
|||
|
|
std::string strSystemTime = JniFun::getDataTime();
|
|||
|
|
m_txtTime->setString(strSystemTime);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// Ѱ<>Ҵ<EFBFBD>Ӯ<EFBFBD><D3AE>;
|
|||
|
|
SCORE lMaxScore = 0;
|
|||
|
|
for (int i = 0; i < DDZ_GAME_PLAYER; i++)
|
|||
|
|
{
|
|||
|
|
GamePlayer* pPlayer = players[i];
|
|||
|
|
if (nullptr == pPlayer) continue;
|
|||
|
|
|
|||
|
|
// <20>ҵ<EFBFBD><D2B5><EFBFBD>Ӯ<EFBFBD><D3AE>;
|
|||
|
|
if (lMaxScore < pNetInfo->lAllScore[i])
|
|||
|
|
{
|
|||
|
|
lMaxScore = pNetInfo->lAllScore[i];
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//SCORE lMaxScore = 0;
|
|||
|
|
for (int i = 0; i < DDZ_GAME_PLAYER; i++)
|
|||
|
|
{
|
|||
|
|
GamePlayer* pPlayer = players[i];
|
|||
|
|
if (nullptr == pPlayer) continue;
|
|||
|
|
if (nullptr == m_pPlayNode[i]) continue;
|
|||
|
|
|
|||
|
|
// ͷ<><CDB7>;
|
|||
|
|
Sprite* pHead = (Sprite*)m_pPlayNode[i]->getChildByName("Head");
|
|||
|
|
if (pHead)
|
|||
|
|
{
|
|||
|
|
ImagicDownManager::Instance().addDown(pHead, pPlayer->GetHeadHttp(), pPlayer->GetGameID());
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
SETCTRLTEXT(m_pPlayNode[i], "txtUserName", pPlayer->GetNickName()); // <20><><EFBFBD><EFBFBD>;
|
|||
|
|
SETCTRLTEXT(m_pPlayNode[i], "txtGameID", StringUtils::format("ID:%d", pPlayer->GetGameID())); // ID;
|
|||
|
|
SETCTRLTEXT(m_pPlayNode[i], "txtAllScore", utility::ScoreToString(pNetInfo->lAllScore[i])); // <20>ܻ<EFBFBD><DCBB><EFBFBD>;
|
|||
|
|
SETCTRLTEXT(m_pPlayNode[i], "txtAllUnionScore", ""); // <20>ܻ<EFBFBD><DCBB><EFBFBD>;
|
|||
|
|
|
|||
|
|
Sprite* pCreate = (Sprite*)m_pPlayNode[i]->getChildByName("create");
|
|||
|
|
if (pCreate) pCreate->setVisible(0 == i);
|
|||
|
|
|
|||
|
|
// <20>Dz<EFBFBD><C7B2>Ǵ<EFBFBD>Ӯ<EFBFBD><D3AE>;
|
|||
|
|
bool bMaxWinUser = false;
|
|||
|
|
if ((lMaxScore > 0) && (lMaxScore == pNetInfo->lAllScore[i]))
|
|||
|
|
{
|
|||
|
|
bMaxWinUser = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// <20><>Ӯ<EFBFBD><D3AE>;
|
|||
|
|
auto winicon = (Sprite*)m_pPlayNode[i]->getChildByName("win");
|
|||
|
|
if (winicon) winicon->setVisible(bMaxWinUser);
|
|||
|
|
|
|||
|
|
// <20>ܻ<EFBFBD><DCBB><EFBFBD>;
|
|||
|
|
SCORE lUnionScore = pNetInfo->lAllScore[i] * cbBaseScore;
|
|||
|
|
SETCTRLTEXT(m_pPlayNode[i], "txtUnionScore", utility::ScoreToString(lUnionScore));
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>;
|
|||
|
|
auto listScore = (ListView*)m_pPlayNode[i]->getChildByName("ListView");
|
|||
|
|
ASSERT(listScore);
|
|||
|
|
if (listScore)
|
|||
|
|
{
|
|||
|
|
// <20><><EFBFBD>ֽڵ<D6BD>;
|
|||
|
|
auto ListItem = (Layout*)m_pPlayNode[i]->getChildByName("Item");
|
|||
|
|
ASSERT(ListItem);
|
|||
|
|
|
|||
|
|
for (int j = 0; j < pNetInfo->cbFinishCout; j++)
|
|||
|
|
{
|
|||
|
|
auto tmp = (Layout*)ListItem->clone();
|
|||
|
|
if (tmp == nullptr)continue;
|
|||
|
|
|
|||
|
|
auto txtTitle = (Text*)tmp->getChildByName("txtTitle");
|
|||
|
|
if (txtTitle)
|
|||
|
|
{
|
|||
|
|
std::string strTitle = StringUtils::format("<EFBFBD><EFBFBD>%d<><64>", j + 1);
|
|||
|
|
txtTitle->setString(utility::a_u8(strTitle));
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
auto txtScore = (Text*)tmp->getChildByName("txtScore");
|
|||
|
|
if (txtScore)
|
|||
|
|
{
|
|||
|
|
std::string strScore = utility::ScoreToString(pNetInfo->lDetails[i][j]);
|
|||
|
|
txtScore->setString(strScore);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
listScore->pushBackCustomItem(tmp);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
ListItem->setVisible(false);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//// <20><>Ӯ<EFBFBD><D3AE>;
|
|||
|
|
//if (lMaxScore > 0)
|
|||
|
|
//{
|
|||
|
|
// for (int i = 0; i < DDZ_GAME_PLAYER; i++)
|
|||
|
|
// {
|
|||
|
|
// if (lMaxScore==pNetInfo->lAllScore[i])
|
|||
|
|
// {
|
|||
|
|
// auto winicon = (Sprite*)m_pPlayNode[i]->getChildByName("win");
|
|||
|
|
// if (winicon)
|
|||
|
|
// {
|
|||
|
|
// winicon->setVisible(true);
|
|||
|
|
// }
|
|||
|
|
// }
|
|||
|
|
// }
|
|||
|
|
//}
|
|||
|
|
|
|||
|
|
this->setVisible(false);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void DDZPrivateEndNode::ShowGameResult(DDZ_CMD_S_Private_End_Info* pNetInfo, GamePlayer* players[DDZ_GAME_PLAYER],
|
|||
|
|
CMD_GF_Private_Room_Info& RoomInfo, CMD_GF_Private_Score_Info& ScoreInfo)
|
|||
|
|
{
|
|||
|
|
if (pNetInfo == nullptr) return;
|
|||
|
|
|
|||
|
|
bool bUnionScore = (RoomInfo.cbUnionGoldOpen == 1);
|
|||
|
|
uint8 cbBaseScore = RoomInfo.cbBaseScore;
|
|||
|
|
SCORE lGameGold = RoomInfo.lGameGold * RoomInfo.dwPlayCost;
|
|||
|
|
|
|||
|
|
// <20><>ǰʱ<C7B0><CAB1>;
|
|||
|
|
if (m_txtTime != nullptr)
|
|||
|
|
{
|
|||
|
|
std::string strSystemTime = JniFun::getDataTime();
|
|||
|
|
m_txtTime->setString(strSystemTime);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// Ѱ<>Ҵ<EFBFBD>Ӯ<EFBFBD><D3AE>;
|
|||
|
|
SCORE lMaxScore = 0;
|
|||
|
|
for (int i = 0; i < DDZ_GAME_PLAYER; i++)
|
|||
|
|
{
|
|||
|
|
GamePlayer* pPlayer = players[i];
|
|||
|
|
if (nullptr == pPlayer) continue;
|
|||
|
|
|
|||
|
|
// <20>ҵ<EFBFBD><D2B5><EFBFBD>Ӯ<EFBFBD><D3AE>;
|
|||
|
|
if (lMaxScore < pNetInfo->lAllScore[i])
|
|||
|
|
{
|
|||
|
|
lMaxScore = pNetInfo->lAllScore[i];
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD>ֳ<EFBFBD><D6B3><EFBFBD><EFBFBD><EFBFBD>˰<EFBFBD><CBB0>;
|
|||
|
|
SCORE lRevenue = 0;
|
|||
|
|
if (bUnionScore)
|
|||
|
|
{
|
|||
|
|
// ͳ<>ƴ<EFBFBD>Ӯ<EFBFBD><D3AE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
|
int iMaxScoreCount = 0;
|
|||
|
|
for (int j = 0; j < DDZ_GAME_PLAYER; j++)
|
|||
|
|
{
|
|||
|
|
if ((lMaxScore > 0) && (pNetInfo->lAllScore[j] == lMaxScore))
|
|||
|
|
{
|
|||
|
|
iMaxScoreCount++;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (iMaxScoreCount > 0)
|
|||
|
|
{
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>;
|
|||
|
|
lRevenue = floor(lGameGold / iMaxScoreCount);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//SCORE lMaxScore = 0;
|
|||
|
|
for (int i = 0; i < DDZ_GAME_PLAYER; i++)
|
|||
|
|
{
|
|||
|
|
GamePlayer* pPlayer = players[i];
|
|||
|
|
if (nullptr == pPlayer) continue;
|
|||
|
|
if (nullptr == m_pPlayNode[i]) continue;
|
|||
|
|
|
|||
|
|
// ͷ<><CDB7>;
|
|||
|
|
Sprite* pHead = (Sprite*)m_pPlayNode[i]->getChildByName("Head");
|
|||
|
|
if (pHead)
|
|||
|
|
{
|
|||
|
|
ImagicDownManager::Instance().addDown(pHead, pPlayer->GetHeadHttp(), pPlayer->GetGameID());
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
SETCTRLTEXT(m_pPlayNode[i], "txtUserName", pPlayer->GetNickName()); // <20><><EFBFBD><EFBFBD>;
|
|||
|
|
SETCTRLTEXT(m_pPlayNode[i], "txtGameID", StringUtils::format("ID:%d", pPlayer->GetGameID())); // ID;
|
|||
|
|
SETCTRLTEXT(m_pPlayNode[i], "txtAllScore", utility::ScoreToString(pNetInfo->lAllScore[i])); // <20>ܻ<EFBFBD><DCBB><EFBFBD>;
|
|||
|
|
|
|||
|
|
Sprite* pCreate = (Sprite*)m_pPlayNode[i]->getChildByName("create");
|
|||
|
|
if (pCreate) pCreate->setVisible(0 == i);
|
|||
|
|
|
|||
|
|
// <20>Dz<EFBFBD><C7B2>Ǵ<EFBFBD>Ӯ<EFBFBD><D3AE>;
|
|||
|
|
bool bMaxWinUser = false;
|
|||
|
|
if ((lMaxScore > 0) && (lMaxScore == pNetInfo->lAllScore[i]))
|
|||
|
|
{
|
|||
|
|
bMaxWinUser = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// <20><>Ӯ<EFBFBD><D3AE>;
|
|||
|
|
auto winicon = (Sprite*)m_pPlayNode[i]->getChildByName("win");
|
|||
|
|
if (winicon) winicon->setVisible(bMaxWinUser);
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD>ֻ<EFBFBD><D6BB><EFBFBD>;
|
|||
|
|
if (bUnionScore)
|
|||
|
|
{
|
|||
|
|
SCORE lUnionScore = pNetInfo->lAllScore[i] * cbBaseScore;
|
|||
|
|
if (bMaxWinUser)
|
|||
|
|
{
|
|||
|
|
if (lUnionScore > lRevenue)
|
|||
|
|
{
|
|||
|
|
lUnionScore -= lRevenue;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
lUnionScore = 0;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
SCORE lAllUnionScore = ScoreInfo.kScoreInfoArray[i] + lUnionScore;
|
|||
|
|
SETCTRLTEXT(m_pPlayNode[i], "txtUnionScore", utility::ScoreToString(lUnionScore)); // <20>ܻ<EFBFBD><DCBB><EFBFBD>;
|
|||
|
|
SETCTRLTEXT(m_pPlayNode[i], "txtAllUnionScore", StringUtils::format("%d", lAllUnionScore)); // <20>ܻ<EFBFBD><DCBB><EFBFBD>;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
SETCTRLTEXT(m_pPlayNode[i], "txtUnionScore", ""); // <20>ܻ<EFBFBD><DCBB><EFBFBD>;
|
|||
|
|
SETCTRLTEXT(m_pPlayNode[i], "txtAllUnionScore", ""); // <20>ܻ<EFBFBD><DCBB><EFBFBD>;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>;
|
|||
|
|
auto listScore = (ListView*)m_pPlayNode[i]->getChildByName("ListView");
|
|||
|
|
ASSERT(listScore);
|
|||
|
|
if (listScore)
|
|||
|
|
{
|
|||
|
|
// <20><><EFBFBD>ֽڵ<D6BD>;
|
|||
|
|
auto ListItem = (Layout*)m_pPlayNode[i]->getChildByName("Item");
|
|||
|
|
ASSERT(ListItem);
|
|||
|
|
|
|||
|
|
for (int j = 0; j < pNetInfo->cbFinishCout; j++)
|
|||
|
|
{
|
|||
|
|
auto tmp = (Layout*)ListItem->clone();
|
|||
|
|
if (tmp == nullptr)continue;
|
|||
|
|
|
|||
|
|
auto txtTitle = (Text*)tmp->getChildByName("txtTitle");
|
|||
|
|
if (txtTitle)
|
|||
|
|
{
|
|||
|
|
std::string strTitle = StringUtils::format("<EFBFBD><EFBFBD>%d<><64>", j + 1);
|
|||
|
|
txtTitle->setString(utility::a_u8(strTitle));
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
auto txtScore = (Text*)tmp->getChildByName("txtScore");
|
|||
|
|
if (txtScore)
|
|||
|
|
{
|
|||
|
|
std::string strScore = utility::ScoreToString(pNetInfo->lDetails[i][j]);
|
|||
|
|
txtScore->setString(strScore);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
listScore->pushBackCustomItem(tmp);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
ListItem->setVisible(false);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
this->setVisible(false);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
void DDZPrivateEndNode::pushScene()
|
|||
|
|
{
|
|||
|
|
this->setVisible(true);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void DDZPrivateEndNode::popScene()
|
|||
|
|
{
|
|||
|
|
this->removeFromParent();
|
|||
|
|
}
|