Пример #1
0
        public void Draw(SpriteBatch spriteBatch, int points, int coins, int zone, int level, int time, WorldState state)
        {
            spriteBatch.Begin();

            spriteBatch.DrawString(Fonts.CourierNew, "Mario", marioPos, Color.White);
            String strPoints = points.ToString().PadLeft(6, '0');

            spriteBatch.DrawString(Fonts.CourierNew, strPoints, pointsPos, Color.White);

            StaticSprite coin = new StaticSprite(Textures.Coin);

            coin.Draw(spriteBatch, coinPos, Color.White, 1.5f, true);

            String strCoins = "x" + coins.ToString().PadLeft(2, '0');

            spriteBatch.DrawString(Fonts.CourierNew, strCoins, coinsPos, Color.White);

            spriteBatch.DrawString(Fonts.CourierNew, "World", worldPos, Color.White);
            String strLevel = zone.ToString() + "-" + level.ToString();

            spriteBatch.DrawString(Fonts.CourierNew, strLevel, levelPos, Color.White);

            spriteBatch.DrawString(Fonts.CourierNew, "Time", timePos, Color.White);
            String strTimeLeft = (time / 30).ToString().PadLeft(3, '0');

            spriteBatch.DrawString(Fonts.CourierNew, strTimeLeft, timeLeftPos, Color.White);

            if (state == WorldState.PAUSED)
            {
                spriteBatch.DrawString(Fonts.CourierNew, "Paused", pausedPos, Color.White);
            }
            spriteBatch.End();
        }
Пример #2
0
        protected override void LoadContent()
        {
            _textures = new Texture2DCache(typeof(Textures));

            _spriteBatch       = new SpriteBatch(Globals.GraphicsDevice);
            _child1            = StaticSprite.Acquire(_textures[(int)Textures.ColoredRect], new Vector2(100, 100));
            _child1.LayerDepth = 1;

            _child2 = StaticSprite.Acquire(_textures[(int)Textures.GrayRect], new Vector2(25, 50));
            _child2.RenderingExtent.Anchor = new Vector2(250, 250);
            _child2.LayerDepth             = 1;

            _markerAnchor_Blue            = StaticSprite.Acquire(_textures[(int)Textures.Marker_Blue], new Vector2(4, 4));
            _markerAnchor_Blue.LayerDepth = 0;
            _renderParamsTemplate.GetTexture_MarkCenter = new Getter <ISprite>(() => { return(_markerAnchor_Blue); });

            _markerTopLeft_Red            = StaticSprite.Acquire(_textures[(int)Textures.Marker_Red], new Vector2(4, 4));
            _markerTopLeft_Red.LayerDepth = 0;
            _renderParamsTemplate.GetTexture_MarkOrigin = new Getter <ISprite>(() => { return(_markerTopLeft_Red); });

            _markerCompositeAnchor_Green                 = StaticSprite.Acquire(_textures[(int)Textures.Marker_Green], new Vector2(4, 4));
            _markerCompositeAnchor_Green.LayerDepth      = 0;
            _renderParamsTemplate.GetTexture_MarkTopLeft = new Getter <ISprite>(() => { return(_markerCompositeAnchor_Green); });

            _compositeExtent = new CompositeExtent();
            _compositeExtent.Add(_child1.RenderingExtent);
            _compositeExtent.Add(_child2.RenderingExtent);

            _contentLoaded = true;
        }
Пример #3
0
        protected override void LoadContent()
        {
            _textures    = new Texture2DCache(typeof(Textures));
            _spriteBatch = new SpriteBatch(Globals.GraphicsDevice);

            for (int i = 0; i < 3; i++)
            {
                for (int j = 0; j < 3; j++)
                {
                    var sprite = StaticSprite.Acquire(_textures[(int)Textures.ColoredRect]);
                    sprite.LayerDepth             = 1;
                    sprite.RenderingExtent.Anchor = new Vector2(100 + i * 250, 100 + j * 250);
                    _sprites.Add(sprite);
                }
            }

            _viewportCenter            = StaticSprite.Acquire(_textures[(int)Textures.Marker_Red], new Vector2(4, 4));
            _viewportCenter.LayerDepth = 0;
            _sprites.Add(_viewportCenter);

            ScreenUtility.InitGraphicsMode(800, 480, false);

            _viewport.ResetWithScreenSize(800, 480);

            _contentLoaded = true;
        }
Пример #4
0
 public override void LoadRes(Microsoft.Xna.Framework.Content.ContentManager cm)
 {
     // Define the resource used as background
     background = new StaticSprite(cm.Load <Texture2D>("test/floor"));
     // Defines the Tex2D that is used to check for walls
     wallDef = cm.Load <Texture2D>("test/Test Room Red");
 }
Пример #5
0
        protected override void LoadContent()
        {
            _textures = new Texture2DCache(typeof(Textures));

            _spriteBatch = new SpriteBatch(Globals.GraphicsDevice);

            _markerAnchor_Blue            = StaticSprite.Acquire(_textures[(int)Textures.Marker_Blue], new Vector2(4, 4));
            _markerAnchor_Blue.LayerDepth = 0;
            _renderParamsTemplate.GetTexture_MarkCenter = new Getter <ISprite>(() => { return(_markerAnchor_Blue); });

            _markerTopLeft_Red            = StaticSprite.Acquire(_textures[(int)Textures.Marker_Red], new Vector2(4, 4));
            _markerTopLeft_Red.LayerDepth = 0;
            _renderParamsTemplate.GetTexture_MarkOrigin = new Getter <ISprite>(() => { return(_markerTopLeft_Red); });

            _markerCompositeAnchor_Green                 = StaticSprite.Acquire(_textures[(int)Textures.Marker_Green], new Vector2(4, 4));
            _markerCompositeAnchor_Green.LayerDepth      = 0;
            _renderParamsTemplate.GetTexture_MarkTopLeft = new Getter <ISprite>(() => { return(_markerCompositeAnchor_Green); });

            List <Vector2> vertices = new List <Vector2>();

            vertices.Add(new Vector2(100, 100));
            vertices.Add(new Vector2(150, 50));
            vertices.Add(new Vector2(200, 100));
            vertices.Add(new Vector2(120, 120));

            _polygon = new PolygonExtent();
            _polygon.Reset(vertices);
            _polygon.ReAnchor(_polygon.ActualCenter);

            _contentLoaded = true;
        }
Пример #6
0
 public void AddStaticSprite(Texture2D sprite)
 {
     if (StaticSprite == null)
     {
         StaticSprite = new StaticSprite(this, sprite);
         components.Add(StaticSprite);
     }
     ComponentAdded(StaticSprite);
 }
