public override void LoadContent() { base.LoadContent(); smallFont = ContentManager.Load<SpriteFont>(@"Fonts\KootenaySmall"); availableHeroes = GenerateAvailableHeroes().ToList(); availableAbilities = GenerateAvailableAbilities().OrderBy(x => x.Name).ToList(); availableItems = GenerateAvailableItems().OrderBy(x => x.ArmorClass).OrderBy(x => x.Rarity).ToList(); var grid = new Grid(); grid.Width = Width; grid.Height = Height; grid.Rows.Add(Size.Fixed(80)); grid.Rows.Add(Size.Fixed(40)); grid.Rows.Add(Size.Fill()); grid.Rows.Add(Size.Fixed(120)); grid.Columns.Add(Size.Fill()); Controls.Add(grid); grid.Cells[0, 0].Add(new Label { Text = "Store" }); grid.Cells[1, 0].Add(new Label { Text = Bind(() => "Gold: " + player.Gold) }); var tabControl = new TabControl(); tabControl.Width = ActualWidth - 40; tabControl.Height = ActualHeight - 80 - 40 - 120 - 40; tabControl.AddPage("Heroes", BuildHeroesTabPage()); //tabControl.AddPage("Skills", BuildAbilitiesTabPage()); tabControl.AddPage("Items", BuildItemsTabPage()); //tabControl.AddPage("Tactics", BuildTacticsTabPage()); grid.Cells[2, 0].Add(tabControl); var okButton = CreateButton("Close", Vector2.Zero); okButton.Click += okButton_Click; grid.Cells[3, 0].Add(okButton); }
public override void LoadContent() { base.LoadContent(); var grid = new Grid(); grid.Width = Width; grid.Height = Height; grid.Rows.Add(Size.Fixed(80)); grid.Rows.Add(Size.Fill()); grid.Rows.Add(Size.Fixed(80)); grid.Rows.Add(Size.Fixed(80)); grid.Rows.Add(Size.Fixed(80)); grid.Rows.Add(Size.Fixed(80)); grid.Columns.Add(Size.Fill()); Controls.Add(grid); grid.Cells[0, 0].Add(new Label { Text = "Eternia" }); var startButton = CreateButton("Encounter", Vector2.Zero); startButton.Click += encounterButton_Click; grid.Cells[2, 0].Add(startButton); var storeButton = CreateButton("Store", Vector2.Zero); storeButton.Click += storeButton_Click; grid.Cells[3, 0].Add(storeButton); var equipmentButton = CreateButton("Equipment", Vector2.Zero); equipmentButton.Click += equipmentButton_Click; grid.Cells[4, 0].Add(equipmentButton); var exitButton = CreateButton("Exit", Vector2.Zero); exitButton.Click += quitButton_Click; grid.Cells[5, 0].Add(exitButton); }
public override void LoadContent() { base.LoadContent(); smallFont = ContentManager.Load<SpriteFont>(@"Fonts\KootenaySmall"); var grid = new Grid(); grid.Width = Size.Fill(); grid.Height = Size.Fill(); grid.Rows.Add(Size.Fixed(60)); grid.Rows.Add(Size.Fill()); grid.Rows.Add(Size.Fixed(60)); grid.Rows.Add(Size.Fixed(60)); grid.Rows.Add(Size.Fixed(80)); grid.Columns.Add(Size.Fill()); grid.Columns.Add(Size.Fill()); grid.Columns.Add(Size.Fill()); Controls.Add(grid); grid.Cells[0, 1].Add(new Label { Text = Bind(() => currentActor.Name) }); grid.Cells[1, 0].Add(new Label { Font = smallFont, Foreground = Color.LightGreen, Text = Bind(() => VictoryScreen.GetStatisticsString(currentActor.CurrentStatistics, currentActor.ResourceType, false)) }); equipmentListBox = AddListBox<Item>(grid.Cells[1, 1], Vector2.Zero, 400, 500); equipmentListBox.ZIndex = 0.2f; equipmentListBox.Font = smallFont; UpdateEquipmentList(); inventoryListBox = AddListBox<Item>(grid.Cells[1, 2], Vector2.Zero, 400, 500); inventoryListBox.ZIndex = 0.2f; inventoryListBox.Font = smallFont; UpdateInventoryList(); var prevActorButton = CreateButton("<", Vector2.Zero); prevActorButton.Click += prevActorButton_Click; grid.Cells[0, 0].Add(prevActorButton); var nextActorButton = CreateButton(">", Vector2.Zero); nextActorButton.Click += nextActorButton_Click; grid.Cells[0, 2].Add(nextActorButton); var unequipButton = CreateButton("Unequip", Vector2.Zero); unequipButton.Click += unequipButton_Click; grid.Cells[2, 1].Add(unequipButton); var equipButton = CreateButton("Equip", Vector2.Zero); equipButton.Click += equipButton_Click; grid.Cells[2, 2].Add(equipButton); var deleteButton = CreateButton("Delete", Vector2.Zero); deleteButton.Click += deleteButton_Click; grid.Cells[3, 2].Add(deleteButton); var okButton = CreateButton("Close", Vector2.Zero); okButton.Click += okButton_Click; grid.Cells[4, 1].Add(okButton); }
public override void LoadContent() { base.LoadContent(); smallFont = ContentManager.Load<SpriteFont>(@"Fonts\kootenaySmall"); var grid = new Grid(); grid.Width = Width; grid.Height = Height; grid.Rows.Add(Size.Fill()); grid.Rows.Add(Size.Fixed(30)); grid.Rows.Add(Size.Fill(4)); grid.Rows.Add(Size.Fixed(40)); grid.Rows.Add(Size.Fixed(80)); grid.Rows.Add(Size.Fixed(80)); grid.Columns.Add(Size.Fill()); Controls.Add(grid); grid.Cells[1, 0].Add(new Label { Text = "Select Party Members" }); memberListBox = AddListBox<Actor>(grid.Cells[2,0], Vector2.Zero, 300, 250); memberListBox.EnableCheckBoxes = true; grid.Cells[3, 0].Add(new Label { Font = smallFont, Text = Bind(() => { if (memberListBox.CheckedItems.Any()) { if (memberListBox.CheckedItems.SelectMany(x => x.Equipment).Any()) { var averageItemLevel = Math.Round(memberListBox.CheckedItems.SelectMany(x => x.Equipment).Average(x => x.Level)); return "Average item level: " + averageItemLevel.ToString(); } } return ""; }) }); var startButton = CreateButton("Start", Vector2.Zero); startButton.Click += okButton_Click; grid.Cells[4,0].Add(startButton); var backButton = CreateButton("Back", Vector2.Zero); backButton.Click += backButton_Click; grid.Cells[5, 0].Add(backButton); memberListBox.Items.AddRange(player.Heroes); for (int i = 0; i < memberListBox.Items.Count; i++) { if (i < encounterDefinition.HeroLimit) memberListBox.GetItemContainer(memberListBox.Items[i]).Checked = true; } }
public override void LoadContent() { base.LoadContent(); var grid = new Grid(); grid.Width = Width; grid.Height = Height; grid.Rows.Add(Size.Fill()); grid.Rows.Add(Size.Fill()); grid.Columns.Add(Size.Fill()); Controls.Add(grid); grid.Cells[0, 0].Add(new Label { Text = "You were defeated!" }); var okButton = CreateButton("New Encounter", new Vector2(0, 0)); okButton.Width = 200; okButton.Click += okButton_Click; grid.Cells[1, 0].Add(okButton); }
private Control BuildAbilitiesTabPage() { var grid = new Grid(); grid.Width = ActualWidth - 40; grid.Height = ActualHeight - 80 - 40 - 120 - 40 - 20; grid.Rows.Add(Size.Fill()); grid.Rows.Add(Size.Fixed(100)); grid.Columns.Add(Size.Fill()); grid.Columns.Add(Size.Fill()); grid.Columns.Add(Size.Fill()); var currentHeroesListBox = AddBoundListBox<Actor>(grid.Cells[0, 0], Vector2.Zero, 300, 400); currentHeroesListBox.ZIndex = 0.2f; currentHeroesListBox.Source = player.Heroes; var currentHeroAbilitiesListBox = AddBoundListBox<Ability>(grid.Cells[0, 1], Vector2.Zero, 300, 400); currentHeroAbilitiesListBox.Font = smallFont; currentHeroAbilitiesListBox.ZIndex = 0.2f; currentHeroAbilitiesListBox.Source = Bind<IEnumerable<Ability>>(() => currentHeroesListBox.SelectedItem != null ? currentHeroesListBox.SelectedItem.Abilities : null); currentHeroAbilitiesListBox.ToolTipBinder = x => new AbilityTooltip(currentHeroesListBox.SelectedItem, x) { Font = smallFont }; currentHeroAbilitiesListBox.ColorBinder = x => Bind(() => GetAbilityColor(currentHeroesListBox.SelectedItem, x)); var availableAbilitiesListBox = AddBoundListBox<Ability>(grid.Cells[0, 2], Vector2.Zero, 300, 400); availableAbilitiesListBox.Font = smallFont; availableAbilitiesListBox.ZIndex = 0.2f; availableAbilitiesListBox.Source = availableAbilities; availableAbilitiesListBox.ToolTipBinder = x => new AbilityTooltip(Bind(() => currentHeroesListBox.SelectedItem), x) { Font = smallFont }; availableAbilitiesListBox.ColorBinder = x => Bind(() => GetAbilityColor(currentHeroesListBox.SelectedItem, x)); var sellAbilityButton = CreateButton("Sell Skill", Vector2.Zero); sellAbilityButton.Sound = ContentManager.Load<SoundEffect>(@"Sounds\140380__d-w__coins-38"); sellAbilityButton.Click += () => SellAbility(currentHeroesListBox.SelectedItem, currentHeroAbilitiesListBox.SelectedItem); grid.Cells[1, 1].Add(sellAbilityButton); var buyAbilityButton = CreateButton("Buy Skill", Vector2.Zero); buyAbilityButton.Sound = ContentManager.Load<SoundEffect>(@"Sounds\140380__d-w__coins-38"); buyAbilityButton.Click += () => BuyAbility(currentHeroesListBox.SelectedItem, availableAbilitiesListBox.SelectedItem); grid.Cells[1, 2].Add(buyAbilityButton); return grid; }
private Control BuildTacticsTabPage() { var grid = new Grid(); grid.Width = ActualWidth - 40; grid.Height = ActualHeight - 80 - 40 - 120 - 40 - 20; grid.Rows.Add(Size.Fill()); grid.Rows.Add(Size.Fixed(100)); grid.Columns.Add(Size.Fill()); grid.Columns.Add(Size.Fill()); grid.Columns.Add(Size.Fill()); var availableItemsListBox = AddBoundListBox<TargetingStrategy>(grid.Cells[0, 2], Vector2.Zero, 300, 400); availableItemsListBox.ZIndex = 0.2f; availableItemsListBox.Source = TargetingStrategy.All(); //availableItemsListBox.ToolTipBinder = x => new ItemTooltip(x) { Font = smallFont, ShowUpgrade = Bind(() => currentHeroesListBox.SelectedItem != null), Upgrade = Bind(() => currentHeroesListBox.SelectedItem.GetItemUpgrade(x)) }; availableItemsListBox.ColorBinder = x => Bind(() => GetTargetingStrategyColor(x)); var buyItemButton = CreateButton("Buy Tactic", Vector2.Zero); buyItemButton.Click += () => BuyTargettingStrategy(availableItemsListBox.SelectedItem); grid.Cells[1, 2].Add(buyItemButton); return grid; }
private Control BuildItemsTabPage() { var grid = new Grid(); grid.Width = ActualWidth - 40; grid.Height = ActualHeight - 80 - 40 - 120 - 40 - 20; grid.Rows.Add(Size.Fill()); grid.Rows.Add(Size.Fixed(100)); grid.Columns.Add(Size.Fill()); grid.Columns.Add(Size.Fill()); grid.Columns.Add(Size.Fill()); var currentHeroesListBox = AddBoundListBox<Actor>(grid.Cells[0, 0], Vector2.Zero, 300, 400); currentHeroesListBox.ZIndex = 0.2f; currentHeroesListBox.Source = player.Heroes; var currentItemsListBox = AddBoundListBox<Item>(grid.Cells[0, 1], Vector2.Zero, 300, 400); currentItemsListBox.ZIndex = 0.2f; currentItemsListBox.Source = player.Inventory; currentItemsListBox.ToolTipBinder = x => new ItemTooltip(x) { Font = smallFont, ShowUpgrade = false }; currentItemsListBox.ColorBinder = x => Bind(() => ItemTooltip.GetItemColor(x.Rarity)); currentItemsListBox.Font = smallFont; var availableItemsListBox = AddBoundListBox<Item>(grid.Cells[0, 2], Vector2.Zero, 300, 400); availableItemsListBox.ZIndex = 0.2f; availableItemsListBox.Source = availableItems; availableItemsListBox.ToolTipBinder = x => new ItemTooltip(x) { Font = smallFont, ShowUpgrade = Bind(() => currentHeroesListBox.SelectedItem != null), Upgrade = Bind(() => currentHeroesListBox.SelectedItem.GetItemUpgrade(x)) }; availableItemsListBox.ColorBinder = x => Bind(() => ItemTooltip.GetItemColor(x.Rarity)); availableItemsListBox.Font = smallFont; var sellItemButton = CreateButton("Sell Item", Vector2.Zero); sellItemButton.Sound = ContentManager.Load<SoundEffect>(@"Sounds\140380__d-w__coins-38"); sellItemButton.Click += () => SellItem(currentItemsListBox.SelectedItem); grid.Cells[1, 1].Add(sellItemButton); var buyItemButton = CreateButton("Buy Item", Vector2.Zero); buyItemButton.Sound = ContentManager.Load<SoundEffect>(@"Sounds\140380__d-w__coins-38"); buyItemButton.Click += () => BuyItem(availableItemsListBox.SelectedItem); grid.Cells[1, 2].Add(buyItemButton); return grid; }
private Control BuildHeroesTabPage() { var grid = new Grid(); grid.Width = ActualWidth - 40; grid.Height = ActualHeight - 80 - 40 - 120 - 40 - 20; grid.Rows.Add(Size.Fixed(60)); grid.Rows.Add(Size.Fill()); grid.Rows.Add(Size.Fixed(100)); grid.Columns.Add(Size.Fill()); grid.Columns.Add(Size.Fill()); grid.Columns.Add(Size.Fill()); grid.Columns.Add(Size.Fill()); grid.Cells[0, 0].Add(new Label { Text = "Current Heroes" }); grid.Cells[0, 3].Add(new Label { Text = "Available Heroes" }); var currentHeroesListBox = AddBoundListBox<Actor>(grid.Cells[1, 0], Vector2.Zero, 300, 400); currentHeroesListBox.ZIndex = 0.2f; currentHeroesListBox.Source = player.Heroes; var availableHeroesListBox = AddBoundListBox<ActorDefinition>(grid.Cells[1, 3], Vector2.Zero, 300, 400); availableHeroesListBox.ZIndex = 0.2f; availableHeroesListBox.Source = availableHeroes; availableHeroesListBox.ColorBinder = x => Bind(() => GetHeroColor(x)); grid.Cells[1, 1].Add(new Label { Text = Bind(() => GetHeroStatistics(currentHeroesListBox)) }); grid.Cells[1, 2].Add(new Label { Text = Bind(() => GetHeroStatistics(availableHeroesListBox )) }); var sellHeroButton = CreateButton("Sell Hero", Vector2.Zero); sellHeroButton.Sound = ContentManager.Load<SoundEffect>(@"Sounds\140380__d-w__coins-38"); sellHeroButton.Click += () => SellHero(currentHeroesListBox.SelectedItem); grid.Cells[2, 0].Add(sellHeroButton); var buyHeroButton = CreateButton("Buy Hero", Vector2.Zero); buyHeroButton.Sound = ContentManager.Load<SoundEffect>(@"Sounds\140380__d-w__coins-38"); buyHeroButton.Click += () => BuyHero(availableHeroesListBox.SelectedItem); grid.Cells[2, 3].Add(buyHeroButton); return grid; }
public GridCellCollection(Grid grid) { this.grid = grid; this.cells = new Dictionary<int, Dictionary<int, ControlCollection>>(); }
public override void LoadContent() { base.LoadContent(); smallFont = ContentManager.Load<SpriteFont>(@"Fonts\KootenaySmall"); var grid = new Grid(); grid.Width = Width; grid.Height = Height; grid.Rows.Add(Size.Fixed(80)); grid.Rows.Add(Size.Fill(2)); grid.Rows.Add(Size.Fill()); grid.Rows.Add(Size.Fixed(80)); grid.Columns.Add(Size.Fill()); Controls.Add(grid); grid.Cells[0, 0].Add(new Label { Text = "Victory!" }); ItemGenerator generator = new ItemGenerator(new Randomizer()); rewardsListBox = AddListBox<Item>(grid.Cells[1, 0], Vector2.Zero, 450, 250); rewardsListBox.ZIndex = 0.2f; rewardsListBox.EnableCheckBoxes = true; Random random = new Random(); for (int i = 0; i < 5 + random.Between(0, battle.Actors.Sum(x => x.CurrentStatistics.For<ExtraRewards>().Value)); i++) { //var item = encounterDefinition.Loot.Any() ? random.From(encounterDefinition.Loot) : generator.Generate(encounterDefinition.ItemLevel); var item = new Item(generator.Generate(encounterDefinition.ItemLevel)); rewardsListBox.Items.Add(item, new ItemTooltip(item) { Font = smallFont }, ItemTooltip.GetItemColor(item.Rarity)); } var okButton = CreateButton("OK", Vector2.Zero); okButton.Click += okButton_Click; grid.Cells[3, 0].Add(okButton); }