608 lines
16 KiB
C++
608 lines
16 KiB
C++
|
||
#include "PDK_PrivateEndNode.h"
|
||
|
||
#include "cocostudio/CocoStudio.h"
|
||
#include "ui/CocosGUI.h"
|
||
#include "GameDefine.h"
|
||
#include "ImagicDownManager.h"
|
||
#include "JniFun.h"
|
||
#include "SelectShareScene.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);\
|
||
}
|
||
|
||
PDKPrivateEndNode::PDKPrivateEndNode()
|
||
{
|
||
m_ImageViewBg = nullptr; // 根节点
|
||
m_btnleave = nullptr; // 用户离开
|
||
m_btnShow = nullptr; // 分享
|
||
|
||
zeromemory(m_pPlayNode, sizeof(m_pPlayNode)); // 玩家结束信息
|
||
|
||
}
|
||
|
||
PDKPrivateEndNode::~PDKPrivateEndNode()
|
||
{
|
||
for (int i = 0; i < PDK_GAME_PLAYER; i++)
|
||
{
|
||
if (nullptr == m_pPlayNode[i]) continue;
|
||
|
||
// 积分列表
|
||
auto listScore = (ListView*)m_pPlayNode[i]->getChildByName("ListView");
|
||
ASSERT(listScore);
|
||
if (listScore)
|
||
{
|
||
listScore->removeAllItems();
|
||
}
|
||
}
|
||
}
|
||
|
||
bool PDKPrivateEndNode::init()
|
||
{
|
||
if (!Node::init()) {
|
||
return false;
|
||
}
|
||
|
||
auto rootNode = static_cast<Node*>(CSLoader::createNodeWithVisibleSize("Games/PDK/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("");
|
||
|
||
// 离开按钮
|
||
m_btnleave = (Button*)m_ImageViewBg->getChildByName("btnClose");
|
||
ASSERT(m_btnleave);
|
||
m_btnleave->addClickEventListener([=](Ref *pSender){
|
||
Director::getInstance()->getEventDispatcher()->dispatchCustomEvent(LEAVE_GAME);
|
||
});
|
||
|
||
// 分享
|
||
m_btnShow = (Button*)m_ImageViewBg->getChildByName("btnShow");
|
||
ASSERT(m_btnShow);
|
||
m_btnShow->addClickEventListener([=](Ref *pSender){
|
||
Director::getInstance()->getEventDispatcher()->dispatchCustomEvent(WEIXIN_SHOW);
|
||
//SelectShareScene::Instance().shareImage();
|
||
});
|
||
|
||
// 内容
|
||
m_PanelList = (Layout*)m_ImageViewBg->getChildByName("PanelList");
|
||
ASSERT(m_PanelList != nullptr);
|
||
|
||
for (WORD i = 0; i < PDK_GAME_PLAYER; i++)
|
||
{
|
||
m_pPlayNode[i] = (Layout*)m_PanelList->getChildByName(StringUtils::format("FileNode_%d", i));
|
||
ASSERT(m_pPlayNode[i] != nullptr);
|
||
m_pPlayNode[i]->setVisible(false);
|
||
}
|
||
|
||
return true;
|
||
}
|
||
|
||
void PDKPrivateEndNode::SetRoomID(std::string strRoomID)
|
||
{
|
||
if (m_txtRoomID != nullptr)
|
||
{
|
||
m_txtRoomID->setString(strRoomID);
|
||
}
|
||
}
|
||
|
||
std::string PDKPrivateEndNode::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 PDKPrivateEndNode::ShowGameResult(PDK_CMD_S_Private_End_Info* pNetInfo, GamePlayer* players[PDK_GAME_PLAYER], bool bUnionScore, SCORE lGameGold, SCORE lScoreMultiple)
|
||
{
|
||
if (pNetInfo == nullptr) return;
|
||
|
||
// 当前时间;
|
||
if (m_txtTime != nullptr)
|
||
{
|
||
std::string strSystemTime = JniFun::getDataTime();
|
||
m_txtTime->setString(strSystemTime);
|
||
}
|
||
|
||
// 寻找大赢家;
|
||
SCORE lMaxScore = 0;
|
||
int iUserCount = 0;
|
||
|
||
for (int i = 0; i < PDK_GAME_PLAYER; i++)
|
||
{
|
||
GamePlayer* pPlayer = players[i];
|
||
if (nullptr == pPlayer) continue;
|
||
|
||
// 找到大赢家;
|
||
if (lMaxScore < pNetInfo->lAllScore[i])
|
||
{
|
||
lMaxScore = pNetInfo->lAllScore[i];
|
||
}
|
||
}
|
||
|
||
// 欢乐场计算税收;
|
||
SCORE lRevenue = 0;
|
||
if (bUnionScore)
|
||
{
|
||
// 统计大赢家数量;
|
||
int iMaxScoreCount = 0;
|
||
for (int j = 0; j < PDK_GAME_PLAYER; j++)
|
||
{
|
||
if ((lMaxScore > 0) && (pNetInfo->lAllScore[j] == lMaxScore))
|
||
{
|
||
iMaxScoreCount++;
|
||
}
|
||
}
|
||
|
||
if (iMaxScoreCount > 0)
|
||
{
|
||
// 计算玩家积分;
|
||
lRevenue = floor(lGameGold / iMaxScoreCount);
|
||
}
|
||
}
|
||
|
||
for (int i = 0; i < PDK_GAME_PLAYER; i++)
|
||
{
|
||
if (pNetInfo->aryActiveStatus[i])
|
||
{
|
||
GamePlayer* pPlayer = players[i];
|
||
if (nullptr == pPlayer) continue;
|
||
if (nullptr == m_pPlayNode[iUserCount]) continue;
|
||
|
||
// 头像;
|
||
Sprite* pHead = (Sprite*)m_pPlayNode[iUserCount]->getChildByName("Head");
|
||
if (pHead)
|
||
{
|
||
ImagicDownManager::Instance().addDown(pHead, pPlayer->GetHeadHttp(), pPlayer->GetGameID());
|
||
}
|
||
|
||
SETCTRLTEXT(m_pPlayNode[iUserCount], "txtUserName", pPlayer->GetNickName()); // 名称;
|
||
SETCTRLTEXT(m_pPlayNode[iUserCount], "txtGameID", StringUtils::format("ID:%d", pPlayer->GetGameID())); // ID;
|
||
SETCTRLTEXT(m_pPlayNode[iUserCount], "txtAllScore", utility::ScoreToString(pNetInfo->lAllScore[i])); // 总积分;
|
||
|
||
Sprite* pCreate = (Sprite*)m_pPlayNode[iUserCount]->getChildByName("create");
|
||
if (pCreate) pCreate->setVisible(0 == i);
|
||
|
||
// 是不是大赢家;
|
||
bool bMaxWinUser = false;
|
||
if ((lMaxScore > 0) && (lMaxScore == pNetInfo->lAllScore[iUserCount]))
|
||
{
|
||
bMaxWinUser = true;
|
||
}
|
||
|
||
// 大赢家;
|
||
auto winicon = (Sprite*)m_pPlayNode[iUserCount]->getChildByName("win");
|
||
if (winicon) winicon->setVisible(bMaxWinUser);
|
||
|
||
// 欢乐积分;
|
||
if (bUnionScore)
|
||
{
|
||
SCORE lUnionScore = pNetInfo->lAllScore[i] * lScoreMultiple;
|
||
|
||
if (bMaxWinUser)
|
||
{
|
||
if (lUnionScore > lRevenue)
|
||
{
|
||
lUnionScore -= lRevenue;
|
||
}
|
||
else
|
||
{
|
||
lUnionScore = 0;
|
||
}
|
||
}
|
||
|
||
SETCTRLTEXT(m_pPlayNode[iUserCount], "txtUnionScore", utility::ScoreToString(lUnionScore)); // 总积分;
|
||
}
|
||
else
|
||
{
|
||
SETCTRLTEXT(m_pPlayNode[iUserCount], "txtUnionScore", ""); // 总积分;
|
||
}
|
||
|
||
// 积分列表;
|
||
auto listScore = (ListView*)m_pPlayNode[iUserCount]->getChildByName("ListView");
|
||
ASSERT(listScore);
|
||
if (listScore)
|
||
{
|
||
// 积分节点;
|
||
auto ListItem = (Layout*)m_pPlayNode[iUserCount]->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("第%d局", 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);
|
||
}
|
||
|
||
m_pPlayNode[iUserCount]->setVisible(true);
|
||
|
||
iUserCount++;
|
||
}
|
||
}
|
||
|
||
// 调玩家位置;
|
||
if (iUserCount > 0)
|
||
{
|
||
// 容器宽度;
|
||
float fPlanelWidth = m_PanelList->getContentSize().width;
|
||
|
||
// 节点宽度;
|
||
auto itembg = (ImageView*)m_pPlayNode[0]->getChildByName("itembg");
|
||
ASSERT(itembg != nullptr);
|
||
|
||
float fItemWidth = itembg->getContentSize().width;
|
||
// 间隔宽度 = (容器宽度 - 节点宽度*节点个数)/(节点个数+1);
|
||
float fIntervalWidth = (fPlanelWidth - fItemWidth*iUserCount) / (iUserCount + 1);
|
||
|
||
// 重置位置;
|
||
for (int i = 0; i < iUserCount; i++)
|
||
{
|
||
if ((m_pPlayNode[i] != nullptr) && m_pPlayNode[i]->isVisible())
|
||
{
|
||
m_pPlayNode[i]->setPositionX(fIntervalWidth + (fItemWidth + fIntervalWidth)*i);
|
||
}
|
||
}
|
||
}
|
||
|
||
this->setVisible(false);
|
||
}
|
||
|
||
void PDKPrivateEndNode::ShowGameResult(PDK_CMD_S_Private_End_Info* pNetInfo, GamePlayer* players[PDK_GAME_PLAYER],
|
||
CMD_GF_Private_Room_Info& RoomInfo, CMD_GF_Private_Score_Info& ScoreInfo)
|
||
{
|
||
if (pNetInfo == nullptr) return;
|
||
|
||
bool bUnionScore = (RoomInfo.cbUnionGoldOpen == 1);
|
||
//SCORE lScoreMultiple = RoomInfo.lScoreMultiple;
|
||
uint8 cbBaseScore = RoomInfo.cbBaseScore;
|
||
SCORE lGameGold = RoomInfo.lGameGold * RoomInfo.dwPlayCost;
|
||
|
||
// 当前时间;
|
||
if (m_txtTime != nullptr)
|
||
{
|
||
std::string strSystemTime = JniFun::getDataTime();
|
||
m_txtTime->setString(strSystemTime);
|
||
}
|
||
|
||
// 寻找大赢家;
|
||
SCORE lMaxScore = 0;
|
||
int iUserCount = 0;
|
||
|
||
for (int i = 0; i < PDK_GAME_PLAYER; i++)
|
||
{
|
||
GamePlayer* pPlayer = players[i];
|
||
if (nullptr == pPlayer) continue;
|
||
|
||
// 找到大赢家;
|
||
if (lMaxScore < pNetInfo->lAllScore[i])
|
||
{
|
||
lMaxScore = pNetInfo->lAllScore[i];
|
||
}
|
||
}
|
||
|
||
// 欢乐场计算税收;
|
||
SCORE lRevenue = 0;
|
||
if (bUnionScore)
|
||
{
|
||
// 统计大赢家数量;
|
||
int iMaxScoreCount = 0;
|
||
for (int j = 0; j < PDK_GAME_PLAYER; j++)
|
||
{
|
||
if ((lMaxScore > 0) && (pNetInfo->lAllScore[j] == lMaxScore))
|
||
{
|
||
iMaxScoreCount++;
|
||
}
|
||
}
|
||
|
||
if (iMaxScoreCount > 0)
|
||
{
|
||
// 计算玩家积分;
|
||
lRevenue = floor(lGameGold / iMaxScoreCount);
|
||
}
|
||
}
|
||
|
||
for (int i = 0; i < PDK_GAME_PLAYER; i++)
|
||
{
|
||
if (pNetInfo->aryActiveStatus[i])
|
||
{
|
||
GamePlayer* pPlayer = players[i];
|
||
if (nullptr == pPlayer) continue;
|
||
if (nullptr == m_pPlayNode[iUserCount]) continue;
|
||
|
||
// 头像;
|
||
Sprite* pHead = (Sprite*)m_pPlayNode[iUserCount]->getChildByName("Head");
|
||
if (pHead)
|
||
{
|
||
ImagicDownManager::Instance().addDown(pHead, pPlayer->GetHeadHttp(), pPlayer->GetGameID());
|
||
}
|
||
|
||
SETCTRLTEXT(m_pPlayNode[iUserCount], "txtUserName", pPlayer->GetNickName()); // 名称;
|
||
SETCTRLTEXT(m_pPlayNode[iUserCount], "txtGameID", StringUtils::format("ID:%d", pPlayer->GetGameID())); // ID;
|
||
SETCTRLTEXT(m_pPlayNode[iUserCount], "txtAllScore", utility::ScoreToString(pNetInfo->lAllScore[i])); // 总积分;
|
||
|
||
Sprite* pCreate = (Sprite*)m_pPlayNode[iUserCount]->getChildByName("create");
|
||
if (pCreate) pCreate->setVisible(0 == i);
|
||
|
||
// 是不是大赢家;
|
||
bool bMaxWinUser = false;
|
||
if ((lMaxScore > 0) && (lMaxScore == pNetInfo->lAllScore[iUserCount]))
|
||
{
|
||
bMaxWinUser = true;
|
||
}
|
||
|
||
// 大赢家;
|
||
auto winicon = (Sprite*)m_pPlayNode[iUserCount]->getChildByName("win");
|
||
if (winicon) winicon->setVisible(bMaxWinUser);
|
||
|
||
// 欢乐积分;
|
||
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[iUserCount], "txtUnionScore", utility::ScoreToString(lUnionScore)); // 总积分;
|
||
SETCTRLTEXT(m_pPlayNode[iUserCount], "txtAllUnionScore", StringUtils::format("%d", lAllUnionScore));
|
||
}
|
||
else
|
||
{
|
||
SETCTRLTEXT(m_pPlayNode[iUserCount], "txtUnionScore", ""); // 总积分;
|
||
SETCTRLTEXT(m_pPlayNode[iUserCount], "txtAllUnionScore", ""); // 总积分;
|
||
}
|
||
|
||
// 积分列表;
|
||
auto listScore = (ListView*)m_pPlayNode[iUserCount]->getChildByName("ListView");
|
||
ASSERT(listScore);
|
||
if (listScore)
|
||
{
|
||
// 积分节点;
|
||
auto ListItem = (Layout*)m_pPlayNode[iUserCount]->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("第%d局", 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);
|
||
}
|
||
|
||
m_pPlayNode[iUserCount]->setVisible(true);
|
||
|
||
iUserCount++;
|
||
}
|
||
}
|
||
|
||
// 调玩家位置;
|
||
if (iUserCount > 0)
|
||
{
|
||
// 容器宽度;
|
||
float fPlanelWidth = m_PanelList->getContentSize().width;
|
||
|
||
// 节点宽度;
|
||
auto itembg = (ImageView*)m_pPlayNode[0]->getChildByName("itembg");
|
||
ASSERT(itembg != nullptr);
|
||
|
||
float fItemWidth = itembg->getContentSize().width;
|
||
// 间隔宽度 = (容器宽度 - 节点宽度*节点个数)/(节点个数+1);
|
||
float fIntervalWidth = (fPlanelWidth - fItemWidth*iUserCount) / (iUserCount + 1);
|
||
|
||
// 重置位置;
|
||
for (int i = 0; i < iUserCount; i++)
|
||
{
|
||
if ((m_pPlayNode[i] != nullptr) && m_pPlayNode[i]->isVisible())
|
||
{
|
||
m_pPlayNode[i]->setPositionX(fIntervalWidth + (fItemWidth + fIntervalWidth)*i);
|
||
}
|
||
}
|
||
}
|
||
|
||
this->setVisible(false);
|
||
}
|
||
|
||
void PDKPrivateEndNode::ShowGameResult(PDK_CMD_S_Private_End_Info* pNetInfo, GamePlayer* players[PDK_GAME_PLAYER],
|
||
uint8 cbBaseScore)
|
||
{
|
||
if (pNetInfo == nullptr) return;
|
||
|
||
// 当前时间;
|
||
if (m_txtTime != nullptr)
|
||
{
|
||
std::string strSystemTime = JniFun::getDataTime();
|
||
m_txtTime->setString(strSystemTime);
|
||
}
|
||
|
||
// 寻找大赢家;
|
||
SCORE lMaxScore = 0;
|
||
int iUserCount = 0;
|
||
|
||
for (int i = 0; i < PDK_GAME_PLAYER; i++)
|
||
{
|
||
GamePlayer* pPlayer = players[i];
|
||
if (nullptr == pPlayer) continue;
|
||
|
||
// 找到大赢家;
|
||
if (lMaxScore < pNetInfo->lAllScore[i])
|
||
{
|
||
lMaxScore = pNetInfo->lAllScore[i];
|
||
}
|
||
}
|
||
|
||
for (int i = 0; i < PDK_GAME_PLAYER; i++)
|
||
{
|
||
if (pNetInfo->aryActiveStatus[i])
|
||
{
|
||
GamePlayer* pPlayer = players[i];
|
||
if (nullptr == pPlayer) continue;
|
||
if (nullptr == m_pPlayNode[iUserCount]) continue;
|
||
|
||
// 头像;
|
||
Sprite* pHead = (Sprite*)m_pPlayNode[iUserCount]->getChildByName("Head");
|
||
if (pHead)
|
||
{
|
||
ImagicDownManager::Instance().addDown(pHead, pPlayer->GetHeadHttp(), pPlayer->GetGameID());
|
||
}
|
||
|
||
SETCTRLTEXT(m_pPlayNode[iUserCount], "txtUserName", pPlayer->GetNickName()); // 名称;
|
||
SETCTRLTEXT(m_pPlayNode[iUserCount], "txtGameID", StringUtils::format("ID:%d", pPlayer->GetGameID())); // ID;
|
||
SETCTRLTEXT(m_pPlayNode[iUserCount], "txtAllScore", utility::ScoreToString(pNetInfo->lAllScore[i])); // 总积分;
|
||
SETCTRLTEXT(m_pPlayNode[iUserCount], "txtAllUnionScore", ""); // 总积分;
|
||
|
||
Sprite* pCreate = (Sprite*)m_pPlayNode[iUserCount]->getChildByName("create");
|
||
if (pCreate) pCreate->setVisible(0 == i);
|
||
|
||
// 是不是大赢家;
|
||
bool bMaxWinUser = false;
|
||
if ((lMaxScore > 0) && (lMaxScore == pNetInfo->lAllScore[iUserCount]))
|
||
{
|
||
bMaxWinUser = true;
|
||
}
|
||
|
||
// 大赢家;
|
||
auto winicon = (Sprite*)m_pPlayNode[iUserCount]->getChildByName("win");
|
||
if (winicon) winicon->setVisible(bMaxWinUser);
|
||
|
||
// 总积分;
|
||
SCORE lUnionScore = pNetInfo->lAllScore[i] * cbBaseScore;
|
||
SETCTRLTEXT(m_pPlayNode[iUserCount], "txtUnionScore", utility::ScoreToString(lUnionScore));
|
||
|
||
// 积分列表;
|
||
auto listScore = (ListView*)m_pPlayNode[iUserCount]->getChildByName("ListView");
|
||
ASSERT(listScore);
|
||
if (listScore)
|
||
{
|
||
// 积分节点;
|
||
auto ListItem = (Layout*)m_pPlayNode[iUserCount]->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("第%d局", 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);
|
||
}
|
||
|
||
m_pPlayNode[iUserCount]->setVisible(true);
|
||
|
||
iUserCount++;
|
||
}
|
||
}
|
||
|
||
// 调玩家位置;
|
||
if (iUserCount > 0)
|
||
{
|
||
// 容器宽度;
|
||
float fPlanelWidth = m_PanelList->getContentSize().width;
|
||
|
||
// 节点宽度;
|
||
auto itembg = (ImageView*)m_pPlayNode[0]->getChildByName("itembg");
|
||
ASSERT(itembg != nullptr);
|
||
|
||
float fItemWidth = itembg->getContentSize().width;
|
||
// 间隔宽度 = (容器宽度 - 节点宽度*节点个数)/(节点个数+1);
|
||
float fIntervalWidth = (fPlanelWidth - fItemWidth*iUserCount) / (iUserCount + 1);
|
||
|
||
// 重置位置;
|
||
for (int i = 0; i < iUserCount; i++)
|
||
{
|
||
if ((m_pPlayNode[i] != nullptr) && m_pPlayNode[i]->isVisible())
|
||
{
|
||
m_pPlayNode[i]->setPositionX(fIntervalWidth + (fItemWidth + fIntervalWidth)*i);
|
||
}
|
||
}
|
||
}
|
||
|
||
this->setVisible(false);
|
||
}
|
||
|
||
void PDKPrivateEndNode::pushScene()
|
||
{
|
||
this->setVisible(true);
|
||
}
|
||
|
||
void PDKPrivateEndNode::popScene()
|
||
{
|
||
this->removeFromParent();
|
||
} |