public override ISerializable FromObject(object obj)
        {
            Dictionary <string, object> dictionary = obj as Dictionary <string, object>;

            if (dictionary != null)
            {
                if (dictionary.ContainsKey("identities"))
                {
                    Dictionary <string, object> dictionary2 = dictionary["identities"] as Dictionary <string, object>;
                    if (dictionary2 != null)
                    {
                        foreach (KeyValuePair <string, object> current in dictionary2)
                        {
                            PlayerIdentityInfo playerIdentityInfo = new PlayerIdentityInfo();
                            playerIdentityInfo.FromObject(current.get_Value());
                            this.PlayerIdentities.Add(current.get_Key(), playerIdentityInfo);
                        }
                    }
                }
                if (dictionary.ContainsKey("secret"))
                {
                    this.Secret = (string)dictionary["secret"];
                }
                if (dictionary.ContainsKey("registrationTime"))
                {
                    this.LastSyncedTimeStamp = Convert.ToInt32((string)dictionary["registrationTime"], CultureInfo.InvariantCulture);
                }
            }
            return(this);
        }
        private void ShowSyncConflict()
        {
            this.labelTitle.Text = this.lang.Get("ACCOUNT_SYNC", new object[0]);
            this.labelBody.Text  = this.lang.Get("ACCOUNT_SYNC_CONFLICT", new object[]
            {
                this.accountProvider,
                this.accountProvider
            });
            this.labelAccountTitle.Text = this.lang.Get("ACCOUNT_SYNC_EXISTING_SYNCED", new object[]
            {
                this.accountProvider
            });
            int lastSyncedTimeStamp = this.command.ResponseResult.LastSyncedTimeStamp;

            if (lastSyncedTimeStamp > 0)
            {
                DateTime dateTime = DateUtils.DateFromSeconds(lastSyncedTimeStamp);
                this.labelLastSynced.Text = this.lang.Get("ACCOUNT_SYNC_LAST_DATE", new object[]
                {
                    dateTime.get_Month(),
                    dateTime.get_Day(),
                    dateTime.get_Year()
                });
                this.labelLastSynced.Visible = true;
            }
            else
            {
                this.labelLastSynced.Visible = false;
            }
            this.buttonLoad.Visible              = true;
            this.buttonLoad.OnClicked            = new UXButtonClickedDelegate(this.OnSyncConflictLoadExistingClicked);
            this.buttonConnectNew.Visible        = true;
            this.buttonConnectNew.OnClicked      = new UXButtonClickedDelegate(this.OnSyncConflictConnectNewClicked);
            this.buttonOk.Visible                = false;
            this.buttonCancel.Visible            = false;
            this.buttonConnectNewConfirm.Visible = false;
            PlayerIdentityInfo       playerIdentityInfo              = null;
            PlayerIdentityInfo       playerIdentityInfo2             = null;
            PlayerIdentityController playerIdentityController        = Service.Get <PlayerIdentityController>();
            Dictionary <string, PlayerIdentityInfo> playerIdentities = this.command.ResponseResult.PlayerIdentities;

            foreach (PlayerIdentityInfo current in playerIdentities.Values)
            {
                if (playerIdentityController.IsFirstIdentity(current.PlayerId))
                {
                    playerIdentityInfo = current;
                }
                else
                {
                    playerIdentityInfo2 = current;
                }
            }
            if (playerIdentityInfo2 != null)
            {
                this.PopulatePlayerInfo(AccountSyncAccountType.MultipleAccountsPrimary, playerIdentityInfo.PlayerName, playerIdentityInfo.HQLevel, playerIdentityInfo.Medals, playerIdentityInfo.Faction, playerIdentityInfo.SquadName);
                this.PopulatePlayerInfo(AccountSyncAccountType.MultipleAccountsSecondary, playerIdentityInfo2.PlayerName, playerIdentityInfo2.HQLevel, playerIdentityInfo2.Medals, playerIdentityInfo2.Faction, playerIdentityInfo2.SquadName);
                return;
            }
            this.PopulatePlayerInfo(AccountSyncAccountType.SingleAccount, playerIdentityInfo.PlayerName, playerIdentityInfo.HQLevel, playerIdentityInfo.Medals, playerIdentityInfo.Faction, playerIdentityInfo.SquadName);
        }
