示例#1
0
        public static Uri FactionIconUri(TagRideProperties properties, FactionProperties faction)
        {
            if (properties == null || faction == null)
            {
                return(null);
            }

            return(new Uri(properties.ThemeResourceBase + faction.IconName));
        }
示例#2
0
        static void OnFactionPropertyChanged(BindableObject bindable, object oldValue, object newValue)
        {
            FactionIconView   view       = bindable as FactionIconView;
            FactionProperties properties = newValue as FactionProperties;

            if (properties != null)
            {
                view.image.Source = ImageSource.FromUri(TagRidePropertyUtils.FactionIconUri(App.Current.TagRideProperties.Value, properties));
                view.label.Text   = properties.Name;
            }
            else
            {
                view.image.Source = null;
                view.label.Text   = "faction";
            }
        }
示例#3
0
        async void OnFactionSelected(FactionProperties faction)
        {
            if (faction == null)
            {
                return;
            }

            string warningText;

            if (!App.Current.GameInfo.HasHadFaction)
            {
                warningText = "You can only change your faction once after this.";
            }
            else
            {
                warningText = "You will not be able to change your faction after this.";
            }

            if (await DisplayAlert(
                    "Faction Selected!",
                    $"You have chosen the faction {faction.Name}! {warningText} Are you sure this is your choice?",
                    "Yes!",
                    "No"))
            {
                if (!await GameService.Instance.PostFactionAsync(App.Current.UserInfo.UserId, faction.Name))
                {
                    await DisplayAlert("Error", "Failed to set faction", "Ok");
                }
                else
                {
                    App.Current.GameInfo.Faction = faction.Name;
                }

                //TODO add loading wheel while faction updates
            }

            factionPicker.ClearSelection();
        }