コード例 #1
0
        public bool RetrieveClan(out ClanView clanView, out string message, out HttpStatusCode code)
        {
            message  = ErrorCode.CONNECTION_FAILED;
            clanView = null;

            Api().CreateAuthenticated("api/clan/current", "get")
            .Execute(out HttpWebResponse response);

            if (response.TryGetStatusCode(out code) && code == HttpStatusCode.OK)
            {
                ValidatedView <ClanView> validatedView = response.GetReponseString()
                                                         .DeserializeJsonSafe <ValidatedView <ClanView> >();
                if (validatedView == null)
                {
                    message = ErrorCode.ERROR_WHILE_READING_RESULT;
                }
                else
                {
                    clanView = validatedView.Object;
                    message  = validatedView.Message;
                    return(validatedView.IsValid);
                }
            }

            return(false);
        }
コード例 #2
0
    // Token: 0x060012C5 RID: 4805 RVA: 0x0000CD86 File Offset: 0x0000AF86
    public void SetClanData(ClanView view)
    {
        PlayerDataManager.ClanData = view;
        AutoMonoBehaviour <CommConnectionManager> .Instance.Client.Lobby.SendContactList();

        Singleton <ChatManager> .Instance.UpdateClanSection();
    }
コード例 #3
0
        // Token: 0x06001048 RID: 4168 RVA: 0x00012FD0 File Offset: 0x000111D0
        public static ClanView Deserialize(Stream bytes)
        {
            int      num      = Int32Proxy.Deserialize(bytes);
            ClanView clanView = new ClanView();

            if ((num & 1) != 0)
            {
                clanView.Address = StringProxy.Deserialize(bytes);
            }
            clanView.ApplicationId = Int32Proxy.Deserialize(bytes);
            clanView.ColorStyle    = EnumProxy <GroupColor> .Deserialize(bytes);

            if ((num & 2) != 0)
            {
                clanView.Description = StringProxy.Deserialize(bytes);
            }
            clanView.FontStyle = EnumProxy <GroupFontStyle> .Deserialize(bytes);

            clanView.FoundingDate = DateTimeProxy.Deserialize(bytes);
            clanView.GroupId      = Int32Proxy.Deserialize(bytes);
            clanView.LastUpdated  = DateTimeProxy.Deserialize(bytes);
            if ((num & 4) != 0)
            {
                clanView.Members = ListProxy <ClanMemberView> .Deserialize(bytes, new ListProxy <ClanMemberView> .Deserializer <ClanMemberView>(ClanMemberViewProxy.Deserialize));
            }
            clanView.MembersCount = Int32Proxy.Deserialize(bytes);
            clanView.MembersLimit = Int32Proxy.Deserialize(bytes);
            if ((num & 8) != 0)
            {
                clanView.Motto = StringProxy.Deserialize(bytes);
            }
            if ((num & 16) != 0)
            {
                clanView.Name = StringProxy.Deserialize(bytes);
            }
            clanView.OwnerCmid = Int32Proxy.Deserialize(bytes);
            if ((num & 32) != 0)
            {
                clanView.OwnerName = StringProxy.Deserialize(bytes);
            }
            if ((num & 64) != 0)
            {
                clanView.Picture = StringProxy.Deserialize(bytes);
            }
            if ((num & 128) != 0)
            {
                clanView.Tag = StringProxy.Deserialize(bytes);
            }
            clanView.Type = EnumProxy <GroupType> .Deserialize(bytes);

            return(clanView);
        }
コード例 #4
0
 protected internal void Refresh()
 {
     if (!ClanService.RetrieveClan(out ClanView clanView, out string message, out HttpStatusCode code))
     {
         NotificationService.ShowError(message, "Failed to load clans!");
         if (code == HttpStatusCode.Unauthorized)
         {
             ComponentService.Show(new Login());
         }
         else
         {
             ComponentService.Show(new CriticalError());
         }
     }
     else
     {
         Current        = clanView;
         PlayerIsInClan = clanView != null;
     }
 }
