상속: global::ProtoBuf.IExtensible
 private void HandleChangeSceneResult(Msg_RL_ChangeSceneResult msg, PBChannel channel, int src, uint session)
 {
     //响应RoomServer消息,进入野外场景结果消息
     int hp = 0;
     int mp = 0;
     if (msg.HP > 0 && msg.MP > 0) {
         hp = msg.HP;
         mp = msg.MP;
     }
     m_RoomProcessThread.OnChangeSceneResult(msg.UserGuid, msg.RoomID, msg.TargetRoomID, msg.Result, hp, mp);
 }
예제 #2
0
        private void RemoveUserForChangeScene(Room room, User user, ulong userGuid, int roomId, int targetRoomId, PBChannel channel, int handle, uint seq)
        {
            Msg_RL_ChangeSceneResult replyBuilder = new Msg_RL_ChangeSceneResult();
            EntityInfo info = user.Info;
            if (null != info) {
                replyBuilder.HP = info.Hp;
                replyBuilder.MP = info.Energy;
            }

            room.RemoveUserFromRoomThread(user, true);

            replyBuilder.UserGuid = userGuid;
            replyBuilder.RoomID = roomId;
            replyBuilder.TargetRoomID = targetRoomId;
            replyBuilder.Result = (int)SceneOperationResultEnum.Success;
            channel.Send(replyBuilder);
        }
예제 #3
0
        private void PlayerGotoRoom(User user, int roomId, int targetRoomId)
        {
            bool isFieldThread;
            int ix = GetActiveRoomThreadIndex(targetRoomId, out isFieldThread);
            if (ix < 0)
                return;

            RoomThread roomThread;
            if (isFieldThread) {
                roomThread = field_roomthread_list_[ix];
            } else {
                roomThread = roomthread_list_[ix];
            }
            roomThread.QueueAction(roomThread.AddUser, user, targetRoomId, (MyAction<bool, int, User>)((bool ret, int sceneId, User successUser) => {
                if (ret) {
                    Msg_RC_ChangeScene msg = new Msg_RC_ChangeScene();
                    msg.target_scene_id = sceneId;
                    successUser.SendMessage(RoomMessageDefine.Msg_RC_ChangeScene, msg);

                    Msg_RL_ChangeSceneResult replyBuilder = new Msg_RL_ChangeSceneResult();
                    EntityInfo info = user.Info;
                    if (null != info) {
                        replyBuilder.HP = info.Hp;
                        replyBuilder.MP = info.Energy;
                    }
                    replyBuilder.UserGuid = user.Guid;
                    replyBuilder.RoomID = roomId;
                    replyBuilder.TargetRoomID = targetRoomId;
                    replyBuilder.Result = (int)SceneOperationResultEnum.Success;
                    connector_.SendMsgToLobby(replyBuilder);
                } else {
                    Msg_RL_ChangeSceneResult replyBuilder = new Msg_RL_ChangeSceneResult();
                    replyBuilder.UserGuid = user.Guid;
                    replyBuilder.RoomID = roomId;
                    replyBuilder.TargetRoomID = targetRoomId;
                    replyBuilder.Result = (int)SceneOperationResultEnum.Cant_Find_Room;
                    connector_.SendMsgToLobby(replyBuilder);
                }
            }));
        }
예제 #4
0
 private void HandleChangeScene(Msg_LR_ChangeScene msg, PBChannel channel, int handle, uint seq)
 {
     ulong guid = msg.UserGuid;
     int roomid = msg.RoomID;
     int targetRoomId = msg.TargetRoomID;
     bool isFieldThread;
     int ix = GetActiveRoomThreadIndex(msg.RoomID, out isFieldThread);
     if (ix < 0) {
         Msg_RL_ChangeSceneResult replyBuilder = new Msg_RL_ChangeSceneResult();
         replyBuilder.UserGuid = msg.UserGuid;
         replyBuilder.RoomID = msg.RoomID;
         replyBuilder.TargetRoomID = msg.TargetRoomID;
         replyBuilder.Result = (int)SceneOperationResultEnum.Cant_Find_Room;
         channel.Send(replyBuilder);
     } else {
         RoomThread roomThread;
         if (isFieldThread) {
             roomThread = field_roomthread_list_[ix];
         } else {
             roomThread = roomthread_list_[ix];
         }
         bool targetIsFieldThread;
         int targetIx = GetActiveRoomThreadIndex(targetRoomId, out targetIsFieldThread);
         if (null != roomThread) {
             if (targetIx >= 0) {
                 //ͬ���г���
                 roomThread.QueueAction(roomThread.RemoveUser, guid, roomid, false, (MyAction<bool, int, User>)((bool success, int sceneId, User user) => {
                     if (success) {
                         PlayerGotoRoom(user, roomid, targetRoomId);
                     } else {
                         Msg_RL_ChangeSceneResult replyBuilder = new Msg_RL_ChangeSceneResult();
                         replyBuilder.UserGuid = guid;
                         replyBuilder.RoomID = roomid;
                         replyBuilder.TargetRoomID = targetRoomId;
                         replyBuilder.Result = (int)SceneOperationResultEnum.Cant_Find_Room;
                         channel.Send(replyBuilder);
                     }
                 }));
             } else {
                 //������
                 roomThread.QueueAction(roomThread.RemoveUser, guid, roomid, true, (MyAction<bool, int, User>)((bool success, int sceneId, User user) => {
                     if (success) {
                         Msg_RL_ChangeSceneResult replyBuilder = new Msg_RL_ChangeSceneResult();
                         EntityInfo info = user.Info;
                         if (null != info) {
                             replyBuilder.HP = info.Hp;
                             replyBuilder.MP = info.Energy;
                         }
                         replyBuilder.UserGuid = guid;
                         replyBuilder.RoomID = roomid;
                         replyBuilder.TargetRoomID = targetRoomId;
                         replyBuilder.Result = (int)SceneOperationResultEnum.Success;
                         channel.Send(replyBuilder);
                     } else {
                         Msg_RL_ChangeSceneResult replyBuilder = new Msg_RL_ChangeSceneResult();
                         replyBuilder.UserGuid = guid;
                         replyBuilder.RoomID = roomid;
                         replyBuilder.TargetRoomID = targetRoomId;
                         replyBuilder.Result = (int)SceneOperationResultEnum.Cant_Find_Room;
                         channel.Send(replyBuilder);
                     }
                 }));
             }
         }
     }
 }