public PlaybackScene(ISceneHost host, IScene previousScene, PlaybackManager playbackManager)
 {
     _host = host;
     this._previousScene = previousScene;
     _playbackManager    = playbackManager;
     _currentFrame       = 0;
 }
Esempio n. 2
0
        public GameScene(ISceneHost host, World world, PlaybackManager playbackManager, Texture2D turnIndicator, Action <Dictionary <Guid, ShipCommands> > onSubmit)
        {
            _host               = host;
            _turnStart          = world;
            _onSubmit           = onSubmit;
            _playbackManager    = playbackManager;
            this._turnIndicator = turnIndicator;
            _commands           = new Dictionary <Guid, ShipCommands>();

            _submitButton            = new Button(Resources.SubmitButton, Resources.SubmitButtonHover, host.ScreenWidth - 100 - 10, host.ScreenHeight - 70, 100);
            _submitButton.OnMouseUp += OnSubmit;

            _previewButton            = new Button(Resources.PlayButton, Resources.PlayButtonHover, host.ScreenWidth - 100 - 10 - 100 - 10, host.ScreenHeight - 70, 100);
            _previewButton.OnMouseUp += OnPreview;

            _playbackButton            = new Button(Resources.ReplayButton, Resources.ReplayButtonHover, host.ScreenWidth - 100 - 10 - 100 - 10 - 100 - 10, host.ScreenHeight - 70, 100);
            _playbackButton.OnMouseUp += OnPlayback;
        }
Esempio n. 3
0
 public HotseatScene(ISceneHost host, World world, PlaybackManager playbackManager)
 {
     _host            = host;
     _world           = world;
     _playbackManager = playbackManager;
 }
