Пример #1
0
        private static void LoadActions(Objekt o, JArray actions, MacGame game)
        {
            //JArray actions = (JArray)obj["Actions"];
            string firstAction = (string)actions[0]["Name"];
            int rows = 0;
            int cols = 0;

            for(int i2 = 0; i2 < actions.Count; i2++)
            {
                rows = (int)actions[i2]["Rows"];
                cols = (int)actions[i2]["Columns"];
                //scale = (float)actions[i2]["Scale"];
                if(rows == 0 && cols == 0)
                {
                    o.AddSprite((string)actions[i2]["Name"],
                                  new Sprite(game.Content, (string)actions[i2]["Asset"]));
                }
                else
                {
                    o.AddSprite((string)actions[i2]["Name"],
                                  new Sprite(game.Content, (string)actions[i2]["Asset"],rows,cols));
                }
            }

            o.SelectedAction = firstAction;
        }
Пример #2
0
        /// <summary>
        /// Load the graphics content
        /// </summary>
        /// <param name="batch">SpriteBatch object</param>
        /// <param name="screenWidth">Width of the screen</param>
        /// <param name="screenHeight">Height of the screen</param>
        public override void LoadContent()
        {
            ContentManager content = ScreenManager.Game.Content;
            tiles = new Dictionary<string, Tile>();

            backgroundTexture =
                content.Load<Texture2D>(@"Textures\GameScreens\PopupScreen");

            Viewport viewport = ScreenManager.GraphicsDevice.Viewport;

            backgroundPosition.X = (viewport.Width - backgroundTexture.Width) / 2;
            backgroundPosition.Y = (viewport.Height - backgroundTexture.Height) / 2;

            titlePosition.X = (viewport.Width -
                               Fonts.HeaderFont.MeasureString(titleText).X) / 2;
            titlePosition.Y = backgroundPosition.Y + 70f;

            tiles.Add("Ground", new Tile((MacGame)ScreenManager.Game, true));

            tiles["Ground"].AddSprite("tile", new Sprite(content, "Ground", false));
            tiles["Ground"].Position = new Vector2(backgroundPosition.X + 20,
                                                   backgroundPosition.Y + 100);
            tiles["Ground"].SelectedAction = "tile";

            tiles.Add("Ground2", new Tile((MacGame)ScreenManager.Game, true));

            tiles["Ground2"].AddSprite("tile", new Sprite(content, "Ground2", false));

            tiles["Ground2"].Position = new Vector2(backgroundPosition.X + 60,
                                                   backgroundPosition.Y + 100);

            tiles["Ground2"].SelectedAction = "tile";

            tiles.Add("Eraser", new Tile(
                (MacGame)ScreenManager.Game, true));

            tiles["Eraser"].AddSprite("eraser", new Sprite(content, "eraser", false));
            tiles["Eraser"].Position = new Vector2(backgroundPosition.X + 550,
                                                   backgroundPosition.Y + 400);
            tiles["Eraser"].SelectedAction = "eraser";

            mouse = new Objekt((MacGame)ScreenManager.Game, true);

            mouse.AddSprite("point",new Sprite(content, "mouse-pointer",false));
            mouse.SelectedAction = "point";
            mouse.Position = new Vector2(0,0);
        }