1
This commit is contained in:
parent
5e6e9a7ce4
commit
8c26eae458
@ -396,6 +396,11 @@ void App::ProcessWSProxyMsg(f8::MsgHdr& hdr)
|
|||||||
ProcessNetMsg(handler, WSListener::Instance(), hdr);
|
ProcessNetMsg(handler, WSListener::Instance(), hdr);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case HID_PlayerMgr:
|
||||||
|
{
|
||||||
|
ProcessNetMsg(handler, PlayerMgr::Instance(), hdr);
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#include "WSListener.h"
|
#include "WSListener.h"
|
||||||
#include "app.h"
|
#include "app.h"
|
||||||
|
#include "player.h"
|
||||||
#include "playermgr.h"
|
#include "playermgr.h"
|
||||||
|
|
||||||
#include "ss_proto.pb.h"
|
#include "ss_proto.pb.h"
|
||||||
@ -32,8 +33,22 @@ void HandlerMgr::UnInit()
|
|||||||
void HandlerMgr::RegisterNetMsgHandlers()
|
void HandlerMgr::RegisterNetMsgHandlers()
|
||||||
{
|
{
|
||||||
RegisterNetMsgHandler(&wsmsghandler, &WSListener::_SS_Ping);
|
RegisterNetMsgHandler(&wsmsghandler, &WSListener::_SS_Ping);
|
||||||
|
|
||||||
RegisterNetMsgHandler(&wsmsghandler, &PlayerMgr::_SS_WSP_SocketDisconnect);
|
RegisterNetMsgHandler(&wsmsghandler, &PlayerMgr::_SS_WSP_SocketDisconnect);
|
||||||
RegisterNetMsgHandler(&wsmsghandler, &PlayerMgr::_CMLogin);
|
RegisterNetMsgHandler(&wsmsghandler, &PlayerMgr::_CMLogin);
|
||||||
|
|
||||||
|
RegisterNetMsgHandler(&wsmsghandler, &Player::_CMFriendList);
|
||||||
|
RegisterNetMsgHandler(&wsmsghandler, &Player::_CMFriendInvite);
|
||||||
|
RegisterNetMsgHandler(&wsmsghandler, &Player::_CMFriendIgnore);
|
||||||
|
RegisterNetMsgHandler(&wsmsghandler, &Player::_CMFriendDelete);
|
||||||
|
|
||||||
|
RegisterNetMsgHandler(&wsmsghandler, &Player::_CMGroupCreate);
|
||||||
|
RegisterNetMsgHandler(&wsmsghandler, &Player::_CMGroupJoin);
|
||||||
|
RegisterNetMsgHandler(&wsmsghandler, &Player::_CMGroupAgree);
|
||||||
|
RegisterNetMsgHandler(&wsmsghandler, &Player::_CMGroupKick);
|
||||||
|
RegisterNetMsgHandler(&wsmsghandler, &Player::_CMGroupQuit);
|
||||||
|
RegisterNetMsgHandler(&wsmsghandler, &Player::_CMGroupDismiss);
|
||||||
|
RegisterNetMsgHandler(&wsmsghandler, &Player::_CMGroupRename);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HandlerMgr::ProcGMMsg(unsigned long saddr, int sockhandle,
|
void HandlerMgr::ProcGMMsg(unsigned long saddr, int sockhandle,
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
#include "precompile.h"
|
#include "precompile.h"
|
||||||
|
|
||||||
#include "player.h"
|
#include "player.h"
|
||||||
#include "cs_proto.pb.h"
|
|
||||||
|
|
||||||
void Player::Init()
|
void Player::Init()
|
||||||
{
|
{
|
||||||
@ -12,3 +11,58 @@ void Player::UnInit()
|
|||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Player::_CMFriendList(f8::MsgHdr& hdr, const cs::CMFriendList& msg)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void Player::_CMFriendInvite(f8::MsgHdr& hdr, const cs::CMFriendInvite& msg)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void Player::_CMFriendIgnore(f8::MsgHdr& hdr, const cs::CMFriendIgnore& msg)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void Player::_CMFriendDelete(f8::MsgHdr& hdr, const cs::CMFriendDelete& msg)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void Player::_CMGroupCreate(f8::MsgHdr& hdr, const cs::CMGroupCreate& msg)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void Player::_CMGroupJoin(f8::MsgHdr& hdr, const cs::CMGroupJoin& msg)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void Player::_CMGroupAgree(f8::MsgHdr& hdr, const cs::CMGroupAgree& msg)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void Player::_CMGroupKick(f8::MsgHdr& hdr, const cs::CMGroupKick& msg)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void Player::_CMGroupQuit(f8::MsgHdr& hdr, const cs::CMGroupQuit& msg)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void Player::_CMGroupDismiss(f8::MsgHdr& hdr, const cs::CMGroupDismiss& msg)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void Player::_CMGroupRename(f8::MsgHdr& hdr, const cs::CMGroupRename& msg)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
@ -1,17 +1,29 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
namespace cs
|
#include "cs_proto.pb.h"
|
||||||
{
|
|
||||||
class MFPair;
|
|
||||||
}
|
|
||||||
|
|
||||||
class Player
|
class Player
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum { HID = HID_Player };
|
enum { HID = HID_Player };
|
||||||
|
|
||||||
|
public:
|
||||||
|
int socket_handle = 0;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void Init();
|
void Init();
|
||||||
void UnInit();
|
void UnInit();
|
||||||
|
|
||||||
|
void _CMFriendList(f8::MsgHdr& hdr, const cs::CMFriendList& msg);
|
||||||
|
void _CMFriendInvite(f8::MsgHdr& hdr, const cs::CMFriendInvite& msg);
|
||||||
|
void _CMFriendIgnore(f8::MsgHdr& hdr, const cs::CMFriendIgnore& msg);
|
||||||
|
void _CMFriendDelete(f8::MsgHdr& hdr, const cs::CMFriendDelete& msg);
|
||||||
|
|
||||||
|
void _CMGroupCreate(f8::MsgHdr& hdr, const cs::CMGroupCreate& msg);
|
||||||
|
void _CMGroupJoin(f8::MsgHdr& hdr, const cs::CMGroupJoin& msg);
|
||||||
|
void _CMGroupAgree(f8::MsgHdr& hdr, const cs::CMGroupAgree& msg);
|
||||||
|
void _CMGroupKick(f8::MsgHdr& hdr, const cs::CMGroupKick& msg);
|
||||||
|
void _CMGroupQuit(f8::MsgHdr& hdr, const cs::CMGroupQuit& msg);
|
||||||
|
void _CMGroupDismiss(f8::MsgHdr& hdr, const cs::CMGroupDismiss& msg);
|
||||||
|
void _CMGroupRename(f8::MsgHdr& hdr, const cs::CMGroupRename& msg);
|
||||||
};
|
};
|
||||||
|
@ -61,9 +61,7 @@ void PlayerMgr::RemovePlayerBySocket(int socket_handle)
|
|||||||
{
|
{
|
||||||
auto itr = socket_hash_.find(socket_handle);
|
auto itr = socket_hash_.find(socket_handle);
|
||||||
if (itr != socket_hash_.end()) {
|
if (itr != socket_hash_.end()) {
|
||||||
#if 0
|
|
||||||
itr->second->socket_handle = 0;
|
itr->second->socket_handle = 0;
|
||||||
#endif
|
|
||||||
socket_hash_.erase(itr);
|
socket_hash_.erase(itr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,4 +35,5 @@ class PlayerMgr : public a8::Singleton<PlayerMgr>
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
std::map<int, Player*> socket_hash_;
|
std::map<int, Player*> socket_hash_;
|
||||||
|
std::map<std::string, Player*> accountid_hash_;
|
||||||
};
|
};
|
||||||
|
@ -6,6 +6,20 @@ enum CMMessageId_e
|
|||||||
_CMPing = 101;
|
_CMPing = 101;
|
||||||
|
|
||||||
_CMLogin = 103;
|
_CMLogin = 103;
|
||||||
|
|
||||||
|
_CMFriendList = 104;
|
||||||
|
_CMFriendInvite = 105;
|
||||||
|
_CMFriendAgree = 106;
|
||||||
|
_CMFriendIgnore = 107;
|
||||||
|
_CMFriendDelete = 108;
|
||||||
|
|
||||||
|
_CMGroupCreate = 201;
|
||||||
|
_CMGroupJoin = 202;
|
||||||
|
_CMGroupAgree = 203;
|
||||||
|
_CMGroupKick = 204;
|
||||||
|
_CMGroupQuit = 205;
|
||||||
|
_CMGroupDismiss = 206;
|
||||||
|
_CMGroupRename = 207;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum SMMessageId_e
|
enum SMMessageId_e
|
||||||
@ -14,4 +28,21 @@ enum SMMessageId_e
|
|||||||
_SMRpcError = 102;
|
_SMRpcError = 102;
|
||||||
|
|
||||||
_SMLogin = 103;
|
_SMLogin = 103;
|
||||||
|
|
||||||
|
_SMFriendList = 104;
|
||||||
|
_SMFriendInvite = 105;
|
||||||
|
_SMFriendAgree = 106;
|
||||||
|
_SMFriendIgnore = 107;
|
||||||
|
_SMFriendDelete = 108;
|
||||||
|
|
||||||
|
_SMGroupCreate = 201;
|
||||||
|
_SMGroupJoin = 202;
|
||||||
|
_SMGroupAgree = 203;
|
||||||
|
_SMGroupKick = 204;
|
||||||
|
_SMGroupQuit = 205;
|
||||||
|
_SMGroupDismiss = 206;
|
||||||
|
_SMGroupRename = 207;
|
||||||
|
|
||||||
|
_SMUserStatusNotify = 1001;
|
||||||
|
_SMUserInfoUpdate = 1002;
|
||||||
}
|
}
|
||||||
|
@ -15,11 +15,153 @@ message SMPing
|
|||||||
optional int32 param1 = 1;
|
optional int32 param1 = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message MFUserInfo
|
||||||
|
{
|
||||||
|
optional string account_id = 1;
|
||||||
|
optional string nickname = 2;
|
||||||
|
optional string avatar_url = 3;
|
||||||
|
optional int32 sex = 4;
|
||||||
|
optional int32 status = 5;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
message CMLogin
|
message CMLogin
|
||||||
{
|
{
|
||||||
|
optional string account_id = 3;
|
||||||
|
optional string session_id = 20;
|
||||||
|
optional string nickname = 4;
|
||||||
|
optional string avatar_url = 5;
|
||||||
|
optional int32 sex = 6;
|
||||||
}
|
}
|
||||||
message SMLogin
|
message SMLogin
|
||||||
{
|
{
|
||||||
optional int32 param1 = 1;
|
}
|
||||||
|
|
||||||
|
message CMFriendList
|
||||||
|
{
|
||||||
|
}
|
||||||
|
message SMFriendList
|
||||||
|
{
|
||||||
|
repeated MFUserInfo user_infos = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message CMFriendInvite
|
||||||
|
{
|
||||||
|
optional string friend_id = 1;
|
||||||
|
optional string invite_msg = 2;
|
||||||
|
}
|
||||||
|
message SMFriendInvite
|
||||||
|
{
|
||||||
|
optional int32 error_code = 1;
|
||||||
|
optional string error_msg = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message CMFriendAgree
|
||||||
|
{
|
||||||
|
optional string friend_id = 1;
|
||||||
|
}
|
||||||
|
message SMFriendAgree
|
||||||
|
{
|
||||||
|
optional int32 error_code = 1;
|
||||||
|
optional string error_msg = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message CMFriendIgnore
|
||||||
|
{
|
||||||
|
optional string friend_id = 1;
|
||||||
|
}
|
||||||
|
message SMFriendIgnore
|
||||||
|
{
|
||||||
|
optional int32 error_code = 1;
|
||||||
|
optional string error_msg = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message CMFriendDelete
|
||||||
|
{
|
||||||
|
optional string friend_id = 1;
|
||||||
|
}
|
||||||
|
message SMFriendDelete
|
||||||
|
{
|
||||||
|
optional int32 error_code = 1;
|
||||||
|
optional string error_msg = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message CMGroupCreate
|
||||||
|
{
|
||||||
|
}
|
||||||
|
message SMGroupCreate
|
||||||
|
{
|
||||||
|
optional int32 error_code = 1;
|
||||||
|
optional string error_msg = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message CMGroupJoin
|
||||||
|
{
|
||||||
|
}
|
||||||
|
message SMGroupJoin
|
||||||
|
{
|
||||||
|
optional int32 error_code = 1;
|
||||||
|
optional string error_msg = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message CMGroupAgree
|
||||||
|
{
|
||||||
|
}
|
||||||
|
message SMGroupAgree
|
||||||
|
{
|
||||||
|
optional int32 error_code = 1;
|
||||||
|
optional string error_msg = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message CMGroupKick
|
||||||
|
{
|
||||||
|
}
|
||||||
|
message SMGroupKick
|
||||||
|
{
|
||||||
|
optional int32 error_code = 1;
|
||||||
|
optional string error_msg = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message CMGroupQuit
|
||||||
|
{
|
||||||
|
}
|
||||||
|
message SMGroupQuit
|
||||||
|
{
|
||||||
|
optional int32 error_code = 1;
|
||||||
|
optional string error_msg = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message CMGroupDismiss
|
||||||
|
{
|
||||||
|
}
|
||||||
|
message SMGroupDismiss
|
||||||
|
{
|
||||||
|
optional int32 error_code = 1;
|
||||||
|
optional string error_msg = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message CMGroupRename
|
||||||
|
{
|
||||||
|
}
|
||||||
|
message SMGroupRename
|
||||||
|
{
|
||||||
|
optional int32 error_code = 1;
|
||||||
|
optional string error_msg = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message SMUserStatusNotify
|
||||||
|
{
|
||||||
|
repeated string online_users = 1;
|
||||||
|
repeated string offline_users = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message SMChatMsgNotify
|
||||||
|
{
|
||||||
|
optional string sender = 1;
|
||||||
|
optional int32 chat_channel = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message SMUserInfoUpdate
|
||||||
|
{
|
||||||
|
repeated MFUserInfo user_infos = 1;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user