Esempio n. 4
0
        protected override void LoadContent()
        {
            _spriteBatch = new SpriteBatch(GraphicsDevice);

            GlobalGraphicsDevice        = GraphicsDevice;
            WorldRenderTarget           = new RenderTarget2D(GraphicsDevice, (int)(ScreenWidth * ScaleHack), (int)(ScreenHeight * ScaleHack));
            GlobalGraphicsDeviceManager = _graphics;

            Resources.Pixel = new Texture2D(GraphicsDevice, 1, 1);
            Resources.Pixel.SetData(new[] { Color.White });

            const int CircleRadius = 100;

            Resources.Circle = new Texture2D(GraphicsDevice, CircleRadius * 2, CircleRadius * 2);
            var colors = new Color[CircleRadius * CircleRadius * 4];

            for (int x = 0; x < CircleRadius * 2; x++)
            {
                for (int y = 0; y < CircleRadius * 2; y++)
                {
                    colors[x + y * CircleRadius * 2] = (new Vector(x, y) - new Vector(CircleRadius, CircleRadius)).Length < CircleRadius + 0.1
                        ? Color.White
                        : new Color(0, 0, 0, 0);
                }
            }
            Resources.Circle.SetData(colors);

            Resources.FontArial12 = Content.Load <SpriteFont>("font-arial-12");
            Resources.PlayerShip  = Content.Load <Texture2D>("good512");
            Resources.EnemyShip   = Content.Load <Texture2D>("bad512");
            Resources.Planets     = new List <Texture2D>()
            {
                Content.Load <Texture2D>("Planet1"),
                Content.Load <Texture2D>("Planet2"),
                Content.Load <Texture2D>("Planet3"),
                Content.Load <Texture2D>("Planet4"),
                Content.Load <Texture2D>("Planet5"),
                Content.Load <Texture2D>("Planet6"),
                Content.Load <Texture2D>("Planet7"),
            };
            Resources.BlueEngine = new List <Texture2D>()
            {
                Content.Load <Texture2D>("Engines/blueng-512"),
                Content.Load <Texture2D>("Engines/blueng1-512"),
                Content.Load <Texture2D>("Engines/blueng2-512"),
                Content.Load <Texture2D>("Engines/blueng3-512"),
                Content.Load <Texture2D>("Engines/blueng4-512")
            };
            Resources.RedEngine = new List <Texture2D>()
            {
                Content.Load <Texture2D>("Engines/redeng-512"),
                Content.Load <Texture2D>("Engines/redeng1-512"),
                Content.Load <Texture2D>("Engines/redeng2-512"),
                Content.Load <Texture2D>("Engines/redeng3-512"),
                Content.Load <Texture2D>("Engines/redeng4-512")
            };
            Resources.PulsingPlanet = new List <Texture2D>()
            {
                Content.Load <Texture2D>("planet2-l1"),
                Content.Load <Texture2D>("planet2-l2"),
                Content.Load <Texture2D>("planet2-l3"),
            };
            Resources.PlayButton        = Content.Load <Texture2D>("Bottoms/play1");
            Resources.PlayButtonHover   = Content.Load <Texture2D>("Bottoms/play2");
            Resources.ReplayButton      = Content.Load <Texture2D>("Bottoms/replay1");
            Resources.ReplayButtonHover = Content.Load <Texture2D>("Bottoms/replay2");
            Resources.SubmitButton      = Content.Load <Texture2D>("Bottoms/sumbit1");
            Resources.SubmitButtonHover = Content.Load <Texture2D>("Bottoms/sumbit2");
            Resources.Slider            = Content.Load <Texture2D>("Bottoms/slider");
            Resources.SliderHover       = Content.Load <Texture2D>("Bottoms/slider_highlight");
            Resources.UIBackground      = Content.Load <Texture2D>("Bottoms/ui_base");
            Resources.LeftLabel         = Content.Load <Texture2D>("Bottoms/left");
            Resources.RightLabel        = Content.Load <Texture2D>("Bottoms/right");
            Resources.WeaponsLabel      = Content.Load <Texture2D>("Bottoms/weapons");
            Resources.BarEmpty          = Content.Load <Texture2D>("Bottoms/bar_empty");
            Resources.BarFull           = Content.Load <Texture2D>("Bottoms/bar_full");
            Resources.BarRed            = Content.Load <Texture2D>("Bottoms/bar_red");
            Resources.BlueExplosion     = Enumerable.Range(1, 10)
                                          .Select(i => "Explosions/blue/" + i)
                                          .Select(s => Content.Load <Texture2D>(s))
                                          .ToList();
            Resources.RedExplosion = Enumerable.Range(1, 10)
                                     .Select(i => "Explosions/red/" + i)
                                     .Select(s => Content.Load <Texture2D>(s))
                                     .ToList();
            var backgroundOptions = new List <string>()
            {
                "Background/something_right1",
                "Background/something_left2",
                "Background/something_top3",
                "Background/something_bottom4",
                "Background/something_front5",
                "Background/something_back6",
            };

            Resources.Background        = Content.Load <Texture2D>(backgroundOptions[new Random().Next(backgroundOptions.Count)]);
            Resources.RedTurnIndicator  = Content.Load <Texture2D>("Bottoms/redturn");
            Resources.BlueTurnIndicator = Content.Load <Texture2D>("Bottoms/blueturn");

            var world = new World(ScreenWidth, ScreenHeight);

            world.Ships.Add(new Ship(new Vector(100, 100), Models.BlueModel));
            world.Ships.Add(new Ship(new Vector(130, 400), Models.BlueModel));
            world.Ships.Add(new Ship(new Vector(115, 560), Models.BlueModel));

            world.Ships.Add(new Ship(new Vector(1600 * 1.5 - 100, 1000 - 100), Models.RedModel));
            world.Ships.Add(new Ship(new Vector(1600 * 1.5 - 130, 1000 - 400), Models.RedModel));
            world.Ships.Add(new Ship(new Vector(1600 * 1.5 - 115, 1000 - 560), Models.RedModel));
            //world.Ships.Add(new Ship(new Vector(150, 400), Models.BlueModel));

            world.Planets.Add(new Planet(new Vector(600, 500), 100, 2));
            //world.Planets.Add(new Planet(new Vector(900, 800), 50, 1));
            //world.Planets.Add(new Planet(new Vector(950, 100), 50, 4));
            //world.Planets.Add(new Planet(new Vector(1100, 680), 100, 5));
            world.Planets.Add(new BlendedPlanet(new Vector(1100, 680), 100));
            //world.Planets.Add(new Planet(new Vector(300, 800), 90, 1));
            world.Planets.Add(new Planet(new Vector(1700, 300), 50, 4));
            //world.Planets.Add(new Planet(new Vector(850, 600), 90, 2));
            world.Planets.Add(new PulsingPlanet(new Vector(1650, 1000), 90));

            var playbackManager = new PlaybackManager();

            //_currentScene = new GameScene(this, world, playbackManager);
            _currentScene = new HotseatScene(this, world, playbackManager);
        }
Esempio n. 5
0
 public SubmitScene(ISceneHost host, IScene previousScene, World world, Dictionary <Guid, IShipController> controllers, PlaybackManager playbackManager)
     : base(host, previousScene, world, controllers)
 {
     _playbackManager = playbackManager;
 }