예제 #1
0
    public bool OnRecvRoomStageChanged(Coop_Model_RoomStageChanged model)
    {
        if (!IsActivate())
        {
            return(true);
        }
        CoopClient coopClient = clients.FindByClientId(model.cid);

        if (coopClient == null)
        {
            Logd("OnRecvRoomStageChanged: client not found. clientId={0}", model.cid);
            return(true);
        }
        Logd("OnRecvRoomStageChanged: sid={0}, client={1}", model.sid, coopClient);
        coopClient.SetStage(model.stgid, model.stgidx, coopClient.clientId == model.stghostid);
        if (coopClient is CoopMyClient)
        {
            MonoBehaviourSingleton <CoopManager> .I.coopStage.OnInitStage(model.stgid, model.stgidx, model.stghostid);

            MonoBehaviourSingleton <CoopNetworkManager> .I.SetRegisterSID(model.sid);
        }
        else if (model.pstgid == MonoBehaviourSingleton <CoopManager> .I.coopStage.stageId)
        {
            MonoBehaviourSingleton <CoopManager> .I.coopStage.OnLeaveClient(coopClient, model.pstghostid);
        }
        else if (model.stgid == MonoBehaviourSingleton <CoopManager> .I.coopStage.stageId)
        {
            MonoBehaviourSingleton <CoopManager> .I.coopStage.OnJoinClient(coopClient);
        }
        clients.ForEach(delegate(CoopClient c)
        {
            if (c.stageId == model.pstgid)
            {
                c.SetStageHost(c.clientId == model.pstghostid);
            }
            if (c.stageId == model.stgid)
            {
                c.SetStageHost(c.clientId == model.stghostid);
            }
        });
        return(true);
    }
예제 #2
0
    private CoopClient OnJoinClient(int client_id, int stgid, int stgidx, bool stghost, int counter = 0)
    {
        //IL_0080: Unknown result type (might be due to invalid IL or missing references)
        //IL_0086: Expected O, but got Unknown
        CoopClient coopClient = null;

        coopClient = clients.FindByClientId(client_id);
        if (coopClient != null)
        {
            Logd("OnJoinClient: already join. client={0}", coopClient);
            return(coopClient);
        }
        if (client_id == MonoBehaviourSingleton <UserInfoManager> .I.userInfo.id)
        {
            coopClient = MonoBehaviourSingleton <CoopManager> .I.coopMyClient;
            coopClient.Init(client_id);
        }
        else
        {
            coopClient = (CoopClient)Utility.CreateGameObjectAndComponent("CoopClient", this.get_transform(), -1);
            coopClient.Init(client_id);
            MonoBehaviourSingleton <CoopManager> .I.coopMyClient.WelcomeClient(client_id);

            if (QuestManager.IsValidInGameExplore())
            {
                if (MonoBehaviourSingleton <CoopManager> .I.isStageHost)
                {
                    MonoBehaviourSingleton <CoopManager> .I.coopRoom.packetSender.SendSyncAllPortalPoint(MonoBehaviourSingleton <QuestManager> .I.GetExploreStatus().GetAllPortalData(), client_id);

                    MonoBehaviourSingleton <CoopManager> .I.coopRoom.packetSender.SendSyncExploreBoss(MonoBehaviourSingleton <QuestManager> .I.GetExploreStatus(), client_id);
                }
                if (MonoBehaviourSingleton <StageObjectManager> .IsValid() && MonoBehaviourSingleton <StageObjectManager> .I.self != null)
                {
                    MonoBehaviourSingleton <CoopManager> .I.coopRoom.packetSender.SendSyncPlayerStatus(MonoBehaviourSingleton <StageObjectManager> .I.self, client_id);
                }
            }
            else if (MonoBehaviourSingleton <QuestManager> .IsValid() && MonoBehaviourSingleton <QuestManager> .I.IsDefenseBattle())
            {
                if (MonoBehaviourSingleton <CoopManager> .I.isStageHost && MonoBehaviourSingleton <InGameProgress> .IsValid())
                {
                    MonoBehaviourSingleton <CoopManager> .I.coopRoom.packetSender.SendSyncDefenseBattle(MonoBehaviourSingleton <InGameProgress> .I.defenseBattleEndurance);
                }
            }
            else if (QuestManager.IsValidInGameWaveMatch() && MonoBehaviourSingleton <CoopManager> .I.isStageHost && !MonoBehaviourSingleton <InGameProgress> .IsValid())
            {
                goto IL_01d8;
            }
        }
        goto IL_01d8;
IL_01d8:
        coopClient.SetStage(stgid, stgidx, stghost);
        int num = slotInfos.FindIndex((FieldModel.SlotInfo s) => s.userId == client_id);

        if (num >= 0)
        {
            FieldModel.SlotInfo slotInfo = slotInfos[num];
            coopClient.Activate(slotInfo.userId, slotInfo.token, slotInfo.userInfo, num);
        }
        else if (counter == 0)
        {
            CoopApp.UpdateField(null);
        }
        clients.Add(coopClient);
        if (MonoBehaviourSingleton <CoopManager> .I.coopStage.stageId == coopClient.stageId)
        {
            MonoBehaviourSingleton <CoopManager> .I.coopStage.OnJoinClient(coopClient);
        }
        return(coopClient);
    }