Пример #7
0
        protected override void Load()
        {
            StaticSprite frame1 = new StaticSprite();
            StaticSprite frame2 = new StaticSprite();

            frame1.Load(Parent.Engine.Content, "Froggy", new Rectangle(0, 0, 34, 29));
            frame1.Origin = new Vector2(17, 28);
            frame2.Load(Parent.Engine.Content, "Froggy", new Rectangle(34, 0, 34, 29));
            frame2.Origin = new Vector2(18, 28);

            frame1.Scale    = 2f;
            frame2.Scale    = 2f;
            _sequence.Scale = 2f;

            _sequence.AddSprite(frame1, 0.5f);
            _sequence.AddSprite(frame2, 0.5f);

            _sequence.RepeatIndefinitely = true;
            _sequence.Start();

            //_mask = new CircleMask(new PointFP(8, 8), 10);
            _mask          = new AABBMask(new PointFP(-16, -32), new PointFP(16, 0));
            _mask.Position = _position;

            Dictionary <PlatformAction, PlatformAction> cmap = new Dictionary <PlatformAction, PlatformAction>();

            cmap[PlatformAction.Left]   = PlatformAction.Left;
            cmap[PlatformAction.Right]  = PlatformAction.Right;
            cmap[PlatformAction.Up]     = PlatformAction.Up;
            cmap[PlatformAction.Down]   = PlatformAction.Down;
            cmap[PlatformAction.Jump]   = PlatformAction.Jump;
            cmap[PlatformAction.Action] = PlatformAction.Action;

            /*PaddleMovement<PaddleAction> behavior = new PaddleMovement<PaddleAction>(this, "player", cmap);
             * behavior.Origin = new Vector2(400, 200);
             * behavior.Range = 100;
             * behavior.Speed = 120;
             * behavior.Direction = PaddleDirection.Vertical;
             * AddBehavior(behavior);*/

            /*PlayerPlatformMovement<PlatformAction> behavior = new PlayerPlatformMovement<PlatformAction>(this, "player", cmap);
             * behavior.AccelX = (FPInt)0.5;
             * behavior.DecelX = (FPInt)0.25;
             * behavior.MinVelocityX = (FPInt)(-3);
             * behavior.MaxVelocityX = (FPInt)3;
             * behavior.AccelY = (FPInt)0.4;
             * behavior.MinVelocityY = -12;
             * behavior.MaxVelocityY = 12;
             * behavior.AccelStateY = PlatformAccelState.Accelerate;*/

            //AddBehavior(behavior);

            CircleMovement circle = new CircleMovement(this, new PointFP(300, 300), 150, 1);

            AddBehavior(circle);
        }
Пример #8
0
 public CombatHUDPanel(LunchHourGames lhg, Player player)
     : base(lhg)
 {
     this.lhg          = lhg;
     this.spriteBatch  = lhg.MySpriteBatch;
     this.player       = player;
     this.playerSprite = player.MyHUDSprite;
     this.playerName   = player.MyName;
     this.font         = lhg.SmallFont;
 }
Пример #9
0
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();

        if (GUILayout.Button("Set Size"))
        {
            StaticSprite component = (StaticSprite)target;
            component.UpdateSize();
        }
    }
Пример #10
0
        protected override void LoadContent()
        {
            _spriteBatch = new SpriteBatch(Globals.GraphicsDevice);
            _textures    = new Texture2DCache(typeof(Textures));
            _spriteRed   = StaticSprite.Acquire(_textures[(int)Textures.RectRedVertical]);

            _spriteRed.LayerDepth  = 0; //front
            _spriteBlue            = StaticSprite.Acquire(_textures[(int)Textures.RectBlueHorizontal]);
            _spriteBlue.LayerDepth = 1; //back
        }
Пример #11
0
        public override void LoadContent(IServiceProvider services)
        {
            base.LoadContent(services);
            var content = (ContentManager)services.GetService(typeof(ContentManager));

            var texture = content.Load <Texture2D>(@"Sprites\Chain");
            var sprite  = new StaticSprite(new Vector2(1.0f), texture, Name + "_Sprite");

            SceneNode.Attach(sprite);
        }
Пример #12
0
        public override void LoadContent(IServiceProvider services)
        {
            base.LoadContent(services);
            var content = (ContentManager)services.GetService(typeof(ContentManager));

            var texture = content.Load <Texture2D>(@"Sprites\SpaceShip");
            var sprite  = new StaticSprite(new Vector2(2.0f, 6.0f), texture, Name + "_Sprite", new Rectangle(0, 0, 128, 386));

            SceneNode.Attach(sprite);
        }
Пример #13
0
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            Statistics.Load(@"Content/settings/save.dat");
            Message.DisplayTime       = 5000;
            AiUnit.statusBarTexture   = new Texture2D[] { Content.Load <Texture2D>(@"texture/ui/status_bar_bottom"), Content.Load <Texture2D>(@"texture/ui/status_bar_top") };
            Building.statusBarTexture = new Texture2D[] { Content.Load <Texture2D>(@"texture/ui/status_bar_bottom"), Content.Load <Texture2D>(@"texture/ui/status_bar_top") };
            BaseObject.DebugFont      = Content.Load <SpriteFont>(@"fonts/debug");
            spriteBatch = new SpriteBatch(GraphicsDevice);
            Texture2D t_r = new Texture2D(GraphicsDevice, 1, 1);
            Texture2D t_g = new Texture2D(GraphicsDevice, 1, 1);
            Texture2D t_b = new Texture2D(GraphicsDevice, 1, 1);

            Color[] red   = new Color[1];
            Color[] green = new Color[1];
            Color[] blue  = new Color[1];

            for (int i = 0; i < t_r.Height * t_g.Width; i++)
            {
                red[i]   = new Color(255, 0, 0);
                green[i] = new Color(0, 255, 0);
                blue[i]  = new Color(0, 0, 255);
            }

            t_r.SetData <Color>(red);
            t_g.SetData <Color>(green);
            t_b.SetData <Color>(blue);

            for (int i = 0; i < points.Count(); i++)
            {
                points[i] = new Vector2(rng.Next(0, 600), rng.Next(0, 600));
            }

            grid       = new Grid(gridSize, new Vector2(0, 0), Content.Load <Texture2D>(@"texture/tile_n"), Content.Load <Texture2D>(@"texture/tile_h"), Content.Load <Texture2D>(@"texture/tile_c"), tileSize, @"Content/buildings/buildings.txt", @"Content/UI/ui_grid_menu.txt", Content);
            player     = new Player(t_b, new Point(1900, 50), new Texture2D[] { Content.Load <Texture2D>(@"texture/ui/healthbar_bottom"), Content.Load <Texture2D>(@"texture/ui/healthbar_top") }, Content);
            os         = new Overseer(Content, new Texture2D[] { t_r, t_g });
            architech  = new Architech(Content, grid);
            uiMaster   = new UiMaster(Content);
            wizard     = new Wizard(Content);
            researcher = new Researcher(Content, rng);
            backdrop   = new StaticSprite(new Vector2(0, 0), Content.Load <Texture2D>(@"texture/ui/backdrop2"), new Point(1920, 1080));
            terrain    = new StaticSprite(new Vector2(0, -5), Content.Load <Texture2D>(@"texture/terrain"), new Point(1920, 1080 - (3 * 64)));
            light      = new StaticSprite(Vector2.Zero, Content.Load <Texture2D>(@"texture/terrainLight"), new Point(1920, 1080 - (3 * 64)));
            screens    = new Texture2D[3];

            screens[0]     = Content.Load <Texture2D>(@"texture/menu_screen");
            screens[1]     = Content.Load <Texture2D>(@"texture/ui/guide");
            screens[2]     = Content.Load <Texture2D>(@"texture/end_screen");
            overlay_Screen = new StaticSprite(Vector2.Zero, screens[0], new Point(1920, 1080));

            update = new TimeSpan();
        }
