Ejemplo n.º 1
0
    private IEnumerator DoLeave(Action <bool> call_back, LoungeLeaveModel ret)
    {
        bool  is_success = false;
        Error error      = ret.Error;

        if (error == Error.None || error == Error.ERR_PARTY_NOT_FOUND_PARTY)
        {
            if (IsHostChange(ret.result.lounge, MonoBehaviourSingleton <UserInfoManager> .I.userInfo.id))
            {
                Lounge_Model_RoomHostChanged hostChange = new Lounge_Model_RoomHostChanged
                {
                    id     = 1005,
                    hostid = ret.result.lounge.ownerUserId
                };
                MonoBehaviourSingleton <LoungeNetworkManager> .I.SendBroadcast(hostChange, false, null, null);

                yield return((object)0);
            }
            is_success = true;
            Lounge_Model_RoomLeaved packet = new Lounge_Model_RoomLeaved
            {
                id    = 1005,
                token = GenerateToken(),
                cid   = MonoBehaviourSingleton <UserInfoManager> .I.userInfo.id
            };
            MonoBehaviourSingleton <LoungeNetworkManager> .I.SendBroadcast(packet, false, (Coop_Model_ACK ack) => true, null);

            MonoBehaviourSingleton <ChatManager> .I.DestroyLoungeChat();

            StopAFKCheck();
            ClearLounge();
            Dirty();
        }
        call_back(is_success);
    }
Ejemplo n.º 2
0
    public bool OnRecvRoomHostChanged(Lounge_Model_RoomHostChanged model)
    {
        Logd("OnRecvHostChanged. hostId = {0}", model.hostid);
        if (!MonoBehaviourSingleton <LoungeMatchingManager> .I.IsUserInLounge(model.hostid))
        {
            return(true);
        }
        MonoBehaviourSingleton <LoungeMatchingManager> .I.ChangeOwner(model.hostid);

        LoungeModel.SlotInfo slotInfoByUserId = MonoBehaviourSingleton <LoungeMatchingManager> .I.GetSlotInfoByUserId(model.hostid);

        if (chatConnection != null)
        {
            chatConnection.OnReceiveNotification(StringTable.Format(STRING_CATEGORY.LOUNGE, 13u, slotInfoByUserId.userInfo.name));
        }
        return(true);
    }
