1775 lines
47 KiB
C++
1775 lines
47 KiB
C++
#include "CreateScene.h"
|
|
#include "PopScene.h"
|
|
#include "CMD_GameServer.h"
|
|
#include "editor-support/cocostudio/CCComExtensionData.h"
|
|
#include "WN_CMD_Sparrow.h"
|
|
#include "DDZ_CMD.h"
|
|
#include "NN_CMD.h"
|
|
#include "DZ_CMD.h"
|
|
#include "13S_CMD.h"
|
|
#include "ZJH_CMD.h"
|
|
#include "PDK_CMD.h"
|
|
#include "UserInfo.h"
|
|
#include "GlobalJosn.h"
|
|
|
|
using namespace cocostudio;
|
|
|
|
static int m_posy[] = {252, 182, 112};
|
|
|
|
static int m_index = 0;
|
|
|
|
CreateScene::CreateScene()
|
|
{
|
|
zeromemory(m_NNCardType, sizeof(m_NNCardType));
|
|
m_cdtype = CDT_CREATE_PRIVATE;
|
|
m_dwUnionCode = 0;
|
|
m_cbUnionGoldOpen = 0;
|
|
}
|
|
|
|
CreateScene::~CreateScene()
|
|
{
|
|
}
|
|
|
|
bool CreateScene::init()
|
|
{
|
|
if (!Node::init())
|
|
{
|
|
return false;
|
|
};
|
|
|
|
auto rootPanel = CSLoader::createNodeWithVisibleSize("Platform/CreateScene.csb");
|
|
CC_ASSERT(rootPanel != nullptr);
|
|
this->addChild(rootPanel);
|
|
|
|
// 背景;
|
|
m_ImageViewBg = (ImageView*)rootPanel->getChildByName("Imagebg");
|
|
CC_ASSERT(m_ImageViewBg != nullptr);
|
|
|
|
//获取关闭按钮
|
|
auto btnClose = (Button*)m_ImageViewBg->getChildByName("btnClose");
|
|
CC_ASSERT(btnClose != nullptr);
|
|
|
|
//注册关闭按钮事件
|
|
btnClose->addClickEventListener([this](Ref*){
|
|
this->popScene();
|
|
});
|
|
|
|
m_txtTitle = (Text*)m_ImageViewBg->getChildByName("txtTitle");
|
|
ASSERT(m_txtTitle != nullptr);
|
|
|
|
m_wCurrentKinID = WNMJ_SPACE::KIND_ID;
|
|
|
|
// 创建节点;
|
|
for (int i = 0; i < MAX_GAME_COUNT; i++)
|
|
{
|
|
std::string strKey = __String::createWithFormat("item_%d", i)->getCString();
|
|
m_CreateItem[i] = (Layout*)m_ImageViewBg->getChildByName(strKey);
|
|
CC_ASSERT(m_CreateItem[i] != nullptr);
|
|
m_CreateItem[i]->setVisible(false);
|
|
|
|
std::string strItemKey = __String::createWithFormat("chb_Item_%d", i)->getCString();
|
|
CheckBox* GameItem = (CheckBox*)m_ImageViewBg->getChildByName(strItemKey);
|
|
ASSERT(GameItem != nullptr);
|
|
if (GameItem == nullptr) continue;
|
|
m_RadioGroupMenu.AddCheckBox(GameItem);
|
|
m_GameItem[i] = GameItem;
|
|
GameItem->setVisible(false);
|
|
|
|
int _index = i;
|
|
GameItem->addClickEventListener([_index, this](Ref* ref){
|
|
|
|
CheckBox* chb = (CheckBox*)ref;
|
|
auto pData = (ComExtensionData*)chb->getComponent("ComExtensionData");
|
|
std::string strUserData = pData->getCustomProperty();
|
|
|
|
m_wCurrentKinID = atoi(strUserData.c_str());
|
|
|
|
for (int i = 0; i < MAX_GAME_COUNT; i++)
|
|
{
|
|
if (m_CreateItem[i])
|
|
{
|
|
m_CreateItem[i]->setVisible(i == _index);
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
m_CreateItem[0]->setVisible(true);
|
|
m_RadioGroupMenu.setDelauftSelect(0, true);
|
|
|
|
//获取创建游戏按钮
|
|
m_btnCreate = (Button*)m_ImageViewBg->getChildByName("btnCreateGame");
|
|
CC_ASSERT(m_btnCreate != nullptr);
|
|
|
|
//注册创建游戏按钮事件
|
|
m_btnCreate->addClickEventListener([this](Ref*){
|
|
YSAudioEngine::Instance().playBtnClickEffect();
|
|
if (m_cdtype == CDT_CREATE_AUTO) return;
|
|
|
|
auto dispatcher = Director::getInstance()->getEventDispatcher();
|
|
EventCustom event(CREATE_PRIVATE_ROOM_EVENT);
|
|
|
|
tagCreatePrivate kSendNet;
|
|
zeromemory(&kSendNet, sizeof(kSendNet));
|
|
|
|
kSendNet.wServerID = getGameKindID();
|
|
kSendNet.CMD_Private.dwUnionCode = m_dwUnionCode;
|
|
kSendNet.CMD_Private.cbUnionGoldOpen = m_cbUnionGoldOpen;
|
|
kSendNet.CMD_Private.cbGameType = Type_Private;
|
|
kSendNet.CMD_Private.bGameRuleIdex = getGameRule();
|
|
kSendNet.CMD_Private.bGameTypeIdex = 0;
|
|
kSendNet.CMD_Private.bPlayCoutIdex = getGameCout();
|
|
kSendNet.CMD_Private.cbEnterRoomScoreType = ePrivateRoomScoreType_SetOneTime;
|
|
kSendNet.CMD_Private.lInitEnterRoomScore = getGameScore();
|
|
kSendNet.CMD_Private.cbBaseScore = getGameBaseScore();
|
|
|
|
event.setUserData(&kSendNet);
|
|
|
|
//派发创建游戏事件至MainScene
|
|
dispatcher->dispatchEvent(&event);
|
|
});
|
|
|
|
//获取创建游戏按钮
|
|
m_btnAuto = (Button*)m_ImageViewBg->getChildByName("btnCreateAuto");
|
|
CC_ASSERT(m_btnAuto != nullptr);
|
|
m_btnAuto->setVisible(false);
|
|
|
|
//注册创建游戏按钮事件
|
|
m_btnAuto->addClickEventListener([this](Ref*){
|
|
YSAudioEngine::Instance().playBtnClickEffect();
|
|
if (m_cdtype != CDT_CREATE_AUTO) return;
|
|
|
|
auto dispatcher = Director::getInstance()->getEventDispatcher();
|
|
EventCustom event(CREATE_AUTO_ROOM_EVENT);
|
|
|
|
CMD_GR_AutoRoomInfo kSendNet;
|
|
zeromemory(&kSendNet, sizeof(kSendNet));
|
|
|
|
kSendNet.wKindID = getGameKindID();
|
|
kSendNet.dwUserID = UserInfo::Instance().getUserID();
|
|
kSendNet.cbGameType = Type_Private;
|
|
|
|
uint32 dwGameRuleIdex = getGameRule();
|
|
kSendNet.bGameRuleIdex = (dwGameRuleIdex | ePrivateTableCommonRule_DaiKaiFang);
|
|
|
|
kSendNet.bGameTypeIdex = 0;
|
|
kSendNet.bPlayCoutIdex = getGameCout();
|
|
kSendNet.cbEnterRoomScoreType = ePrivateRoomScoreType_SetOneTime;
|
|
kSendNet.lInitEnterRoomScore = getGameScore();
|
|
kSendNet.cbBaseScore = getGameBaseScore();
|
|
|
|
event.setUserData(&kSendNet);
|
|
|
|
//派发创建游戏事件至MainScene
|
|
dispatcher->dispatchEvent(&event);
|
|
});
|
|
|
|
initGame();
|
|
|
|
return true;
|
|
}
|
|
|
|
void CreateScene::onEnter()
|
|
{
|
|
Node::onEnter();
|
|
}
|
|
|
|
void CreateScene::onEnterTransitionDidFinish()
|
|
{
|
|
Node::onEnterTransitionDidFinish();
|
|
}
|
|
|
|
void CreateScene::onExit()
|
|
{
|
|
Node::onExit();
|
|
}
|
|
|
|
void CreateScene::initGame()
|
|
{
|
|
//////////////////////////////// 万年麻将 //////////////////////////////////////////
|
|
if (m_CreateItem[INDEX_WN] != nullptr)
|
|
{
|
|
Layout* WNItem = m_CreateItem[INDEX_WN];
|
|
|
|
// 翻数选择
|
|
auto chbFan0 = (CheckBox*)WNItem->getChildByName("chb_fan_0");
|
|
CC_ASSERT(chbFan0);
|
|
m_rdWNGameScore.AddCheckBox(chbFan0);
|
|
|
|
auto chbFan1 = (CheckBox*)WNItem->getChildByName("chb_fan_1");
|
|
CC_ASSERT(chbFan1);
|
|
m_rdWNGameScore.AddCheckBox(chbFan1);
|
|
m_rdWNGameScore.setDelauftSelect(0, true);
|
|
|
|
// 局数控件
|
|
auto chbCout0 = (CheckBox*)WNItem->getChildByName("chb_cout_0");
|
|
CC_ASSERT(chbCout0);
|
|
m_rdWNGameCout.AddCheckBox(chbCout0);
|
|
|
|
auto chbCout1 = (CheckBox*)WNItem->getChildByName("chb_cout_1");
|
|
CC_ASSERT(chbCout1);
|
|
m_rdWNGameCout.AddCheckBox(chbCout1);
|
|
m_rdWNGameCout.setDelauftSelect(0, true);
|
|
|
|
// 玩法
|
|
auto chbWay0 = (CheckBox*)WNItem->getChildByName("chb_way_0");
|
|
CC_ASSERT(chbWay0);
|
|
m_rdWNGameWay.AddCheckBox(chbWay0);
|
|
|
|
auto chbWay1 = (CheckBox*)WNItem->getChildByName("chb_way_1");
|
|
CC_ASSERT(chbWay1);
|
|
m_rdWNGameWay.AddCheckBox(chbWay1);
|
|
|
|
auto chbWay2 = (CheckBox*)WNItem->getChildByName("chb_way_2");
|
|
CC_ASSERT(chbWay2);
|
|
m_rdWNGameWay.AddCheckBox(chbWay2);
|
|
|
|
m_rdWNGameWay.setDelauftSelect(0, true);
|
|
|
|
// 杠翻倍;
|
|
auto chbGang0 = (CheckBox*)WNItem->getChildByName("chb_gang_0");
|
|
CC_ASSERT(chbGang0);
|
|
m_rdWNGangWay.AddCheckBox(chbGang0);
|
|
|
|
auto chbGang1 = (CheckBox*)WNItem->getChildByName("chb_gang_1");
|
|
CC_ASSERT(chbGang1);
|
|
m_rdWNGangWay.AddCheckBox(chbGang1);
|
|
|
|
m_rdWNGangWay.setDelauftSelect(0, true);
|
|
|
|
// 人数;
|
|
auto chb_playcount_0 = (CheckBox*)WNItem->getChildByName("chb_playcount_0");
|
|
CC_ASSERT(chb_playcount_0);
|
|
m_rdWNUserCount.AddCheckBox(chb_playcount_0);
|
|
|
|
auto chb_playcount_1 = (CheckBox*)WNItem->getChildByName("chb_playcount_1");
|
|
CC_ASSERT(chb_playcount_1);
|
|
m_rdWNUserCount.AddCheckBox(chb_playcount_1);
|
|
|
|
auto chb_playcount_2 = (CheckBox*)WNItem->getChildByName("chb_playcount_2");
|
|
CC_ASSERT(chb_playcount_2);
|
|
m_rdWNUserCount.AddCheckBox(chb_playcount_2);
|
|
|
|
auto chb_playcount_3 = (CheckBox*)WNItem->getChildByName("chb_playcount_3");
|
|
CC_ASSERT(chb_playcount_3);
|
|
m_rdWNUserCount.AddCheckBox(chb_playcount_3);
|
|
|
|
m_rdWNUserCount.setDelauftSelect(2, true);
|
|
|
|
initMJBaseScore();
|
|
}
|
|
|
|
//////////////////////////////// 斗地主 //////////////////////////////////////////
|
|
if (m_CreateItem[INDEX_DDZ] != nullptr)
|
|
{
|
|
Layout* DDZItem = m_CreateItem[INDEX_DDZ];
|
|
// 局数
|
|
for (int i = 0; i < 2; i++)
|
|
{
|
|
std::string strKey = __String::createWithFormat("chbGameCount%d", i)->getCString();
|
|
auto chb = (CheckBox*)DDZItem->getChildByName(strKey);
|
|
CC_ASSERT(chb != nullptr);
|
|
if (nullptr == chb) continue;
|
|
|
|
m_rgDDZGameCount.AddCheckBox(chb);
|
|
}
|
|
|
|
m_rgDDZGameCount.setRadioMode(true);
|
|
m_rgDDZGameCount.setDelauftSelect(0);
|
|
|
|
initDDZBaseScore();
|
|
}
|
|
|
|
//////////////////////////////// 牛牛 //////////////////////////////////////////
|
|
if (m_CreateItem[INDEX_NN] != nullptr)
|
|
{
|
|
Layout* NNItem = m_CreateItem[INDEX_NN];
|
|
|
|
// 局数
|
|
for (int i = 0; i < 2; i++)
|
|
{
|
|
std::string strKey = __String::createWithFormat("chbGameCount%d", i)->getCString();
|
|
auto chb = (CheckBox*)NNItem->getChildByName(strKey);
|
|
CC_ASSERT(chb != nullptr);
|
|
if (nullptr == chb) continue;
|
|
|
|
m_rgNNGameCount.AddCheckBox(chb);
|
|
}
|
|
|
|
m_rgNNGameCount.setRadioMode(true);
|
|
m_rgNNGameCount.setDelauftSelect(0);
|
|
|
|
// 玩法;
|
|
for (int i = 0; i < 3; i++)
|
|
{
|
|
std::string strKey = __String::createWithFormat("chbGameWay%d", i)->getCString();
|
|
auto chb = (CheckBox*)NNItem->getChildByName(strKey);
|
|
CC_ASSERT(chb != nullptr);
|
|
if (nullptr == chb) continue;
|
|
|
|
m_rgNNGameRule.AddCheckBox(chb);
|
|
}
|
|
|
|
m_rgNNGameRule.setRadioMode(true);
|
|
m_rgNNGameRule.setDelauftSelect(0);
|
|
|
|
// 牌型;
|
|
for (int i = 0; i < 3; i++)
|
|
{
|
|
std::string strKey = __String::createWithFormat("chbCardType_%d", i)->getCString();
|
|
m_NNCardType[i] = (CheckBox*)NNItem->getChildByName(strKey);
|
|
CC_ASSERT(m_NNCardType[i] != nullptr);
|
|
m_NNCardType[i]->setSelected(true);
|
|
}
|
|
|
|
initNNBaseScore();
|
|
}
|
|
|
|
//////////////////////////////// 打炸 //////////////////////////////////////////
|
|
if (m_CreateItem[INDEX_DZ] != nullptr)
|
|
{
|
|
Layout* DZItem = m_CreateItem[INDEX_DZ];
|
|
|
|
// 局数
|
|
for (int i = 0; i < 2; i++)
|
|
{
|
|
std::string strKey = __String::createWithFormat("chbGameCount%d", i)->getCString();
|
|
auto chb = (CheckBox*)DZItem->getChildByName(strKey);
|
|
CC_ASSERT(chb != nullptr);
|
|
if (nullptr == chb) continue;
|
|
|
|
m_rgDZGameCount.AddCheckBox(chb);
|
|
}
|
|
|
|
m_rgDZGameCount.setRadioMode(true);
|
|
m_rgDZGameCount.setDelauftSelect(0);
|
|
|
|
// 玩法;
|
|
for (int i = 0; i < 2; i++)
|
|
{
|
|
std::string strKey = __String::createWithFormat("chbGameWay%d", i)->getCString();
|
|
auto chb = (CheckBox*)DZItem->getChildByName(strKey);
|
|
CC_ASSERT(chb != nullptr);
|
|
if (nullptr == chb) continue;
|
|
|
|
m_rgDZGameRule.AddCheckBox(chb);
|
|
}
|
|
|
|
m_rgDZGameRule.setRadioMode(true);
|
|
m_rgDZGameRule.setDelauftSelect(0);
|
|
|
|
// 叫边;
|
|
for (int i = 0; i < 2; i++)
|
|
{
|
|
std::string strKey = __String::createWithFormat("chbGameCall%d", i)->getCString();
|
|
auto chb = (CheckBox*)DZItem->getChildByName(strKey);
|
|
CC_ASSERT(chb != nullptr);
|
|
if (nullptr == chb) continue;
|
|
|
|
m_rgDZGameCall.AddCheckBox(chb);
|
|
}
|
|
|
|
m_rgDZGameCall.setRadioMode(true);
|
|
m_rgDZGameCall.setDelauftSelect(0);
|
|
|
|
// 附加玩法;
|
|
for (int i = 0; i < 7; i++)
|
|
{
|
|
std::string strKey = StringUtils::format("chbCardType_%d", i);
|
|
auto chb = (CheckBox*)DZItem->getChildByName(strKey);
|
|
CC_ASSERT(chb != nullptr);
|
|
if (nullptr == chb) continue;
|
|
|
|
m_DZSubRule[i] = chb;
|
|
}
|
|
|
|
initDZBaseScore();
|
|
}
|
|
|
|
//////////////////////////////// 十三水 //////////////////////////////////////////
|
|
if (m_CreateItem[INDEX_13S] != nullptr)
|
|
{
|
|
Layout* SSSItem = m_CreateItem[INDEX_13S];
|
|
|
|
// 玩法;
|
|
for (int i = 0; i < 4; i++)
|
|
{
|
|
std::string strKey = __String::createWithFormat("chbGameWay%d", i)->getCString();
|
|
auto chb = (CheckBox*)SSSItem->getChildByName(strKey);
|
|
CC_ASSERT(chb != nullptr);
|
|
if (nullptr == chb) continue;
|
|
|
|
m_rgSSSGameRule.AddCheckBox(chb);
|
|
}
|
|
m_rgSSSGameRule.setRadioMode(true);
|
|
m_rgSSSGameRule.setDelauftSelect(3);
|
|
|
|
// 局数;
|
|
for (int i = 0; i < 2; i++)
|
|
{
|
|
std::string strKey = __String::createWithFormat("chbGameCount%d", i)->getCString();
|
|
auto chb = (CheckBox*)SSSItem->getChildByName(strKey);
|
|
CC_ASSERT(chb != nullptr);
|
|
if (nullptr == chb) continue;
|
|
|
|
m_rgSSSGameCount.AddCheckBox(chb);
|
|
}
|
|
|
|
m_rgSSSGameCount.setRadioMode(true);
|
|
m_rgSSSGameCount.setDelauftSelect(0);
|
|
|
|
initSSSBaseScore();
|
|
}
|
|
|
|
//////////////////////////////// 炸金花 //////////////////////////////////////////
|
|
if (m_CreateItem[INDEX_ZJH] != nullptr)
|
|
{
|
|
Layout* ZJHItem = m_CreateItem[INDEX_ZJH];
|
|
// 局数;
|
|
for (int i = 0; i < 2; i++)
|
|
{
|
|
std::string strKey = __String::createWithFormat("chbGameCount%d", i)->getCString();
|
|
auto chb = (CheckBox*)ZJHItem->getChildByName(strKey);
|
|
CC_ASSERT(chb != nullptr);
|
|
if (nullptr == chb) continue;
|
|
|
|
m_rgZJHGameCount.AddCheckBox(chb);
|
|
}
|
|
|
|
m_rgZJHGameCount.setRadioMode(true);
|
|
m_rgZJHGameCount.setDelauftSelect(0);
|
|
|
|
// 比牌轮数;
|
|
for (int i = 0; i < 3; i++)
|
|
{
|
|
std::string strKey = StringUtils::format("chbCompareRound%d", i);
|
|
auto chb = (CheckBox*)ZJHItem->getChildByName(strKey);
|
|
CC_ASSERT(chb != nullptr);
|
|
if (nullptr == chb) continue;
|
|
|
|
m_rgZJHCompareRound.AddCheckBox(chb);
|
|
}
|
|
m_rgZJHCompareRound.setRadioMode(true);
|
|
m_rgZJHCompareRound.setDelauftSelect(0);
|
|
|
|
// 开牌轮数;
|
|
for (int i = 0; i < 3; i++)
|
|
{
|
|
std::string strKey = StringUtils::format("chbOpenCardRound%d", i);
|
|
auto chb = (CheckBox*)ZJHItem->getChildByName(strKey);
|
|
CC_ASSERT(chb != nullptr);
|
|
if (nullptr == chb) continue;
|
|
|
|
m_rgZJHOpenCardRound.AddCheckBox(chb);
|
|
}
|
|
m_rgZJHOpenCardRound.setRadioMode(true);
|
|
m_rgZJHOpenCardRound.setDelauftSelect(0);
|
|
|
|
// 看牌轮数;
|
|
for (int i = 0; i < 3; i++)
|
|
{
|
|
std::string strKey = StringUtils::format("chbLookCardRound%d", i);
|
|
auto chb = (CheckBox*)ZJHItem->getChildByName(strKey);
|
|
CC_ASSERT(chb != nullptr);
|
|
if (nullptr == chb) continue;
|
|
|
|
m_rgZJHLookCardRound.AddCheckBox(chb);
|
|
}
|
|
m_rgZJHLookCardRound.setRadioMode(true);
|
|
m_rgZJHLookCardRound.setDelauftSelect(0);
|
|
|
|
initZJHBaseScore();
|
|
}
|
|
|
|
//////////////////////////////// 跑得快 //////////////////////////////////////////
|
|
if (m_CreateItem[INDEX_PDK] != nullptr)
|
|
{
|
|
Layout* PDKItem = m_CreateItem[INDEX_PDK];
|
|
ASSERT(PDKItem != nullptr);
|
|
|
|
// 张数;
|
|
for (int i = 0; i < 2; i++)
|
|
{
|
|
std::string strKey = __String::createWithFormat("chbWay_%d", i)->getCString();
|
|
auto chb = (CheckBox*)PDKItem->getChildByName(strKey);
|
|
CC_ASSERT(chb != nullptr);
|
|
if (nullptr == chb) continue;
|
|
|
|
bool isVisible = (i == 0);
|
|
chb->addClickEventListener([isVisible, this](Ref*){
|
|
|
|
if (m_PDKSubRule[PDK_SR_3A_BOMB] != nullptr)
|
|
{
|
|
m_PDKSubRule[PDK_SR_3A_BOMB]->setSelected(isVisible);
|
|
m_PDKSubRule[PDK_SR_3A_BOMB]->setVisible(isVisible);
|
|
}
|
|
});
|
|
|
|
m_rgPDKCardCount.AddCheckBox(chb);
|
|
}
|
|
|
|
m_rgPDKCardCount.setRadioMode(true);
|
|
m_rgPDKCardCount.setDelauftSelect(0);
|
|
|
|
// 局数;
|
|
for (int i = 0; i < 2; i++)
|
|
{
|
|
std::string strKey = __String::createWithFormat("chbGameCount%d", i)->getCString();
|
|
auto chb = (CheckBox*)PDKItem->getChildByName(strKey);
|
|
CC_ASSERT(chb != nullptr);
|
|
if (nullptr == chb) continue;
|
|
|
|
m_rgPDKGameCount.AddCheckBox(chb);
|
|
}
|
|
|
|
m_rgPDKGameCount.setRadioMode(true);
|
|
m_rgPDKGameCount.setDelauftSelect(0);
|
|
|
|
// 游戏人数;
|
|
for (int i = 0; i < 2; i++)
|
|
{
|
|
std::string strKey = StringUtils::format("chbUserCount%d", i);
|
|
auto chb = (CheckBox*)PDKItem->getChildByName(strKey);
|
|
CC_ASSERT(chb != nullptr);
|
|
if (nullptr == chb) continue;
|
|
|
|
m_rgPDKUserCount.AddCheckBox(chb);
|
|
}
|
|
m_rgPDKUserCount.setRadioMode(true);
|
|
m_rgPDKUserCount.setDelauftSelect(1);
|
|
|
|
// 游戏规则;
|
|
for (int i = 0; i < 2; i++)
|
|
{
|
|
std::string strKey = StringUtils::format("chbGameRule%d", i);
|
|
auto chb = (CheckBox*)PDKItem->getChildByName(strKey);
|
|
CC_ASSERT(chb != nullptr);
|
|
if (nullptr == chb) continue;
|
|
|
|
m_rgPDKRuleCount.AddCheckBox(chb);
|
|
}
|
|
m_rgPDKRuleCount.setRadioMode(true);
|
|
m_rgPDKRuleCount.setDelauftSelect(1);
|
|
|
|
// 附加玩法;
|
|
for (int i = 0; i < 5; i++)
|
|
{
|
|
std::string strKey = StringUtils::format("chbCardType_%d", i);
|
|
auto chb = (CheckBox*)PDKItem->getChildByName(strKey);
|
|
CC_ASSERT(chb != nullptr);
|
|
if (nullptr == chb) continue;
|
|
|
|
m_PDKSubRule[i] = chb;
|
|
}
|
|
|
|
initPDKBaseScore();
|
|
}
|
|
}
|
|
|
|
void CreateScene::initMJBaseScore(bool bOnClick)
|
|
{
|
|
if (m_CreateItem[INDEX_WN] == nullptr) return;
|
|
|
|
//if (m_cbUnionGoldOpen == 1)
|
|
//{
|
|
// Text* txtScoreTip = static_cast<Text*>(m_CreateItem[INDEX_WN]->getChildByName("txtScoreTip"));
|
|
// CC_ASSERT(txtScoreTip != nullptr);
|
|
// txtScoreTip->setVisible(false);
|
|
|
|
// Text* txtBaseScore = static_cast<Text*>(m_CreateItem[INDEX_WN]->getChildByName("txtBaseScore"));
|
|
// CC_ASSERT(txtBaseScore != nullptr);
|
|
// txtBaseScore->setVisible(false);
|
|
|
|
// //加
|
|
// Button* btnAdd = (Button*)m_CreateItem[INDEX_WN]->getChildByName("btnAdd");
|
|
// CC_ASSERT(btnAdd != nullptr);
|
|
// btnAdd->setVisible(false);
|
|
|
|
|
|
// Button* btnMinus = (Button*)m_CreateItem[INDEX_WN]->getChildByName("btnMinus");
|
|
// CC_ASSERT(btnMinus != nullptr);
|
|
// btnMinus->setVisible(false);
|
|
|
|
//}
|
|
//else
|
|
{
|
|
Text* txtScoreTip = static_cast<Text*>(m_CreateItem[INDEX_WN]->getChildByName("txtScoreTip"));
|
|
CC_ASSERT(txtScoreTip != nullptr);
|
|
txtScoreTip->setVisible(true);
|
|
|
|
Text* txtBaseScore = static_cast<Text*>(m_CreateItem[INDEX_WN]->getChildByName("txtBaseScore"));
|
|
CC_ASSERT(txtBaseScore != nullptr);
|
|
txtBaseScore->setVisible(true);
|
|
|
|
//加
|
|
Button* btnAdd = (Button*)m_CreateItem[INDEX_WN]->getChildByName("btnAdd");
|
|
CC_ASSERT(btnAdd != nullptr);
|
|
btnAdd->setVisible(true);
|
|
|
|
Button* btnMinus = (Button*)m_CreateItem[INDEX_WN]->getChildByName("btnMinus");
|
|
CC_ASSERT(btnMinus != nullptr);
|
|
btnMinus->setVisible(true);
|
|
|
|
if (bOnClick)
|
|
{
|
|
btnAdd->addClickEventListener([this](Ref*){
|
|
YSAudioEngine::Instance().playBtnClickEffect();
|
|
|
|
Text* txtBaseScore = static_cast<Text*>(m_CreateItem[INDEX_WN]->getChildByName("txtBaseScore"));
|
|
CC_ASSERT(txtBaseScore != nullptr);
|
|
int nBaseScore = atoi(txtBaseScore->getString().c_str());
|
|
if (nBaseScore < 99)
|
|
{
|
|
nBaseScore++;
|
|
txtBaseScore->setString(StringUtils::format("%d", nBaseScore));
|
|
}
|
|
});
|
|
|
|
btnMinus->addClickEventListener([this](Ref*){
|
|
YSAudioEngine::Instance().playBtnClickEffect();
|
|
|
|
Text* txtBaseScore = static_cast<Text*>(m_CreateItem[INDEX_WN]->getChildByName("txtBaseScore"));
|
|
CC_ASSERT(txtBaseScore != nullptr);
|
|
int nBaseScore = atoi(txtBaseScore->getString().c_str());
|
|
if (nBaseScore > 1)
|
|
{
|
|
nBaseScore--;
|
|
txtBaseScore->setString(StringUtils::format("%d", nBaseScore));
|
|
}
|
|
});
|
|
}
|
|
}
|
|
}
|
|
|
|
void CreateScene::initDDZBaseScore(bool bOnClick)
|
|
{
|
|
if (m_CreateItem[INDEX_DDZ] == nullptr) return;
|
|
|
|
//if (m_cbUnionGoldOpen == 1)
|
|
//{
|
|
// Text* txtScoreTip = static_cast<Text*>(m_CreateItem[INDEX_DDZ]->getChildByName("txtScoreTip"));
|
|
// CC_ASSERT(txtScoreTip != nullptr);
|
|
// txtScoreTip->setVisible(false);
|
|
|
|
// Text* txtBaseScore = static_cast<Text*>(m_CreateItem[INDEX_DDZ]->getChildByName("txtBaseScore"));
|
|
// CC_ASSERT(txtBaseScore != nullptr);
|
|
// txtBaseScore->setVisible(false);
|
|
|
|
// //加
|
|
// Button* btnAdd = (Button*)m_CreateItem[INDEX_DDZ]->getChildByName("btnAdd");
|
|
// CC_ASSERT(btnAdd != nullptr);
|
|
// btnAdd->setVisible(false);
|
|
|
|
|
|
// Button* btnMinus = (Button*)m_CreateItem[INDEX_DDZ]->getChildByName("btnMinus");
|
|
// CC_ASSERT(btnMinus != nullptr);
|
|
// btnMinus->setVisible(false);
|
|
|
|
//}
|
|
//else
|
|
{
|
|
Text* txtScoreTip = static_cast<Text*>(m_CreateItem[INDEX_DDZ]->getChildByName("txtScoreTip"));
|
|
CC_ASSERT(txtScoreTip != nullptr);
|
|
txtScoreTip->setVisible(true);
|
|
|
|
Text* txtBaseScore = static_cast<Text*>(m_CreateItem[INDEX_DDZ]->getChildByName("txtBaseScore"));
|
|
CC_ASSERT(txtBaseScore != nullptr);
|
|
txtBaseScore->setVisible(true);
|
|
|
|
//加
|
|
Button* btnAdd = (Button*)m_CreateItem[INDEX_DDZ]->getChildByName("btnAdd");
|
|
CC_ASSERT(btnAdd != nullptr);
|
|
btnAdd->setVisible(true);
|
|
|
|
Button* btnMinus = (Button*)m_CreateItem[INDEX_DDZ]->getChildByName("btnMinus");
|
|
CC_ASSERT(btnMinus != nullptr);
|
|
btnMinus->setVisible(true);
|
|
|
|
if (bOnClick)
|
|
{
|
|
btnAdd->addClickEventListener([this](Ref*){
|
|
YSAudioEngine::Instance().playBtnClickEffect();
|
|
|
|
Text* txtBaseScore = static_cast<Text*>(m_CreateItem[INDEX_DDZ]->getChildByName("txtBaseScore"));
|
|
CC_ASSERT(txtBaseScore != nullptr);
|
|
int nBaseScore = atoi(txtBaseScore->getString().c_str());
|
|
if (nBaseScore < 99)
|
|
{
|
|
nBaseScore++;
|
|
txtBaseScore->setString(StringUtils::format("%d", nBaseScore));
|
|
}
|
|
});
|
|
|
|
|
|
btnMinus->addClickEventListener([this](Ref*){
|
|
YSAudioEngine::Instance().playBtnClickEffect();
|
|
|
|
Text* txtBaseScore = static_cast<Text*>(m_CreateItem[INDEX_DDZ]->getChildByName("txtBaseScore"));
|
|
CC_ASSERT(txtBaseScore != nullptr);
|
|
int nBaseScore = atoi(txtBaseScore->getString().c_str());
|
|
if (nBaseScore > 1)
|
|
{
|
|
nBaseScore--;
|
|
txtBaseScore->setString(StringUtils::format("%d", nBaseScore));
|
|
}
|
|
});
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
void CreateScene::initNNBaseScore(bool bOnClick)
|
|
{
|
|
if (m_CreateItem[INDEX_NN] == nullptr) return;
|
|
|
|
//if (m_cbUnionGoldOpen == 1)
|
|
//{
|
|
// Text* txtScoreTip = static_cast<Text*>(m_CreateItem[INDEX_NN]->getChildByName("txtScoreTip"));
|
|
// CC_ASSERT(txtScoreTip != nullptr);
|
|
// txtScoreTip->setVisible(false);
|
|
|
|
// Text* txtBaseScore = static_cast<Text*>(m_CreateItem[INDEX_NN]->getChildByName("txtBaseScore"));
|
|
// CC_ASSERT(txtBaseScore != nullptr);
|
|
// txtBaseScore->setVisible(false);
|
|
|
|
// //加
|
|
// Button* btnAdd = (Button*)m_CreateItem[INDEX_NN]->getChildByName("btnAdd");
|
|
// CC_ASSERT(btnAdd != nullptr);
|
|
// btnAdd->setVisible(false);
|
|
|
|
|
|
// Button* btnMinus = (Button*)m_CreateItem[INDEX_NN]->getChildByName("btnMinus");
|
|
// CC_ASSERT(btnMinus != nullptr);
|
|
// btnMinus->setVisible(false);
|
|
|
|
//}
|
|
//else
|
|
{
|
|
Text* txtScoreTip = static_cast<Text*>(m_CreateItem[INDEX_NN]->getChildByName("txtScoreTip"));
|
|
CC_ASSERT(txtScoreTip != nullptr);
|
|
txtScoreTip->setVisible(true);
|
|
|
|
Text* txtBaseScore = static_cast<Text*>(m_CreateItem[INDEX_NN]->getChildByName("txtBaseScore"));
|
|
CC_ASSERT(txtBaseScore != nullptr);
|
|
txtBaseScore->setVisible(true);
|
|
|
|
//加
|
|
Button* btnAdd = (Button*)m_CreateItem[INDEX_NN]->getChildByName("btnAdd");
|
|
CC_ASSERT(btnAdd != nullptr);
|
|
btnAdd->setVisible(true);
|
|
|
|
Button* btnMinus = (Button*)m_CreateItem[INDEX_NN]->getChildByName("btnMinus");
|
|
CC_ASSERT(btnMinus != nullptr);
|
|
btnMinus->setVisible(true);
|
|
|
|
if (bOnClick)
|
|
{
|
|
btnAdd->addClickEventListener([this](Ref*){
|
|
YSAudioEngine::Instance().playBtnClickEffect();
|
|
|
|
Text* txtBaseScore = static_cast<Text*>(m_CreateItem[INDEX_NN]->getChildByName("txtBaseScore"));
|
|
CC_ASSERT(txtBaseScore != nullptr);
|
|
int nBaseScore = atoi(txtBaseScore->getString().c_str());
|
|
if (nBaseScore < 99)
|
|
{
|
|
nBaseScore++;
|
|
txtBaseScore->setString(StringUtils::format("%d", nBaseScore));
|
|
}
|
|
});
|
|
|
|
|
|
btnMinus->addClickEventListener([this](Ref*){
|
|
YSAudioEngine::Instance().playBtnClickEffect();
|
|
|
|
Text* txtBaseScore = static_cast<Text*>(m_CreateItem[INDEX_NN]->getChildByName("txtBaseScore"));
|
|
CC_ASSERT(txtBaseScore != nullptr);
|
|
int nBaseScore = atoi(txtBaseScore->getString().c_str());
|
|
if (nBaseScore > 1)
|
|
{
|
|
nBaseScore--;
|
|
txtBaseScore->setString(StringUtils::format("%d", nBaseScore));
|
|
}
|
|
});
|
|
}
|
|
else
|
|
{
|
|
if (m_GameItem[INDEX_NN] != nullptr)
|
|
{
|
|
m_GameItem[INDEX_NN]->setVisible(GlobalJosn::getInstance()->m_IsOpenNN);
|
|
if (GlobalJosn::getInstance()->m_IsOpenNN)
|
|
{
|
|
m_GameItem[INDEX_NN]->setPositionY(m_posy[m_index++]);
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
void CreateScene::initDZBaseScore(bool bOnClick)
|
|
{
|
|
if (m_CreateItem[INDEX_DZ] == nullptr) return;
|
|
|
|
//if (m_cbUnionGoldOpen == 1)
|
|
//{
|
|
// Text* txtScoreTip = static_cast<Text*>(m_CreateItem[INDEX_DZ]->getChildByName("txtScoreTip"));
|
|
// CC_ASSERT(txtScoreTip != nullptr);
|
|
// txtScoreTip->setVisible(false);
|
|
|
|
// Text* txtBaseScore = static_cast<Text*>(m_CreateItem[INDEX_DZ]->getChildByName("txtBaseScore"));
|
|
// CC_ASSERT(txtBaseScore != nullptr);
|
|
// txtBaseScore->setVisible(false);
|
|
|
|
// //加
|
|
// Button* btnAdd = (Button*)m_CreateItem[INDEX_DZ]->getChildByName("btnAdd");
|
|
// CC_ASSERT(btnAdd != nullptr);
|
|
// btnAdd->setVisible(false);
|
|
|
|
|
|
// Button* btnMinus = (Button*)m_CreateItem[INDEX_DZ]->getChildByName("btnMinus");
|
|
// CC_ASSERT(btnMinus != nullptr);
|
|
// btnMinus->setVisible(false);
|
|
|
|
//}
|
|
//else
|
|
{
|
|
Text* txtScoreTip = static_cast<Text*>(m_CreateItem[INDEX_DZ]->getChildByName("txtScoreTip"));
|
|
CC_ASSERT(txtScoreTip != nullptr);
|
|
txtScoreTip->setVisible(true);
|
|
|
|
Text* txtBaseScore = static_cast<Text*>(m_CreateItem[INDEX_DZ]->getChildByName("txtBaseScore"));
|
|
CC_ASSERT(txtBaseScore != nullptr);
|
|
txtBaseScore->setVisible(true);
|
|
|
|
//加
|
|
Button* btnAdd = (Button*)m_CreateItem[INDEX_DZ]->getChildByName("btnAdd");
|
|
CC_ASSERT(btnAdd != nullptr);
|
|
btnAdd->setVisible(true);
|
|
|
|
Button* btnMinus = (Button*)m_CreateItem[INDEX_DZ]->getChildByName("btnMinus");
|
|
CC_ASSERT(btnMinus != nullptr);
|
|
btnMinus->setVisible(true);
|
|
|
|
if (bOnClick)
|
|
{
|
|
btnAdd->addClickEventListener([this](Ref*){
|
|
YSAudioEngine::Instance().playBtnClickEffect();
|
|
|
|
Text* txtBaseScore = static_cast<Text*>(m_CreateItem[INDEX_DZ]->getChildByName("txtBaseScore"));
|
|
CC_ASSERT(txtBaseScore != nullptr);
|
|
int nBaseScore = atoi(txtBaseScore->getString().c_str());
|
|
if (nBaseScore < 99)
|
|
{
|
|
nBaseScore++;
|
|
txtBaseScore->setString(StringUtils::format("%d", nBaseScore));
|
|
}
|
|
});
|
|
|
|
|
|
btnMinus->addClickEventListener([this](Ref*){
|
|
YSAudioEngine::Instance().playBtnClickEffect();
|
|
|
|
Text* txtBaseScore = static_cast<Text*>(m_CreateItem[INDEX_DZ]->getChildByName("txtBaseScore"));
|
|
CC_ASSERT(txtBaseScore != nullptr);
|
|
int nBaseScore = atoi(txtBaseScore->getString().c_str());
|
|
if (nBaseScore > 1)
|
|
{
|
|
nBaseScore--;
|
|
txtBaseScore->setString(StringUtils::format("%d", nBaseScore));
|
|
}
|
|
});
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
void CreateScene::initSSSBaseScore(bool bOnClick)
|
|
{
|
|
if (m_CreateItem[INDEX_13S] == nullptr) return;
|
|
|
|
//if (m_cbUnionGoldOpen == 1)
|
|
//{
|
|
// Text* txtScoreTip = static_cast<Text*>(m_CreateItem[INDEX_13S]->getChildByName("txtScoreTip"));
|
|
// CC_ASSERT(txtScoreTip != nullptr);
|
|
// txtScoreTip->setVisible(false);
|
|
|
|
// Text* txtBaseScore = static_cast<Text*>(m_CreateItem[INDEX_13S]->getChildByName("txtBaseScore"));
|
|
// CC_ASSERT(txtBaseScore != nullptr);
|
|
// txtBaseScore->setVisible(false);
|
|
|
|
// //加
|
|
// Button* btnAdd = (Button*)m_CreateItem[INDEX_13S]->getChildByName("btnAdd");
|
|
// CC_ASSERT(btnAdd != nullptr);
|
|
// btnAdd->setVisible(false);
|
|
|
|
|
|
// Button* btnMinus = (Button*)m_CreateItem[INDEX_13S]->getChildByName("btnMinus");
|
|
// CC_ASSERT(btnMinus != nullptr);
|
|
// btnMinus->setVisible(false);
|
|
|
|
//}
|
|
//else
|
|
{
|
|
Text* txtScoreTip = static_cast<Text*>(m_CreateItem[INDEX_13S]->getChildByName("txtScoreTip"));
|
|
CC_ASSERT(txtScoreTip != nullptr);
|
|
txtScoreTip->setVisible(true);
|
|
|
|
Text* txtBaseScore = static_cast<Text*>(m_CreateItem[INDEX_13S]->getChildByName("txtBaseScore"));
|
|
CC_ASSERT(txtBaseScore != nullptr);
|
|
txtBaseScore->setVisible(true);
|
|
|
|
//加
|
|
Button* btnAdd = (Button*)m_CreateItem[INDEX_13S]->getChildByName("btnAdd");
|
|
CC_ASSERT(btnAdd != nullptr);
|
|
btnAdd->setVisible(true);
|
|
|
|
Button* btnMinus = (Button*)m_CreateItem[INDEX_13S]->getChildByName("btnMinus");
|
|
CC_ASSERT(btnMinus != nullptr);
|
|
btnMinus->setVisible(true);
|
|
|
|
if (bOnClick)
|
|
{
|
|
btnAdd->addClickEventListener([this](Ref*){
|
|
YSAudioEngine::Instance().playBtnClickEffect();
|
|
|
|
Text* txtBaseScore = static_cast<Text*>(m_CreateItem[INDEX_13S]->getChildByName("txtBaseScore"));
|
|
CC_ASSERT(txtBaseScore != nullptr);
|
|
int nBaseScore = atoi(txtBaseScore->getString().c_str());
|
|
if (nBaseScore < 99)
|
|
{
|
|
nBaseScore++;
|
|
txtBaseScore->setString(StringUtils::format("%d", nBaseScore));
|
|
}
|
|
});
|
|
|
|
|
|
btnMinus->addClickEventListener([this](Ref*){
|
|
YSAudioEngine::Instance().playBtnClickEffect();
|
|
|
|
Text* txtBaseScore = static_cast<Text*>(m_CreateItem[INDEX_13S]->getChildByName("txtBaseScore"));
|
|
CC_ASSERT(txtBaseScore != nullptr);
|
|
int nBaseScore = atoi(txtBaseScore->getString().c_str());
|
|
if (nBaseScore > 1)
|
|
{
|
|
nBaseScore--;
|
|
txtBaseScore->setString(StringUtils::format("%d", nBaseScore));
|
|
}
|
|
});
|
|
}
|
|
else
|
|
{
|
|
if (m_GameItem[INDEX_13S] != nullptr)
|
|
{
|
|
m_GameItem[INDEX_13S]->setVisible(GlobalJosn::getInstance()->m_IsOpenSSZ);
|
|
|
|
if (GlobalJosn::getInstance()->m_IsOpenSSZ)
|
|
{
|
|
m_GameItem[INDEX_13S]->setPositionY(m_posy[m_index++]);
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
void CreateScene::initZJHBaseScore(bool bOnClick)
|
|
{
|
|
if (m_CreateItem[INDEX_ZJH] == nullptr) return;
|
|
|
|
//if (m_cbUnionGoldOpen == 1)
|
|
//{
|
|
// Text* txtScoreTip = static_cast<Text*>(m_CreateItem[INDEX_ZJH]->getChildByName("txtScoreTip"));
|
|
// CC_ASSERT(txtScoreTip != nullptr);
|
|
// txtScoreTip->setVisible(false);
|
|
|
|
// Text* txtBaseScore = static_cast<Text*>(m_CreateItem[INDEX_ZJH]->getChildByName("txtBaseScore"));
|
|
// CC_ASSERT(txtBaseScore != nullptr);
|
|
// txtBaseScore->setVisible(false);
|
|
|
|
// //加
|
|
// Button* btnAdd = (Button*)m_CreateItem[INDEX_ZJH]->getChildByName("btnAdd");
|
|
// CC_ASSERT(btnAdd != nullptr);
|
|
// btnAdd->setVisible(false);
|
|
|
|
|
|
// Button* btnMinus = (Button*)m_CreateItem[INDEX_ZJH]->getChildByName("btnMinus");
|
|
// CC_ASSERT(btnMinus != nullptr);
|
|
// btnMinus->setVisible(false);
|
|
|
|
//}
|
|
//else
|
|
{
|
|
Text* txtScoreTip = static_cast<Text*>(m_CreateItem[INDEX_ZJH]->getChildByName("txtScoreTip"));
|
|
CC_ASSERT(txtScoreTip != nullptr);
|
|
txtScoreTip->setVisible(true);
|
|
|
|
Text* txtBaseScore = static_cast<Text*>(m_CreateItem[INDEX_ZJH]->getChildByName("txtBaseScore"));
|
|
CC_ASSERT(txtBaseScore != nullptr);
|
|
txtBaseScore->setVisible(true);
|
|
|
|
//加
|
|
Button* btnAdd = (Button*)m_CreateItem[INDEX_ZJH]->getChildByName("btnAdd");
|
|
CC_ASSERT(btnAdd != nullptr);
|
|
btnAdd->setVisible(true);
|
|
|
|
Button* btnMinus = (Button*)m_CreateItem[INDEX_ZJH]->getChildByName("btnMinus");
|
|
CC_ASSERT(btnMinus != nullptr);
|
|
btnMinus->setVisible(true);
|
|
|
|
if (bOnClick)
|
|
{
|
|
btnAdd->addClickEventListener([this](Ref*){
|
|
YSAudioEngine::Instance().playBtnClickEffect();
|
|
|
|
Text* txtBaseScore = static_cast<Text*>(m_CreateItem[INDEX_ZJH]->getChildByName("txtBaseScore"));
|
|
CC_ASSERT(txtBaseScore != nullptr);
|
|
int nBaseScore = atoi(txtBaseScore->getString().c_str());
|
|
if (nBaseScore < 99)
|
|
{
|
|
nBaseScore++;
|
|
txtBaseScore->setString(StringUtils::format("%d", nBaseScore));
|
|
}
|
|
});
|
|
|
|
|
|
btnMinus->addClickEventListener([this](Ref*){
|
|
YSAudioEngine::Instance().playBtnClickEffect();
|
|
|
|
Text* txtBaseScore = static_cast<Text*>(m_CreateItem[INDEX_ZJH]->getChildByName("txtBaseScore"));
|
|
CC_ASSERT(txtBaseScore != nullptr);
|
|
int nBaseScore = atoi(txtBaseScore->getString().c_str());
|
|
if (nBaseScore > 1)
|
|
{
|
|
nBaseScore--;
|
|
txtBaseScore->setString(StringUtils::format("%d", nBaseScore));
|
|
}
|
|
});
|
|
}
|
|
else
|
|
{
|
|
if (m_GameItem[INDEX_ZJH] != nullptr)
|
|
{
|
|
m_GameItem[INDEX_ZJH]->setVisible(GlobalJosn::getInstance()->m_IsOpenZJH);
|
|
|
|
if (GlobalJosn::getInstance()->m_IsOpenZJH)
|
|
{
|
|
m_GameItem[INDEX_ZJH]->setPositionY(m_posy[m_index++]);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
void CreateScene::initPDKBaseScore(bool bOnClick)
|
|
{
|
|
if (m_CreateItem[INDEX_PDK] == nullptr) return;
|
|
|
|
//if (m_cbUnionGoldOpen == 1)
|
|
//{
|
|
// Text* txtScoreTip = static_cast<Text*>(m_CreateItem[INDEX_PDK]->getChildByName("txtScoreTip"));
|
|
// CC_ASSERT(txtScoreTip != nullptr);
|
|
// txtScoreTip->setVisible(false);
|
|
|
|
// Text* txtBaseScore = static_cast<Text*>(m_CreateItem[INDEX_PDK]->getChildByName("txtBaseScore"));
|
|
// CC_ASSERT(txtBaseScore != nullptr);
|
|
// txtBaseScore->setVisible(false);
|
|
|
|
// //加
|
|
// Button* btnAdd = (Button*)m_CreateItem[INDEX_PDK]->getChildByName("btnAdd");
|
|
// CC_ASSERT(btnAdd != nullptr);
|
|
// btnAdd->setVisible(false);
|
|
|
|
|
|
// Button* btnMinus = (Button*)m_CreateItem[INDEX_PDK]->getChildByName("btnMinus");
|
|
// CC_ASSERT(btnMinus != nullptr);
|
|
// btnMinus->setVisible(false);
|
|
|
|
//}
|
|
//else
|
|
{
|
|
Text* txtScoreTip = static_cast<Text*>(m_CreateItem[INDEX_PDK]->getChildByName("txtScoreTip"));
|
|
CC_ASSERT(txtScoreTip != nullptr);
|
|
txtScoreTip->setVisible(true);
|
|
|
|
Text* txtBaseScore = static_cast<Text*>(m_CreateItem[INDEX_PDK]->getChildByName("txtBaseScore"));
|
|
CC_ASSERT(txtBaseScore != nullptr);
|
|
txtBaseScore->setVisible(true);
|
|
|
|
//加
|
|
Button* btnAdd = (Button*)m_CreateItem[INDEX_PDK]->getChildByName("btnAdd");
|
|
CC_ASSERT(btnAdd != nullptr);
|
|
btnAdd->setVisible(true);
|
|
|
|
Button* btnMinus = (Button*)m_CreateItem[INDEX_PDK]->getChildByName("btnMinus");
|
|
CC_ASSERT(btnMinus != nullptr);
|
|
btnMinus->setVisible(true);
|
|
|
|
if (bOnClick)
|
|
{
|
|
btnAdd->addClickEventListener([this](Ref*){
|
|
YSAudioEngine::Instance().playBtnClickEffect();
|
|
|
|
Text* txtBaseScore = static_cast<Text*>(m_CreateItem[INDEX_PDK]->getChildByName("txtBaseScore"));
|
|
CC_ASSERT(txtBaseScore != nullptr);
|
|
int nBaseScore = atof(txtBaseScore->getString().c_str());
|
|
if (nBaseScore < 99)
|
|
{
|
|
nBaseScore++;
|
|
|
|
}
|
|
else if (nBaseScore == 0.5)
|
|
{
|
|
nBaseScore = 1;
|
|
}
|
|
|
|
txtBaseScore->setString(StringUtils::format("%d", nBaseScore));
|
|
});
|
|
|
|
|
|
btnMinus->addClickEventListener([this](Ref*){
|
|
YSAudioEngine::Instance().playBtnClickEffect();
|
|
|
|
Text* txtBaseScore = static_cast<Text*>(m_CreateItem[INDEX_PDK]->getChildByName("txtBaseScore"));
|
|
CC_ASSERT(txtBaseScore != nullptr);
|
|
int nBaseScore = atoi(txtBaseScore->getString().c_str());
|
|
if (nBaseScore > 1)
|
|
{
|
|
nBaseScore--;
|
|
}
|
|
else if (nBaseScore == 1)
|
|
{
|
|
nBaseScore = 0.5;
|
|
}
|
|
txtBaseScore->setString(StringUtils::format("%d", nBaseScore));
|
|
|
|
});
|
|
}
|
|
}
|
|
}
|
|
|
|
SCORE CreateScene::getGameScore()
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
uint8 CreateScene::getGameBaseScore()
|
|
{
|
|
// 万年麻将;
|
|
if (m_CreateItem[INDEX_WN]->isVisible())
|
|
{
|
|
Text* txtBaseScore = static_cast<Text*>(m_CreateItem[INDEX_WN]->getChildByName("txtBaseScore"));
|
|
CC_ASSERT(txtBaseScore != nullptr);
|
|
return atoi(txtBaseScore->getString().c_str());
|
|
}
|
|
|
|
// 斗地主;
|
|
if (m_CreateItem[INDEX_DDZ]->isVisible())
|
|
{
|
|
Text* txtBaseScore = static_cast<Text*>(m_CreateItem[INDEX_DDZ]->getChildByName("txtBaseScore"));
|
|
CC_ASSERT(txtBaseScore != nullptr);
|
|
return atoi(txtBaseScore->getString().c_str());
|
|
}
|
|
|
|
// 牛牛;
|
|
if (m_CreateItem[INDEX_NN]->isVisible())
|
|
{
|
|
Text* txtBaseScore = static_cast<Text*>(m_CreateItem[INDEX_NN]->getChildByName("txtBaseScore"));
|
|
CC_ASSERT(txtBaseScore != nullptr);
|
|
return atoi(txtBaseScore->getString().c_str());
|
|
}
|
|
|
|
// 打炸;
|
|
if (m_CreateItem[INDEX_DZ]->isVisible())
|
|
{
|
|
Text* txtBaseScore = static_cast<Text*>(m_CreateItem[INDEX_DZ]->getChildByName("txtBaseScore"));
|
|
CC_ASSERT(txtBaseScore != nullptr);
|
|
return atoi(txtBaseScore->getString().c_str());
|
|
}
|
|
|
|
// 十三张;
|
|
if (m_CreateItem[INDEX_13S]->isVisible())
|
|
{
|
|
Text* txtBaseScore = static_cast<Text*>(m_CreateItem[INDEX_13S]->getChildByName("txtBaseScore"));
|
|
CC_ASSERT(txtBaseScore != nullptr);
|
|
return atoi(txtBaseScore->getString().c_str());
|
|
}
|
|
|
|
// 炸金花;
|
|
if (m_CreateItem[INDEX_ZJH]->isVisible())
|
|
{
|
|
Text* txtBaseScore = static_cast<Text*>(m_CreateItem[INDEX_ZJH]->getChildByName("txtBaseScore"));
|
|
CC_ASSERT(txtBaseScore != nullptr);
|
|
return atoi(txtBaseScore->getString().c_str());
|
|
}
|
|
|
|
// 跑得快;
|
|
if (m_CreateItem[INDEX_PDK]->isVisible())
|
|
{
|
|
Text* txtBaseScore = static_cast<Text*>(m_CreateItem[INDEX_PDK]->getChildByName("txtBaseScore"));
|
|
CC_ASSERT(txtBaseScore != nullptr);
|
|
return atoi(txtBaseScore->getString().c_str());
|
|
}
|
|
|
|
return 1;
|
|
}
|
|
|
|
BYTE CreateScene::getGameCout()
|
|
{
|
|
// 万年麻将;
|
|
if (m_CreateItem[INDEX_WN]->isVisible())
|
|
{
|
|
cocos2d::Ref* chb = m_rdWNGameCout.getCurrentSelect();
|
|
if (chb == nullptr) return 0;
|
|
|
|
// 局数控件
|
|
auto chbCout12 = (CheckBox*)m_CreateItem[0]->getChildByName("chb_cout_1");
|
|
CC_ASSERT(chbCout12);
|
|
if (chb == chbCout12) return 1;
|
|
|
|
return 0;
|
|
}
|
|
|
|
// 斗地主;
|
|
if (m_CreateItem[INDEX_DDZ]->isVisible())
|
|
{
|
|
CheckBox* chb = static_cast<CheckBox*>(m_rgDDZGameCount.getCurrentSelect());
|
|
CC_ASSERT(chb != nullptr);
|
|
if (chb == nullptr) return 0;
|
|
|
|
auto pData = (ComExtensionData*)chb->getComponent("ComExtensionData");
|
|
std::string strUserData = pData->getCustomProperty();
|
|
|
|
return atoi(strUserData.c_str());
|
|
}
|
|
|
|
// 牛牛;
|
|
if (m_CreateItem[INDEX_NN]->isVisible())
|
|
{
|
|
CheckBox* chb = static_cast<CheckBox*>(m_rgNNGameCount.getCurrentSelect());
|
|
CC_ASSERT(chb != nullptr);
|
|
if (chb == nullptr) return 0;
|
|
|
|
auto pData = (ComExtensionData*)chb->getComponent("ComExtensionData");
|
|
std::string strUserData = pData->getCustomProperty();
|
|
|
|
return atoi(strUserData.c_str());
|
|
}
|
|
|
|
// 打炸;
|
|
if (m_CreateItem[INDEX_DZ]->isVisible())
|
|
{
|
|
CheckBox* chb = static_cast<CheckBox*>(m_rgDZGameCount.getCurrentSelect());
|
|
CC_ASSERT(chb != nullptr);
|
|
if (chb == nullptr) return 0;
|
|
|
|
auto pData = (ComExtensionData*)chb->getComponent("ComExtensionData");
|
|
std::string strUserData = pData->getCustomProperty();
|
|
|
|
return atoi(strUserData.c_str());
|
|
}
|
|
|
|
// 十三张;
|
|
if (m_CreateItem[INDEX_13S]->isVisible())
|
|
{
|
|
CheckBox* chb = static_cast<CheckBox*>(m_rgSSSGameCount.getCurrentSelect());
|
|
CC_ASSERT(chb != nullptr);
|
|
if (chb == nullptr) return 0;
|
|
|
|
auto pData = (ComExtensionData*)chb->getComponent("ComExtensionData");
|
|
std::string strUserData = pData->getCustomProperty();
|
|
|
|
return atoi(strUserData.c_str());
|
|
}
|
|
|
|
// 炸金花;
|
|
if (m_CreateItem[INDEX_ZJH]->isVisible())
|
|
{
|
|
CheckBox* chb = static_cast<CheckBox*>(m_rgZJHGameCount.getCurrentSelect());
|
|
CC_ASSERT(chb != nullptr);
|
|
if (chb == nullptr) return 0;
|
|
|
|
auto pData = (ComExtensionData*)chb->getComponent("ComExtensionData");
|
|
std::string strUserData = pData->getCustomProperty();
|
|
|
|
return atoi(strUserData.c_str());
|
|
}
|
|
|
|
// 跑得快;
|
|
if (m_CreateItem[INDEX_PDK]->isVisible())
|
|
{
|
|
CheckBox* chb = static_cast<CheckBox*>(m_rgPDKGameCount.getCurrentSelect());
|
|
CC_ASSERT(chb != nullptr);
|
|
if (chb == nullptr) return 0;
|
|
|
|
auto pData = (ComExtensionData*)chb->getComponent("ComExtensionData");
|
|
std::string strUserData = pData->getCustomProperty();
|
|
|
|
return atoi(strUserData.c_str());
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
DWORD CreateScene::getGameRule()
|
|
{
|
|
// 万年麻将;
|
|
if (m_CreateItem[INDEX_WN]->isVisible())
|
|
{
|
|
uint32 rule = WNMJ_SPACE::eWNMJRuleEnum_Null;
|
|
|
|
Layout* pRootPanel = m_CreateItem[0];
|
|
|
|
// 玩法选择
|
|
cocos2d::Ref* chbway = m_rdWNGameWay.getCurrentSelect();
|
|
auto chbWay1 = (CheckBox*)pRootPanel->getChildByName("chb_way_1");
|
|
auto chbWay2 = (CheckBox*)pRootPanel->getChildByName("chb_way_2");
|
|
|
|
if (chbway == chbWay1)
|
|
{
|
|
rule |= WNMJ_SPACE::eWNMJRuleEnum_YiBianDaoHU;
|
|
}
|
|
else if (chbWay2 == chbway)
|
|
{
|
|
rule |= WNMJ_SPACE::eWNMJRuleEnum_HunHU;
|
|
}
|
|
else
|
|
{
|
|
rule |= WNMJ_SPACE::eWNMJRuleEnum_YingHU;
|
|
}
|
|
|
|
// 积分选择
|
|
cocos2d::Ref* chbScore = m_rdWNGameScore.getCurrentSelect();
|
|
auto chbFan1 = (CheckBox*)pRootPanel->getChildByName("chb_fan_1");
|
|
|
|
if (chbScore == chbFan1)
|
|
{
|
|
rule |= WNMJ_SPACE::eWNMJRuleEnum_TwoThreeFAN;
|
|
}
|
|
else
|
|
{
|
|
rule |= WNMJ_SPACE::eWNMJRuleEnum_OneTwoFAN;
|
|
}
|
|
|
|
// 杠选择;
|
|
cocos2d::Ref* chbGang = m_rdWNGangWay.getCurrentSelect();
|
|
auto chbgang1 = (CheckBox*)pRootPanel->getChildByName("chb_gang_1");
|
|
|
|
if (chbGang == chbgang1)
|
|
{
|
|
rule |= WNMJ_SPACE::eWNMJRuleEnum_ZhiAnGang;
|
|
}
|
|
|
|
// 游戏人数;
|
|
CheckBox* chbPlayCount = static_cast<CheckBox*>(m_rdWNUserCount.getCurrentSelect());
|
|
CC_ASSERT(chbPlayCount != nullptr);
|
|
if (chbPlayCount != nullptr)
|
|
{
|
|
auto pCompareData = (ComExtensionData*)chbPlayCount->getComponent("ComExtensionData");
|
|
std::string strCompareUserData = pCompareData->getCustomProperty();
|
|
|
|
int iCompareGameRule = atoi(strCompareUserData.c_str());
|
|
if (2 == iCompareGameRule)
|
|
{
|
|
rule |= WNMJ_SPACE::eWNMJRuleEnum_PlayCount2;
|
|
}
|
|
else if (3 == iCompareGameRule)
|
|
{
|
|
rule |= WNMJ_SPACE::eWNMJRuleEnum_PlayCount3;
|
|
}
|
|
else if (1 == iCompareGameRule)
|
|
{
|
|
rule |= WNMJ_SPACE::eWNMJRuleEnum_PlayCount_auto;
|
|
}
|
|
}
|
|
|
|
return rule;
|
|
}
|
|
|
|
// 斗地主;
|
|
if (m_CreateItem[INDEX_DDZ]->isVisible())
|
|
{
|
|
return eDDZRuleEnum_NoLimitMultiple;
|
|
}
|
|
|
|
// 牛牛;
|
|
if (m_CreateItem[INDEX_NN]->isVisible())
|
|
{
|
|
CheckBox* chb = static_cast<CheckBox*>(m_rgNNGameRule.getCurrentSelect());
|
|
CC_ASSERT(chb != nullptr);
|
|
if (chb == nullptr) return 0;
|
|
|
|
auto pData = (ComExtensionData*)chb->getComponent("ComExtensionData");
|
|
std::string strUserData = pData->getCustomProperty();
|
|
|
|
int iGameRule = atoi(strUserData.c_str());
|
|
|
|
uint32 rule = 0;
|
|
|
|
switch (iGameRule)
|
|
{
|
|
case 2: // 拼刺刀
|
|
rule |= eNNRuleEnum_BAYONET | eNNRuleEnum_BANKER_ROB4;
|
|
break;
|
|
case 1: // 霸王庄
|
|
rule |= eNNRuleEnum_BANKER_OWNER;
|
|
break;
|
|
default: // 抢庄
|
|
rule |= eNNRuleEnum_BANKER_ROB | eNNRuleEnum_BANKER_ROB4;
|
|
break;
|
|
}
|
|
|
|
static eNNRuleEnum g_SelectCardType[] = { eNNRuleEnum_WHN, eNNRuleEnum_BOMB, eNNRuleEnum_WXN};
|
|
|
|
// 牌型;
|
|
for (int i = 0; i < 3; i++)
|
|
{
|
|
if (m_NNCardType[i] != nullptr && m_NNCardType[i]->isSelected())
|
|
{
|
|
rule |= g_SelectCardType[i];
|
|
}
|
|
}
|
|
|
|
return rule;
|
|
}
|
|
|
|
// 打炸;
|
|
if (m_CreateItem[INDEX_DZ]->isVisible())
|
|
{
|
|
DWORD dwGameRulue = 0;
|
|
|
|
CheckBox* chb = static_cast<CheckBox*>(m_rgDZGameRule.getCurrentSelect());
|
|
CC_ASSERT(chb != nullptr);
|
|
if (chb != nullptr)
|
|
{
|
|
auto pData = (ComExtensionData*)chb->getComponent("ComExtensionData");
|
|
std::string strUserData = pData->getCustomProperty();
|
|
|
|
int iGameRule = atoi(strUserData.c_str());
|
|
|
|
if (1 == iGameRule)
|
|
{
|
|
dwGameRulue |= eDZRuleEnum_NO_JOKER;
|
|
}
|
|
}
|
|
|
|
// 叫边;
|
|
CheckBox* chbGameCall = static_cast<CheckBox*>(m_rgDZGameCall.getCurrentSelect());
|
|
CC_ASSERT(chbGameCall != nullptr);
|
|
if (chbGameCall != nullptr)
|
|
{
|
|
auto pCompareData = (ComExtensionData*)chbGameCall->getComponent("ComExtensionData");
|
|
std::string strCompareUserData = pCompareData->getCustomProperty();
|
|
|
|
int iCompareGameRule = atoi(strCompareUserData.c_str());
|
|
if (0 == iCompareGameRule)
|
|
{
|
|
dwGameRulue |= eDZRuleEnum_MINGBIAN;
|
|
}
|
|
}
|
|
|
|
// 可选规则;
|
|
for (uint8 i = 0; i < 7; i++)
|
|
{
|
|
if (m_DZSubRule[i] != nullptr && m_DZSubRule[i]->isSelected())
|
|
{
|
|
dwGameRulue |= (eDZRuleEnum_TO_TWO << i);
|
|
}
|
|
}
|
|
|
|
return dwGameRulue;
|
|
}
|
|
|
|
// 十三张;
|
|
if (m_CreateItem[INDEX_13S]->isVisible())
|
|
{
|
|
CheckBox* chb = static_cast<CheckBox*>(m_rgSSSGameRule.getCurrentSelect());
|
|
CC_ASSERT(chb != nullptr);
|
|
if (chb == nullptr) return 0;
|
|
|
|
auto pData = (ComExtensionData*)chb->getComponent("ComExtensionData");
|
|
std::string strUserData = pData->getCustomProperty();
|
|
|
|
int iGameRule = atoi(strUserData.c_str());
|
|
|
|
uint32 rule = 0;
|
|
switch (iGameRule)
|
|
{
|
|
case 0: // 抢庄;
|
|
rule |= eSSSGameRuleRobBanker | eSSSGameRuleSend7Cards;
|
|
break;
|
|
case 1: // 轮庄;
|
|
rule |= eSSSGameRuleTurnBanker;
|
|
break;
|
|
case 2: // 霸王庄;
|
|
rule |= eSSSGameRuleFixBanker;
|
|
break;
|
|
default: //经典玩法;
|
|
rule |= eSSSGameRuleClassic;
|
|
break;
|
|
}
|
|
return rule;
|
|
}
|
|
|
|
//炸金花;
|
|
if (m_CreateItem[INDEX_ZJH]->isVisible())
|
|
{
|
|
DWORD dwGameRulue = 0;
|
|
|
|
// 比牌轮数;
|
|
CheckBox* chbCompare = static_cast<CheckBox*>(m_rgZJHCompareRound.getCurrentSelect());
|
|
CC_ASSERT(chbCompare != nullptr);
|
|
if (chbCompare != nullptr)
|
|
{
|
|
auto pCompareData = (ComExtensionData*)chbCompare->getComponent("ComExtensionData");
|
|
std::string strCompareUserData = pCompareData->getCustomProperty();
|
|
|
|
int iCompareGameRule = atoi(strCompareUserData.c_str());
|
|
if (1 == iCompareGameRule)
|
|
{
|
|
dwGameRulue |= eZJHGameRuleCompareRound2;
|
|
}
|
|
else if (2 == iCompareGameRule)
|
|
{
|
|
dwGameRulue |= eZJHGameRuleCompareRound3;
|
|
}
|
|
else
|
|
{
|
|
dwGameRulue |= eZJHGameRuleCompareRound1;
|
|
}
|
|
}
|
|
|
|
// 开牌轮数;
|
|
CheckBox* chbOpenCard = static_cast<CheckBox*>(m_rgZJHOpenCardRound.getCurrentSelect());
|
|
CC_ASSERT(chbOpenCard != nullptr);
|
|
if (chbOpenCard != nullptr)
|
|
{
|
|
auto pOpenCardData = (ComExtensionData*)chbOpenCard->getComponent("ComExtensionData");
|
|
std::string strOpenCardUserData = pOpenCardData->getCustomProperty();
|
|
|
|
int iOpenCardGameRule = atoi(strOpenCardUserData.c_str());
|
|
if (1 == iOpenCardGameRule)
|
|
{
|
|
dwGameRulue |= eZJHGameRuleOpenCardRound10;
|
|
}
|
|
else if (2 == iOpenCardGameRule)
|
|
{
|
|
dwGameRulue |= eZJHGameRuleOpenCardRound15;
|
|
}
|
|
else
|
|
{
|
|
dwGameRulue |= eZJHGameRuleOpenCardRound5;
|
|
}
|
|
}
|
|
|
|
// 看牌轮数;
|
|
CheckBox* chbLookCard = static_cast<CheckBox*>(m_rgZJHLookCardRound.getCurrentSelect());
|
|
CC_ASSERT(chbLookCard != nullptr);
|
|
if (chbLookCard != nullptr)
|
|
{
|
|
auto pLookCardData = (ComExtensionData*)chbLookCard->getComponent("ComExtensionData");
|
|
std::string strLookCardUserData = pLookCardData->getCustomProperty();
|
|
|
|
int iLookCardGameRule = atoi(strLookCardUserData.c_str());
|
|
if (1 == iLookCardGameRule)
|
|
{
|
|
dwGameRulue |= eZJHGameRuleLookCardRound2;
|
|
}
|
|
else if (2 == iLookCardGameRule)
|
|
{
|
|
dwGameRulue |= eZJHGameRuleLookCardRound3;
|
|
}
|
|
else
|
|
{
|
|
dwGameRulue |= eZJHGameRuleLookCardRound0;
|
|
}
|
|
}
|
|
|
|
return dwGameRulue;
|
|
}
|
|
|
|
// 跑得快;
|
|
if (m_CreateItem[INDEX_PDK]->isVisible())
|
|
{
|
|
DWORD dwGameRulue = 0;
|
|
|
|
// 抓拍张数;
|
|
CheckBox* chbCardCount = static_cast<CheckBox*>(m_rgPDKCardCount.getCurrentSelect());
|
|
CC_ASSERT(chbCardCount != nullptr);
|
|
if (chbCardCount != nullptr)
|
|
{
|
|
auto pCompareData = (ComExtensionData*)chbCardCount->getComponent("ComExtensionData");
|
|
std::string strCompareUserData = pCompareData->getCustomProperty();
|
|
|
|
int iCompareGameRule = atoi(strCompareUserData.c_str());
|
|
if (0 == iCompareGameRule)
|
|
{
|
|
dwGameRulue |= ePDKRuleEnum_HandCardCount;
|
|
}
|
|
}
|
|
|
|
// 游戏人数;
|
|
CheckBox* chbPlayCount = static_cast<CheckBox*>(m_rgPDKUserCount.getCurrentSelect());
|
|
CC_ASSERT(chbPlayCount != nullptr);
|
|
if (chbPlayCount != nullptr)
|
|
{
|
|
auto pCompareData = (ComExtensionData*)chbPlayCount->getComponent("ComExtensionData");
|
|
std::string strCompareUserData = pCompareData->getCustomProperty();
|
|
|
|
int iCompareGameRule = atoi(strCompareUserData.c_str());
|
|
if (1 == iCompareGameRule)
|
|
{
|
|
dwGameRulue |= ePDKRuleEnum_PlayCount;
|
|
}
|
|
}
|
|
|
|
// 出牌规则;
|
|
CheckBox* chbOutCard = static_cast<CheckBox*>(m_rgPDKRuleCount.getCurrentSelect());
|
|
CC_ASSERT(chbOutCard != nullptr);
|
|
if (chbOutCard != nullptr)
|
|
{
|
|
auto pCompareData = (ComExtensionData*)chbOutCard->getComponent("ComExtensionData");
|
|
std::string strCompareUserData = pCompareData->getCustomProperty();
|
|
|
|
int iCompareGameRule = atoi(strCompareUserData.c_str());
|
|
if (0 == iCompareGameRule)
|
|
{
|
|
dwGameRulue |= ePDKRuleEnum_OutCardRule;
|
|
}
|
|
}
|
|
|
|
// 可选规则;
|
|
for (uint8 i = 0; i < 5; i++)
|
|
{
|
|
if (m_PDKSubRule[i] != nullptr && m_PDKSubRule[i]->isSelected())
|
|
{
|
|
dwGameRulue |= (ePDKRuleEnum_MustOutCard << i);
|
|
}
|
|
}
|
|
|
|
return dwGameRulue;
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
WORD CreateScene::getGameKindID()
|
|
{
|
|
return m_wCurrentKinID;
|
|
}
|
|
|
|
void CreateScene::pushScene(CREATE_DLG_TYPE cdtype /*= CDT_CREATE_PRIVATE */, uint32 dwUnionCode /*= 0*/, uint8 cbUnionGoldOpen /*= 0*/)
|
|
{
|
|
if (m_ImageViewBg)
|
|
{
|
|
m_cdtype = cdtype;
|
|
m_dwUnionCode = dwUnionCode;
|
|
m_cbUnionGoldOpen = cbUnionGoldOpen;
|
|
|
|
if (CDT_CREATE_PRIVATE == cdtype)
|
|
{
|
|
m_btnCreate->setVisible(true);
|
|
m_btnAuto->setVisible(false);
|
|
|
|
m_txtTitle->setString(utility::a_u8("创建房间"));
|
|
|
|
#if CC_TARGET_PLATFORM == CC_PLATFORM_WIN32
|
|
// 创建节点;
|
|
for (int i = 0; i < MAX_GAME_COUNT; i++)
|
|
{
|
|
CheckBox* GameItem = m_GameItem[i];
|
|
if (GameItem == nullptr) continue;
|
|
|
|
GameItem->setVisible(true);
|
|
}
|
|
#else
|
|
// 创建节点;
|
|
for (int i = 0; i < MAX_GAME_COUNT; i++)
|
|
{
|
|
CheckBox* GameItem = m_GameItem[i];
|
|
if (GameItem == nullptr) continue;
|
|
|
|
if (i == INDEX_NN || i == INDEX_ZJH || i == INDEX_13S)
|
|
{
|
|
GameItem->setVisible(false);
|
|
}
|
|
else
|
|
{
|
|
GameItem->setVisible(true);
|
|
}
|
|
}
|
|
#endif
|
|
|
|
}
|
|
else if (CDT_CREATE_UNION == cdtype)
|
|
{
|
|
m_btnCreate->setVisible(true);
|
|
m_btnAuto->setVisible(false);
|
|
|
|
m_txtTitle->setString(utility::a_u8("创建公会房间"));
|
|
|
|
// 创建节点;
|
|
for (int i = 0; i < MAX_GAME_COUNT; i++)
|
|
{
|
|
CheckBox* GameItem = m_GameItem[i];
|
|
if (GameItem == nullptr) continue;
|
|
GameItem->setVisible(true);
|
|
}
|
|
|
|
m_index = 0;
|
|
|
|
initMJBaseScore(false);
|
|
initDDZBaseScore(false);
|
|
initNNBaseScore(false);
|
|
initDZBaseScore(false);
|
|
initSSSBaseScore(false);
|
|
initZJHBaseScore(false);
|
|
initPDKBaseScore(false);
|
|
|
|
}
|
|
else
|
|
{
|
|
m_btnCreate->setVisible(false);
|
|
m_btnAuto->setVisible(true);
|
|
|
|
m_txtTitle->setString(utility::a_u8("设置自动开房"));
|
|
|
|
// 创建节点;
|
|
for (int i = 0; i < MAX_GAME_COUNT; i++)
|
|
{
|
|
CheckBox* GameItem = m_GameItem[i];
|
|
if (GameItem == nullptr) continue;
|
|
GameItem->setVisible(true);
|
|
}
|
|
|
|
m_index = 0;
|
|
|
|
initMJBaseScore(false);
|
|
initDDZBaseScore(false);
|
|
initNNBaseScore(false);
|
|
initDZBaseScore(false);
|
|
initSSSBaseScore(false);
|
|
initZJHBaseScore(false);
|
|
initPDKBaseScore(false);
|
|
|
|
}
|
|
|
|
|
|
this->setVisible(true);
|
|
m_ImageViewBg->setScale(0.8f);
|
|
m_ImageViewBg->runAction(Sequence::create(Show::create(), ScaleTo::create(0.2f, 1.2f), ScaleTo::create(0.1f, 1.f), CCCallFunc::create([&]()
|
|
{
|
|
|
|
}), nullptr));
|
|
}
|
|
}
|
|
|
|
void CreateScene::popScene()
|
|
{
|
|
if (m_ImageViewBg)
|
|
{
|
|
m_ImageViewBg->runAction(Sequence::create(Hide::create(), ScaleTo::create(0.1f, 0.1f), CCCallFunc::create([&]()
|
|
{
|
|
this->setVisible(false);
|
|
}), nullptr));
|
|
}
|
|
} |