Пример #14
0
        internal void Initialize()
        {
            _minimapFrame = new StaticSprite("HUD/Minimap_Frame", 1.0f, DrawLayers.HUD.Backgrounds);

            float mapFrameSideLength = Math.Min(Screen.Width / 4.0f, Screen.Height / 3.0f);

            _mapFrameScale = mapFrameSideLength / _minimapFrame.Texture.Bounds.Width;
            _mapFrameRect  = new Rectangle(0, (int)(Screen.Height - mapFrameSideLength), (int)mapFrameSideLength, (int)mapFrameSideLength);

            float frameWidth = _mapFrameWidthFraction * mapFrameSideLength;

            _mapRect = new Rectangle((int)(_mapFrameRect.Left + frameWidth), (int)(_mapFrameRect.Top + frameWidth), (int)(_mapFrameRect.Width - 2 * frameWidth), (int)(_mapFrameRect.Height - 2 * frameWidth));
        }
Пример #15
0
        public void Initialize()
        {
            _weaponFrameSprite = new StaticSprite("HUD/WeaponFrame", 1.0f, DrawLayers.HUD.Backgrounds);

            float weaponFrameSideLength = Math.Min(Screen.Width / 4.0f, Screen.Height / 3.0f);

            _weaponFrameRectangle = new Rectangle((int)(Screen.Width - weaponFrameSideLength), (int)(Screen.Height - weaponFrameSideLength), (int)(weaponFrameSideLength), (int)(weaponFrameSideLength));

            _ammoLocation        = new Vector2(Screen.Width - 0.824f * weaponFrameSideLength, Screen.Height - 0.411f * weaponFrameSideLength);
            _spareRoundsLocation = new Vector2(Screen.Width - 0.824f * weaponFrameSideLength, Screen.Height - 0.201f * weaponFrameSideLength);

            _weaponImageRectangle = new Rectangle((int)(_weaponFrameRectangle.Left + (0.357f * weaponFrameSideLength)), (int)(_weaponFrameRectangle.Top + (0.150f * weaponFrameSideLength)), (int)(0.547f * _weaponFrameRectangle.Width), (int)(0.547f * _weaponFrameRectangle.Height));
        }
Пример #16
0
        protected override void LoadContent()
        {
            _textures = new Texture2DCache(typeof(Textures));

            _spriteBatch       = new SpriteBatch(Globals.GraphicsDevice);
            _sprite            = StaticSprite.Acquire(_textures[(int)Textures.ColoredRect], new Vector2(100, 100));
            _sprite.LayerDepth = 1;

            _markerAnchor_Blue            = StaticSprite.Acquire(_textures[(int)Textures.Marker_Blue], new Vector2(4, 4));
            _markerAnchor_Blue.LayerDepth = 0;

            _markerTopLeft_Red            = StaticSprite.Acquire(_textures[(int)Textures.Marker_Red], new Vector2(4, 4));
            _markerTopLeft_Red.LayerDepth = 0;
        }
Пример #17
0
        public static Bot CreateBot(BotInfo info, List <Vector> patrolPoints)
        {
            var position       = info.Position.Copy();
            var angle          = info.Angle;
            var type           = BotBank.GetBotTypeInfo(info.Type);
            var legs           = new PlayerBodySprite(position, GetBitmap(type.ClothesTileMapPath), 1, 14, 27, new Size(64, 64));
            var torso          = new StaticSprite(GetBitmap(type.WeaponsTileMapPath), WeaponFramesId[type.Weapon.WeaponType], new Size(79, 57));
            var legsContainer  = new SpriteContainer(legs, position, angle);
            var torsoContainer = new SpriteContainer(torso, position, angle);
            var sightVector    = new Vector(1, 0).Rotate(-angle, Vector.ZeroVector).Normalize();

            return(new Bot(
                       type.Health, type.Armor, legsContainer, torsoContainer, sightVector,
                       new RigidCircle(position, 32, false, true),
                       AbstractWeaponFactory.CreateGun(type.Weapon), type.DeadBodyTileMapPath, patrolPoints));
        }
Пример #18
0
        internal void Initialize()
        {
            _healthSprite      = new StaticSprite("HUD/HealthBar", 1.0f, DrawLayers.HUD.Dynamic_Info);
            _healthFrameSprite = new StaticSprite("HUD/Health_Frame", 1.0f, DrawLayers.HUD.Backgrounds);

            float healthFrameSpriteWidth  = Screen.Width / 2.0f;
            float healthFrameSpriteHeight = _healthFrameSprite.Texture.Height / 3;

            //To be used with the spriteBatch.Draw() call
            _healthFrameScale = new Vector2(healthFrameSpriteWidth / _healthFrameSprite.Texture.Width, healthFrameSpriteHeight / _healthFrameSprite.Texture.Height);

            float healthFrameWidth  = healthFrameSpriteWidth * _healthFrameWidthFraction;
            float healthFrameHeight = healthFrameSpriteHeight * _healthFrameHeightFraction;

            _healthFrameRect = new Rectangle((int)(Screen.Width / 4.0f), 10, (int)healthFrameSpriteWidth, (int)healthFrameSpriteHeight);

            _healthRect = new Rectangle((int)(_healthFrameRect.Left + healthFrameWidth), (int)(_healthFrameRect.Top + healthFrameHeight), (int)(_healthFrameRect.Width - 2 * healthFrameWidth), (int)(_healthFrameRect.Height - 2 * healthFrameHeight));
        }
Пример #19
0
        public void LoadRes(Microsoft.Xna.Framework.Content.ContentManager cm)
        {
            menubg = new StaticSprite(cm.Load <Texture2D>("Menu/Battle Menu/Battle HUD - Core"));
            skill  = new StaticSprite(cm.Load <Texture2D>("Menu/Battle Menu/Battle HUD - Arms, Magick"));
            item   = new StaticSprite(cm.Load <Texture2D>("Menu/Battle Menu/Battle HUD - Items"));

            int i = 1;

            foreach (Button alpha in new Button[] { punch, jump, arms, magick, items, run })
            {
                Texture2D tex = cm.Load <Texture2D>("Menu/Battle Menu/Battle buttons " + i);

                alpha.Hover      = new StaticSprite(tex);
                alpha.Idle       = new StaticSprite(tex);
                alpha.Idle.Tint  = new Color(240, 240, 240);
                alpha.Press      = new StaticSprite(tex);
                alpha.Press.Tint = new Color(205, 205, 205);

                i++;
            }
        }
