public Market() { InitializeComponent(); player = player = JsonConvert.DeserializeObject <DefaultChar>(App.Current.Properties["Player"].ToString()); BindingContext = new ItemsMVVM(); StkCurrentXP.BindingContext = player; }
private async void BtnStartGame(object sender, EventArgs e) { if (PointBuy == 0) { if (entryName.Text.Length > 0 && entryName.Text != null) { player = new DefaultChar(Str, Def, Dex, Wis, entryName.Text); } else { await DisplayAlert("Error", "Please, give your char a name", "OK"); return; } string json = JsonConvert.SerializeObject(player); if (App.Current.Properties.ContainsKey("Player")) { App.Current.Properties.Remove("Player"); } App.Current.Properties.Add("Player", json); if (Device.RuntimePlatform == Device.Android) { DependencyService.Get <Imessage>().ShortAlert("Char created succesfully"); } App.Current.MainPage = new NavigationPage(new PrimaryPage()); } else { await DisplayAlert("Error", "Please, spend all your points before continuing", "OK"); } }
public StatusPage() { InitializeComponent(); player = JsonConvert.DeserializeObject <DefaultChar>(App.Current.Properties["Player"].ToString()); BindingContext = player; Title = player.Name + " Status"; }
public ItemsMVVM() { player = player = JsonConvert.DeserializeObject <DefaultChar>(App.Current.Properties["Player"].ToString()); Random rdn = new Random(); string[] names = { "Golden", "Darkness", "Holy", "Iron", "Steel", "Void", "Obsidian" }; List = new ObservableCollection <Items>(); for (int x = 0; x < 5; x++) { List.Add(new HeavyArmor { Name = names[rdn.Next(6)] + " Breastplate", LVL = rdn.Next(player.LVL * 2) + 1 }); List.Add(new HeavyWeapon { Name = names[rdn.Next(6)] + " Sword", LVL = rdn.Next(player.LVL * 2) + 1 }); List.Add(new MediumArmor { Name = names[rdn.Next(6)] + " Cuirass", LVL = rdn.Next(player.LVL * 2) + 1 }); List.Add(new MediumWeapon { Name = names[rdn.Next(6)] + " Dagger", LVL = rdn.Next(player.LVL * 2) + 1 }); List.Add(new LightArmor { Name = names[rdn.Next(6)] + " Robe", LVL = rdn.Next(player.LVL * 2) + 1 }); List.Add(new LightWeapon { Name = names[rdn.Next(6)] + " Wand", LVL = rdn.Next(player.LVL * 2) + 1 }); } //TODO - implement cost = 25/100 * (this.LVL*100) }
public PrimaryPage() { InitializeComponent(); var json = App.Current.Properties["Player"]; player = JsonConvert.DeserializeObject <DefaultChar>(json.ToString()); Title = player.Name + " Estate"; LblTest.Text = json.ToString(); }
public TrainingPage() { InitializeComponent(); List <string> attributes = new List <string> { "Strenght", "Defense", "Dexterity", "Wisdom" }; pkrAttribute.ItemsSource = attributes; var json = App.Current.Properties["Player"]; player = JsonConvert.DeserializeObject <DefaultChar>(json.ToString()); LblXPLeft.Text = "Current XP: " + player.XP; Title = player.Name + " training area"; }
protected override void OnAppearing() { base.OnAppearing(); player = JsonConvert.DeserializeObject <DefaultChar>(App.Current.Properties["Player"].ToString()); }