private void ShowPlayScreen(int oldScreenIndex, int newScreenIndex) { if (newScreenIndex >= 0 && newScreenIndex < PlayScreens.Count) { FrameworkElement screen = CreatePlayScreen(newScreenIndex); _playContainer2.Child = screen; if (oldScreenIndex < newScreenIndex) { PlayScreenDirection = PlayScreenDirection.Next; Storyboard slide = (Storyboard)screen.TryFindResource("SlideFromRight"); if (slide != null) { slide.Begin(screen); } } else { PlayScreenDirection = PlayScreenDirection.Prev; Storyboard slide = (Storyboard)screen.TryFindResource("SlideFromLeft"); if (slide != null) { slide.Begin(screen); } } PlayScreenDirection = PlayScreenDirection.Current; Player.SelectedLocation = Locations[0]; } }
private void ShowPlayScreen(int oldScreenIndex, int newScreenIndex) { if (newScreenIndex >= 0 && newScreenIndex < PlayScreens.Count) { FrameworkElement screen = CreatePlayScreen(newScreenIndex); _playContainer2.Child = screen; screen.UpdateLayout(); if (oldScreenIndex < newScreenIndex) { PlayScreenDirection = PlayScreenDirection.Next; } else { PlayScreenDirection = PlayScreenDirection.Prev; } OnPropertyChanged("PlayScreenDirection"); PlayScreenDirection = PlayScreenDirection.Current; OnPropertyChanged("PlayScreenDirection"); Player.SelectedLocation = Locations[0]; } }
public ViewModel(FrameworkElement root) { MenuCommand = new DelegateCommand(OnMenu); PlayCommand = new DelegateCommand(OnPlay); OptionsCommand = new DelegateCommand(OnOptions); QuitCommand = new DelegateCommand(OnQuit); FightCommand = new DelegateCommand(OnFight); PrevCommand = new DelegateCommand(OnPrev); NextCommand = new DelegateCommand(OnNext); FadeCompletedCommand = new DelegateCommand(OnFadeCompleted); SlideCompletedCommand = new DelegateCommand(OnSlideCompleted); Race human = new Race { Name = "Human" }; human.Classes.Add(new RaceClass { Name = "Knight", Image = "pack://application:,,,/Assets/NoesisGUI/Samples/NorthGame/Images/ClassHumanKnight.png" }); human.Classes.Add(new RaceClass { Name = "Thief", Image = "pack://application:,,,/Assets/NoesisGUI/Samples/NorthGame/Images/ClassHumanThief.png" }); human.Classes.Add(new RaceClass { Name = "Cleric", Image = "pack://application:,,,/Assets/NoesisGUI/Samples/NorthGame/Images/ClassHumanCleric.png" }); Race orc = new Race { Name = "Orc" }; orc.Classes.Add(new RaceClass { Name = "Warrior", Image = "pack://application:,,,/Assets/NoesisGUI/Samples/NorthGame/Images/ClassOrcWarrior.png" }); orc.Classes.Add(new RaceClass { Name = "Hunter", Image = "pack://application:,,,/Assets/NoesisGUI/Samples/NorthGame/Images/ClassOrcHunter.png" }); orc.Classes.Add(new RaceClass { Name = "Shaman", Image = "pack://application:,,,/Assets/NoesisGUI/Samples/NorthGame/Images/ClassOrcShaman.png" }); Race elf = new Race { Name = "Elf" }; elf.Classes.Add(new RaceClass { Name = "Ranger", Image = "pack://application:,,,/Assets/NoesisGUI/Samples/NorthGame/Images/ClassElfRanger.png" }); elf.Classes.Add(new RaceClass { Name = "Priest", Image = "pack://application:,,,/Assets/NoesisGUI/Samples/NorthGame/Images/ClassElfPriest.png" }); elf.Classes.Add(new RaceClass { Name = "Wizard", Image = "pack://application:,,,/Assets/NoesisGUI/Samples/NorthGame/Images/ClassElfWizard.png" }); Races = new List <Race> { human, orc, elf }; WeaponCategory closeRange = new WeaponCategory { Name = "Close Range" }; closeRange.Weapons.Add(new Weapon { Name = "Double Axe", Image = "pack://application:,,,/Assets/NoesisGUI/Samples/NorthGame/Images/WeaponDoubleAxe.png" }); closeRange.Weapons.Add(new Weapon { Name = "Long Sword", Image = "pack://application:,,,/Assets/NoesisGUI/Samples/NorthGame/Images/WeaponLongSword.png" }); closeRange.Weapons.Add(new Weapon { Name = "Hand Axe", Image = "pack://application:,,,/Assets/NoesisGUI/Samples/NorthGame/Images/WeaponHandAxe.png" }); closeRange.Weapons.Add(new Weapon { Name = "Double Sword", Image = "pack://application:,,,/Assets/NoesisGUI/Samples/NorthGame/Images/WeaponDoubleSword.png" }); closeRange.Weapons.Add(new Weapon { Name = "Mace", Image = "pack://application:,,,/Assets/NoesisGUI/Samples/NorthGame/Images/WeaponMace.png" }); closeRange.SelectedWeapon = closeRange.Weapons[0]; WeaponCategory longRange = new WeaponCategory { Name = "Long Range" }; longRange.Weapons.Add(new Weapon { Name = "Long Bow", Image = "pack://application:,,,/Assets/NoesisGUI/Samples/NorthGame/Images/WeaponLongBow.png" }); longRange.Weapons.Add(new Weapon { Name = "Crossbow", Image = "pack://application:,,,/Assets/NoesisGUI/Samples/NorthGame/Images/WeaponCrossbow.png" }); longRange.Weapons.Add(new Weapon { Name = "Sling", Image = "pack://application:,,,/Assets/NoesisGUI/Samples/NorthGame/Images/WeaponSling.png" }); longRange.Weapons.Add(new Weapon { Name = "Spear", Image = "pack://application:,,,/Assets/NoesisGUI/Samples/NorthGame/Images/WeaponSpear.png" }); longRange.SelectedWeapon = longRange.Weapons[0]; WeaponCategory armor = new WeaponCategory { Name = "Armor" }; armor.Weapons.Add(new Weapon { Name = "Round Shield", Image = "pack://application:,,,/Assets/NoesisGUI/Samples/NorthGame/Images/WeaponRoundShield.png" }); armor.Weapons.Add(new Weapon { Name = "Chain Mail", Image = "pack://application:,,,/Assets/NoesisGUI/Samples/NorthGame/Images/WeaponChainMail.png" }); armor.Weapons.Add(new Weapon { Name = "Big Shield", Image = "pack://application:,,,/Assets/NoesisGUI/Samples/NorthGame/Images/WeaponBigShield.png" }); armor.Weapons.Add(new Weapon { Name = "Breastplate", Image = "pack://application:,,,/Assets/NoesisGUI/Samples/NorthGame/Images/WeaponBreastplate.png" }); armor.Weapons.Add(new Weapon { Name = "Helmet", Image = "pack://application:,,,/Assets/NoesisGUI/Samples/NorthGame/Images/WeaponHelmet.png" }); armor.SelectedWeapon = armor.Weapons[0]; WeaponCategory magic = new WeaponCategory { Name = "Magic" }; magic.Weapons.Add(new Weapon { Name = "Wand", Image = "pack://application:,,,/Assets/NoesisGUI/Samples/NorthGame/Images/WeaponWand.png" }); magic.Weapons.Add(new Weapon { Name = "Staff", Image = "pack://application:,,,/Assets/NoesisGUI/Samples/NorthGame/Images/WeaponStaff.png" }); magic.Weapons.Add(new Weapon { Name = "Spell Book", Image = "pack://application:,,,/Assets/NoesisGUI/Samples/NorthGame/Images/WeaponSpellBook.png" }); magic.SelectedWeapon = magic.Weapons[0]; Locations = new List <Location>(); Locations.Add(new Location { Name = "The Spark Range", Members = 45, Type = RaidType.Defend, Difficulty = RaidDifficulty.Hard, Image = "pack://application:,,,/Assets/NoesisGUI/Samples/NorthGame/Images/Location1.jpg" }); Locations.Add(new Location { Name = "Frirf Woods", Members = 20, Type = RaidType.Explore, Difficulty = RaidDifficulty.Easy, Image = "pack://application:,,,/Assets/NoesisGUI/Samples/NorthGame/Images/Location2.jpg" }); Locations.Add(new Location { Name = "The Ymart Plains", Members = 30, Type = RaidType.Arena, Difficulty = RaidDifficulty.Normal, Image = "pack://application:,,,/Assets/NoesisGUI/Samples/NorthGame/Images/Location3.jpg" }); Locations.Add(new Location { Name = "Rusty Wallaby Grove", Members = 5, Type = RaidType.Defend, Difficulty = RaidDifficulty.Normal, Image = "pack://application:,,,/Assets/NoesisGUI/Samples/NorthGame/Images/Location4.jpg" }); Locations.Add(new Location { Name = "Sapphire Shallows", Members = 40, Type = RaidType.Arena, Difficulty = RaidDifficulty.Hard, Image = "pack://application:,,,/Assets/NoesisGUI/Samples/NorthGame/Images/Location5.jpg" }); Locations.Add(new Location { Name = "The Seagrass Islet", Members = 25, Type = RaidType.Explore, Difficulty = RaidDifficulty.Easy, Image = "pack://application:,,,/Assets/NoesisGUI/Samples/NorthGame/Images/Location6.jpg" }); Locations.Add(new Location { Name = "The Spark Range", Members = 45, Type = RaidType.Arena, Difficulty = RaidDifficulty.Easy, Image = "pack://application:,,,/Assets/NoesisGUI/Samples/NorthGame/Images/Location1.jpg" }); Locations.Add(new Location { Name = "Frirf Woods", Members = 20, Type = RaidType.Defend, Difficulty = RaidDifficulty.Normal, Image = "pack://application:,,,/Assets/NoesisGUI/Samples/NorthGame/Images/Location2.jpg" }); Locations.Add(new Location { Name = "The Ymart Plains", Members = 30, Type = RaidType.Explore, Difficulty = RaidDifficulty.Normal, Image = "pack://application:,,,/Assets/NoesisGUI/Samples/NorthGame/Images/Location3.jpg" }); Locations.Add(new Location { Name = "Rusty Wallaby Grove", Members = 5, Type = RaidType.Defend, Difficulty = RaidDifficulty.Hard, Image = "pack://application:,,,/Assets/NoesisGUI/Samples/NorthGame/Images/Location4.jpg" }); Locations.Add(new Location { Name = "Sapphire Shallows", Members = 40, Type = RaidType.Arena, Difficulty = RaidDifficulty.Easy, Image = "pack://application:,,,/Assets/NoesisGUI/Samples/NorthGame/Images/Location5.jpg" }); Locations.Add(new Location { Name = "The Seagrass Islet", Members = 25, Type = RaidType.Explore, Difficulty = RaidDifficulty.Normal, Image = "pack://application:,,,/Assets/NoesisGUI/Samples/NorthGame/Images/Location6.jpg" }); Player = new PlayerInfo { Name = "Highlander", Race = Races[0], Class = Races[0].Classes[0], Initiative = Randomizer.r.Next(50, 150), Wins = Randomizer.r.Next(20, 30), Losses = Randomizer.r.Next(1, 10), Odds = Randomizer.r.Next(80, 120) }; Race opponentRace = Races[Randomizer.r.Next(0, 2)]; string[] opponentNames = { "Khorlsendukr", "Nettala", "Belarlug", "Kumar", "Jiduaz", "Nazzous", "Ookhin", "Gunaq" }; Opponent = new PlayerInfo { Name = opponentNames[Randomizer.r.Next(0, 7)], Race = opponentRace, Class = opponentRace.Classes[Randomizer.r.Next(0, 2)], Initiative = Randomizer.r.Next(50, 150), Wins = Randomizer.r.Next(50, 100), Losses = Randomizer.r.Next(20, 50), Odds = Randomizer.r.Next(80, 120) }; Player.WeaponCategories.Add(closeRange); Player.WeaponCategories.Add(longRange); Player.WeaponCategories.Add(armor); Player.WeaponCategories.Add(magic); Player.SelectedCategory = Player.WeaponCategories[0]; Player.SelectedLocation = Locations[0]; PlayScreens = new List <string> { "Select", "Equip", "Raid", "Fight" }; PlayScreenDirection = PlayScreenDirection.Current; NewMessages = Randomizer.r.Next(3, 8); Credits = Randomizer.r.Next(30000, 80000); NextGame = string.Format("{0} mins", Randomizer.r.Next(20, 50)); _container1 = (Border)root.FindName("Container1"); _container2 = (Border)root.FindName("Container2"); OnMenu(null); }