示例#1
0
        private void AntiblockCardSelected()
        {
            ListBoxItems.Show();
            ButtonUseCard.Show();
            ButtonDiscardCard.Show();

            PlayerSet myPlayer = Game.Players.Where(player => player.Name == Game.Player.Name).First();

            if (myPlayer.Blocks.HasValue)
            {
                if (Game.Player.SelectedCard.BlockType.Value.HasFlag(BlockType.Cart))
                {
                    if (myPlayer.Blocks.Value.HasFlag(BlockType.Cart))
                    {
                        ListBoxItems.Items.Add(BlockType.Cart);
                    }
                }
                if (Game.Player.SelectedCard.BlockType.Value.HasFlag(BlockType.Lantern))
                {
                    if (myPlayer.Blocks.Value.HasFlag(BlockType.Lantern))
                    {
                        ListBoxItems.Items.Add(BlockType.Lantern);
                    }
                }
                if (Game.Player.SelectedCard.BlockType.Value.HasFlag(BlockType.Pickaxe))
                {
                    if (myPlayer.Blocks.Value.HasFlag(BlockType.Pickaxe))
                    {
                        ListBoxItems.Items.Add(BlockType.Pickaxe);
                    }
                }
            }
        }
示例#2
0
 private void ButtonUseCard_Click(object sender, EventArgs e)
 {
     if (Game.Player.SelectedCard.Type == CardType.Block)
     {
         if (ListBoxItems.SelectedItem != null)
         {
             if (((PlayerSet)ListBoxItems.SelectedItem).Blocks.HasValue)
             {
                 ((PlayerSet)ListBoxItems.SelectedItem).Blocks = ((PlayerSet)ListBoxItems.SelectedItem).Blocks | Game.Player.SelectedCard.BlockType;
             }
             else
             {
                 ((PlayerSet)ListBoxItems.SelectedItem).Blocks = Game.Player.SelectedCard.BlockType;
             }
             EndTurn();
         }
     }
     if (Game.Player.SelectedCard.Type == CardType.AntiBlock)
     {
         if (ListBoxItems.SelectedItem != null)
         {
             PlayerSet blockedPlayer = Game.Players.Where(player => player.Name == Game.Player.Name).First();
             blockedPlayer.Blocks = blockedPlayer.Blocks ^ (BlockType)ListBoxItems.SelectedItem;
             EndTurn();
         }
     }
 }
示例#3
0
文件: Game.cs 项目: Karolas/Sabateur
        public static void AssignRandomCard(string playerName)
        {
            PlayerSet player = Players.Find(playerName);

            CardSet[] cards = Cards.Where(card => card.Owner == "Deck").ToArray();
            cards[RandNumGen.Next(0, cards.Count() - 1)].Owner = playerName;

            SqlWorker.SaveData();
        }
示例#4
0
文件: Game.cs 项目: Karolas/Sabateur
        private static PlayerSet CratePlayer(string name)
        {
            PlayerSet deck = new PlayerSet();

            deck.Name       = name;
            deck.IsTurn     = false;
            deck.IsSabateur = false;
            deck.Score      = 0;

            return(deck);
        }
示例#5
0
 public bool IsTurn()
 {
     if (Connection.State == System.Data.ConnectionState.Closed)
     {
         Connection.Open();
         PlayerSet curPlayer = db.PlayerSet.Find(Game.Player.Name);
         if (curPlayer != null && curPlayer.IsTurn == true)
         {
             Connection.Close();
             Game.Player.IsTurn = true;
             return(true);
         }
         else
         {
             Connection.Close();
             return(false);
         }
     }
     else
     {
         return(false);
     }
 }