Inheritance: MSGUIUnclickable
示例#1
0
        protected void AddSelection(string title, string description, MSBuildingStats stats, Rectangle boundingRectangle, Texture2D unhoveredTexture, Texture2D clickedTexture, Texture2D hoveredTexture, Alignment alignment)
        {
            if (selected is MSChangeableBuilding)
            {
                MSToolTip toolTip = new MSToolTip(Game.Content.Load<Texture2D>("BlackOut"), new Rectangle(0, 568, 1024, 200), 10, 10, 10, 10, SpriteBatch, Game);

                MSWrappingLabel titleToolTip = new MSWrappingLabel(new Point(0, 0), title, Game.Content.Load<SpriteFont>("ToolTipTitle"), Color.White, null, 2, 2, 2, 2, 1024, 758, SpriteBatch, Game);
                toolTip.AddComponent(titleToolTip, Alignment.TOP_LEFT);

                /**
                MSToolTip orbCostToolTip = new MSToolTip(null, new Rectangle(BoundingRectangle.X + BoundingRectangle.Width / 2, BoundingRectangle.Y, 75, 50), -30, 0, 0, 0, SpriteBatch, Game);
                orbCostToolTip.AddComponent(bucksIcon, Alignment.MIDDLE_LEFT);
                orbCostToolTip.AddComponent(moneyCost, Alignment.MIDDLE_RIGHT);
                orbCostToolTip.AddComponent(gingerBreadManIcon, Alignment.BOTTOM_LEFT);
                orbCostToolTip.AddComponent(volunteerCost, Alignment.BOTTOM_RIGHT);
                toolTip.AddComponent(orbCostToolTip);
                 */

                MSToolTip costToolTip = new MSToolTip(null, new Rectangle(0, 0, 75, 50), 0, 0, 0, 0, SpriteBatch, Game);
                toolTip.AddComponent(costToolTip, Alignment.TOP_RIGHT);

                if (stats.GetFundsCost() != 0)
                {
                    MSWrappingLabel moneyCost = new MSWrappingLabel(new Point(0, 0), stats.GetFundsCost().ToString(), Game.Content.Load<SpriteFont>("BuyDialog"), Color.White, null, null, null, SpriteBatch, Game);
                    costToolTip.AddComponent(bucksIcon, Alignment.TOP_LEFT);
                    costToolTip.AddComponent(moneyCost, Alignment.TOP_RIGHT);
                }

                if (stats.GetVolunteerCost() != 0)
                {
                    MSWrappingLabel volunteerCost = new MSWrappingLabel(new Point(0, 0), stats.GetVolunteerCost().ToString(), Game.Content.Load<SpriteFont>("BuyDialog"), Color.White, null, null, null, SpriteBatch, Game);
                    costToolTip.AddComponent(gingerBreadManIcon, Alignment.BOTTOM_LEFT);
                    costToolTip.AddComponent(volunteerCost, Alignment.BOTTOM_RIGHT);
                }

                MSWrappingLabel descriptionToolTip = new MSWrappingLabel(new Point(titleToolTip.BoundingRectangle.X, costToolTip.BoundingRectangle.Y + costToolTip.BoundingRectangle.Height), description, Game.Content.Load<SpriteFont>("ToolTipFont"), Color.White, null, 2, 2, 2, 2, 1024, 758, SpriteBatch, Game);
                toolTip.AddComponent(descriptionToolTip);

                MSAction toPerform;

                if (stats is MSTowerStats)
                    toPerform = new BuyTower(selected as MSChangeableBuilding, stats as MSTowerStats);

                else if (stats is MSVolunteerCenterStats)
                    toPerform = new BuyVolunteerCenter(selected as MSChangeableBuilding);

                else if (stats is MSFundraiserStats)
                    toPerform = new BuyFundraiser(selected as MSChangeableBuilding);

                else throw new ArgumentException();

                AddComponent(new MSButton(null, toPerform, boundingRectangle, unhoveredTexture, clickedTexture, hoveredTexture, toolTip, Shape.AMORPHOUS, spriteBatch, Game), alignment);
            }
            else throw new NotImplementedException();
        }
