Пример #1
0
 protected override void Awake()
 {
     base.Awake();
     mainTowerShop = GameObject.Find("Main Tower Shop").GetComponent <BuyTower>();
 }
Пример #2
0
 protected override void Awake()
 {
     base.Awake();
     mainTowerShop = GameObject.Find("Main Tower Shop").GetComponent<BuyTower>();
 }
Пример #3
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();
        }