示例#1
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            font = Content.Load <SpriteFont>("Arial");

            JSONTable settings = new JSONTable("Settings.json");

            spriteBatch = new SpriteBatch(GraphicsDevice);
            TextureCache.Load(Content);
            inventory     = new Inventory();
            buttonStyle   = UIButton.GetDefaultStyle(Content);
            worldLevel    = new WorldLevel(settings.getJSON("cities"));
            platformLevel = new PlatformLevel();
            currentScreen = worldLevel.tutorialCity.cityLevel;
            splashes      = new SplashManager();
        }
示例#2
0
        public override void DrawUI(SpriteBatch spriteBatch, CityUIBlackboard blackboard)
        {
            if (anyThreadStalled && warningTriangleMessage != "")
            {
                Vectangle warningRect = GetWarningRect();
                spriteBatch.Draw(TextureCache.warning, warningRect, Color.White);

                if (showErrorMessage)
                {
                    Vector2 messageSize = Game1.font.MeasureString(warningTriangleMessage);
                    if (messageSize.X > warningRect.Left)
                    {
                        spriteBatch.Draw(TextureCache.white, Game1.font.GetStringBounds(warningTriangleMessage, warningRect.TopRight, TextAlignment.LEFT).Bloat(2), new Color(0.25f, 0, 0, 0.5f));
                        spriteBatch.DrawString(Game1.font, warningTriangleMessage, warningRect.TopRight, Color.Yellow);
                    }
                    else
                    {
                        spriteBatch.Draw(TextureCache.white, Game1.font.GetStringBounds(warningTriangleMessage, warningRect.TopLeft, TextAlignment.RIGHT).Bloat(2), new Color(0.25f, 0, 0, 0.5f));
                        spriteBatch.DrawString(Game1.font, warningTriangleMessage, warningRect.TopLeft, TextAlignment.RIGHT, Color.Yellow);
                    }
                }
            }

            if (selected)
            {
                ui.Draw(spriteBatch);

                Rectangle dragBoxRect = GetDragBox();

                if (commands.Count > 0)
                {
                    int     recordingDurationFrames = commands.Last().time;
                    string  durationStr             = "(" + PlatformLevel.TimeToString(recordingDurationFrames) + " secs)";
                    Vector2 textPos = new Vector2((int)bounds.CenterX, (int)(bounds.Top) - 15);
                    spriteBatch.DrawString(Game1.font, durationStr, textPos, TextAlignment.CENTER, Color.White);
                }

/*                string text = "" + numCores;
 *              Vector2 textSize = Game1.font.MeasureString(text);
 *              spriteBatch.Draw(TextureCache.outlined_square, dragBoxRect, numCores > DEFAULT_NUM_CORES? Color.Orange: Color.Gray);
 *              spriteBatch.DrawString(Game1.font, text, new Vector2((int)(dragBoxRect.Center.X - textSize.X / 2), (int)(dragBoxRect.Center.Y - textSize.Y / 2)), Color.Black);*/
            }
        }