Ejemplo n.º 1
0
        public Overview(GraphicsDeviceManager graphics, ContentManager theContent, 
            EventHandler theScreenEvent, EventHandler paused, Account account, 
            Vector2 Centre, EventHandler systemSelected, EventHandler DayPassed, 
            EventHandler SystemHovered, EventHandler RemoveSystemHovered,
            EventHandler UpdateBuildQueue, EventHandler UpdateResourceDetails, 
            GraphicsDevice graphicsDevice, SpriteBatch spriteBatch)
            : base(theScreenEvent, theContent)
        {
            content = new ContentManager(theContent.ServiceProvider, theContent.RootDirectory);
            this.device = graphicsDevice;
            this.spriteBatch = spriteBatch;
            this.graphics = graphics;
            var presParams = graphicsDevice.PresentationParameters.Clone();
            // Configure parameters for secondary graphics device
            device = new GraphicsDevice(graphicsDevice.Adapter, GraphicsProfile.HiDef, presParams);


            dayPassed = DayPassed;
            systemHovered = SystemHovered;
            removeSystemHovered = RemoveSystemHovered;
            updateBuildQueue = UpdateBuildQueue;
            updateResources = UpdateResourceDetails;
            this.systemSelected = systemSelected;

            Paused = paused;
            EscapeToMenu = theScreenEvent;
            user = account;
            data = account.SaveData;
            centre = Centre;
            map = new Map(new EventHandler(SystemSelected), new EventHandler(OnSystemHovered),
                new EventHandler(OnRemoveSystemHovered), new EventHandler(UpdateResources));
            AllPlayers = new List<Player>();
        }
Ejemplo n.º 2
0
        public Menu(StrategyGame game1, GraphicsDeviceManager Graphics, ContentManager theContent, System.EventHandler theScreenEvent, Account account, GraphicsDevice Device, System.EventHandler ExitGame)
            : base(theScreenEvent, theContent)
        {
            content = new ContentManager(theContent.ServiceProvider, theContent.RootDirectory);
            graphics = Graphics;
            device = Device;

            user = account;
            game = game1;

            newGame = theScreenEvent;
            exitGame = ExitGame;
        }
Ejemplo n.º 3
0
        public override void LoadContent(Account acc, NewGameDetails details)
        {
            user = acc;
            SysTex = content.Load<Texture2D>("sun");
            RingTex = content.Load<Texture2D>("ring");
            background = content.Load<Texture2D>("galaxyBackground");
            Font = content.Load<SpriteFont>("Font");
            ShipTex = content.Load<Texture2D>("Ship1");
            base.sf = content.Load<SpriteFont>("Font");
            Texture2D sectorOutline = content.Load<Texture2D>("outline");

            for (int i = 1; i <= 20; i++)
            {
                planetTextures[i - 1] = content.Load<Texture2D>("Planets/planet" + i);
            }

            HumanPlayer = new Player(details.playerFaction, 1);
            AllPlayers.Add(HumanPlayer);
            HumanPlayer.playerListPosition = AllPlayers.Count - 1;
            screentitle = "OVERVIEW SCREEN";
            data = user.SaveData;
            prev = new SaveGameData();
            aiPlayers = new AIPlayer[details.NumAI]; //plus 1 so the player can be added to the array when serializing 
            for (int i = 0; i < details.NumAI; i++)
            {
                aiPlayers[i] = new AIPlayer();
                aiPlayers[i].playerNumber = i;
                AllPlayers.Add(aiPlayers[i]);
                aiPlayers[i].playerListPosition = AllPlayers.Count - 1;
            }
            map.Initialize(details.NumSystems, SysTex, RingTex, details.MapSizeVector, 
                planetTextures, ref aiPlayers, ref humanPlayer, sectorOutline, Font,
                device, graphics, spriteBatch);
            zoom = 1.0f;
            Systems = map.AllSystems;
            selectedSystem = map.AllSystems[map.selectedSystem];

            BackgroundRec = new Rectangle(
                0 - (graphics.PreferredBackBufferWidth / 3),
                0 - (graphics.PreferredBackBufferHeight / 3),
                background.Width, background.Height);
            UpdateResourcesDetails();
            UpdateEndDayResources();
            gameSpeed = 1f;
            CurrentView = ViewType.MapView;
            elapsedDays = 0;
            elapsedHours = 0;
            paused = false;
            planetsTaxChange.Clear();
            planetsTaxChangeNames.Clear();
        }
