修复稳定
This commit is contained in:
@@ -37,12 +37,12 @@ GameFrameBase::GameFrameBase()
|
||||
dispatcher->addCustomEventListener(WEIXIN_SHOW, CC_CALLBACK_1(GameFrameBase::onButtonWeiXinImagic, this));
|
||||
dispatcher->addCustomEventListener(AUTO_USER_READY_EVENT, CC_CALLBACK_1(GameFrameBase::onEventAutoUserReady, this));
|
||||
|
||||
// 录像信息;
|
||||
// 记录信息;
|
||||
m_GameRecord = tagGameRecord(); // 游戏记录
|
||||
m_iActRecordIdex = 0;
|
||||
m_RecordTime = 0.f;
|
||||
m_wRecordSelfChairID = INVALID_CHAIR;
|
||||
m_wMainGameID = 0; // 主视角GAMEID
|
||||
m_wMainGameID = 0; // 加入进场GAMEID
|
||||
m_IsGameRecord = false;
|
||||
m_voicechairid.clear();
|
||||
|
||||
@@ -185,7 +185,7 @@ bool GameFrameBase::RevTalkFile(void* data,int dataSize)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GameFrameBase::OnSocketSubUserChat(void* data, int dataSize) //用户文字
|
||||
bool GameFrameBase::OnSocketSubUserChat(void* data, int dataSize) //用户聊天
|
||||
{
|
||||
CMD_GF_S_UserChat* pUserChat = (CMD_GF_S_UserChat*)data;
|
||||
|
||||
@@ -233,9 +233,9 @@ bool GameFrameBase::OnSocketSubUserFace(void* data, int dataSize) //
|
||||
}
|
||||
else
|
||||
{
|
||||
// 短语语音路径;
|
||||
// 获取语音路径;
|
||||
std::string strSoundPath = getShortChatSoundPath(pGamePlayer->GetUserInfo()->cbGender, pUserFace->wItemIndex);
|
||||
// 短语内容;
|
||||
// 聊天内容;
|
||||
std::string strChatInfo = getShortChatInfoByIndex(pUserFace->wItemIndex);
|
||||
|
||||
pGamePlayer->showChatInfo(strChatInfo);
|
||||
@@ -255,7 +255,7 @@ bool GameFrameBase::ShowUserFace(CMD_GF_S_UserExpression* pUserFace) //
|
||||
|
||||
Vec2 pos = GetPlayerPosByUserID(pUserFace->dwSendUserID);
|
||||
|
||||
//动画
|
||||
//表情
|
||||
Animation* pAnimate = LoadFaceAnimations(pUserFace->wItemIndex);
|
||||
ASSERT(pAnimate != nullptr);
|
||||
|
||||
@@ -286,13 +286,13 @@ Animation* GameFrameBase::LoadFaceAnimations(uint16 wItemIndex)
|
||||
|
||||
if (pAnimate == nullptr)
|
||||
{
|
||||
// 创建集合,存每一张图片
|
||||
// 遍历所有帧,每一张图片
|
||||
Vector< SpriteFrame* > sfme;
|
||||
|
||||
std::string strImg;
|
||||
for (int i = 1; i <= cbFaceCount[wItemIndex]; ++i)
|
||||
{
|
||||
// 获取图片名字,加入到集合中
|
||||
// 获取图片名称,加入到数组中
|
||||
strImg = __String::createWithFormat("Platform/Talk/%d/%d.png", wItemIndex+1, i)->getCString();
|
||||
Texture2D* pTexture = Director::getInstance()->getTextureCache()->addImage(strImg);
|
||||
if (nullptr == pTexture) continue;
|
||||
@@ -304,7 +304,7 @@ Animation* GameFrameBase::LoadFaceAnimations(uint16 wItemIndex)
|
||||
}
|
||||
}
|
||||
|
||||
// ⑤ 创建动画,设置播放速度
|
||||
// 用所有帧创建动画并设置播放速度
|
||||
pAnimate = Animation::createWithSpriteFrames(sfme, ANIM_DELAY_TIME);
|
||||
pAnimationCache->addAnimation(pAnimate, strAnimation);
|
||||
}
|
||||
@@ -316,7 +316,7 @@ void GameFrameBase::showVoiceTip()
|
||||
{
|
||||
if (m_VoiceList.empty())
|
||||
{
|
||||
//// 还原背景音乐音量;
|
||||
//// 恢复背景音乐音量;
|
||||
//CocosDenshion::SimpleAudioEngine::getInstance()->setBackgroundMusicVolume(m_fMusicVolume);
|
||||
CocosDenshion::SimpleAudioEngine::getInstance()->resumeBackgroundMusic();
|
||||
return;
|
||||
@@ -425,7 +425,7 @@ bool GameFrameBase::OnSocketSubGameSystemMessage(void* data, int dataSize)
|
||||
return true;
|
||||
}
|
||||
|
||||
// 添加公告信息;
|
||||
// 滚动公告消息;
|
||||
void GameFrameBase::ShowRollMessage(const std::string& message, int repeat /*= 0*/, bool bForever /*= false*/)
|
||||
{
|
||||
if (m_PlatformNotic)
|
||||
@@ -445,7 +445,7 @@ bool GameFrameBase::OnEventSceneMessage(uint8 cbGameStatus, bool bLookonUser, vo
|
||||
{
|
||||
return true;
|
||||
}
|
||||
//场景消息
|
||||
//游戏消息
|
||||
bool GameFrameBase::OnEventGameMessage(int sub, void* data, int dataSize)
|
||||
{
|
||||
std::vector<NET_CBInfo*> kCallFun;
|
||||
@@ -520,7 +520,7 @@ void GameFrameBase::ReconnectServer()
|
||||
|
||||
ResetTable();
|
||||
|
||||
// 清空语音信息;
|
||||
// 清理语音信息;
|
||||
m_voicechairid.clear();
|
||||
m_VoiceList.clear();
|
||||
|
||||
@@ -528,10 +528,10 @@ void GameFrameBase::ReconnectServer()
|
||||
}
|
||||
}
|
||||
|
||||
//获取快捷语音文件路径;
|
||||
//获取快捷语音的文件路径;
|
||||
const std::string GameFrameBase::getShortChatSoundPath(uint8 cbGender, int nIndex)
|
||||
{
|
||||
// 短语;
|
||||
// 拼接;
|
||||
std::string strFilePath = "common/sound/chat/";
|
||||
if ( cbGender == enMan)
|
||||
{
|
||||
@@ -699,7 +699,7 @@ void GameFrameBase::OnEventUserEnter(IClientUserItem * pIClientUserItem, bool bL
|
||||
addGamePlayerToList(m_pSelfPlayer);
|
||||
upSelfPlayerInfo();
|
||||
|
||||
// 同步地理位置;
|
||||
// 同步用户位置;
|
||||
tagUserAddr* pUserAddr = CGlobalUserInfo::GetInstance()->GetUserAddr();
|
||||
m_pSelfPlayer->SetLocation(pUserAddr);
|
||||
|
||||
@@ -733,7 +733,7 @@ void GameFrameBase::OnEventUserEnter(IClientUserItem * pIClientUserItem, bool bL
|
||||
addGamePlayerToList(pTempPlayer);
|
||||
}
|
||||
|
||||
// 启动网络延迟获取
|
||||
// 网络延迟定时获取
|
||||
if (!m_IsGameRecord)
|
||||
{
|
||||
m_PingTime.dwPingCount = 0;
|
||||
@@ -856,7 +856,7 @@ void GameFrameBase::SetServerItem(CGameServerItem* pServerItem)
|
||||
return m_kGameMission.SetServerItem(pServerItem);
|
||||
}
|
||||
|
||||
//加载短语内容;
|
||||
//加载短语聊天;
|
||||
void GameFrameBase::loadShortChat(const std::string& strFilePath)
|
||||
{
|
||||
std::vector <std::string>().swap(m_vecShortChatList);
|
||||
@@ -881,13 +881,13 @@ void GameFrameBase::loadShortChat(const std::string& strFilePath)
|
||||
}
|
||||
}
|
||||
|
||||
//获取快捷语列表;
|
||||
//获取短语列表;
|
||||
const std::vector<std::string>& GameFrameBase::getShortChatList()
|
||||
{
|
||||
return m_vecShortChatList;
|
||||
}
|
||||
|
||||
//获取快捷语文字;
|
||||
//获取短语内容;
|
||||
std::string GameFrameBase::getShortChatInfoByIndex(int nIndex)
|
||||
{
|
||||
if ((int)m_vecShortChatList.size() <= nIndex)
|
||||
@@ -898,7 +898,7 @@ std::string GameFrameBase::getShortChatInfoByIndex(int nIndex)
|
||||
return m_vecShortChatList[nIndex];
|
||||
}
|
||||
|
||||
/**************************************************** 游戏内事件处理 BEGIN ****************************************************/
|
||||
/**************************************************** 游戏各事件处理 BEGIN ****************************************************/
|
||||
// 离开游戏事件
|
||||
void GameFrameBase::EventLeaveGame(cocos2d::EventCustom *event)
|
||||
{
|
||||
@@ -911,7 +911,7 @@ void GameFrameBase::onEventDismissRoom(cocos2d::EventCustom *event)
|
||||
onEventAgreeDismissRoom(pBool->getValue());
|
||||
}
|
||||
|
||||
// 自由人数场玩家准备
|
||||
// 房主发起自动准备
|
||||
void GameFrameBase::onEventAutoUserReady(cocos2d::EventCustom *event)
|
||||
{
|
||||
__Bool* pBool = (__Bool*)event->getUserData();
|
||||
@@ -932,7 +932,7 @@ void GameFrameBase::onEventAutoUserReady(cocos2d::EventCustom *event)
|
||||
//}
|
||||
}
|
||||
|
||||
// 私人场结束(子游戏掉线主动关闭网络);
|
||||
// 私人场结束(在游戏里不允许关闭程序);
|
||||
void GameFrameBase::PrivateRoomEnd()
|
||||
{
|
||||
std::vector<GamePlayer*>::iterator itor = m_kPlayers.begin();
|
||||
@@ -969,7 +969,7 @@ void GameFrameBase::onButtonWeiXinImagic(Ref*)
|
||||
}
|
||||
};
|
||||
|
||||
cocos2d::utils::captureScreen(afterCaptured, "screenshot.jpg");
|
||||
cocos2d::utils::captureScreen(afterCaptured, "screenshot.png");
|
||||
|
||||
//SelectShareScene::Instance().shareImage();
|
||||
}
|
||||
@@ -979,7 +979,7 @@ void GameFrameBase::OnSocketSubPrivateScoreInfo(CMD_GF_Private_Score_Info* pNetI
|
||||
{
|
||||
m_PrivateScoreInfo = *pNetInfo;
|
||||
}
|
||||
/**************************************************** 游戏内事件处理 END ****************************************************/
|
||||
/**************************************************** 游戏各事件处理 END ****************************************************/
|
||||
|
||||
//////////////////////////////// 游戏录像 //////////////////////////////////////////
|
||||
// 设置游戏录像资源
|
||||
@@ -988,13 +988,13 @@ bool GameFrameBase::SetGameRecord(DataStream &kDataStream)
|
||||
return m_GameRecord.StreamValue(kDataStream, false);
|
||||
}
|
||||
|
||||
// 设置自己的视角
|
||||
// 设置自己的加入进场
|
||||
void GameFrameBase::SetMainGameID(DWORD dwGameID, bool isGameRecord)
|
||||
{
|
||||
m_wMainGameID = dwGameID;
|
||||
m_IsGameRecord = isGameRecord;
|
||||
|
||||
// 操作菜单
|
||||
// 创建菜单
|
||||
m_pMeunNOde = static_cast<Node*>(CSLoader::createNode("Games/GameRecord/GameRecordNode.csb"));
|
||||
this->addChild(m_pMeunNOde, 999);
|
||||
this->uiMenuInit();
|
||||
@@ -1075,7 +1075,7 @@ bool GameFrameBase::StartRecord(WORD wGamePlayer)
|
||||
|
||||
int nRealUserCount = m_GameRecord.playersVec.size();
|
||||
|
||||
// 获取自己椅子号
|
||||
// 获取自己的座位号
|
||||
for (int i = 0; i < nRealUserCount; i++)
|
||||
{
|
||||
tagGameRecordPlayer& kRecordPlayer = m_GameRecord.playersVec[i];
|
||||
@@ -1086,7 +1086,7 @@ bool GameFrameBase::StartRecord(WORD wGamePlayer)
|
||||
}
|
||||
}
|
||||
|
||||
// 显示所有玩家(从自己开始);
|
||||
// 显示其他玩家(从自己开始);
|
||||
tagGameRecordPlayer& kSelfRecordPlayer = m_GameRecord.playersVec[m_wRecordSelfChairID];
|
||||
m_kGameMission.InitRecordGamePlayer(m_wRecordSelfChairID, kSelfRecordPlayer);
|
||||
|
||||
@@ -1186,7 +1186,7 @@ void GameFrameBase::onGetNetWorkTime(float delta)
|
||||
|
||||
if (m_fLocationTimer>180.f)
|
||||
{
|
||||
//发送地里位置;
|
||||
//发送地理位置;
|
||||
tagUserAddr* pUserAddr = CGlobalUserInfo::GetInstance()->GetUserAddr();
|
||||
if (pUserAddr && pUserAddr->isInit)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user