手游新品开发日志:第13天 - 游戏内玩家操控的怪兽移动同步实现
最编程
2024-07-25 07:34:08
...
GAME_MSG_PLAYER_ENTER_VIEW = 9002, //人物进入视野
GAME_PLAYER_LOCATION_NOTIFY = 9003, //人物移动信息
GAME_MSG_PLAYER_MOVE = 1005, //C -> C 人物移动信息
_snprintf(buf, sizeof(buf)-1, "%d", DbRet["GUID"]->GetLongLong() );
场景ID:1001 未加载!
地图资源没有加载, 玩家430000120|地图1001
SetSceneId
修改某个值
update player_table set x = 40
http://192.168.0.26/cq10/
for(Tint32 index = 0; index < attrLen; ++index)
{
CommMsg::ItemInfo_Attr* attr = item.add_extraattrlist();
attr->set_key(bagCell.m_DynamicExtraAttr[index].Key);
Tint32 nValue = bagCell.m_DynamicExtraAttr[index].Value;
attr->set_value(nValue);
}
Extralib::Timer::DateTime::GetCurSec()
void GamePlayer::SendEnterViewInfo( GamePlayer* pPlayer )
http://192.168.0.26/cq9/
void CSceneCell::SendCellEnterMsg( IRole* pPlayer, bool bIncludeNear )
bool Room::HandleOnMove( IRole * pRole )
void SyncCoord( ); //同步坐标到前端
std::set<IRole*> m_HandleMoveList;
bool Room::OnMove( IRole * pRole )
MonsterChangePosPlayData
((GamePlayer*)pRole)->GetGUID();
后进的没有先进的附近玩家
进场景获得附近玩家列表
vector<GamePlayer*> NearPlayers = GetNearPlayerList();
IntVector IRole::GetNearPlayersLua()
{
IntVector roleidlist;
CSceneCell* pSceneCell = GetSceneCell();
if( !pSceneCell )
return roleidlist;
vector<GamePlayer*> vNear = pSceneCell->GetNearPlayerList();
for(vector<GamePlayer*>::iterator itr=vNear.begin();itr!=vNear.end();itr++)
{
GamePlayer* pGamePlayer = *itr;
roleidlist.Add(pGamePlayer->GetRoleId());
}
return roleidlist;
}
vector<GamePlayer*> GetNearPlayers();
void GamePlayer::SendEnterViewInfo( GamePlayer* pPlayer )
GAME_MSG_PLAYER_LEAVE_VIEW = 143, //人物离开视野
// 玩家离开地图返回
struct MsgRoleLeaveMapRes
{
t_RoleID roleId_m;
};
共享内存 - 读写锁
GAME_MSG_MONSTER_ENTER_VIEW = 141, //怪物进入视野
struct MsgEnterViewMonsterInfo
GAME_MSG_MONSTER_LOCATION_RES = 147, //怪物移动信息
移动-》添加进移动列表
for 移动列表
{
for 附近玩家列表
{
告诉他我移动了
}
}