Пример #20
0
        protected override void LoadContent()
        {
            _textures = new Texture2DCache(typeof(Textures));

            _spriteBatch = new SpriteBatch(Globals.GraphicsDevice);
            _fonts       = new SpriteFontCache(typeof(Fonts));

            _markerIntersect_Blue            = StaticSprite.Acquire(_textures[(int)Textures.Marker_Blue], new Vector2(4, 4));
            _markerIntersect_Blue.LayerDepth = 0;

            _markerPoint_Red                        = StaticSprite.Acquire(_textures[(int)Textures.Marker_Red], new Vector2(4, 4));
            _markerPoint_Red.LayerDepth             = 0;
            _markerPoint_Red.RenderingExtent.Anchor = new Vector2(_xValue, _yValue);

            var vertices = new List <Vector2>();

            vertices.Add(new Vector2(22, 122));
            vertices.Add(new Vector2(66, 23));
            vertices.Add(new Vector2(150, 5));
            vertices.Add(new Vector2(293, 78));
            vertices.Add(new Vector2(256, 194));
            vertices.Add(new Vector2(230, 86));
            vertices.Add(new Vector2(202, 175));
            vertices.Add(new Vector2(113, 157));
            vertices.Add(new Vector2(168, 69));
            vertices.Add(new Vector2(165, 148));
            vertices.Add(new Vector2(203, 60));
            vertices.Add(new Vector2(105, 50));
            vertices.Add(new Vector2(77, 140));
            vertices.Add(new Vector2(40, 147));

            _insidePolygon = XenString.Acquire();
            _insidePolygon.Reset(_fonts[(int)Fonts.Arial], "Inside!");

            _polygonExtent = new PolygonExtent();
            _polygonExtent.Reset(vertices);
        }
Пример #21
0
 /// <summary>
 /// Add sprite to draw on the static batch.
 /// </summary>
 /// <param name="sprite">Sprite to add to grid.</param>
 public void AddSprite(StaticSprite sprite)
 {
     _spritesPending.Add(sprite);
 }
Пример #22
0
            public static void LoadRes(Microsoft.Xna.Framework.Content.ContentManager cm)
            {
                // Protagonist: Idle
                AnimateSprite atemp = new AnimateSprite(new TimeSpan(1050000));
                for(int i = 1; i < 5; i++) {
                    StaticSprite stemp = new StaticSprite(cm.Load<Texture2D>("Talking/Protag - Arms/Talk Portrait - Protag - Arms - Idle " + i));
                    atemp.Add(stemp);
                }
                for(int i = 0; i < 20; i++) {
                    StaticSprite stemp = new StaticSprite(cm.Load<Texture2D>("Talking/Protag - Arms/Talk Portrait - Protag - Arms - Idle 4"));
                    atemp.Add(stemp);
                }
                ports["pIdle"] = atemp;

                // Protagonist: Happy
                atemp = new AnimateSprite(new TimeSpan(1050000));
                for(int i = 1; i < 9; i++) {
                    StaticSprite stemp = new StaticSprite(cm.Load<Texture2D>("Talking/Protag - Arms/Talk Portrait - Protag - Arms - Talk Happy " + i));
                    atemp.Add(stemp);
                }
                ports["pHappy"] = atemp;

                // Flat Lizard: Idle
                atemp = new AnimateSprite(new TimeSpan(1050000));
                for(int i = 1; i < 6; i++) {
                    StaticSprite stemp = new StaticSprite(cm.Load<Texture2D>("Talking/NPCs/Tiny Animals/Talk Portrait - NPC - Flat Lizard - Idle " + i));
                    atemp.Add(stemp);
                }
                for(int i = 0; i < 20; i++) {
                    StaticSprite stemp = new StaticSprite(cm.Load<Texture2D>("Talking/NPCs/Tiny Animals/Talk Portrait - NPC - Flat Lizard - Idle 5"));
                    atemp.Add(stemp);
                }
                ports["flatlizIdle"] = atemp;

                // Flat Lizard: Talk
                atemp = new AnimateSprite(new TimeSpan(1050000));
                atemp.Add(new StaticSprite(cm.Load<Texture2D>("Talking/NPCs/Tiny Animals/Talk Portrait - NPC - Flat Lizard - Idle 1")));
                for(int i = 1; i < 4; i++) {
                    StaticSprite stemp = new StaticSprite(cm.Load<Texture2D>("Talking/NPCs/Tiny Animals/Talk Portrait - NPC - Flat Lizard - Talk " + i));
                    atemp.Add(stemp);
                }
                atemp.Add(new StaticSprite(cm.Load<Texture2D>("Talking/NPCs/Tiny Animals/Talk Portrait - NPC - Flat Lizard - Talk 2")));
                ports["flatlizTalk"] = atemp;

                // Lumisnail 1 & 2
                for(int n = 1; n < 3; n++) {
                    atemp = new AnimateSprite(new TimeSpan(1050000));
                    for(int i = 1; i < 5; i++) {
                        StaticSprite stemp = new StaticSprite(cm.Load<Texture2D>("Talking/NPCs/Tiny Animals/Talk Portrait - NPC - Lumisnail " + n + " - All " + i));
                        atemp.Add(stemp);
                    }
                    ports["lumisnail" + n] = atemp;
                }

                // Mantis
                atemp = new AnimateSprite(new TimeSpan(1050000));
                for(int i = 1; i < 5; i++) {
                    StaticSprite stemp = new StaticSprite(cm.Load<Texture2D>("Talking/NPCs/Tiny Animals/Talk Portrait - NPC - Mantis - All " + i));
                    atemp.Add(stemp);
                }
                ports["mantis"] = atemp;

                top = new StaticSprite(cm.Load<Texture2D>("Talking/Talk Box U"));
                bottom = new StaticSprite(cm.Load<Texture2D>("Talking/Talk Box D"));
                nameplate = new StaticSprite(cm.Load<Texture2D>("Talking/Talk Nameplate"));
            }
Пример #23
0
 public override void LoadRes(Microsoft.Xna.Framework.Content.ContentManager cm)
 {
     background = new StaticSprite(cm.Load <Texture2D>("Locations/Derelict Laboratory/Room 1"));
     wallDef    = cm.Load <Texture2D>("Locations/Derelict Laboratory/Room 1 Walls");
 }
