Esempio n. 1
0
 /// <summary>
 /// Konstruktor
 /// </summary>
 public GameCellContext(GameTableContext gameTable, Hexagon hexagon)
 {
     if (hexagon == null)
         throw new ArgumentNullException("hexagon");
     GameTable = gameTable;
     _Hexagon = hexagon;
     Player = new Player();
 }
Esempio n. 2
0
 public MessageContext(GameTableContext context, string message, string title, MessageType messageType)
 {
     if (context == null) throw new ArgumentNullException("context");
     if (string.IsNullOrWhiteSpace(message)) throw new ArgumentNullException("message");
     if (title == null) throw new ArgumentNullException("title");
     Context = context;
     Message = message;
     Title = title;
     MessageType = messageType;
 }
Esempio n. 3
0
        public NewGameContext(GameTableContext gameTableContext, IEnumerable<Player> players)
        {
            if (players == null)
                throw new ArgumentNullException("players");
            if (gameTableContext == null)
                throw new ArgumentNullException("gameTableContext");

            GameTableContext = gameTableContext;
            WinnerScore = 9;
            TableSize = 7;
            Open();
            Players = new List<ChoosablePlayer>(players.Select(player => new ChoosablePlayer(player)));
            foreach (var player in Players.Take(2)) {
                player.IsChoosen = true;
            }
        }
Esempio n. 4
0
        private void MainWindow_OnActivated(object sender, EventArgs e)
        {
            var context = new GameTableContext(7, new WPFWindowService(this));

            /*context.GameCells = new List<GameCellContext>()
                                    {
                                        new GameCellContext(context, new Hexagon(10, Material.Iron)) { Value = 1},
                                        new GameCellContext(context, new Hexagon(10, Material.Wheat)) { Value = 2},
                                        new GameCellContext(context, new Hexagon(10, Material.Wood)) { Value = 3},
                                        new GameCellContext(context, new Hexagon(10, Material.Wool)) { Value = 4},
                                    };*/

            /*context.GameCells = new List<GameCellContext>();

            var random = new Random();

            var materials = new[]
            {
                Material.Wood,
                Material.Wool,
                Material.Clay,
                Material.Wheat,
                Material.Iron
            };

            for (var j = 0; j < 7; ++j) {
                for (var i = 0; i < 7 - Math.Abs(3 - j); ++i) {
                    Hexagon h = new Hexagon(10, materials[random.Next(0, materials.Length)], new Hexid(j, i));
                    (context.GameCells as List<GameCellContext>)
                        .Add(new GameCellContext(context, h) { Value = random.Next(2, 13) });
                    GameController.Instance.Hexagons.Add(h);
                }
            }

            GameController.Instance.SetAllNeighbours();*/
            /*NewGameWindow newGameWindow = new NewGameWindow();
            var newGameContext = new NewGameContext(context, 7, new WPFWindowService(newGameWindow));
            newGameWindow.DataContext = newGameContext;

            newGameWindow.ShowDialog();*/
            DataContext = context;
        }
Esempio n. 5
0
 public TradeContext(GameTableContext context, Player player)
 {
     GameTableContext = context;
     Player = player;
 }
Esempio n. 6
0
 public MessageContext(GameTableContext context, string message)
     : this(context, message, string.Empty, MessageType.Information)
 {
 }