示例#2
0
        public MSPanel(Texture2D background, Rectangle boundingRectangle, float topPadding, float bottomPadding, float leftPadding, float rightPadding, Color highlight, MSToolTip toolTip, Shape shape, SpriteBatch spriteBatch, Game game)
            : base(boundingRectangle, toolTip, shape, spriteBatch, game)
        {
            this.background = background;
            if(background != null)
                collisionTexture = background;
            unclickableComponents = new List<MSGUIUnclickable>();
            clickableComponents = new List<MSGUIClickable>();
            components = new List<MSGUIObject>();

            boundedPosition = Position + new Vector2(leftPadding, topPadding);
            boundedSize = Size - new Vector2(leftPadding, topPadding) - new Vector2(rightPadding, bottomPadding);

            this.highlight = highlight;
        }
示例#3
0
 /// <summary>
 /// Constructs an MSButton.
 /// </summary>
 /// <param name="label">Add text to this MSButton with an MSLabel. Use null if you don't need to add text. Make sure to position the MSLabel relative to the upper-left corner of this MSButton.</param>
 /// <param name="action">will be executed when this MSButton is clicked</param>
 /// <param name="boundingRectangle">the bounding Rectangle of thisMSButton</param>
 /// <param name="unhovered">will be drawn when this MSButton is unhovered</param>
 /// <param name="clicked">will be drawn when this MSButton is pressed and hovered</param>
 /// <param name="hovered">will be drawn when this MSButton is released and hovered</param>
 /// <param name="spriteBatch">the SpriteBatch that will draw this MSButton</param>
 /// <param name="highlight">the Color to overlay this MSButton with</param>
 /// <param name="shape">the Shape of this MSButton<seealso cref="MoodSwingCoreComponents.Shape"/></param>
 /// <param name="game">the Game where this MSButton will be used</param>
 public MSButton(MSLabel label, MSAction action, Rectangle boundingRectangle, Texture2D unhovered, Texture2D clicked, Texture2D hovered, Color highlight, MSToolTip toolTip, Shape shape, SpriteBatch spriteBatch, Game game)
     : base(boundingRectangle, toolTip, shape, spriteBatch, game)
 {
     unhoveredTexture = unhovered;
     clickedTexture = clicked;
     hoveredTexture = hovered;
     this.highlight = highlight;
     collisionTexture = unhovered;
     if (label != null)
     {
         this.label = label;
         this.label.Position += Position;
     }
     this.action = action;
     this.shape = shape;
     UnHover();
 }
示例#4
0
 /// <summary>
 /// Constructs an MSButton.
 /// </summary>
 /// <param name="label">Add text to this MSButton with an MSLabel. Use null if you don't need to add text. Make sure to position the MSLabel relative to the upper-left corner of this MSButton.</param>
 /// <param name="action">will be executed when this MSButton is clicked</param>
 /// <param name="boundingRectangle">the bounding Rectangle of thisMSButton</param>
 /// <param name="unhovered">will be drawn when this MSButton is unhovered</param>
 /// <param name="clicked">will be drawn when this MSButton is pressed and hovered</param>
 /// <param name="hovered">will be drawn when this MSButton is released and hovered</param>
 /// <param name="spriteBatch">the SpriteBatch that will draw this MSButton</param>
 /// <param name="highlight">the Color to overlay this MSButton with</param>
 /// <param name="shape">the Shape of this MSButton<seealso cref="MoodSwingCoreComponents.Shape"/></param>
 /// <param name="game">the Game where this MSButton will be used</param>
 public MSAnimatingButton(MSLabel label, MSAction action, Rectangle boundingRectangle, Texture2D unhovered, Texture2D clicked, Texture2D hovered, Color highlight, MSToolTip toolTip, Shape shape, SpriteBatch spriteBatch, Game game)
     : base(label, action, boundingRectangle, unhovered, clicked, hovered, highlight, toolTip, shape, spriteBatch, game)
 {
     clickTimer = 0;
     unclickTimer = 0;
     UnclickTimerLimit = 0;
     unclickTriggered = false;
     hoverTimer = 0;
     unhoverTimer = 0;
     ClickPosition = new ConstantParametricCurve();
     ClickSize = new ConstantParametricCurve();
     HoverPosition = new ConstantParametricCurve();
     HoverSize = new ConstantParametricCurve();
     UnclickPosition = new ConstantParametricCurve();
     UnclickSize = new ConstantParametricCurve();
     UnhoverPosition = new ConstantParametricCurve();
     UnhoverSize = new ConstantParametricCurve();
     x0 = boundingRectangle.X;
     y0 = boundingRectangle.Y;
     w0 = boundingRectangle.Width;
     h0 = boundingRectangle.Height;
 }