コード例 #5
0
        public static async Task <ValidatedView <ClanView> > RetrieveClan(int accountId, int clanId)
        {
            try {
                ClanModel clanModel = await Model <ClanModel> .AsQueryable().FirstOrDefault(x => x.ID == clanId);

                if (clanModel == null)   // wtf kann nd sein
                {
                    return(ValidatedView <ClanView> .Invalid(ErrorCode.CLAN_NOT_FOUND));
                }

                ClanView clanOverview = Mapper <ClanModel> .Map <ClanView>(clanModel);

                clanOverview.LeaderUsername = "";
                ValidatedView <int> validatedLeaderIDView = await RetrieveLeaderID(clanModel.ID);

                if (validatedLeaderIDView.IsValid)
                {
                    ValidatedView <string> validedLeaderUsernameView = await AccountService.RetrieveUsername(validatedLeaderIDView.Object);

                    if (validedLeaderUsernameView.IsValid)
                    {
                        clanOverview.LeaderUsername = validedLeaderUsernameView.Object;
                    }
                }

                clanOverview.MembersCount = await Model <ClanMemberModel> .AsQueryable().Count(x => x.ClanID == clanModel.ID);

                if (await Model <ClanMemberPendingModel> .AsQueryable()
                    .Any(x => x.AccountID == accountId && x.ClanID == clanId))
                {
                    clanOverview.Pending = true;
                }

                return(ValidatedView <ClanView> .Valid(clanOverview));
            } catch (Exception e) {
                GameContext.Logger.LogError(e);
            }
            return(ValidatedView <ClanView> .Invalid(ErrorCode.OPERATION_FAILED));
        }
コード例 #6
0
        public bool RevokeJoinRequest(ClanView clanView, out string message, out HttpStatusCode code)
        {
            message = ErrorCode.CONNECTION_FAILED;

            Api().CreateAuthenticated($"api/clan/request/{clanView.ID}", "delete")
            .Execute(out HttpWebResponse response);

            if (response.TryGetStatusCode(out code) && code == HttpStatusCode.OK)
            {
                ValidatedView validatedView = response.GetReponseString()
                                              .DeserializeJsonSafe <ValidatedView>();
                if (validatedView == null)
                {
                    message = ErrorCode.ERROR_WHILE_READING_RESULT;
                }
                else
                {
                    message = validatedView.Message;
                    return(validatedView.IsValid);
                }
            }

            return(false);
        }
 protected void Select(ClanView clan)
 {
     Selected = clan;
     StateHasChanged();
 }
コード例 #8
0
 private PlayerDataManager()
 {
     _serverLocalPlayerPlayerStatisticsView = new PlayerStatisticsView();
     _playerClanData = new ClanView();
 }
コード例 #9
0
        // Token: 0x06001047 RID: 4167 RVA: 0x00012DF0 File Offset: 0x00010FF0
        public static void Serialize(Stream stream, ClanView instance)
        {
            int num = 0;

            using (MemoryStream memoryStream = new MemoryStream())
            {
                if (instance.Address != null)
                {
                    StringProxy.Serialize(memoryStream, instance.Address);
                }
                else
                {
                    num |= 1;
                }
                Int32Proxy.Serialize(memoryStream, instance.ApplicationId);
                EnumProxy <GroupColor> .Serialize(memoryStream, instance.ColorStyle);

                if (instance.Description != null)
                {
                    StringProxy.Serialize(memoryStream, instance.Description);
                }
                else
                {
                    num |= 2;
                }
                EnumProxy <GroupFontStyle> .Serialize(memoryStream, instance.FontStyle);

                DateTimeProxy.Serialize(memoryStream, instance.FoundingDate);
                Int32Proxy.Serialize(memoryStream, instance.GroupId);
                DateTimeProxy.Serialize(memoryStream, instance.LastUpdated);
                if (instance.Members != null)
                {
                    ListProxy <ClanMemberView> .Serialize(memoryStream, instance.Members, new ListProxy <ClanMemberView> .Serializer <ClanMemberView>(ClanMemberViewProxy.Serialize));
                }
                else
                {
                    num |= 4;
                }
                Int32Proxy.Serialize(memoryStream, instance.MembersCount);
                Int32Proxy.Serialize(memoryStream, instance.MembersLimit);
                if (instance.Motto != null)
                {
                    StringProxy.Serialize(memoryStream, instance.Motto);
                }
                else
                {
                    num |= 8;
                }
                if (instance.Name != null)
                {
                    StringProxy.Serialize(memoryStream, instance.Name);
                }
                else
                {
                    num |= 16;
                }
                Int32Proxy.Serialize(memoryStream, instance.OwnerCmid);
                if (instance.OwnerName != null)
                {
                    StringProxy.Serialize(memoryStream, instance.OwnerName);
                }
                else
                {
                    num |= 32;
                }
                if (instance.Picture != null)
                {
                    StringProxy.Serialize(memoryStream, instance.Picture);
                }
                else
                {
                    num |= 64;
                }
                if (instance.Tag != null)
                {
                    StringProxy.Serialize(memoryStream, instance.Tag);
                }
                else
                {
                    num |= 128;
                }
                EnumProxy <GroupType> .Serialize(memoryStream, instance.Type);

                Int32Proxy.Serialize(stream, ~num);
                memoryStream.WriteTo(stream);
            }
        }