private void InitFacebookData() { this.friendTexture.Visible = false; ISocialDataController iSocialDataController = Service.ISocialDataController; Dictionary <string, SocialFriendData> playerIdToFriendData = iSocialDataController.PlayerIdToFriendData; SocialFriendData socialFriendData = null; if (this.player.PlayerID == Service.CurrentPlayer.PlayerId && iSocialDataController.FacebookId != null) { iSocialDataController.GetSelfPicture(new OnGetProfilePicture(this.OnGetProfilePicture), this.friendTexture); } else if (playerIdToFriendData != null && playerIdToFriendData.TryGetValue(this.player.PlayerID, out socialFriendData)) { if (!string.IsNullOrEmpty(socialFriendData.Name)) { string[] array = socialFriendData.Name.Split(new char[] { ' ' }); this.nameLabel.Text = Service.Lang.Get("PLAYER_NAME_AND_REAL_NAME", new object[] { this.player.PlayerName, array[0] }); } if (this.tab == SocialTabs.Friends) { iSocialDataController.GetFriendPicture(socialFriendData, new OnGetProfilePicture(this.OnGetProfilePicture), this.friendTexture); } } }
private void ShowFacebookCallToAction(bool show) { base.GetElement <UXElement>("FacebookConnect").Visible = show; base.GetElement <UXElement>("FriendPics").Visible = !show; if (show) { UXLabel element = base.GetElement <UXLabel>("LabelCrystalCount"); UXLabel element2 = base.GetElement <UXLabel>("LabelCrystals"); if (Service.CurrentPlayer.IsConnectedAccount) { element.Visible = false; element2.Visible = false; base.GetElement <UXElement>("SpriteIcoCrystal").Visible = false; } else { element.Text = this.lang.Get("GET_AMOUNT", new object[] { GameConstants.FB_CONNECT_REWARD }); element2.Text = this.lang.Get("CRYSTALS", new object[0]); } } else { ISocialDataController iSocialDataController = Service.ISocialDataController; iSocialDataController.FriendsDetailsCB = new OnFBFriendsDelegate(this.OnFBDataPopulated); Service.ISocialDataController.CheckFacebookLoginOnStartup(); } }
private void OnFBDataPopulated() { bool flag = false; ServerAPI serverAPI = Service.ServerAPI; if (!serverAPI.Enabled && Service.CurrentPlayer.CampaignProgress.FueInProgress) { serverAPI.Enabled = true; flag = true; } ISocialDataController iSocialDataController = Service.ISocialDataController; iSocialDataController.FriendsDetailsCB = new OnFBFriendsDelegate(this.RefreshFriendData); iSocialDataController.UpdateFriends(); if (flag) { serverAPI.Enabled = false; } }
public override void OnDestroyElement() { ISocialDataController socialDataController = Service.Get <ISocialDataController>(); for (int i = 0; i < this.loadedFBTextures.Count; i++) { socialDataController.DestroyFriendPicture(this.loadedFBTextures[i]); } this.loadedFBTextures = null; if (this.empireGrid != null) { this.empireGrid.Clear(); this.empireGrid = null; } if (this.rebelGrid != null) { this.rebelGrid.Clear(); this.rebelGrid = null; } base.OnDestroyElement(); }
private void ShowFacebookCallToAction(bool show) { base.GetElement <UXElement>("FacebookConnect").Visible = show; base.GetElement <UXElement>("FriendPics").Visible = !show; if (!show) { bool flag = false; ServerAPI serverAPI = Service.Get <ServerAPI>(); if (!serverAPI.Enabled && Service.Get <CurrentPlayer>().CampaignProgress.FueInProgress) { serverAPI.Enabled = true; flag = true; } ISocialDataController socialDataController = Service.Get <ISocialDataController>(); socialDataController.FriendsDetailsCB = new OnFBFriendsDelegate(this.RefreshFriendData); socialDataController.UpdateFriends(); if (flag) { serverAPI.Enabled = false; } return; } UXLabel element = base.GetElement <UXLabel>("LabelCrystalCount"); UXLabel element2 = base.GetElement <UXLabel>("LabelCrystals"); if (Service.Get <CurrentPlayer>().IsConnectedAccount) { element.Visible = false; element2.Visible = false; base.GetElement <UXElement>("SpriteIcoCrystal").Visible = false; return; } element.Text = this.lang.Get("GET_AMOUNT", new object[] { GameConstants.FB_CONNECT_REWARD }); element2.Text = this.lang.Get("CRYSTALS", new object[0]); }
private void OnVideoDetailsFB(string guid) { VideoData videoData = null; Service.Get <VideoDataManager>().VideoDatas.TryGetValue(guid, out videoData); if (videoData == null) { Service.Get <StaRTSLogger>().ErrorFormat("OnVideoDetailsFB: could not find {0}", new object[] { guid }); return; } ISocialDataController socialDataController = Service.Get <ISocialDataController>(); if (socialDataController.IsLoggedIn) { this.PostFB(videoData); return; } this.videoGuid = guid; socialDataController.Login(new OnAllDataFetchedDelegate(this.OnFBLoggedIn)); }