Ejemplo n.º 3
0
 public void SendRoomPartyAFKKick(int kickedUserId, Action <bool> call_back = null)
 {
     LoungeModel.RequestForceKick requestForceKick = new LoungeModel.RequestForceKick();
     requestForceKick.id     = GetLoungeId();
     requestForceKick.userId = kickedUserId;
     Protocol.Send(LoungeModel.RequestForceKick.path, requestForceKick, delegate(LoungeModel ret)
     {
         bool flag = ret.Error == Error.None;
         if (flag)
         {
             if (ret.Error == Error.None)
             {
                 LoungeModel.SlotInfo slotInfo = ret.result.lounge.slotInfos.Find((LoungeModel.SlotInfo s) => s.userInfo != null && s.userInfo.userId == kickedUserId);
                 if (slotInfo != null)
                 {
                     loungeMemberStatus[kickedUserId].UpdateLastExecTime(TimeManager.GetNow().ToUniversalTime());
                 }
                 else
                 {
                     if (IsHostChange(ret.result.lounge, kickedUserId))
                     {
                         Lounge_Model_RoomHostChanged model = new Lounge_Model_RoomHostChanged
                         {
                             id     = 1005,
                             hostid = ret.result.lounge.ownerUserId
                         };
                         MonoBehaviourSingleton <LoungeNetworkManager> .I.SendBroadcast(model, false, null, null);
                     }
                     Lounge_Model_AFK_Kick model2 = new Lounge_Model_AFK_Kick
                     {
                         id    = 1005,
                         cid   = kickedUserId,
                         token = GenerateToken()
                     };
                     MonoBehaviourSingleton <LoungeNetworkManager> .I.SendBroadcast(model2, false, null, null);
                 }
                 UpdateLounge(ret.result.lounge, ret.result.friend, ret.result.loungeServer, ret.result.inviteFriendInfo, ret.result.firstMetUserIds);
             }
             else
             {
                 call_back(flag);
             }
         }
         call_back(flag);
     }, string.Empty);
 }
    protected override bool HandleCoopEvent(CoopPacket packet)
    {
        bool result = false;

        switch (packet.packetType)
        {
        case PACKET_TYPE.LOUNGE_ROOM_JOINED:
        {
            Lounge_Model_RoomJoined model14 = packet.GetModel <Lounge_Model_RoomJoined>();
            result = MonoBehaviourSingleton <LoungeNetworkManager> .I.OnRecvRoomJoined(model14);

            break;
        }

        case PACKET_TYPE.LOUNGE_ROOM_LEAVED:
        {
            Lounge_Model_RoomLeaved model13 = packet.GetModel <Lounge_Model_RoomLeaved>();
            result = MonoBehaviourSingleton <LoungeNetworkManager> .I.OnRecvRoomLeaved(model13);

            break;
        }

        case PACKET_TYPE.LOUNGE_ROOM_ACTION:
        {
            Lounge_Model_RoomAction model12 = packet.GetModel <Lounge_Model_RoomAction>();
            result = MonoBehaviourSingleton <LoungeNetworkManager> .I.OnRecvRoomAction(model12);

            break;
        }

        case PACKET_TYPE.LOUNGE_ROOM_MOVE:
        {
            Lounge_Model_RoomMove model11 = packet.GetModel <Lounge_Model_RoomMove>();
            result = MonoBehaviourSingleton <LoungeNetworkManager> .I.OnRecvRoomMove(model11);

            break;
        }

        case PACKET_TYPE.LOUNGE_ROOM_POSITION:
        {
            Lounge_Model_RoomPosition model10 = packet.GetModel <Lounge_Model_RoomPosition>();
            result = MonoBehaviourSingleton <LoungeNetworkManager> .I.OnRecvRoomPoisition(model10);

            break;
        }

        case PACKET_TYPE.LOUNGE_ROOM_KICK:
        {
            Lounge_Model_RoomKick model9 = packet.GetModel <Lounge_Model_RoomKick>();
            result = MonoBehaviourSingleton <LoungeNetworkManager> .I.OnRecvRoomKick(model9);

            break;
        }

        case PACKET_TYPE.LOUNGE_ROOM_AFK_KICK:
        {
            Lounge_Model_AFK_Kick model8 = packet.GetModel <Lounge_Model_AFK_Kick>();
            result = MonoBehaviourSingleton <LoungeNetworkManager> .I.OnRecvRoomAFKKick(model8);

            break;
        }

        case PACKET_TYPE.LOUNGE_ROOM_HOST_CHANGED:
        {
            Lounge_Model_RoomHostChanged model7 = packet.GetModel <Lounge_Model_RoomHostChanged>();
            result = MonoBehaviourSingleton <LoungeNetworkManager> .I.OnRecvRoomHostChanged(model7);

            break;
        }

        case PACKET_TYPE.LOUNGE_MEMBER_LOUNGE:
        {
            Lounge_Model_MemberLounge model6 = packet.GetModel <Lounge_Model_MemberLounge>();
            result = MonoBehaviourSingleton <LoungeNetworkManager> .I.OnRecvMemberLounge(model6);

            break;
        }

        case PACKET_TYPE.LOUNGE_MEMBER_FIELD:
        {
            Lounge_Model_MemberField model5 = packet.GetModel <Lounge_Model_MemberField>();
            result = MonoBehaviourSingleton <LoungeNetworkManager> .I.OnRecvMemberField(model5);

            break;
        }

        case PACKET_TYPE.LOUNGE_MEMBER_QUEST:
        {
            Lounge_Model_MemberQuest model4 = packet.GetModel <Lounge_Model_MemberQuest>();
            result = MonoBehaviourSingleton <LoungeNetworkManager> .I.OnRecvMemberQuest(model4);

            break;
        }

        case PACKET_TYPE.LOUNGE_MEMBER_ARENA:
        {
            Lounge_Model_MemberArena model3 = packet.GetModel <Lounge_Model_MemberArena>();
            result = MonoBehaviourSingleton <LoungeNetworkManager> .I.OnRecvMemberArena(model3);

            break;
        }

        case PACKET_TYPE.CHAT_MESSAGE:
        {
            Coop_Model_StageChatMessage model2 = packet.GetModel <Coop_Model_StageChatMessage>();
            result = MonoBehaviourSingleton <LoungeNetworkManager> .I.OnRecvChatMessage(model2);

            break;
        }

        case PACKET_TYPE.STAGE_CHAT_STAMP:
        {
            Coop_Model_StageChatStamp model = packet.GetModel <Coop_Model_StageChatStamp>();
            result = MonoBehaviourSingleton <LoungeNetworkManager> .I.OnRecvChatStamp(model);

            break;
        }
        }
        return(result);
    }