Example #1
0
        public mainForm()
        {
            InitializeComponent();

            currentGameState = new gameState();
            currentGameState.PlayedLand = false;
            knightsRepo = new KnightsRepository();
            dragonRepo = new DragonsRepository();

            currentGameState.KnightCreatures = knightsRepo.GetKnightCreatures().ToList();
            currentGameState.KnightEnchantments = knightsRepo.GetKnightEnchantments().ToList();
            currentGameState.KnightInstants = knightsRepo.GetKnightInstants().ToList();
            currentGameState.Equipment = knightsRepo.GetKnightEquipment().ToList();

            currentGameState.KnightCards.AddRange(currentGameState.KnightCreatures.Cast<ICard>());
            currentGameState.KnightCards.AddRange(currentGameState.KnightEnchantments.Cast<ICard>());
            currentGameState.KnightCards.AddRange(currentGameState.KnightInstants.Cast<ICard>());
            currentGameState.KnightCards.AddRange(currentGameState.Equipment.Cast<ICard>());
            currentGameState.KnightCards.AddRange(knightsRepo.GetLands().Cast<ICard>());

            currentGameState.DragonCreatures = dragonRepo.GetDragonCreatures().ToList();
            currentGameState.DragonEnchantments = dragonRepo.GetDragonEnchantment().ToList();
            currentGameState.DragonInstants = dragonRepo.GetDragonInstants().ToList();

            currentGameState.DragonCards.AddRange(currentGameState.DragonCreatures.Cast<ICard>());
            currentGameState.DragonCards.AddRange(currentGameState.DragonEnchantments.Cast<ICard>());
            currentGameState.DragonCards.AddRange(currentGameState.DragonInstants.Cast<ICard>());
            currentGameState.DragonCards.AddRange(dragonRepo.GetDragonLands().Cast<ICard>());
            currentGameState.DragonCards.AddRange(dragonRepo.GetDragonArtifacts().Cast<ICard>());

            currentGameState.AllEnchantments = currentGameState.KnightEnchantments.Concat(currentGameState.DragonEnchantments);
        }
        public addEquipmentForm(gameState currentGameState, List<Creature> CreaturesInPlay)
        {
            InitializeComponent();

            CreatureList = CreaturesInPlay;

            foreach (var equipment in currentGameState.Equipment)
            {
                equipmentCB.Items.Add(equipment.ToString());
            }
            equipmentCB.SelectedIndex = 0;

            foreach (Creature c in CreaturesInPlay)
            {
                CreatureCB.Items.Add(c.ToString());
            }

            if (CreaturesInPlay.Count > 0)
            {
                CreatureCB.SelectedIndex = 0;
            }

            equipCreatureCheckBox.Checked = false;
            CreatureCB.Enabled = false;
        }
        // Can make this fancier and if we dont have any Creatures in play, only list the global enchantments
        public addEnchantmentForm(gameState currentGameState, List<Creature> CreaturesInPlay)
        {
            InitializeComponent();
            this.currentGameState = currentGameState;

            EnchantmentList = new List<Enchantment>();

            foreach(var enchantment in currentGameState.AllEnchantments)
            {
                enchantmentCB.Items.Add(enchantment.ToString());

                if(enchantment.GlobalEnchantment == 1)
                {
                    _globalEnchantments.Add(enchantment);
                }
                else
                {
                    _creatureEnchantments.Add(enchantment);
                }
            }

            //enchantmentCB.SelectedIndex = 0;

            CreatureList = new List<Creature>(CreaturesInPlay);

            // initialize our listbox
            if (CreaturesInPlay.Count > 0)
            {
                foreach (Creature c in CreatureList)
                {
                    CreatureCB.Items.Add(c.ToString());
                }
                CreatureCB.SelectedIndex = 0; // this will error if there are no Creatures in play
            }
        }
        public addToHandForm(gameState currentGameState)
        {
            InitializeComponent();

            this.currentGameState = currentGameState;
        }
 public addCreatureForm(gameState currentGameState)
 {
     InitializeComponent();
     // TODO: Complete member initialization
     this.currentGameState = currentGameState;
 }