Пример #24
0
        public void LoadContent()
        {
            m_debug.LoadContent();

            var pp = m_graphics.PresentationParameters;

            // Create our entity world.
            m_world = new DynamicEntityWorld(m_game.Services);

            // Create the debug view.
            m_debugView = new DebugViewXNA(m_world.PhysicsWorld);
            m_debugView.LoadContent(m_graphics, m_content);

            // Create the camera.
            m_camera = new DefaultCamera(null, new Viewport(0, 0, pp.BackBufferWidth, pp.BackBufferHeight));
            m_cameraNode = m_world.Scene.Root.CreateChild("Camera");
            m_cameraNode.Attach(m_camera);

            // Create the player.
            m_player = new Entities.Player(
                new StaticSprite(Vector2.One * 10.0f, m_content.Load<Texture2D>(@"Sprites\Ship01"), "Player"));

            m_player.Attach(new Controllers.PlayerMovement(m_camera));
            m_world.Add(m_player);

            m_player.Position = new Vector2(0.0f, 0.0f);

            // Create the layers.
            m_playerLayer = new DefaultLayer(typeof(ISprite), "Player", 0.5f) { Scene = m_world.Scene };
            m_backgroundLayer = new DefaultLayer(0.0f) { Scene = m_world.Scene };

            // Create the background.
            var deepSpaceSprite = new StaticSprite(Vector2.One * 200.0f, m_content.Load<Texture2D>(@"Textures\Background01"), null) { BlendState = BlendState.Additive };
            var lessDeepSpaceSprite = new StaticSprite(Vector2.One * 400.0f, m_content.Load<Texture2D>(@"Textures\Background02"), null) { BlendState = BlendState.Additive };

            m_deepSpaceNode = m_cameraNode.CreateChild("Background_DeepSpace");
            m_deepSpaceNode.Depth = -1.0f; // Move the background into the back.
            m_deepSpaceNode.Attach(deepSpaceSprite);

            m_lessDeepSpaceNode = m_cameraNode.CreateChild("Background_LessDeepSpace");
            m_lessDeepSpaceNode.Depth = -0.9f; // Move the background into the back, but in front of the other background.
            m_lessDeepSpaceNode.Attach(lessDeepSpaceSprite);

            m_backgroundLayer.AddRenderable(deepSpaceSprite);
            m_backgroundLayer.AddRenderable(lessDeepSpaceSprite);

            // Create the dust cloud.
            var dustCloud = new Movables.DustCloud(100);

            m_dustCloudNode = m_world.Scene.Root.CreateChild("DustCloud");
            m_dustCloudNode.Depth = -0.8f;
            m_dustCloudNode.Attach(dustCloud);

            m_backgroundLayer.AddRenderable(dustCloud);

            // Create the planet.
            m_terrainLayer = new DefaultLayer(typeof(Entities.TerrainRegion), null, 0.0f) { Scene = m_world.Scene };
            m_miscLayer = new DefaultLayer(typeof(ISprite), "MISC_", -0.5f) { Scene = m_world.Scene };

            CreatePlanet();
        }
Пример #25
0
 public override void LoadRes(Microsoft.Xna.Framework.Content.ContentManager cm)
 {
     sprite = new StaticSprite(cm.Load <Texture2D>("test/orange"));
 }
Пример #26
0
        protected override void Load()
        {
            StaticSprite frame1 = new StaticSprite();
            StaticSprite frame2 = new StaticSprite();

            frame1.Load(Parent.Engine.Content, "Froggy", new Rectangle(0, 0, 34, 29));
            frame1.Origin = new Vector2(17, 28);
            frame2.Load(Parent.Engine.Content, "Froggy", new Rectangle(34, 0, 34, 29));
            frame2.Origin = new Vector2(18, 28);

            frame1.Scale = 2f;
            frame2.Scale = 2f;
            _sequence.Scale = 2f;

            _sequence.AddSprite(frame1, 0.5f);
            _sequence.AddSprite(frame2, 0.5f);

            _sequence.RepeatIndefinitely = true;
            _sequence.Start();

            //_mask = new CircleMask(new PointFP(8, 8), 10);
            _mask = new AABBMask(new PointFP(-16, -32), new PointFP(16, 0));
            _mask.Position = _position;

            Dictionary<PlatformAction, PlatformAction> cmap = new Dictionary<PlatformAction, PlatformAction>();
            cmap[PlatformAction.Left] = PlatformAction.Left;
            cmap[PlatformAction.Right] = PlatformAction.Right;
            cmap[PlatformAction.Up] = PlatformAction.Up;
            cmap[PlatformAction.Down] = PlatformAction.Down;
            cmap[PlatformAction.Jump] = PlatformAction.Jump;
            cmap[PlatformAction.Action] = PlatformAction.Action;

            /*PaddleMovement<PaddleAction> behavior = new PaddleMovement<PaddleAction>(this, "player", cmap);
            behavior.Origin = new Vector2(400, 200);
            behavior.Range = 100;
            behavior.Speed = 120;
            behavior.Direction = PaddleDirection.Vertical;
            AddBehavior(behavior);*/

            /*PlayerPlatformMovement<PlatformAction> behavior = new PlayerPlatformMovement<PlatformAction>(this, "player", cmap);
            behavior.AccelX = (FPInt)0.5;
            behavior.DecelX = (FPInt)0.25;
            behavior.MinVelocityX = (FPInt)(-3);
            behavior.MaxVelocityX = (FPInt)3;
            behavior.AccelY = (FPInt)0.4;
            behavior.MinVelocityY = -12;
            behavior.MaxVelocityY = 12;
            behavior.AccelStateY = PlatformAccelState.Accelerate;*/

            //AddBehavior(behavior);

            CircleMovement circle = new CircleMovement(this, new PointFP(300, 300), 150, 1);
            AddBehavior(circle);
        }
Пример #27
0
        /// <summary>
        /// Fires a missle.
        /// </summary>
        public void FireMissle()
        {
            // Spawn a missle entity.
            var sprite = new StaticSprite(Vector2.One * 2.0f, m_missleTexture, "MISC_Missle", new Rectangle(4, 2, 24, 28));
            var missle = new Missle(sprite);

            var direction = -Vector2.UnitY;
            direction = new Vector2(
                direction.X * MathCore.Cos(this.SceneNode.Rotation) + -direction.Y * MathCore.Sin(this.SceneNode.Rotation),
                direction.Y * MathCore.Cos(this.SceneNode.Rotation) + direction.X * MathCore.Sin(this.SceneNode.Rotation));

            this.World.Add(missle);

            missle.Position = this.SceneNode.Position + (direction * 8.0f);
            missle.Rotation = this.SceneNode.Rotation;
            missle.Body.LinearVelocity = this.Body.LinearVelocity + (direction * 50.0f);

            // Play the sound.
            m_soundMissleLaunch.Play();
        }