示例#5
0
 /// <summary>
 /// Constructs an MSAnimatingButton with no highlight.
 /// </summary>
 /// <param name="label">Add text to this MSAnimatingButton with an MSLabel. Use null if you don't need to add text. Make sure to position the MSLabel relative to the upper-left corner of this MSButton.</param>
 /// <param name="action">will be executed when this MSAnimatingButton is clicked</param>
 /// <param name="boundingRectangle">the bounding Rectangle of this MSAnimatingButton</param>
 /// <param name="unhovered">will be drawn when this MSAnimatingButton is unhovered</param>
 /// <param name="clicked">will be drawn when this MSAnimatingButton is pressed and hovered</param>
 /// <param name="hovered">will be drawn when this MSAnimatingButton is released and hovered</param>
 /// <param name="spriteBatch">the SpriteBatch that will draw this MSButton</param>
 /// <param name="shape">the Shape of this MSButton<seealso cref="MoodSwingCoreComponents.Shape"/></param>
 /// <param name="game">the Game where this MSButton will be used</param>
 public MSAnimatingButton(MSLabel label, MSAction action, Rectangle boundingRectangle, Texture2D unhovered, Texture2D clicked, Texture2D hovered, MSToolTip toolTip, Shape shape, SpriteBatch spriteBatch, Game game)
     : this(label, action, boundingRectangle, unhovered, clicked, hovered, Color.White, toolTip, shape, spriteBatch, game)
 {
 }
示例#6
0
 public MSGUIClickable(Rectangle boundingRectangle, Shape shape, MSToolTip toolTip, SpriteBatch spriteBatch, Game game)
     : base(boundingRectangle, shape, spriteBatch, game)
 {
     this.toolTip = toolTip;
 }
示例#7
0
 public MSGUITypable(Rectangle boundingRectangle, MSToolTip toolTip, Shape shape, SpriteBatch spriteBatch, Game game)
     : base(boundingRectangle, shape, toolTip, spriteBatch, game)
 {
     HasKeyboardFocus = false;
 }
示例#8
0
 public MSPanel(Texture2D background, Rectangle boundingRectangle, float topPadding, float bottomPadding, float leftPadding, float rightPadding, MSToolTip toolTip, Shape shape, SpriteBatch spriteBatch, Game game)
     : this(background, boundingRectangle, topPadding, bottomPadding, leftPadding, rightPadding, Color.White, toolTip, shape, spriteBatch, game)
 {
 }
示例#9
0
 public MSPanel(Texture2D background, Rectangle boundingRectangle, Color highlight, MSToolTip toolTip, Shape shape, SpriteBatch spriteBatch, Game game)
     : this(background, boundingRectangle, 0, 0, 0, 0, toolTip, shape, spriteBatch, game)
 {
 }