Ejemplo n.º 4
0
        public virtual void LoadContent(Account acc, NewGameDetails details)
        {

        }
Ejemplo n.º 5
0
 public void MenuScreenEvent(object obj, System.EventArgs e)
 {
     loading = true;
     account = menuscreen.user;
     gameDetails = menuscreen.GetGameDetails();
     account.SaveData.MapSize = gameDetails.MapSizeVector;
     ToChange = 2;
     loadingScreen.Begin();
 }
Ejemplo n.º 6
0
        protected override void LoadContent()
        {
            rectangledraw = Content.Load<Texture2D>("white");

            account = new Account();
            spriteBatch = new SpriteBatch(GraphicsDevice);
            spriteBatch2 = new SpriteBatch(GraphicsDevice);
            sf = Content.Load<SpriteFont>("Segoe_UI_9_Regular");
            glowEffect = Content.Load<Effect>("effect1");
            //glowEffect.CurrentTechnique.Passes[0].Apply();


            titlescreen = new Title(this.Content, new System.EventHandler(TitleScreenEvent));

            menuscreen = new Menu(this, graphics, this.Content,
                new System.EventHandler(MenuScreenEvent), account, GraphicsDevice,
                new System.EventHandler(ExitGamePressed));

            overviewScreen = new Overview(this.graphics, this.Content,
                new System.EventHandler(OverviewEscapeToMenu), new System.EventHandler(gamePaused),
                account, new Vector2(0, 0), new EventHandler(SystemSelected), new EventHandler(DayPassed),
                new EventHandler(SystemHovered), new EventHandler(RemoveSystemHovered),
                new EventHandler(UpdateBuildQueue), new EventHandler(UpdatePlanetResources),
                GraphicsDevice, spriteBatch);

            loadingScreen = new Loading(Content, graphics);
            camera = new Camera(GraphicsDevice.Viewport);

            DGUI = new GUIManager(graphics, Content, new EventHandler(ExitGamePressed),
                new EventHandler(OverviewEscapeToMenu), new EventHandler(SaveGamePressed),
                new EventHandler(LoadGamePressed), new EventHandler(overviewScreen.Button1Pressed),
                new EventHandler(ZoomIn), new EventHandler(overviewScreen.ZoomOut),
                new EventHandler(gamePaused), new EventHandler(planetHighlighted),
                new EventHandler(PlanetslistToggled), new EventHandler(SectorChanged),
                new EventHandler(PlanetInfoPressed), account.SaveData,
                new EventHandler(MapSystemSelected), new EventHandler(JumpToSystem),
                new EventHandler(JumpToPlanet), new EventHandler(TaxRateChanged),
                new EventHandler(GameSpeedChanged), new EventHandler(BuildingUpgraded),
                new EventHandler(BuildingDismantled), new EventHandler(AddBuildQueueItem),
                new EventHandler(RemoveBuildQueueItem), GraphicsDevice);

            //account.SaveData.Score = 6;
            //account.SaveData.MapSize = new Vector2(2000, 2000);
            currentscreen = titlescreen; // <= SETTING FIRST SCREEN TO BE SHOWN
                                         //overviewScreen.LoadContent(account, gameDetails);
                                         //DGUI.Init(this, new Point(0,0));
                                         //DGUI.StartKeyBindings();
                                         // REMOVE WHEN REVERTING BACK TO TITLE SCREEN FIRST ^^

            centre.X = 0;
            centre.Y = 0;
            zoom = 1.0f;

            FramesCounter = new FPSCounter(this, spriteBatch, sf);
        }