Пример #28
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.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            // TODO: use this.Content to load your game content here
            font = Content.Load <SpriteFont>("font");

            var         playerSheet   = Content.Load <Texture2D>("playerSheet");
            SpriteSheet playerSprites = new SpriteSheet(playerSheet, 64, 64);

            player             = new Player(this);
            player.spritesheet = playerSheet;
            var l = (from index in Enumerable.Range(4, 8) select playerSprites[index]).ToList();

            l.AddRange((from index in Enumerable.Range(41, 6) select playerSprites[index]).ToList());
            player.sprites = l.ToArray();
            var testPixel = Content.Load <Texture2D>("bricksx64");

            obstacle             = new Obstacle(this);
            obstacle.spritesheet = testPixel;

            frontLayer = new ParallaxLayer(this);
            frontLayer.Sprites.Add(player);
            frontLayer.Sprites.Add(obstacle);
            frontLayer.DrawOrder        = 8;
            frontLayer.ScrollController = new AutoScrollController(0.0f);
            Components.Add(frontLayer);

            var backgroundTextures = new Texture2D[]
            {
                Content.Load <Texture2D>("layer_08"),
                Content.Load <Texture2D>("layer_07_1")
            };
            var backgroundSprites = new StaticSprite[]
            {
                new StaticSprite(backgroundTextures[0]),
                new StaticSprite(backgroundTextures[1])
            };
            var backgroundLayer = new ParallaxLayer(this);

            backgroundLayer.Sprites.AddRange(backgroundSprites);
            backgroundLayer.DrawOrder = 1;
            Components.Add(backgroundLayer);

            var cloudLayerTexture = Content.Load <Texture2D>("layer_07_2");
            var cloudLayerSprite  = new StaticSprite(cloudLayerTexture);
            var cloudLayer        = new ParallaxLayer(this);

            cloudLayer.Sprites.Add(cloudLayerSprite);
            cloudLayer.DrawOrder        = 2;
            cloudLayer.ScrollController = new AutoScrollController(10f);
            Components.Add(cloudLayer);

            var midSkylineTexture1 = Content.Load <Texture2D>("layer_06");
            var midSkylineSprite1  = new StaticSprite(midSkylineTexture1);
            var midSkylineLayer1   = new ParallaxLayer(this);

            midSkylineLayer1.Sprites.Add(midSkylineSprite1);
            midSkylineLayer1.DrawOrder        = 3;
            midSkylineLayer1.ScrollController = new AutoScrollController(10f);
            Components.Add(midSkylineLayer1);

            var midSkylineTexture2 = Content.Load <Texture2D>("layer_05");
            var midSkylineSprite2  = new StaticSprite(midSkylineTexture2);
            var midSkylineLayer2   = new ParallaxLayer(this);

            midSkylineLayer2.Sprites.Add(midSkylineSprite2);
            midSkylineLayer2.DrawOrder        = 4;
            midSkylineLayer2.ScrollController = new AutoScrollController(10f);
            Components.Add(midSkylineLayer2);

            var midSkylineTexture3 = Content.Load <Texture2D>("layer_04");
            var midSkylineSprite3  = new StaticSprite(midSkylineTexture3);
            var midSkylineLayer3   = new ParallaxLayer(this);

            midSkylineLayer3.Sprites.Add(midSkylineSprite3);
            midSkylineLayer3.DrawOrder        = 5;
            midSkylineLayer3.ScrollController = new AutoScrollController(10f);
            Components.Add(midSkylineLayer3);

            var midSkylineTexture4 = Content.Load <Texture2D>("layer_03");
            var midSkylineSprite4  = new StaticSprite(midSkylineTexture4);
            var midSkylineLayer4   = new ParallaxLayer(this);

            midSkylineLayer4.Sprites.Add(midSkylineSprite4);
            midSkylineLayer4.DrawOrder        = 6;
            midSkylineLayer4.ScrollController = new AutoScrollController(10f);
            Components.Add(midSkylineLayer4);

            var foregroundTextures = new Texture2D[]
            {
                Content.Load <Texture2D>("layer_02"),
                Content.Load <Texture2D>("layer_01")
            };
            var foregroundSprites = new StaticSprite[]
            {
                new StaticSprite(foregroundTextures[0]),
                new StaticSprite(foregroundTextures[1])
            };
            var foregroundLayer = new ParallaxLayer(this);

            foregroundLayer.Sprites.AddRange(foregroundSprites);
            foregroundLayer.DrawOrder = 7;
            Components.Add(foregroundLayer);

            midSkylineLayer1.ScrollController = new AutoScrollController(15);
            midSkylineLayer2.ScrollController = new AutoScrollController(20);
            midSkylineLayer3.ScrollController = new AutoScrollController(25);
            midSkylineLayer4.ScrollController = new AutoScrollController(35);
            foregroundLayer.ScrollController  = new AutoScrollController(100);
        }
Пример #29
0
        public override void InitUI()
        {
            game.background = StaticSprite.CreateSprite(0, 0, game.ScreenScaleFactor, @"Sprite/GameUI/Background", 1.0f);
            // title
            if (game.GameTitle == null)
            {
                game.GameTitle = StaticSprite.CreateSprite(200, 182, game.ScreenScaleFactor, @"Sprite/GameUI/Title", 0.9f);
            }

            // panel
            if (game.Panel == null)
            {
                game.Panel = StaticSprite.CreateSprite(215, 315, game.ScreenScaleFactor, @"Sprite/GameUI/Panel", 0.8f);
            }

            if (game.TextBoxName == null)
            {
                game.TextBoxName = TextBox.CreateTextBox(454, 350, game.ScreenScaleFactor, @"Sprite/GameUI/TextBox", 0.7f);
                game.TextBoxName.InitTextBox();
                game.TextBoxName.SetFont("SegoeWP");
                TextBoxStyle.Assign(game.TextBoxName);
            }

            if (game.TextBoxRoom == null)
            {
                game.TextBoxRoom = TextBox.CreateTextBox(454, 420, game.ScreenScaleFactor, @"Sprite/GameUI/TextBox", 0.7f);
                game.TextBoxRoom.InitTextBox();
                game.TextBoxRoom.SetFont("SegoeWP");
                TextBoxStyle.Assign(game.TextBoxRoom);
            }

            if (game.TextPlayerName == null)
            {
                game.TextPlayerName = StaticSprite.CreateSprite(273, 360, game.ScreenScaleFactor, @"Sprite/GameUI/TextPlayerName", 0.7f);
            }

            if (game.TextRoomID == null)
            {
                game.TextRoomID = StaticSprite.CreateSprite(273, 430, game.ScreenScaleFactor, @"Sprite/GameUI/TextRoomID", 0.7f);
            }

            // btn play
            if (game.btnPlaySingle == null)
            {
                game.btnPlaySingle = StaticSprite.CreateSprite(440, 538, game.ScreenScaleFactor, @"Sprite/GameUI/btnPlay", 0.8f);

                game.btnPlaySingle.OnMouseUp += TransitionToGame;

                ButtonStyle.Assign(game.btnPlaySingle);
            }

            // small top icons
            if (game.btnShop == null)
            {
                game.btnShop = StaticSprite.CreateSprite(700, 22, game.ScreenScaleFactor, @"Sprite/GameUI/btnShop", 0.9f);
                ButtonStyle.Assign(game.btnShop);
            }

            if (game.btnSetting == null)
            {
                game.btnSetting = StaticSprite.CreateSprite(780, 22, game.ScreenScaleFactor, @"Sprite/GameUI/btnSetting", 0.9f);
                ButtonStyle.Assign(game.btnSetting);
            }

            if (game.btnHelp == null)
            {
                game.btnHelp = StaticSprite.CreateSprite(860, 22, game.ScreenScaleFactor, @"Sprite/GameUI/btnHelp", 0.9f);
                ButtonStyle.Assign(game.btnHelp);
            }

            if (game.btnExit == null)
            {
                game.btnExit = StaticSprite.CreateSprite(940, 22, game.ScreenScaleFactor, @"Sprite/GameUI/btnExit", 0.9f);
                ButtonStyle.Assign(game.btnExit);
                game.btnExit.OnMouseUp += TransitionToMenu;
            }

            base.InitUI();
        }
