コード例 #1
0
ファイル: GameBuilder.cs プロジェクト: Gweylorth/SWOP
        public Map BuildMap(BuilderMapStrategy mapStrategy, int randomSeed)
        {
            IMapBuilder mapBuilder;
            switch (mapStrategy)
            {
                case BuilderMapStrategy.Demo:
                    mapBuilder = new DemoMapBuilder();
                    break;

                case BuilderMapStrategy.Small:
                    mapBuilder = new SmallMapBuilder();
                    break;

                case BuilderMapStrategy.Normal:
                    mapBuilder = new NormalMapBuilder();
                    break;

                default:
                    throw new NotImplementedException();
            }

            Map map = mapBuilder.Build(randomSeed);

            return map;
        }
コード例 #2
0
ファイル: GameBuilder.cs プロジェクト: Gweylorth/SWOP
        public IGame Build(BuilderGameStrategy gameStrategy, BuilderMapStrategy mapStrategy, List<Tuple<string, FactionName>> playersInfo)
        {
            LastBuilderGameStrategy = gameStrategy;
            LastBuilderMapStrategy = mapStrategy;

            List<Player> players = BuildPlayers(playersInfo);
            IGame game = null;

            switch (gameStrategy)
            {
                case BuilderGameStrategy.Local:
                    game = new LocalGame(BuildMap(mapStrategy, 0), players);
                    break;

                case BuilderGameStrategy.Server:
                    game = new ServerGame(BuildMap(mapStrategy, 0), players);
                    break;

                case BuilderGameStrategy.Client:
                    game = new ClientGame(null, players);
                    break;

                default:
                    throw new NotImplementedException();
            }
            return game;
        }
コード例 #3
0
ファイル: MainWindow.xaml.cs プロジェクト: Gweylorth/SWOP
        /// <summary>
        /// Creation of a new game
        /// </summary>
        /// <param name="gameStrategy"></param>
        /// <param name="mapStrategy"></param>
        public void NewGame(BuilderGameStrategy gameStrategy, BuilderMapStrategy mapStrategy, List<Tuple<string, FactionName>> listFaction)
        {
            GM.NewGame(gameStrategy, mapStrategy, listFaction);

            // Subscribe to Game events
            GM.CurrentGame.OnStartGame += OnStartGame;
            GM.CurrentGame.OnNextPlayer += OnNextPlayer;
            GM.CurrentGame.OnEndGame += OnEndGame;
            GM.CurrentGame.OnMoveUnit += OnMoveUnit;
            GM.CurrentGame.OnAttackUnit += OnAttackUnit;
            GM.CurrentGame.OnNewChatMessage += OnNewChatMessage;

            // Subscribe to Media event
            this.MediaPlayer.MediaEnded += OnMediaEnded;

            // GUI
            this.btnEndGame.Visibility = Visibility.Collapsed;
            this.btnNextPlayer.Visibility = Visibility.Visible;
            this.btnNextPlayer.Content = "Start Game !";

            if (MapView != null)
                MapView.MapViewGrid.Children.RemoveRange(0, MapView.MapViewGrid.Children.Count);
        }
コード例 #4
0
ファイル: GameMaster.cs プロジェクト: Gweylorth/SWOP
        /// <summary>
        /// Create a new game (map, players...)
        /// </summary>
        public void NewGame(BuilderGameStrategy gameStrategy, BuilderMapStrategy mapStrategy, List<Tuple<string, FactionName>> playersInfo)
        {
            if (CurrentGame != null)
                DestroyGame();

            CurrentGame = GameBuilder.Build(gameStrategy, mapStrategy, playersInfo);
        }
コード例 #5
0
ファイル: MapSelector.xaml.cs プロジェクト: Gweylorth/SWOP
 private void btnSmall_Click(object sender, RoutedEventArgs e)
 {
     this.mapChosen = BuilderMapStrategy.Small;
     this.AnyButtonClick();
 }