Esempio n. 1
0
 public void SetSlotInfos(List <FieldModel.SlotInfo> slot_infos)
 {
     slotInfos = slot_infos;
     if (slotInfos != null)
     {
         int i = 0;
         for (int count = slotInfos.Count; i < count; i++)
         {
             FieldModel.SlotInfo slotInfo   = slotInfos[i];
             CoopClient          coopClient = clients.FindByClientId(slotInfo.userId);
             if (coopClient != null)
             {
                 coopClient.Activate(slotInfo.userId, slotInfo.token, slotInfo.userInfo, i);
             }
         }
     }
 }
Esempio n. 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);
    }