public static void Load() { GameAssets.Materials = DeserializeType <Material>(Path.Combine(Environment.CurrentDirectory, @"Data", @"GameAssets\", "Materials.aes")); GameAssets.Artifacts = DeserializeType <Artifact>(Path.Combine(Environment.CurrentDirectory, @"Data", @"GameAssets\", "Artifacts.aes")); GameAssets.Recipes = DeserializeType <Recipe>(Path.Combine(Environment.CurrentDirectory, @"Data", @"GameAssets\", "Recipes.aes")); GameAssets.Ingots = DeserializeType <Ingot>(Path.Combine(Environment.CurrentDirectory, @"Data", @"GameAssets\", "Ingots.aes")); GameAssets.DungeonKeys = DeserializeType <DungeonKey>(Path.Combine(Environment.CurrentDirectory, @"Data", @"GameAssets\", "DungeonKeys.aes")); GameAssets.Monsters = DeserializeType <Monster>(Path.Combine(Environment.CurrentDirectory, @"Data", @"GameAssets\", "Monsters.aes")); GameAssets.Regions = DeserializeType <Region>(Path.Combine(Environment.CurrentDirectory, @"Data", @"GameAssets\", "Regions.aes")); GameAssets.Blessings = DeserializeType <Blessing>(Path.Combine(Environment.CurrentDirectory, @"Data", @"GameAssets\", "Blessings.aes")); GameAssets.ShopOffer = DeserializeType <VendorPattern>(Path.Combine(Environment.CurrentDirectory, @"Data", @"GameAssets\", "ShopOffer.aes")); GameAssets.PriestOffer = DeserializeType <VendorPattern>(Path.Combine(Environment.CurrentDirectory, @"Data", @"GameAssets\", "PriestOffer.aes")); GameAssets.Quests = DeserializeType <Quest>(Path.Combine(Environment.CurrentDirectory, @"Data", @"GameAssets\", "Quests.aes")); GameAssets.Bosses = DeserializeType <Boss>(Path.Combine(Environment.CurrentDirectory, @"Data", @"GameAssets\", "Bosses.aes")); GameAssets.DungeonGroups = DeserializeType <DungeonGroup>(Path.Combine(Environment.CurrentDirectory, @"Data", @"GameAssets\", "DungeonGroups.aes")); GameAssets.Dungeons = DeserializeType <Dungeon>(Path.Combine(Environment.CurrentDirectory, @"Data", @"GameAssets\", "Dungeons.aes")); GameAssets.GameMechanicsTabs = DeserializeType <GameMechanicsTab>(Path.Combine(Environment.CurrentDirectory, @"Data", @"GameAssets\", "GameMechanics.aes")); PostLoad(); // Refresh Pages collection in order to rearrange page bindings. GameAssets.RefreshPages(); GameAssets.CurrentPage = GameAssets.Pages["MainMenu"]; }
public void CreateHeroButton_Click(object sender, RoutedEventArgs e) { var isHeroClassSelected = HeroClassBox.SelectedItems.Count > 0; var isHeroRaceSelected = HeroRaceBox.SelectedItems.Count > 0; if (isHeroClassSelected && isHeroRaceSelected) { var isHeroNameAlphanumericWithSpaces = HeroNameBox.Text.Trim().All(x => char.IsLetterOrDigit(x) || x == ' '); var isHeroNameLengthCorrect = HeroNameBox.Text.Trim().Length is > 0 and <= 15; if (!isHeroNameAlphanumericWithSpaces || !isHeroNameLengthCorrect) { AlertBox.Show("Hero name can contain up to 15 characters.\nValid characters: A-Z, a-z, 0-9, space.", MessageBoxButton.OK); return; } CreateHero(); GameAssets.RefreshPages(); InterfaceHelper.ChangePage(GameAssets.Pages["Town"], "Town"); } else { AlertBox.Show("You must choose both race and class for your hero!", MessageBoxButton.OK); } }
private static void SelectHeroButton_Click(object sender, RoutedEventArgs e) { var selectedHero = (sender as Button)?.Tag as Hero; User.Instance.CurrentHero = selectedHero; if (selectedHero != null) { selectedHero.LoadQuests(); selectedHero.ResumeBlessing(); selectedHero.ReequipArtifacts(); selectedHero.Specializations.UpdateSpecialization(); selectedHero.SessionStartDate = DateTime.Now; selectedHero.RefreshHeroExperience(); GameAssets.RefreshPages(); InterfaceHelper.ChangePage(GameAssets.Pages["Town"], "Town"); selectedHero.ResumeQuest(); } }
public static void ChangeApplicationColorTheme(ColorTheme newTheme) { switch (newTheme) { case ColorTheme.Blue: { const string blueThemeXamlPath = "/UserInterface/Styles/Themes/Blue.xaml"; var newDict = new ResourceDictionary { Source = new Uri(blueThemeXamlPath, UriKind.Relative) }; foreach (var mergedDict in newDict.MergedDictionaries) { Application.Current.Resources.MergedDictionaries.Add(mergedDict); } foreach (var key in newDict.Keys) { Application.Current.Resources[key] = newDict[key]; } break; } case ColorTheme.Orange: { const string orangeThemeXamlPath = "/UserInterface/Styles/Themes/Orange.xaml"; var newDict = new ResourceDictionary { Source = new Uri(orangeThemeXamlPath, UriKind.Relative) }; foreach (var mergedDict in newDict.MergedDictionaries) { Application.Current.Resources.MergedDictionaries.Add(mergedDict); } foreach (var key in newDict.Keys) { Application.Current.Resources[key] = newDict[key]; } break; } case ColorTheme.Pink: { const string pinkThemeXamlPath = "/UserInterface/Styles/Themes/Pink.xaml"; var newDict = new ResourceDictionary { Source = new Uri(pinkThemeXamlPath, UriKind.Relative) }; foreach (var mergedDict in newDict.MergedDictionaries) { Application.Current.Resources.MergedDictionaries.Add(mergedDict); } foreach (var key in newDict.Keys) { Application.Current.Resources[key] = newDict[key]; } break; } } GameAssets.RefreshPages(); }