Пример #30
0
            public static void LoadRes(Microsoft.Xna.Framework.Content.ContentManager cm)
            {
                // Protagonist: Idle
                AnimateSprite atemp = new AnimateSprite(new TimeSpan(1050000));

                for (int i = 1; i < 5; i++)
                {
                    StaticSprite stemp = new StaticSprite(cm.Load <Texture2D>("Talking/Protag - Arms/Talk Portrait - Protag - Arms - Idle " + i));
                    atemp.Add(stemp);
                }
                for (int i = 0; i < 20; i++)
                {
                    StaticSprite stemp = new StaticSprite(cm.Load <Texture2D>("Talking/Protag - Arms/Talk Portrait - Protag - Arms - Idle 4"));
                    atemp.Add(stemp);
                }
                ports["pIdle"] = atemp;

                // Protagonist: Happy
                atemp = new AnimateSprite(new TimeSpan(1050000));
                for (int i = 1; i < 9; i++)
                {
                    StaticSprite stemp = new StaticSprite(cm.Load <Texture2D>("Talking/Protag - Arms/Talk Portrait - Protag - Arms - Talk Happy " + i));
                    atemp.Add(stemp);
                }
                ports["pHappy"] = atemp;

                // Flat Lizard: Idle
                atemp = new AnimateSprite(new TimeSpan(1050000));
                for (int i = 1; i < 6; i++)
                {
                    StaticSprite stemp = new StaticSprite(cm.Load <Texture2D>("Talking/NPCs/Tiny Animals/Talk Portrait - NPC - Flat Lizard - Idle " + i));
                    atemp.Add(stemp);
                }
                for (int i = 0; i < 20; i++)
                {
                    StaticSprite stemp = new StaticSprite(cm.Load <Texture2D>("Talking/NPCs/Tiny Animals/Talk Portrait - NPC - Flat Lizard - Idle 5"));
                    atemp.Add(stemp);
                }
                ports["flatlizIdle"] = atemp;

                // Flat Lizard: Talk
                atemp = new AnimateSprite(new TimeSpan(1050000));
                atemp.Add(new StaticSprite(cm.Load <Texture2D>("Talking/NPCs/Tiny Animals/Talk Portrait - NPC - Flat Lizard - Idle 1")));
                for (int i = 1; i < 4; i++)
                {
                    StaticSprite stemp = new StaticSprite(cm.Load <Texture2D>("Talking/NPCs/Tiny Animals/Talk Portrait - NPC - Flat Lizard - Talk " + i));
                    atemp.Add(stemp);
                }
                atemp.Add(new StaticSprite(cm.Load <Texture2D>("Talking/NPCs/Tiny Animals/Talk Portrait - NPC - Flat Lizard - Talk 2")));
                ports["flatlizTalk"] = atemp;

                // Lumisnail 1 & 2
                for (int n = 1; n < 3; n++)
                {
                    atemp = new AnimateSprite(new TimeSpan(1050000));
                    for (int i = 1; i < 5; i++)
                    {
                        StaticSprite stemp = new StaticSprite(cm.Load <Texture2D>("Talking/NPCs/Tiny Animals/Talk Portrait - NPC - Lumisnail " + n + " - All " + i));
                        atemp.Add(stemp);
                    }
                    ports["lumisnail" + n] = atemp;
                }

                // Mantis
                atemp = new AnimateSprite(new TimeSpan(1050000));
                for (int i = 1; i < 5; i++)
                {
                    StaticSprite stemp = new StaticSprite(cm.Load <Texture2D>("Talking/NPCs/Tiny Animals/Talk Portrait - NPC - Mantis - All " + i));
                    atemp.Add(stemp);
                }
                ports["mantis"] = atemp;

                top       = new StaticSprite(cm.Load <Texture2D>("Talking/Talk Box U"));
                bottom    = new StaticSprite(cm.Load <Texture2D>("Talking/Talk Box D"));
                nameplate = new StaticSprite(cm.Load <Texture2D>("Talking/Talk Nameplate"));
            }
Пример #31
0
 public override void LoadRes(Microsoft.Xna.Framework.Content.ContentManager cm)
 {
     sprite = new StaticSprite(cm.Load<Texture2D>("Items/I - Wrecked Robot Head"));
 }
Пример #32
0
 public override void LoadRes(Microsoft.Xna.Framework.Content.ContentManager cm)
 {
     sprite = new StaticSprite(cm.Load<Texture2D>("Items/I - Pretty Okay Alloy"));
 }
Пример #33
0
 public override void LoadRes(Microsoft.Xna.Framework.Content.ContentManager cm)
 {
     sprite = new StaticSprite(cm.Load<Texture2D>("test/orange"));
 }
Пример #34
0
 public override void LoadRes(Microsoft.Xna.Framework.Content.ContentManager cm)
 {
     sprite = new StaticSprite(cm.Load <Texture2D>("Items/I - Pretty Okay Alloy"));
 }
Пример #35
0
        private Player createPlayerFromTemplate(string referenceName)
        {
            Player player = null;

            if (playersDocument == null)
            {
                this.playersDocument = new XmlDocument();
                playersDocument.Load("Content/Xml/players.xml");
            }

            // Check to see if the player template is in our cache already.
            Player cachedPlayer = lhg.Assets.findPlayerTemplateInCache(referenceName);

            if (cachedPlayer != null)
            {
                progress.updateProgress("Loading player template " + referenceName + " from cache", "Loading", 0);
                return(createQuickCopy(cachedPlayer));
            }
            else
            {
                progress.updateProgress("Loading player template " + referenceName + " from disk", "Loading", 0);
                string  xpath      = "/players/player[@referenceName='" + referenceName + "']";
                XmlNode playerNode = playersDocument.SelectSingleNode(xpath);
                if (playerNode != null)
                {
                    PrimaryStatistics stats = null;

                    List <PlayerSpriteSheet> playerSpriteSheetList = null;
                    StaticSprite             hudSprite             = null;
                    InventoryStorage         inventoryStorage      = null;
                    Player.Type type           = Player.getTypeFromString(playerNode.Attributes["type"].Value);
                    XmlNodeList playerChildren = playerNode.ChildNodes;
                    foreach (XmlNode childNode in playerChildren)
                    {
                        switch (childNode.Name)
                        {
                        case "stats":
                            stats = loadStats(childNode);
                            break;

                        case "hud":
                            hudSprite = loadCombatHUDSprite(childNode);
                            break;

                        case "animations":
                            playerSpriteSheetList = loadAnimations(childNode);
                            break;

                        case "inventory":
                            inventoryStorage = loadInventory(childNode);
                            break;
                        }
                    }

                    PlayerSprite playerSprite = new PlayerSprite(lhg, playerSpriteSheetList, PlayerSpriteSheet.Type.Standing);

                    // Create a player for our cache that won't change, so we can quickly create copies
                    if (type == Player.Type.Human)
                    {
                        cachedPlayer = new Human(lhg, referenceName, referenceName, playerSprite);
                    }
                    else if (type == Player.Type.Zombie)
                    {
                        cachedPlayer = new Zombie(lhg, referenceName, referenceName, playerSprite);
                    }

                    cachedPlayer.MyHUDSprite = hudSprite;
                    cachedPlayer.MyInventory = inventoryStorage;
                    lhg.Assets.addPlayerTemplate(cachedPlayer);

                    // Now, create a copy we will use as the real instance
                    player = createQuickCopy(cachedPlayer);
                }
            }

            return(player);
        }
