public void AddDrawable(IDrawable drawable)
 {
     if (drawables.IsNull())
     {
         drawables = new DrawableList();
     }
     drawables.Add(drawable);
 }
Exemple #2
0
        public void StartScreen(Screen screen, bool replaceCurrent)
        {
            if (screens.Contains(screen))
            {
                throw new InvalidOperationException("Screen already started: " + screen);
            }

            if (currentScreen != null)
            {
                if (replaceCurrent)
                {
                    currentScreen.screenManager = null;
                    updatables.Remove(currentScreen);
                    drawables.Remove(currentScreen);
                    screens.Remove(currentScreen);

                    Stop(currentScreen);
                }
                else
                {
                    if (!screen.AllowsUpdatePrevious)
                    {
                        Suspend(currentScreen);
                        updatables.Remove(currentScreen);
                    }

                    if (!screen.AllowsDrawPrevious)
                    {
                        drawables.Remove(currentScreen);
                    }
                }
            }

            currentScreen = screen;

            screens.Add(screen);
            screen.screenManager = this;

            Start(screen);

            updatables.Add(screen);
            drawables.Add(screen);
        }
Exemple #3
0
        public void LoadContent(Content content, GraphicsDevice graphicsDevice)
        {
            var map             = content.Map;
            var deploymentLayer = map.GetLayer <TiledMapObjectLayer>("Deployment");

            spaghettiDeployment = MapHelper.GetObjectRectangleInMapPoints(deploymentLayer.Objects.SingleOrDefault(deployment => deployment.Name.Equals("Spaghetti")));
            unicornDeployment   = MapHelper.GetObjectRectangleInMapPoints(deploymentLayer.Objects.SingleOrDefault(deployment => deployment.Name.Equals("Unicorn")));
            MapHelper.Map       = map;
            MapHelper.Entities  = entities;

            entities.Add(new Terrain(content.MediumTree, new MapPoint(3, 4)));
            entities.Add(new Terrain(content.MediumTree, new MapPoint(17, 21)));
            entities.Add(new Terrain(content.MediumTree, new MapPoint(23, 2)));
            entities.Add(new Terrain(content.MediumTree, new MapPoint(6, 15)));
            entities.Add(new Terrain(content.SmallTree, new MapPoint(15, 20)));
            entities.Add(new Terrain(content.SmallTree, new MapPoint(19, 22)));
            entities.Add(new Terrain(content.SmallTree, new MapPoint(6, 16)));
            entities.Add(new Terrain(content.SmallTree, new MapPoint(6, 14)));
            entities.Add(new Terrain(content.SmallTree, new MapPoint(28, 20)));
            entities.Add(new Terrain(content.SmallTree, new MapPoint(24, 25)));
            entities.Add(new Terrain(content.LargeBush, new MapPoint(26, 6)));
            entities.Add(new Terrain(content.LargeBush, new MapPoint(16, 10)));
            entities.Add(new Terrain(content.LargeBush, new MapPoint(1, 20)));

            mapRenderer = new TiledMapRenderer(graphicsDevice, map);
            camera      = new OrthographicCamera(graphicsDevice);
            camera.LookAt(new Vector2(0, map.HeightInPixels / 2));              // center the map in the screen

            selectedPlayerStatsPanel.Background = content.PanelBackground;
            selectedPlayerStatsPanel.Components.Add(playerClassText);
            selectedPlayerStatsPanel.Components.Add(sideText);
            selectedPlayerStatsPanel.Components.Add(healthText);
            selectedPlayerStatsPanel.Components.Add(strAgiText);
            selectedPlayerStatsPanel.Components.Add(intStaText);
            selectedPlayerStatsPanel.Components.Add(evdDefText);
            selectedPlayerStatsPanel.Components.Add(deckText);
            selectedPlayerStatsPanel.Components.Add(playsMovesText);
            selectedPlayerStatsPanel.Components.Add(appliedConditionRow);
            conditionIcons           = content.ConditionIcons;
            SelectedCharacterChange += UpdateSelectedCharacterPanel;

            playerSidePanel.Background = content.PanelBackground;
            playerSidePanel.Components.Add(playerSideText);

            gameLogPanel.Background = content.PanelBackground;

            spaghettiHatIcon = content.SpaghettiHatIcon;
            unicornHatIcon   = content.UnicornHatIcon;
            moveIcon         = content.MoveIcon;
            cardIcon         = content.CardIcon;
            heldGameLogEntryPanel.Background = content.PanelBackground;
            heldGameLogEntryPanel.Components.Add(heldGameLogSource);
            heldGameLogEntryPanel.Components.Add(heldGameLogTarget);
            heldGameLogEntryPanel.Components.Add(heldGameLogActionText);

            appliedConditionDetailsPanel.Background = content.PanelBackground;
            appliedConditionDetailsPanel.Components.Add(appliedConditionDetailsText);

            statusPanel.Background         = content.PanelBackground;
            screenComponent                = new ScreenComponent();
            screenComponent.OnGestureRead += ScreenComponent_GestureRead;
            screenComponent.Components.Add(endTurnButton);
            screenComponent.Components.Add(winGameNowButton);
            screenComponent.Components.Add(selectedPlayerStatsPanel);
            screenComponent.Components.Add(gameLogPanel);
            screenComponent.Components.Add(playerSidePanel);
            screenComponent.Components.Add(heldGameLogEntryPanel);
            screenComponent.Components.Add(appliedConditionDetailsPanel);
            screenComponent.Components.Add(statusPanel);
            screenComponent.LoadContent(content.ContentManager, graphicsDevice);

            this.content        = content;
            handOfCards.Content = content;

            renderTarget = new RenderTarget2D(graphicsDevice, graphicsDevice.Viewport.Width, graphicsDevice.Viewport.Height, false, SurfaceFormat.Color, DepthFormat.None);
        }
Exemple #4
0
 protected void AddDrawable(IDrawable drawable)
 {
     drawables.Add(drawable);
 }