Beispiel #3
0
 private void OnGetOtherPlayerIdentity(PlayerIdentityInfo info)
 {
     this.oppositePlayerInfo = info;
     if (base.IsLoaded())
     {
         this.InitPlayerInfo(this.oppositePlayerInfo);
     }
 }
Beispiel #4
0
 private void OnGetOtherPlayerIdentity(PlayerIdentityGetResponse response, object cookie)
 {
     this.otherPlayerIdentityInfo = response.Info;
     PlayerIdentityController.GetOtherPlayerIdentityCallback getOtherPlayerIdentityCallback = cookie as PlayerIdentityController.GetOtherPlayerIdentityCallback;
     if (getOtherPlayerIdentityCallback != null)
     {
         getOtherPlayerIdentityCallback(this.otherPlayerIdentityInfo);
     }
 }
Beispiel #5
0
 private void InitPlayerInfo(PlayerIdentityInfo playerInfo)
 {
     base.GetElement <UXLabel>("LabelCallsign" + this.factionSuffix).Text     = this.lang.Get("FACTION_FLIP_CALL_SIGN", new object[0]);
     base.GetElement <UXLabel>("LabelCallsignName" + this.factionSuffix).Text = ((playerInfo.PlayerName == null) ? this.lang.Get("general_none", new object[0]) : playerInfo.PlayerName);
     base.GetElement <UXLabel>("LabelHQLEVEL" + this.factionSuffix).Text      = this.lang.Get("FACTION_FLIP_HQ_LEVEL", new object[]
     {
         playerInfo.HQLevel
     });
     base.GetElement <UXLabel>("LabelMedalCount" + this.factionSuffix).Text = this.lang.Get("FACTION_FLIP_MEDALS", new object[]
     {
         playerInfo.Medals
     });
     base.GetElement <UXLabel>("LabelSquad" + this.factionSuffix).Text     = this.lang.Get("FACTION_FLIP_SQUAD", new object[0]);
     base.GetElement <UXLabel>("LabelSquadName" + this.factionSuffix).Text = ((playerInfo.SquadName == null) ? this.lang.Get("general_none", new object[0]) : playerInfo.SquadName);
     this.swapButton.Enabled = true;
     this.groupStats.Visible = true;
 }
Beispiel #6
0
        public override ISerializable FromObject(object obj)
        {
            Dictionary <string, object> dictionary = obj as Dictionary <string, object>;

            if (dictionary != null)
            {
                if (dictionary.ContainsKey("identities"))
                {
                    Dictionary <string, object> dictionary2 = dictionary["identities"] as Dictionary <string, object>;
                    if (dictionary2 != null)
                    {
                        foreach (KeyValuePair <string, object> current in dictionary2)
                        {
                            PlayerIdentityInfo playerIdentityInfo = new PlayerIdentityInfo();
                            playerIdentityInfo.FromObject(current.Value);
                            this.PlayerIdentities.Add(current.Key, playerIdentityInfo);
                        }
                    }
                }
                if (dictionary.ContainsKey("secret"))
                {
                    this.Secret = (string)dictionary["secret"];
                }
                if (dictionary.ContainsKey("registrationTime"))
                {
                    this.LastSyncedTimeStamp = Convert.ToInt32((string)dictionary["registrationTime"]);
                }
                if (dictionary.ContainsKey("derivedExternalAccountId"))
                {
                    this.DerivedExternalAccountId = (string)dictionary["derivedExternalAccountId"];
                }
                if (dictionary.ContainsKey("registrationReward"))
                {
                    this.ExternalAccountReward = Convert.ToInt32((string)dictionary["registrationReward"]);
                }
            }
            return(this);
        }
        private void OnOtherPlayerIdentityFetched(PlayerIdentityInfo info)
        {
            AccountSyncAccountType typeForMultipleAccountId = this.GetTypeForMultipleAccountId(info.PlayerId);

            this.PopulatePlayerInfo(typeForMultipleAccountId, info.PlayerName, info.HQLevel, info.Medals, info.Faction, info.SquadName);
        }
Beispiel #8
0
 public override void OnDestroyElement()
 {
     this.oppositePlayerInfo = null;
     base.OnDestroyElement();
 }
 public PlayerIdentityGetResponse()
 {
     this.Info = new PlayerIdentityInfo();
 }