Пример #36
0
        public override void InitUI()
        {
            game.background = StaticSprite.CreateSprite(0, 0, game.ScreenScaleFactor, @"Sprite/GameUI/Background_Black", 1.0f);

            // title
            if (game.GameTitle == null)
            {
                game.GameTitle = StaticSprite.CreateSprite(303, 39, game.ScreenScaleFactor, @"Sprite/GameUI/Black_Logo", 0.9f);
            }

            // panel
            if (game.Panel == null)
            {
                game.Panel = StaticSprite.CreateSprite(255, 356, game.ScreenScaleFactor, @"Sprite/GameUI/Black_Panel", 0.8f);
            }

            if (game.TextBoxName == null)
            {
                game.TextBoxName = TextBox.CreateTextBox(445, 380, game.ScreenScaleFactor, @"Sprite/GameUI/Black_TextBox", 0.7f);
                game.TextBoxName.InitTextBox();
                game.TextBoxName.SetFont("Black_SegoeWP");
                game.TextBoxName.SetColor(Color.WhiteSmoke);
                TextBoxStyle.Assign(game.TextBoxName);
            }

            if (game.TextBoxRoom == null)
            {
                game.TextBoxRoom = TextBox.CreateTextBox(445, 433, game.ScreenScaleFactor, @"Sprite/GameUI/Black_TextBox", 0.7f);
                game.TextBoxRoom.InitTextBox();
                game.TextBoxRoom.SetFont("Black_SegoeWP");
                game.TextBoxRoom.SetColor(Color.WhiteSmoke);
                TextBoxStyle.Assign(game.TextBoxRoom);
            }

            if (game.TextPlayerName == null)
            {
                game.TextPlayerName = StaticSprite.CreateSprite(295, 384, game.ScreenScaleFactor, @"Sprite/GameUI/Black_TextPlayerName", 0.7f);
            }

            if (game.TextRoomID == null)
            {
                game.TextRoomID = StaticSprite.CreateSprite(295, 437, game.ScreenScaleFactor, @"Sprite/GameUI/Black_TextRoomID", 0.7f);
            }

            // btn play
            if (game.btnPlaySingle == null)
            {
                game.btnPlaySingle = StaticSprite.CreateSprite(394, 610, game.ScreenScaleFactor, @"Sprite/GameUI/Black_btnRound", 0.8f);
                game.btnPlaySingle.AddChildAtMid(StaticSprite.CreateSprite(0, 0, game.ScreenScaleFactor, @"Sprite/GameUI/Black_btnSinglePlay", 0.7f));
                game.btnPlaySingle.OnMouseUp += (sender) =>
                {
                    TransitionToGame(StartGameSingle);
                };

                ModernButtonStyle.Assign(game.btnPlaySingle);
            }

            if (game.btnPlayMulti == null)
            {
                game.btnPlayMulti = StaticSprite.CreateSprite(394, 554, game.ScreenScaleFactor, @"Sprite/GameUI/Black_btnRound", 0.8f);
                game.btnPlayMulti.AddChildAtMid(StaticSprite.CreateSprite(0, 0, game.ScreenScaleFactor, @"Sprite/GameUI/Black_btnMultiPlay", 0.7f));
                game.btnPlayMulti.OnMouseUp += (sender) => {
                    if (String.IsNullOrEmpty(game.TextBoxName.GetText()))
                    {
                        return;
                    }
                    if (String.IsNullOrEmpty(game.TextBoxRoom.GetText()))
                    {
                        return;
                    }
                    TransitionToGame(StartGameMultiplayer);
                };

                ModernButtonStyle.Assign(game.btnPlayMulti);
            }

            if (game.btnSetting == null)
            {
                game.btnSetting = StaticSprite.CreateSprite(394, 666, game.ScreenScaleFactor, @"Sprite/GameUI/Black_btnRound", 0.8f);
                game.btnSetting.AddChildAtMid(StaticSprite.CreateSprite(0, 0, game.ScreenScaleFactor, @"Sprite/GameUI/Black_btnSetting", 0.7f));

                ModernButtonStyle.Assign(game.btnSetting);
            }

            // small top icons
            if (game.btnShop == null)
            {
                game.btnShop = StaticSprite.CreateSprite(882, 24, game.ScreenScaleFactor, @"Sprite/GameUI/Black_btnShop", 0.9f);
                ButtonStyle.Assign(game.btnShop);
            }

            // small top icons
            if (game.btnSound == null)
            {
                game.btnSound = StaticSprite.CreateSprite(934, 24, game.ScreenScaleFactor, @"Sprite/GameUI/Black_audioOn", 0.9f);
                ButtonStyle.Assign(game.btnSound);
            }

            if (game.scoreBoard == null)
            {
                var Red  = StaticSprite.CreateSprite(0, 30, game.ScreenScaleFactor, @"Sprite/GameUI/Player1", 0.6f);
                var Blue = StaticSprite.CreateSprite(0, 110, game.ScreenScaleFactor, @"Sprite/GameUI/Player2", 0.6f);
                game.scoreBoard      = new Scoreboard(Red, Blue, game.ScreenScaleFactor);
                game.scoreBoard.Top  = 320 * game.ScreenScaleFactor.Y;
                game.scoreBoard.Left = 90 * game.ScreenScaleFactor.X;
            }


            //if (game.btnHelp == null)
            //{
            //    game.btnHelp = StaticSprite.CreateSprite(860, 22, game.ScreenScaleFactor, @"Sprite/GameUI/btnHelp", 0.9f);
            //    ButtonStyle.Assign(game.btnHelp);
            //}


            if (game.btnExit == null)
            {
                game.btnExit = StaticSprite.CreateSprite(39, 670 + 300, game.ScreenScaleFactor, @"Sprite/GameUI/Black_btnRound", 0.8f);
                game.btnExit.AddChildAtMid(StaticSprite.CreateSprite(0, 0, game.ScreenScaleFactor, @"Sprite/GameUI/Black_btnExit", 0.7f));

                game.btnExit.OnMouseUp += TransitionToMenu;
                ModernButtonStyle.Assign(game.btnExit);
            }

            base.InitUI();
        }
Пример #37
0
 public Player(StaticSprite sprite, string name = "Player")
     : base(name)
 {
     m_sprite = sprite;
     m_maxSpeedSqr = m_maxSpeed * m_maxSpeed;
 }
Пример #38
0
 public override void LoadRes(Microsoft.Xna.Framework.Content.ContentManager cm)
 {
     background = new StaticSprite(cm.Load<Texture2D>("Locations/Derelict Laboratory/Room 1"));
     wallDef = cm.Load<Texture2D>("Locations/Derelict Laboratory/Room 1 Walls");
 }
Пример #39
0
 public override void LoadRes(Microsoft.Xna.Framework.Content.ContentManager cm)
 {
     sprite = new StaticSprite(cm.Load <Texture2D>("Items/I - Wrecked Robot Head"));
 }