protected override void OnQuery_FOLLOW()
    {
        GameSection.SetEventData(new object[1]
        {
            record.charaInfo.name
        });
        List <int> list = new List <int>();

        list.Add(record.charaInfo.userId);
        if (isQuestResult)
        {
            SendFollow(list, delegate
            {
                if (MonoBehaviourSingleton <CoopApp> .IsValid())
                {
                    CoopApp.UpdateField(null);
                }
            });
        }
        else
        {
            GameSection.StayEvent();
            MonoBehaviourSingleton <PartyManager> .I.SendFollowAgency(list, delegate(bool is_success)
            {
                if (isQuestResult && is_success)
                {
                    MonoBehaviourSingleton <FriendManager> .I.SetFollowToHomeCharaInfo(record.charaInfo.userId, true);
                }
                GameSection.ResumeEvent(is_success, null);
            });
        }
    }
    private void OnQuery_FOLLOW()
    {
        int index = (int)GameSection.GetEventData();

        GameSection.SetEventData(new object[1]
        {
            infoList[index].name
        });
        List <int> list = new List <int>();

        list.Add(infoList[index].userId);
        GameSection.StayEvent();
        MonoBehaviourSingleton <FriendManager> .I.SendFollowUser(list, delegate(Error err, List <int> follow_list)
        {
            bool flag = err == Error.None && follow_list.Count > 0;
            if (flag)
            {
                infoList[index].following = !infoList[index].following;
            }
            if (MonoBehaviourSingleton <CoopApp> .IsValid())
            {
                CoopApp.UpdateField(null);
            }
            GameSection.ResumeEvent(flag, null);
            RefreshUI();
        });
    }
    private void OnQuery_FOLLOW()
    {
        int playerIndex = (int)GameSection.GetEventData();

        InGameRecorder.PlayerRecord record = playerRecords[playerIndex];
        if (record == null)
        {
            GameSection.StopEvent();
        }
        else if (MonoBehaviourSingleton <FriendManager> .I.followNum >= MonoBehaviourSingleton <UserInfoManager> .I.userStatus.maxFollow)
        {
            GameSection.ChangeEvent("FOLLOW_MAX", null);
        }
        else
        {
            GameSection.StayEvent();
            List <int> list = new List <int>();
            list.Add(record.charaInfo.userId);
            MonoBehaviourSingleton <FriendManager> .I.SendFollowUser(list, delegate(Error err, List <int> follow_list)
            {
                if (err == Error.None)
                {
                    GameSection.ChangeStayEvent("FOLLOW_DIALOG", new object[1]
                    {
                        record.charaInfo.name
                    });
                    Transform root = itemsL[playerIndex];
                    SetButtonSprite(root, UI.BTN_FOLLOW, "ResultfollowBtnOff", true);
                    SetButtonEnabled(root, UI.BTN_FOLLOW, false);
                    if (MonoBehaviourSingleton <CoopApp> .IsValid())
                    {
                        CoopApp.UpdateField(null);
                    }
                }
                else if (follow_list.Count == 0)
                {
                    GameSection.ChangeStayEvent("FAILED_FOLLOW", new object[1]
                    {
                        record.charaInfo.name
                    });
                }
                GameSection.ResumeEvent(err == Error.None, null);
            });
        }
    }
Esempio n. 4
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);
    }