示例#10
0
        public MSDistrictScreen(DistrictName district, MoodSwing game)
            : base(game.Content.Load<Texture2D>("districtmap"), 0, 0, 0, 0, game.SpriteBatch, game)
        {
            gameTime = 0;
            lastTotalRunTime = 0;

            this.name = district;
            String filename = "";
            if (district == DistrictName.FEAR)
            {
                filename = @"Content\smallMap.txt";
                districtName = "small";
                ultiGoal = 3;
            }
            else if (district == DistrictName.SADNESS)
            {
                filename = @"Content\mediumMap.txt";
                districtName = "medium";
                ultiGoal = 6;
            }
            else if (district == DistrictName.ANGER)
            {
                filename = @"Content\largeMap.txt";
                districtName = "large";
                ultiGoal = 8;
            }
            map = new MSMap(filename);

            MSCamera.initialize((game as MoodSwing).GraphicsDevice.Viewport,
                MSDistrictHall.getInstance().Position, MSDistrictHall.getInstance().Rotation);
            //citizensList = new List<MSCitizen>();
            unitHandler = MSUnitHandler.Restart();
            moodManager = MSMoodManager.GetInstance();
            MSMoodManager.Reset();
            resourceManager = MSResourceManager.GetInstance();
            MSResourceManager.instantiate(1000, map.InitialVolunteerCenters);

            foreach (MS3DTile tile in map.MapArray)
            {
                tile.LightSource = map.LightSource;
            }

            blackOutPanel = new MSPanel
            (
                game.Content.Load<Texture2D>("BlackOut"),
                BoundingRectangle,
                null,
                Shape.RECTANGULAR,
                spriteBatch,
                game
            );
            blackOutPanel.Visible = false;
            AddComponent(blackOutPanel);

            MSToolTip idleVolunteersToolTip = new MSToolTip
            (
                null,
                new Rectangle(52, 25, 50, 14),
                SpriteBatch,
                Game
            );
            MSPanel idleVolunteersPanel = new MSPanel
            (
                null,
                new Rectangle(52, 25, 50, 14),
                idleVolunteersToolTip,
                Shape.RECTANGULAR,
                SpriteBatch,
                Game
            );
            idleVolunteers = new MSTextField
            (
                "0",
                new Rectangle(82, 25, 20, 14),
                null,
                null,
                4,
                game.Content.Load<SpriteFont>("TopPanel"),
                Color.White,
                spriteBatch,
                game
            );
            idleVolunteersPanel.AddComponent(idleVolunteers);
            idleVolunteersToolTip.AddComponent(new MSWrappingLabel
            (
                new Point(82, 39),
                "Idle Volunteers",
                Game.Content.Load<SpriteFont>("ToolTipFont"),
                Color.White,
                Game.Content.Load<Texture2D>("BlackOut"),
                3, 3, 3, 3, null, null,
                SpriteBatch,
                Game
            ));

            MSToolTip totalVolunteersToolTip = new MSToolTip
            (
                null,
                new Rectangle(152, 25, 80, 14),
                SpriteBatch,
                Game
            );
            MSPanel totalVolunteersPanel = new MSPanel
            (
                null,
                new Rectangle(152, 25, 80, 14),
                totalVolunteersToolTip,
                Shape.RECTANGULAR,
                SpriteBatch,
                Game
            );
            totalVolunteers = new MSTextField(
                "0/0",
                new Rectangle(192, 34, 40, 14),
                null,
                null,
                9,
                game.Content.Load<SpriteFont>("TopPanel"),
                Color.White,
                spriteBatch,
                game);
            totalVolunteersPanel.AddComponent(totalVolunteers);
            totalVolunteersToolTip.AddComponent(new MSWrappingLabel
            (
                new Point(192, 48),
                "Total Volunteers/Volunteer Limit",
                Game.Content.Load<SpriteFont>("ToolTipFont"),
                Color.White,
                Game.Content.Load<Texture2D>("BlackOut"),
                3, 3, 3, 3, null, null,
                SpriteBatch,
                Game
            ));

            MSToolTip fundsToolTip = new MSToolTip
            (
                null,
                new Rectangle(262, 44, 150, 20),
                SpriteBatch,
                Game
            );
            MSPanel fundsPanel = new MSPanel
            (
                null,
                new Rectangle(262, 44, 150, 20),
                fundsToolTip,
                Shape.RECTANGULAR,
                SpriteBatch,
                Game
            );
            funds = new MSTextField
            (
                "0",
                new Rectangle(332, 44, 80, 20),
                null,
                null,
                8,
                game.Content.Load<SpriteFont>("TopPanel"),
                Color.White,
                spriteBatch,
                game
            );
            fundsPanel.AddComponent(funds);
            fundsToolTip.AddComponent(new MSWrappingLabel
            (
                new Point(332, 64),
                "Funds",
                Game.Content.Load<SpriteFont>("ToolTipFont"),
                Color.White,
                Game.Content.Load<Texture2D>("BlackOut"),
                3, 3, 3, 3, null, null,
                SpriteBatch,
                Game
            ));

            MSPanel topPanelBack = new MSPanel
            (
                Game.Content.Load<Texture2D>("GamePanel/WhiteBG"),
                new Rectangle(0, 0, 1024, 91),
                null,
                Shape.AMORPHOUS,
                SpriteBatch,
                Game
            );

            AddComponent(topPanelBack, Alignment.TOP_CENTER);

            MSPanel topPanel = new MSPanel
            (
                Game.Content.Load<Texture2D>("GamePanel/TopPanel"),
                new Rectangle(0, 0, 1024, 91),
                null,
                Shape.AMORPHOUS,
                SpriteBatch,
                Game
            );

            topPanel.AddComponent(idleVolunteersPanel);
            topPanel.AddComponent(totalVolunteersPanel);
            topPanel.AddComponent(fundsPanel);

            AddComponent(topPanel, Alignment.TOP_CENTER);

            mainMenuButton = new MSButton(
                null,
                new OpenExitConfirmation(OpenExitConfirmation.ExitType.ToMainMenu),
                new Rectangle(403, 92, 226, 57),
                game.Content.Load<Texture2D>("GamePanel/MainMenu"),
                game.Content.Load<Texture2D>("GamePanel/mainmenuclicked"),
                game.Content.Load<Texture2D>("GamePanel/mainmenuhovered"),
                null,
                Shape.AMORPHOUS,
                spriteBatch,
                game);

            optionsButton = new MSButton(
                null,
                OpenOptionsScreen.GetInstance(),
                new Rectangle(431, 151, 237, 57),
                game.Content.Load<Texture2D>("GamePanel/Options"),
                game.Content.Load<Texture2D>("GamePanel/optionsclicked"),
                game.Content.Load<Texture2D>("GamePanel/optionshovered"),
                null,
                Shape.AMORPHOUS,
                spriteBatch,
                game);

            exitButton = new MSButton(
                null,
                new OpenExitConfirmation(OpenExitConfirmation.ExitType.ToWindows),
                new Rectangle(460, 210, 277, 57),
                game.Content.Load<Texture2D>("GamePanel/quit"),
                game.Content.Load<Texture2D>("GamePanel/quitclicked"),
                game.Content.Load<Texture2D>("GamePanel/quithovered"),
                null,
                Shape.AMORPHOUS,
                spriteBatch,
                game);

            AddComponent(mainMenuButton);
            AddComponent(optionsButton);
            AddComponent(exitButton);

            mainMenuButton.Visible = false;
            optionsButton.Visible = false;
            exitButton.Visible = false;

            openInGameMenu = new MSAnimatingButton(
                   null,
                   new OpenInGameMenu(),
                   new Rectangle(465, 25, 111, 110),
                   game.Content.Load<Texture2D>("GamePanel/Logo"),
                   game.Content.Load<Texture2D>("GamePanel/LogoClicked"),
                   game.Content.Load<Texture2D>("GamePanel/LogoHovered"),
                   Color.White,
                   null,
                   Shape.CIRCULAR,
                   SpriteBatch,
                   Game);
            openInGameMenu.UnclickPosition = new SwingButtonOpenMovement();
            openInGameMenu.UnclickTimerLimit = 12;

            closeInGameMenu = new MSAnimatingButton(
                   null,
                   new CloseInGameMenu(),
                   new Rectangle(639, 235, 111, 110),
                   game.Content.Load<Texture2D>("GamePanel/Logo"),
                   game.Content.Load<Texture2D>("GamePanel/LogoClicked"),
                   game.Content.Load<Texture2D>("GamePanel/LogoHovered"),
                   Color.White,
                   null,
                   Shape.CIRCULAR,
                   SpriteBatch,
                   Game);

            closeInGameMenu.UnclickPosition = new SwingButtonCloseMovement();
            closeInGameMenu.UnclickTimerLimit = 12;
            closeInGameMenu.Visible = false;

            AddComponent(closeInGameMenu);
            AddComponent(openInGameMenu);

            AddComponent(moodManager.PovertyProgressBar);
            AddComponent(moodManager.EducationProgressBar);
            AddComponent(moodManager.GenderEqualityProgressBar);
            AddComponent(moodManager.ChildHealthProgressBar);
            AddComponent(moodManager.MaternalHealthProgressBar);
            AddComponent(moodManager.HivAidsProgressBar);
            AddComponent(moodManager.EnvironmentProgressBar);
            AddComponent(moodManager.GlobalPartnershipProgressBar);

            MSImageHolder translucentOverlay = new MSImageHolder
            (
                new Rectangle(0, 0, 1024, 91),
                Game.Content.Load<Texture2D>("GamePanel/translucent"),
                SpriteBatch,
                Game
            );

            AddComponent(translucentOverlay);

            Paused = false;
            MSStory.Init(district);
            load();
        }
示例#11
0
 public MSFacadePanel(Texture2D background, Rectangle boundingRectangle, float topPadding, float bottomPadding, float leftPadding, float rightPadding, Color highlight, MSToolTip toolTip, Shape shape, SpriteBatch spriteBatch, Game game)
     : base(background, boundingRectangle, topPadding, bottomPadding, leftPadding, rightPadding, highlight, toolTip, shape, spriteBatch, game)
 {
     HasFocus = false;
 }
示例#12
0
 public MSFacadePanel(Texture2D background, Rectangle boundingRectangle, MSToolTip toolTip, Shape shape, SpriteBatch spriteBatch, Game game)
     : this(background, boundingRectangle, 0, 0, 0, 0, Color.White, toolTip, shape, spriteBatch, game)
 {
 }