//在游戏服务端删除虚拟用户 func setSessionOffline(session *link.Session, protoMsg protos.ProtoMsg) { rev_msg := protoMsg.Body.(*systemProto.System_ClientSessionOfflineC2S) userSession := global.GetSession(rev_msg.GetSessionID()) if userSession != nil { userSession.Close() } //通知WorldServer用户下线 worldProxy.SendSystemMsgToServer(protos.MarshalProtoMsg(rev_msg)) }
//在GameServer设置用户登录成功 func setClientLoginSuccess(session *link.Session, protoMsg protos.ProtoMsg) { rev_msg := protoMsg.Body.(*systemProto.System_ClientLoginSuccessC2S) userConn := proxys.NewDummyConn(rev_msg.GetSessionID(), rev_msg.GetNetwork(), rev_msg.GetAddr(), transferClient) userSession := link.NewSessionByID(userConn, codecType.DummyCodecType{}, rev_msg.GetSessionID()) global.AddSession(userSession) //接收游戏消息 go func() { var msg []byte for { if err := userSession.Receive(&msg); err != nil { break } gameProxy.MsgDispatch.Process(userSession, msg) } }() module.User.LoginSuccess(userSession, rev_msg.GetUserName(), rev_msg.GetUserID(), rev_msg.GetGameServerID()) //通知WorldServer用户登录成功 worldProxy.SendSystemMsgToServer(protos.MarshalProtoMsg(rev_msg)) }