상속: UIMonoBehaviour, IBeginDragHandler
        public GameScreen(ContentManager Content, Texture2D Background, Player player, Robot robot, bool OnLeftSide)
        {
            this.Content.Unload();
            this.Content.Dispose();
            this.Content = Content;

            //Do some stuff to Left and Right before adding them
            if (OnLeftSide)
            {
                player.Position = new Vector2(60, 120);
                robot.Position = new Vector2(730, 120);
            }
            else
            {
                player.Position = new Vector2(730, 120);
                robot.Position = new Vector2(60, 120);
            }

            FlyingDisc flyingDisc = new FlyingDisc(Content.Load<Texture2D>("General\\FlyingDisc"));
            flyingDisc.Position = new Vector2(70, 110);

            Entities = new List<Entity>(new List<Entity> { player, robot, flyingDisc });

            this.Background = Background;
        }
예제 #2
0
 protected override Model LoadModel(ICommandContext commandContext, ContentManager contentManager)
 {
     var meshConverter = CreateMeshConverter(commandContext);
     var materialMapping = Materials.Select((s, i) => new { Value = s, Index = i }).ToDictionary(x => x.Value.Name, x => x.Index);
     var sceneData = meshConverter.Convert(SourcePath, Location, materialMapping);
     return sceneData;
 }
예제 #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GameScreenBase"/> class.
        /// </summary>
        /// <param name="rootDirectory">The root directory of the panel's local content manager.</param>
        /// <param name="definitionAsset">The asset path of the screen's definition file.</param>
        /// <param name="globalContent">The content manager with which to load globally-available assets.</param>
        /// <param name="uiScreenService">The screen service which created this screen.</param>
        public GameScreenBase(String rootDirectory, String definitionAsset, ContentManager globalContent, UIScreenService uiScreenService)
            : base(rootDirectory, definitionAsset, globalContent)
        {
            Contract.Require(uiScreenService, "uiScreenService");

            this.uiScreenService = uiScreenService;
        }
예제 #4
0
 public FrameRateCounter(Microsoft.Xna.Framework.Game game)
     : base(game)
 {
     //use own content manager
     content = new ContentManager(game.Services);
     content.RootDirectory = "Content\\FrameRateCounter";
 }
예제 #5
0
 public Scene0()
 {
     Gm = new GraphicsDeviceManager(this);
     Gm.PreferredBackBufferWidth = 800;
     Gm.PreferredBackBufferHeight = 600;
     Cm = new ContentManager(Services);
 }
예제 #6
0
        void Reload( RenderSystem rs, ContentManager content )
        {
            if (meshInstance!=null) {
                if (!rs.RenderWorld.Instances.Remove( meshInstance )) {
                    Log.Warning("Failed to remove {0}|{1}", scenePath, nodeName );
                }
            }

            var scene = content.Load<Scene>( scenePath, (Scene)null );

            if (scene==null) {
                return;
            }

            var node  = scene.Nodes.FirstOrDefault( n => n.Name == nodeName );

            if (node==null) {
                Log.Warning("Scene '{0}' does not contain node '{1}'", scenePath, nodeName );
                return;
            }

            if (node.MeshIndex<0) {
                Log.Warning("Node '{0}|{1}' does not contain mesh", scenePath, nodeName );
                return;
            }

            var mesh		=	scene.Meshes[node.MeshIndex];

            meshInstance		= new MeshInstance( rs, scene, mesh );

            rs.RenderWorld.Instances.Add( meshInstance );
        }
예제 #7
0
        public override void Intro( params object [] args )
        {
            LiqueurSystem.Window.Title = "Simple Dodge";
            LiqueurSystem.GraphicsDevice.BlendState = true;
            LiqueurSystem.GraphicsDevice.BlendOperation = BlendOperation.AlphaBlend;

            Add ( InputHelper.CreateInstance () );
            InputHelper.IsKeyboardEnabled = true;
            Add ( SceneContainer = new SceneContainer ( new MenuScene () ) );

            contentManager = new ContentManager ( FileSystemManager.GetFileSystem ( "ManifestFileSystem" ) );
            contentManager.AddDefaultContentLoader ();
            LiqueurSystem.Launcher.InvokeInMainThread ( () =>
            {
                fpsFont = contentManager.Load<TrueTypeFont> ( "Test.Game.Dodge.Resources.GameFont.ttf", 20 );
            } );

            FpsCalculator calc;
            Add ( calc = new FpsCalculator () );
            calc.DrawEvent += ( object sender, GameTimeEventArgs e ) =>
            {
                string fpsString = string.Format ( "Update FPS:{0:0.00}\nRender FPS:{1:0.00}", calc.UpdateFPS, calc.DrawFPS );
                fpsFont.DrawFont ( fpsString, Color.White,
                    LiqueurSystem.GraphicsDevice.ScreenSize - fpsFont.MeasureString ( fpsString ) - new Vector2 ( 10, 10 ) );
            };

            base.Intro ( args );
        }
예제 #8
0
 protected ContentItem(TcmUri itemId, SessionAwareCoreServiceClient client)
 {
     ReadOptions = new ReadOptions();
     Client = client;
     Content = (ComponentData) client.Read(itemId, ReadOptions);
     ContentManager = new ContentManager(Client);
 }
예제 #9
0
        public SpriteBatch(Device d, ContentManager c)
        {
            Device = d;

            cubeVert = new VertexBuffer(Device, 4 * 28, Usage.WriteOnly, VertexFormat.None, Pool.Managed);
            cubeVert.Lock(0, 0, LockFlags.None).WriteRange(new[]
            {
                new VertexPositionTextureColor() { Color = Color.White.ToArgb(), Position = new Vector4f(0, 0, 0.0f, 1.0f), TexCoord = new Vector2f(0.0f, 1.0f) },
                new VertexPositionTextureColor() { Color = Color.White.ToArgb(), Position = new Vector4f(0, 1, 0.0f, 1.0f), TexCoord = new Vector2f(0.0f, 0.0f) },
                new VertexPositionTextureColor() { Color = Color.White.ToArgb(), Position = new Vector4f(1, 0, 0.0f, 1.0f), TexCoord = new Vector2f(1.0f, 1.0f) },
                new VertexPositionTextureColor() { Color = Color.White.ToArgb(), Position = new Vector4f(1, 1, 0.0f, 1.0f), TexCoord = new Vector2f(1.0f, 0.0f) }
            });
            cubeVert.Unlock();

            var cubeElems = new[]
            {
                new VertexElement(0, 0, DeclarationType.Float4, DeclarationMethod.Default, DeclarationUsage.Position, 0),
                new VertexElement(0, 16, DeclarationType.Float2, DeclarationMethod.Default, DeclarationUsage.TextureCoordinate, 0),
                new VertexElement(0, 24, DeclarationType.Color, DeclarationMethod.Default, DeclarationUsage.Color, 0),
                VertexElement.VertexDeclarationEnd
            };

            cubeDecl = new VertexDeclaration(Device, cubeElems);

            renderEffect = c.LoadString<Content.Effect>("float4 c;Texture b;sampler s=sampler_state{texture=<b>;magfilter=LINEAR;minfilter=LINEAR;mipfilter=LINEAR;AddressU=wrap;AddressV=wrap;};float4 f(float2 t:TEXCOORD0):COLOR{return tex2D(s, t) * c;}technique t{pass p{PixelShader = compile ps_2_0 f();}}");
        }
            /// <summary>
            /// Initializes a new instance of the <see cref="DialogScreen"/> class.
            /// </summary>
            /// <param name="dialog">The dialog that owns this screen.</param>
            /// <param name="globalContent">The screen's global content manager.</param>
            public DialogScreen(EscMenuDialog dialog, ContentManager globalContent)
                : base("Content/UI/Dialogs/EscMenuDialog", "EscMenuDialog", globalContent)
            {
                Contract.Require(dialog, "dialog");

                this.dialog = dialog;
            }
예제 #11
0
 protected ContentItem(ComponentData content, SessionAwareCoreServiceClient client)
 {
     Content = content;
     Client = client;
     ReadOptions = new ReadOptions();
     ContentManager = new ContentManager(Client);
 }
예제 #12
0
        public override void LoadContent(ContentManager content)
        {
            var text = ResourceManager.GetResource<TextFile>("HowToPlay");

            _labelRules = new Label(_game, text.Text, "DefaultFont", Color.White)
            {
                Visible = true,
                Enabled = true,
                Position = new Vector2(25, 25),
                Size = new Rectangle(0, 0, 1, 1)
            };

            _backButton = new Button(_game, "ButtonExit", "ButtonExitHovered", "ButtonFont")
            {
                Text = "Return to main menu",
                Enabled = true,
                Position = new Vector2(25, 700),
                Size = new Rectangle(0, 0, 275, 50)
            };

            _registeredControls.Add(_labelRules);
            _registeredControls.Add(_backButton);

            _backButton.OnClick += ReturnToMainMenu;
        }
예제 #13
0
        public SceneRenderer(GameSettingsAsset gameSettings)
        {
            if (gameSettings == null) throw new ArgumentNullException(nameof(gameSettings));

            // Initialize services
            Services = new ServiceRegistry();
            ContentManager = new ContentManager(Services);

            var renderingSettings = gameSettings.Get<RenderingSettings>();
            GraphicsDevice = GraphicsDevice.New(DeviceCreationFlags.None, new[] { renderingSettings.DefaultGraphicsProfile });

            var graphicsDeviceService = new GraphicsDeviceServiceLocal(Services, GraphicsDevice);
            EffectSystem = new EffectSystem(Services);
            GraphicsContext = new GraphicsContext(GraphicsDevice);
            Services.AddService(typeof(GraphicsContext), GraphicsContext);

            SceneSystem = new SceneSystem(Services);

            // Create game systems
            GameSystems = new GameSystemCollection(Services);
            GameSystems.Add(new GameFontSystem(Services));
            GameSystems.Add(new UISystem(Services));
            GameSystems.Add(EffectSystem);
            GameSystems.Add(SceneSystem);
            GameSystems.Initialize();

            // Fake presenter
            // TODO GRAPHICS REFACTOR: This is needed be for render stage setup
            GraphicsDevice.Presenter = new RenderTargetGraphicsPresenter(GraphicsDevice,
                Texture.New2D(GraphicsDevice, renderingSettings.DefaultBackBufferWidth, renderingSettings.DefaultBackBufferHeight,
                    renderingSettings.ColorSpace == ColorSpace.Linear ? PixelFormat.R8G8B8A8_UNorm_SRgb : PixelFormat.R8G8B8A8_UNorm, TextureFlags.ShaderResource | TextureFlags.RenderTarget),
                PixelFormat.D24_UNorm_S8_UInt);

            SceneSystem.MainRenderFrame = RenderFrame.FromTexture(GraphicsDevice.Presenter.BackBuffer, GraphicsDevice.Presenter.DepthStencilBuffer);
        }
            /// <summary>
            /// Initializes a new instance of the <see cref="DialogScreen"/> class.
            /// </summary>
            /// <param name="dialog">The dialog that owns this screen.</param>
            /// <param name="globalContent">The screen's global content manager.</param>
            public DialogScreen(EscMenuDialog dialog, ContentManager globalContent)
                : base("Content/UI/Dialogs/EscMenuDialog", "EscMenuDialog", globalContent)
            {
                Contract.Require(dialog, "dialog");

                View.SetViewModel(new DialogScreenVM(dialog));
            }
예제 #15
0
        public Options(ContentManager Content)
            : base()
        {
            bBackground = new GUIItems.Background(Content);

            sPixel = new AnimatedSprite(Content, "pixel");
            sPixel.Colour = new Color(Color.Black, 1.0f);
            sPixel.FrameHeight = 544;
            sPixel.FrameWidth = 960;
            sPixel.Alpha = 0.7f;

            XOffset = 32;
            YOffset = Dimensions.Height / 10;

            #if DESKTOP
            bMusic = new GUIItems.Button(Content, new Vector2(XOffset, YOffset * 3), "Music");
            #endif
            //  Buttons
            tbMinRooms  = new Neuroleptic.Editor.GUI.Textbox(Content, new Vector2(XOffset, YOffset * 5),"Min Rooms");
            tbMaxRooms  = new Neuroleptic.Editor.GUI.Textbox(Content, new Vector2(XOffset, YOffset * 6),"Max Rooms");
            tbMinRooms.CurrentString = Option.RoomsMin.ToString();
            tbMaxRooms.CurrentString = Option.RoomsMax.ToString();

            bControls   = new GUIItems.Button(Content , new Vector2(XOffset, YOffset * 7), "Controls");
            bBack       = new GUIItems.Button(Content , new Vector2(XOffset, YOffset * 8), "Back");
        }
예제 #16
0
		public GameStateManager(IGameWindow gameWindow, ContentManager content)
		{
			GameWindow = gameWindow;

			_content = content;
			_states = new List<GameState>();
		}
예제 #17
0
    public void LoadContent(ContentManager theContentManager, string theAssetName, int x, int y)
    {
        AssetName = theAssetName;
        mSpriteTexture = theContentManager.Load<Texture2D>(theAssetName);

        Size = new Rectangle(0, 0, (int)(mSpriteTexture.Width * Scale), (int)(mSpriteTexture.Height * Scale));
    }
예제 #18
0
 /// <summary>
 /// Loads the content.
 /// </summary>
 /// <param name="content">The ContentManager.</param>
 public override void LoadContent(ContentManager content)
 {
     _skyBox =
         new Skybox(new[]
         {
             content.Load<Texture2D>("mainbackground.png"), content.Load<Texture2D>("bgLayer1.png"),
             content.Load<Texture2D>("bgLayer2.png")
         });
     _header = new Font("Segoe UI", 25, TypefaceStyle.Bold);
     _subHeader = new Font("Segoe UI", 40, TypefaceStyle.Bold);
     _fadeableText1 = new FadeableText
     {
         Font = _header,
         Text = "ThuCommix presents",
         Position = new Vector2(270, 200),
         FadeInVelocity = 2,
         FadeOutVelocity = 3
     };
     _fadeableText2 = new FadeableText
     {
         Font = _header,
         Text = "a game powered by Sharpex2D",
         Position = new Vector2(220, 200),
         FadeInVelocity = 2,
         FadeOutVelocity = 3
     };
     _fadeableText3 = new FadeableText
     {
         Font = _subHeader,
         Text = "XPlane",
         Position = new Vector2(330, 200),
         FadeInVelocity = 2,
         FadeOutVelocity = 2
     };
 }
예제 #19
0
파일: Ball.cs 프로젝트: Lunaface/Pong
    public Ball(ContentManager Content, GraphicsDeviceManager graphics, int MinimumAngle, int MaximumAngle)
    {

        BallOrientation = new Random();
        BallSpeed = new Random();
        this.BallTexture = Content.Load<Texture2D>("bal");
        // Put the Ball in the middle of the playing field.
        BallPosition = new Vector2(graphics.GraphicsDevice.Viewport.Width / 2, graphics.GraphicsDevice.Viewport.Height / 2);

        // Set 2 variables for the middle Viewport positions, so you can use them in Reset.
        xmiddle = graphics.GraphicsDevice.Viewport.Width / 2;
        ymiddle = graphics.GraphicsDevice.Viewport.Height / 2;

        BoundsBall = BallTexture.Bounds;
        BoundsBall.X = (int)BallPosition.X;
        BoundsBall.Y = (int)BallPosition.Y;

        // Integers that can easily change the Minimum and Maximum of the initial ball orientation.
        MinimumStart = MinimumAngle;
        MaximumStart = MaximumAngle;

        // Set up the initial orienation and speed of the ball.
        this.SpeedReset();



    }
예제 #20
0
    public MessageBox(ContentManager contentManager, SpriteRenderer spriteRenderer)
    {
        this.contentManager = contentManager;
        this.spriteRenderer = spriteRenderer;

        registerSprites();
    }
예제 #21
0
        public ExampleScreen(ContentManager globalContent, UIScreenService uiScreenService)
            : base("Content/UI/Screens/ExampleScreen", "ExampleScreen", globalContent)
        {
            Contract.Require(uiScreenService, "uiScreenService");

            View.SetViewModel(new ExampleViewModel(Ultraviolet));
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="TextureAtlasDefinition"/> class.
        /// </summary>
        /// <param name="xml">The XML document that defines the texture atlas.</param>
        /// <param name="content">The content manager that is loading the texture atlas.</param>
        /// <param name="assetPath">The asset path of the texture atlas that is being loaded.</param>
        public TextureAtlasDefinition(XDocument xml, ContentManager content, String assetPath)
        {
            var metadata = xml.Root.Element("Metadata");
            if (metadata != null)
            {
                rootDirectory = metadata.ElementValueString("RootDirectory") ?? rootDirectory;
                requirePowerOfTwo = metadata.ElementValueBoolean("RequirePowerOfTwo") ?? requirePowerOfTwo;
                requireSquare = metadata.ElementValueBoolean("RequireSquare") ?? requireSquare;
                maximumWidth = metadata.ElementValueInt32("MaximumWidth") ?? maximumWidth;
                maximumHeight = metadata.ElementValueInt32("MaximumHeight") ?? maximumHeight;
                padding = metadata.ElementValueInt32("Padding") ?? padding;
            }

            var assetDirectory = Path.GetDirectoryName(assetPath);
            rootDirectory = ContentManager.NormalizeAssetPath(
                Path.Combine(assetDirectory, rootDirectory ?? String.Empty));

            var images = xml.Root.Element("Images");

            if (!LoadImages(content, images))
            {
                throw new InvalidOperationException(UltravioletStrings.TextureAtlasContainsNoImages);
            }
            SortImagesBySize();
        }
예제 #23
0
        public DemoGame()
            : base()
        {
            this.Window.Title = "Snowball Demo Game";

            this.graphicsDevice = new GraphicsDevice(this.Window);
            this.Services.AddService(typeof(IGraphicsDevice), this.graphicsDevice);

            this.keyboard = new Keyboard();
            this.Services.AddService(typeof(IKeyboard), this.keyboard);

            this.mouse = new Mouse(this.Window);
            this.Services.AddService(typeof(IMouse), this.mouse);

            this.gamePad = new GamePad(GamePadIndex.One);

            this.soundDevice = new SoundDevice();
            this.Services.AddService(typeof(ISoundDevice), this.soundDevice);

            this.starfield = new Starfield(this.graphicsDevice);

            this.ship = new Ship(this.graphicsDevice, this.keyboard, this.gamePad);

            this.console = new GameConsole(this.Window, this.graphicsDevice);
            this.console.InputEnabled = true;
            this.console.InputColor = Color.Blue;
            this.console.InputReceived += (s, e) => { this.console.WriteLine(e.Text); };
            this.console.IsVisibleChanged += (s, e) => { this.console.WriteLine("Console toggled."); };

            this.contentManager = new ContentManager<DemoGameContent>(this.Services);

            this.RegisterContent();
        }
예제 #24
0
    public GameWorld(int width, int height, ContentManager Content)
    {
        screenWidth = width;
        screenHeight = height;
        random = new Random();
        gameState = GameState.Menu;
        inputHelper = new InputHelper();
        block = Content.Load<Texture2D>("block");
        reset = Content.Load<Texture2D>("reset");
        font = Content.Load<SpriteFont>("SpelFont");
        font2 = Content.Load<SpriteFont>("SpriteFont1");
        font3 = Content.Load<SpriteFont>("SpriteFont2");
        playButton = Content.Load<Texture2D>("Play");
        optionsButton = Content.Load<Texture2D>("Options");
        backButton = Content.Load<Texture2D>("Back");
        polytris = Content.Load<Texture2D>("Polytris");
        grid = new TetrisGrid(block);
        level = 1;
        levelspeed = 1;
        score = 0;
        i = (int)random.Next(7) + 1;
        i2 = (int)random.Next(7) + 1;
        blockcounter = 1;

        blocks = new BlockList(block, Content);          //Voegen de verschillende blockobjecten toe aan de lijst
        block1 = new Block1(block, Content);
        blocks.Add(block1, 1);
        block2 = new Block2(block, Content);
        blocks.Add(block2, 2);
        block3 = new Block3(block, Content);
        blocks.Add(block3, 3);
        block4 = new Block4(block, Content);
        blocks.Add(block4, 4);
        block5 = new Block5(block, Content);
        blocks.Add(block5, 5);
        block6 = new Block6(block, Content);
        blocks.Add(block6, 6);
        block7 = new Block7(block, Content);
        blocks.Add(block7, 7);

        //Voegen de verschillende blockobjecten toe aan een tweede lijst voor het tekenen van het volgende blokje
        block1res = new Block1(block, Content);
        blocks.AddToReserve(block1res, 1);
        block2res = new Block2(block, Content);
        blocks.AddToReserve(block2res, 2);
        block3res = new Block3(block, Content);
        blocks.AddToReserve(block3res, 3);
        block4res = new Block4(block, Content);
        blocks.AddToReserve(block4res, 4);
        block5res = new Block5(block, Content);
        blocks.AddToReserve(block5res, 5);
        block6res = new Block6(block, Content);
        blocks.AddToReserve(block6res, 6);
        block7res = new Block7(block, Content);
        blocks.AddToReserve(block7res, 7);

        options = new Options(block, reset, backButton, width, height, font, blocks);
        menu = new Menu(playButton, optionsButton, polytris, width, height);
        gameOver = new GameOver(backButton, width, height);
    }
 protected override Dictionary<string, AnimationClip> LoadAnimation(ICommandContext commandContext, ContentManager contentManager, out TimeSpan duration)
 {
     var meshConverter = this.CreateMeshConverter(commandContext);
     var sceneData = meshConverter.ConvertAnimation(SourcePath, Location);
     duration = sceneData.Duration;
     return sceneData.AnimationClips;
 }
예제 #26
0
        public GameConsole(ContentManager content)
        {
            // Magic number, this really just depends on the font...
            _consoleTextLines = new string[100];

            _consoleFont = content.Load<SpriteFont>("DebugFont");
        }
예제 #27
0
        /// <summary>
        /// Initializes a new instance of the BallerburgGame class
        /// </summary>
        public BallerburgGame()
        {
            Instance = this;
              gameSettings = new GameSettings();
              playerSettings = new PlayerSettings[4];

              applicationSettings = new ApplicationSettings();

              graphics = new GraphicsDeviceManager(this)
                     {
                       PreferredBackBufferWidth = 640,
                       PreferredBackBufferHeight = 480
                     };

              graphicsManager = new BallerburgGraphicsManager();
              contentManager = new ContentManager();
              shaderManager = new ShaderManager();
              audioManager = new AudioManager(applicationSettings, contentManager);
              gameObjectManager = new GameObjectManager(contentManager, this.audioManager, this.graphicsManager);

              MousePointer = new MousePointer(this)
                         {
                           DrawOrder = 1000,
                           RestrictZone = new Rectangle(0, 0, 640, 480)
                         };
              Components.Add(MousePointer);

              // Create the screen manager component.
              screenManager = new ScreenManager(graphicsManager, contentManager, gameObjectManager, applicationSettings, gameSettings, shaderManager, audioManager, playerSettings)
                          {
                            GameMousePointer = MousePointer
                          };
        }
예제 #28
0
        public ParticleSystem(GraphicsDevice device, ContentManager content)
        {
            this.device = device;

            // Create vertex buffer used to spawn new particles
            this.particleStart = Buffer.Vertex.New<ParticleVertex>(device, MAX_NEW);

            // Create vertex buffers to use for updating and drawing the particles alternatively
            var vbFlags = BufferFlags.VertexBuffer | BufferFlags.StreamOutput;
            this.particleDrawFrom = Buffer.New<ParticleVertex>(device, MAX_PARTICLES, vbFlags);
            this.particleStreamTo = Buffer.New<ParticleVertex>(device, MAX_PARTICLES, vbFlags);

            this.layout = VertexInputLayout.FromBuffer(0, this.particleStreamTo);
            this.effect = content.Load<Effect>("ParticleEffect");
            this.texture = content.Load<Texture2D>("Dot");

            this.viewParameter = effect.Parameters["_view"];
            this.projParameter = effect.Parameters["_proj"];
            this.lookAtMatrixParameter = effect.Parameters["_lookAtMatrix"];
            this.elapsedSecondsParameter = effect.Parameters["_elapsedSeconds"];
            this.camDirParameter = effect.Parameters["_camDir"];
            this.gravityParameter = effect.Parameters["_gravity"];
            this.textureParameter = effect.Parameters["_texture"];
            this.samplerParameter = effect.Parameters["_sampler"];
            this.updatePass = effect.Techniques["UpdateTeq"].Passes[0];
            this.renderPass = effect.Techniques["RenderTeq"].Passes[0];
        }
예제 #29
0
        public static void LoadContent(ContentManager content)
        {
            // Textures.
            tileSet1 = content.Load<Texture2D>("Textures/TileSets/tileSet1");
            tileSetInterieur = content.Load<Texture2D>("Textures/TileSets/tileSetInterieur");
            tileSetFloorInt = content.Load<Texture2D>("Textures/TileSets/tileSetFloorInt");
            tileSetInterieurDetails = content.Load<Texture2D>("Textures/TileSets/tileSetInterieurDetails");

            // Divers.
            cursor = content.Load<Texture2D>("Textures/TileSets/cursorTileSet2");
            SelectionTest = content.Load<Texture2D>("Textures/Selection");

            // Fonts.
            font1 = content.Load<SpriteFont>("Fonts/MedievalFont1");

            // TextureData.
            cursorData1 = content.Load<Texture2D>("Textures/TextureData/Cursor/cursorTextureData1");
            cursorData2 = content.Load<Texture2D>("Textures/TextureData/Cursor/cursorTextureData2");

            // HUD.
            textureHUD = content.Load<Texture2D>("Textures/TextureData/HUD/textureHUD");
            buttonHUD = content.Load<Texture2D>("Textures/TextureData/HUD/boutonHUD");
            boutonPlanHUD = content.Load<Texture2D>("Textures/TextureData/HUD/boutonPlanHUD");
            flecheDroiteHUD = content.Load<Texture2D>("Textures/TextureData/HUD/flecheDroiteHUD");
            flecheGaucheHUD = content.Load<Texture2D>("Textures/TextureData/HUD/flecheGaucheHUD");
        }
예제 #30
0
    // Startup
    public override void Startup( ContentManager content )
    {
        _UI.Startup( _G.Game, _G.GameInput );

        // load textures
        int bundleIndex = _UI.Texture.CreateBundle();

        _UI.Texture.Add( bundleIndex, "Textures\\UI_Box", "box" );

        // load fonts
        _UI.Font.Add( "Fonts\\", "SegoeUI" );

        // setup common font styles
        UI.FontStyle fontStyle = new UI.FontStyle( "SegoeUI" );
        fontStyle.AddRenderPass( new UI.FontStyleRenderPass() );
        _UI.Store_FontStyle.Add( "Default", fontStyle );

        UI.FontStyle fontStyleDS = new UI.FontStyle( "SegoeUI" );
        UI.FontStyleRenderPass renderPassDS = new UI.FontStyleRenderPass();
        renderPassDS.ColorOverride = Color.Black;
        renderPassDS.AlphaMult = 0.5f;
        renderPassDS.Offset = new Vector3( 0.05f, -0.05f, 0.0f );
        renderPassDS.OffsetProportional = true;
        fontStyleDS.AddRenderPass( renderPassDS );
        fontStyleDS.AddRenderPass( new UI.FontStyleRenderPass() );
        _UI.Store_FontStyle.Add( "Default3dDS", fontStyleDS );

        // setup font icons
        _UI.Store_FontIcon.Add( "A", new UI.FontIcon( _UI.Texture.Get( "null" ), 0.0f, 0.0f, 1.0f, 1.0f ) );
        _UI.Store_FontIcon.Add( "B", new UI.FontIcon( _UI.Texture.Get( "null" ), 0.0f, 0.0f, 1.0f, 1.0f ) );

        // add initial screens
        _UI.Screen.AddScreen( new UI.Screen_Background() );
        _UI.Screen.AddScreen( new UI.Screen_Start() );
    }
예제 #31
0
 public abstract void Load(ContentManager content);
예제 #32
0
 private static void LoadSoundEffectFiles(ContentManager content)
 {
 }
예제 #33
0
 public void LoadContent(string texturePath, ContentManager content)
 {
     Texture = content.Load <Texture2D>(texturePath);
 }
예제 #34
0
 //Constructor
 public Dungeon(string path, ContentManager c)
 {
     filePath = path;
     rect     = new Rectangle(ORIG_LOCATION_X, ORIG_LOCATION_Y, ROOM_SIZE, ROOM_SIZE);
     cm       = c;
 }
예제 #35
0
 /// <summary>
 /// Construtor
 /// </summary>
 /// <param name="contents">Instancia de ContentManager</param>
 /// <param name="assetName">Nome da sprite na pasta Content</param>
 public FlyingEntity(ContentManager contents, string assetName)
     : base(contents, assetName)
 {
     //this.sprite = new Sprite(contents, assetName);
 }
 public abstract void LoadContent(ContentManager Content, string filename);
예제 #37
0
 public Background(ContentManager content)
     : base(content, "Images/Background")
 {
 }
예제 #38
0
 /// <summary>
 /// Loading all view content
 /// </summary>
 /// <param name="content">ContentManager instance</param>
 public void LoadContent(ContentManager a_content)
 {
     this._screenContent.LoadScreenContent(a_content);
     this._animationSys.LoadContent(a_content);
 }
예제 #39
0
 public AcidMudLeftBlock(ContentManager content, string name) : base(content, name)
 {
 }
예제 #40
0
 public void LoadAllTextures(ContentManager content)
 {
     ItemSpriteSheet = content.Load <Texture2D>("NES - The Legend of Zelda - Items & Weapons");
 }
예제 #41
0
 public Player(GraphicsDevice device, ContentManager contentManager)
 {
     // create new player health bar
     healthBar = new HealthBar(contentManager, playerColour);
 }
예제 #42
0
 public Splashscreen(Game1 game, GraphicsDevice graphicsDevice, ContentManager content) : base(game, graphicsDevice, content)
 {
     //
 }
예제 #43
0
 public MyGame()
 {
     graphics = new GraphicsDeviceManager(this);
     Content.RootDirectory = "Content";
     content = this.Content;
 }
예제 #44
0
 public abstract void Load(ContentManager content, Vector2 pos);
예제 #45
0
        /// <remarks>
        ///<para>AUTHOR: Khaled Salah, Ahmed Shirin </para>
        ///</remarks>
        public override void Update(GameTime gameTime)
        {
            Content = ScreenManager.Game.Content;

            #region Omar Abdulaal

            bgLayer1.Update();
            bgLayer2.Update();
            bgLayer3.Update();

            player.Update(gameTime);

            if (jumping)
            {
                GetActualBounds(player.GetBoundingRectangle(), player.GetColorData(), out playerBounds, out playerData);
            }
            else
            {
                playerBounds = player.GetBoundingRectangle();
                playerData   = player.GetColorData();
            }

            if (player.CheckDeath())
            {
                if (colorDataList.Count == 0)
                {
                    this.Remove();
                    ScreenManager.AddScreen(new LosingScreen(player.Score));
                }
                else
                {
                    this.Remove();
                    ScreenManager.AddScreen(new PhotographsScreen(colorDataList, player.Score));
                }
            }


            if (Constants.isJumping && colorDataList.Count == 0)
            {
                byte[] colorData = ScreenManager.Kinect.GetColorPixels(30);
                if (colorData != null)
                {
                    colorDataList.Add(colorData);
                }
            }

            if (Constants.isRunning && colorDataList.Count == 1)
            {
                byte[] colorData = ScreenManager.Kinect.GetColorPixels(30);
                if (colorData != null)
                {
                    colorDataList.Add(colorData);
                }
            }

            if (player.Immunity < 30)
            {
                alertTimer += gameTime.ElapsedGameTime.Milliseconds;

                if (alertTimer >= 750)
                {
                    displayAlert = !displayAlert;
                    alertTimer   = 0;
                }
            }
            else
            {
                displayAlert = false;
            }

            #endregion

            #region khaled's pausescreen and music

            if (MediaPlayer.State.Equals(MediaState.Stopped))
            {
                switch (playQueue)
                {
                case 1:
                {
                    MediaPlayer.Play(songs[0]);
                    playQueue = 2;
                    break;
                }

                case 2:
                {
                    MediaPlayer.Play(songs[1]);
                    playQueue = 3;
                    break;
                }

                case 3:
                {
                    playQueue = 1;
                    break;
                }

                default: break;
                }
            }
            #endregion

            updateImmunityCounter++;
            if (player.Immunity < 30 && updateImmunityCounter > 0)
            {
                immunityAudio.Play();
                updateImmunityCounter = -300;
            }

            KeyboardState state = Keyboard.GetState();
            if (state.IsKeyDown(Keys.Space))
            {
                Constants.isJumping = true;
            }
            if (state.IsKeyDown(Keys.LeftControl))
            {
                Constants.isBending = true;
            }
            if (state.IsKeyDown(Keys.Enter))
            {
                Constants.isPunching = true;
            }
            if (state.IsKeyDown(Keys.D))
            {
                Constants.isSwappingHand = true;
            }

            if (Constants.isJumping)
            {
                jumpTimer++;
            }
            if (jumpTimer == 1)
            {
                soundEffects[9].Play();
            }
            if (!player.CheckJump())
            {
                jumpTimer = 0;
            }

            if (player.CheckJump())
            {
                jumping = true;
            }

            if (jumping)
            {
                time += gameTime.ElapsedGameTime.Milliseconds;
                if (time <= player.GetJumpTime())
                {
                    jumping = true;
                }
                else
                {
                    jumping = false; time = 0;
                }
            }

            if (player.CheckSword())
            {
                swordTimer += gameTime.ElapsedGameTime.Milliseconds;
            }

            if (globalCounter % 600 == 0)
            {
                NewItems();
            }

            globalCounter++;

            if (globalCounter % 60 == 0 && globalCounter > 600)
            {
                spriteCounter++;
            }

            for (int i = 0; i <= spriteCounter - 1; i++)
            {
                try
                {
                    currentSprite[i].Update(spriteSpeed);
                    HandleCollision(currentSprite[i]);
                }
                catch (Exception e)
                {
                    spriteCounter--;
                }
            }

            for (int i = 0; i <= spriteCounter - 1; i++)
            {
                try
                {
                    Sprite sprite = currentSprite[i];
                    if (sprite.GetName().Contains("boss") && sprite.GetX() == 800)
                    {
                        spriteSpeed = 0;
                        bgLayer1.PauseBackground();
                        bgLayer2.PauseBackground();
                        bgLayer3.PauseBackground();
                        player.MovePlayer();
                    }
                }
                catch (Exception e)
                {
                    spriteCounter--;
                }
            }
            if (!player.CheckSword())
            {
                swordTimer = 0;
            }
            if (swordUsed)
            {
                player.AcquireSword(false);
                if (swordTimer >= player.GetSwordTime())
                {
                    swordUsed = false;
                    player.ReInitializeRunAnimation();
                    swordTimer = 0;
                }
            }
            RemoveSprites();

            bar.SetCurrentValue(player.Immunity);
            score.score = player.Score;

            //FreezeScreen();
            //ScreenManager.AddScreen(new BossFightScreen(this, 1));
            base.Update(gameTime);
        }
예제 #46
0
 public void loadContent(ContentManager contman)
 {
     instructpic = contman.Load <Texture2D>("Instructions");
     instructpos = new Vector2(0, 0);
 }
예제 #47
0
 public void ReloadLevel(ContentManager content)
 {
     RemoveAll();
     LoadLevel(content);
 }
예제 #48
0
        /// <remarks>
        ///<para>AUTHOR: Khaled Salah, Ahmed Shirin </para>
        ///</remarks>
        public override void LoadContent()
        {
            ContentManager Content = ScreenManager.Game.Content;

            songs[0] = Content.Load <Song>("Audio\\song");
            songs[1] = Content.Load <Song>("Audio\\song2");
            //songs[2] = Content.Load<Song>("Directory\\songtitle");
            MediaPlayer.IsRepeating = false;

            bar.LoadContent(Content);
            score.LoadContent(Content);
            player.LoadContent(Content);

            #region Tamer
            immunityAudio  = Content.Load <SoundEffect>("Audio\\Immunity2");
            textFont       = Content.Load <SpriteFont>("newFont2");
            splashDead     = Content.Load <Texture2D>("Textures\\splash1");
            splashSemiDead = Content.Load <Texture2D>("Textures\\splash3");
            splashInjured  = Content.Load <Texture2D>("Textures\\splash2");
            #endregion


            #region Shirin
            correct        = Content.Load <Texture2D>("Textures//correct");
            swordTexture   = Content.Load <Texture2D>("Textures//sword");
            shieldTexture  = Content.Load <Texture2D>("Textures//shield");
            trans          = Content.Load <Texture2D>("Textures//Transparent");
            sword          = new Sprite(swordTexture, new Rectangle(335, 7, 50, 50), Content);
            shield         = new Sprite(shieldTexture, new Rectangle(420, 0, 60, 60), Content);
            swordAcquired  = new Sprite(correct, new Rectangle(325, 10, 60, 60), Content);
            shieldAcquired = new Sprite(correct, new Rectangle(410, 10, 60, 60), Content);

            soundEffects[0] = Content.Load <SoundEffect>("Audio//Death");
            soundEffects[1] = Content.Load <SoundEffect>("Audio//Food");
            soundEffects[2] = Content.Load <SoundEffect>("Audio//ShieldAcquired");
            soundEffects[3] = Content.Load <SoundEffect>("Audio//SwordAcquired");
            soundEffects[4] = Content.Load <SoundEffect>("Audio//SwordSlash");
            soundEffects[5] = Content.Load <SoundEffect>("Audio//VirusHit");
            soundEffects[6] = Content.Load <SoundEffect>("Audio//VirusSlashed");
            soundEffects[7] = Content.Load <SoundEffect>("Audio//VirusPunched");
            soundEffects[8] = Content.Load <SoundEffect>("Audio//VirusKilled");
            soundEffects[9] = Content.Load <SoundEffect>("Audio//jump");

            items.Add(Content.Load <Texture2D>("Textures//banana"));
            items.Add(Content.Load <Texture2D>("Textures//brocolli"));
            items.Add(Content.Load <Texture2D>("Textures//carrot"));
            items.Add(Content.Load <Texture2D>("Textures//pineapple"));
            items.Add(Content.Load <Texture2D>("Textures//tomato"));
            items.Add(Content.Load <Texture2D>("Textures//strawberry"));
            items.Add(Content.Load <Texture2D>("Textures//hotdog"));
            items.Add(Content.Load <Texture2D>("Textures//pizza"));
            items.Add(Content.Load <Texture2D>("Textures//fries"));
            items.Add(Content.Load <Texture2D>("Textures//donut"));
            items.Add(Content.Load <Texture2D>("Textures//cupcake"));
            items.Add(Content.Load <Texture2D>("Textures//burger"));
            items.Add(Content.Load <Texture2D>("Textures//virus1"));
            items.Add(Content.Load <Texture2D>("Textures//virus2"));
            items.Add(Content.Load <Texture2D>("Textures//virus3"));
            items.Add(shieldTexture);
            items.Add(swordTexture);
            items.Add(Content.Load <Texture2D>("Textures//gym"));
            items.Add(trans);
            items.Add(Content.Load <Texture2D>("Textures//boss"));

            #endregion

            bgLayer1.Initialize(Content, "Background/Layer 1", ScreenManager.GraphicsDevice.Viewport.Width, -1);
            bgLayer2.Initialize(Content, "Background/Layer 2", ScreenManager.GraphicsDevice.Viewport.Width, -2);
            bgLayer3.Initialize(Content, "Background/Layer 3", ScreenManager.GraphicsDevice.Viewport.Width, -4);

            alertTexture = Content.Load <Texture2D>("Textures/alert");

            playerBounds = player.GetBoundingRectangle();
            playerData   = player.GetColorData();
            base.LoadContent();
        }
예제 #49
0
        public GameObject(int id, string name, int x, int y, ObjectType type, int frames, ContentManager content)
        {
            ID    = id;
            Name  = name;
            X     = x;
            Y     = y;
            OType = type;



            //Effect = new Animation(new Sprite(Config.SPRITEDIR + "explosion.png", 1540 , 90), 2.0F, 14, false);
            Bounds = new Rectangle(x, y, Sprite.FrameWidth, Sprite.FrameHeight);
            Origin = new Point(Sprite.FrameWidth / 2, Sprite.FrameHeight / 2);
            //ObjectSound = new Sound(3, SoundEngine.explodeSound, false);
        }
예제 #50
0
 public GameObjectCollection(ContentManager contentManager)
 {
     _contentManager = contentManager;
     _items          = new List <GameObject>();
 }
예제 #51
0
 public void LoadContent(ContentManager theContentManager)
 {
     Position = new Vector2(START_POSITION_X, START_POSITION_Y);
     base.LoadContent(theContentManager, WIZARD_ASSETNAME);
     Scale = 0.1f;
 }
예제 #52
0
        public void LoadLevel(ContentManager content)
        {
            ObjectList objectList = content.Load <XMLData.ObjectList>(fileName);

            foreach (XMLData.GameObject nextGameObject in objectList.List)
            {
                Vector2 location = new Vector2(nextGameObject.X, nextGameObject.Y);
                //TODO create the objects related to nextGameObject.ItemName
                //This should become a dictionary or something eventually
                switch (nextGameObject.ItemName)
                {
                case "NormalBrickBlock":
                    AddToCollidables(new NormalBrickBlock(location));
                    break;

                case "CoinBrickBlock":
                    AddToCollidables(new CoinBrickBlock(location));
                    break;

                case "StarBrickBlock":
                    AddToCollidables(new StarBrickBlock(location));
                    break;

                case "GroundBlock1x1":
                    AddToCollidables(new GroundBlock(location, SpriteMachine.Instance.CreateSprite(SpriteMachine.SpriteTag.GroundBlock1x1)));
                    break;

                case "UndergroundBrickBlock":
                    AddToCollidables(new GroundBlock(location, SpriteMachine.Instance.CreateSprite(SpriteMachine.SpriteTag.UndergroundBrickBlock)));
                    break;

                case "UndergroundBlock1x1":
                    AddToCollidables(new GroundBlock(location, SpriteMachine.Instance.CreateSprite(SpriteMachine.SpriteTag.UndergroundBlock1x1)));
                    break;

                case "UndergroundBlock4x15":
                    AddToCollidables(new GroundBlock(location, SpriteMachine.Instance.CreateSprite(SpriteMachine.SpriteTag.UndergroundBlock4x15)));
                    break;

                case "GroundBlock4x65":
                    AddToCollidables(new GroundBlock(location, SpriteMachine.Instance.CreateSprite(SpriteMachine.SpriteTag.GroundBlock4x65)));
                    break;

                case "GroundBlock4x15":
                    AddToCollidables(new GroundBlock(location, SpriteMachine.Instance.CreateSprite(SpriteMachine.SpriteTag.GroundBlock4x15)));
                    break;

                case "GroundBlock4x60":
                    AddToCollidables(new GroundBlock(location, SpriteMachine.Instance.CreateSprite(SpriteMachine.SpriteTag.GroundBlock4x60)));
                    break;

                case "GroundBlock4x54":
                    AddToCollidables(new GroundBlock(location, SpriteMachine.Instance.CreateSprite(SpriteMachine.SpriteTag.GroundBlock4x54)));
                    break;

                case "InvisibleBlock":
                    AddToCollidables(new InvisibleBlock(location));
                    break;

                case "PowerUpInvisibleBlock":
                    AddToCollidables(new PowerUpInvisibleBlock(location));
                    break;

                case "SpeedBoostQuestionBlock":
                    AddToCollidables(new SpeedBoostQuestionBlock(location));
                    break;

                case "ExtraLifeInvisibleBlock":
                    AddToCollidables(new ExtraLifeInvisibleBlock(location));
                    break;

                case "CoinQuestionBlock":
                    AddToCollidables(new CoinQuestionBlock(location));
                    break;

                case "PowerUpQuestionBlock":
                    AddToCollidables(new PowerUpQuestionBlock(location));
                    break;

                case "FlowerQuestionBlock":
                    AddToCollidables(new FlowerQuestionBlock(location));
                    break;

                case "SolidBlock":
                    AddToCollidables(new SolidBlock(location));
                    break;

                case "StairBlock":
                    AddToCollidables(new StairBlock(location));
                    break;

                case "Goomba":
                    AddToCollidables(new Goomba(location));
                    break;

                case "Koopa":
                    AddToCollidables(new Koopa(location));
                    break;

                case "KoopaShell":
                    AddToCollidables(new KoopaShell(location));
                    break;

                case "StaticCoin":
                    AddToCollidables(new StaticCoin(location));
                    break;

                case "BrownMushroom":
                    AddToCollidables(new BrownMushroom(location));
                    break;

                case "SpeedBoostItem":
                    AddToCollidables(new SpeedBoostItem(location));
                    break;

                case "Star":
                    AddToCollidables(new Star(location));
                    break;

                case "PushableBlock":
                    AddToCollidables(new PushableBlock(location));
                    break;

                case "Flower":
                    AddToCollidables(new Flower(location));
                    break;

                case "SmallPipe":
                    AddToCollidables(new SmallPipe(location));
                    break;

                case "MediumPipe":
                    AddToCollidables(new MediumPipe(location));
                    break;

                case "LeftFacingPipe":
                    AddToCollidables(new LeftFacingPipe(location));
                    break;

                case "LargePipe":
                    AddToCollidables(new LargePipe(location));
                    break;

                case "PipeFlagpole":
                    AddToCollidables(new PipeFlagpole(location));
                    break;

                case "PipeHalf":
                    AddToCollidables(new PipeHalf(location));
                    break;

                case "TeleportationPipe":
                    AddToCollidables(new TeleportationPipe(location));
                    break;

                case "Castle":
                    AddToNonCollidables(new BackgroundElement(location, SpriteMachine.Instance.CreateSprite(SpriteMachine.SpriteTag.Castle)));
                    break;

                case "Flagpole":
                    AddToCollidables(new Flagpole(location));
                    break;

                case "Flag":
                    AddToNonCollidables(new Flag(location));
                    break;

                case "OneHumpCloud":
                    AddToNonCollidables(new BackgroundElement(location, SpriteMachine.Instance.CreateSprite(SpriteMachine.SpriteTag.OneHumpCloud)));
                    break;

                case "TwoHumpCloud":
                    AddToNonCollidables(new BackgroundElement(location, SpriteMachine.Instance.CreateSprite(SpriteMachine.SpriteTag.TwoHumpCloud)));
                    break;

                case "ThreeHumpCloud":
                    AddToNonCollidables(new BackgroundElement(location, SpriteMachine.Instance.CreateSprite(SpriteMachine.SpriteTag.ThreeHumpCloud)));
                    break;

                case "OneHumpBush":
                    AddToNonCollidables(new BackgroundElement(location, SpriteMachine.Instance.CreateSprite(SpriteMachine.SpriteTag.OneHumpBush)));
                    break;

                case "TwoHumpBush":
                    AddToNonCollidables(new BackgroundElement(location, SpriteMachine.Instance.CreateSprite(SpriteMachine.SpriteTag.TwoHumpBush)));
                    break;

                case "ThreeHumpBush":
                    AddToNonCollidables(new BackgroundElement(location, SpriteMachine.Instance.CreateSprite(SpriteMachine.SpriteTag.ThreeHumpBush)));
                    break;

                case "TallHill":
                    AddToNonCollidables(new BackgroundElement(location, SpriteMachine.Instance.CreateSprite(SpriteMachine.SpriteTag.TallHill)));
                    break;

                case "ShortHill":
                    AddToNonCollidables(new BackgroundElement(location, SpriteMachine.Instance.CreateSprite(SpriteMachine.SpriteTag.ShortHill)));
                    break;

                default:
                    Console.WriteLine(string.Format(Config.GetLevelLoadingExceptionString(), nextGameObject.ItemName));
                    break;
                }
            }
        }
예제 #53
0
 public void CreateForm()
 {
     ContentManager.ShowContent(FormFactory <Product> .InitializeAddForm());
 }
 //[Constructor]
 public Scene_MainMenu(ContentManager cont) : base(cont)
 {
 }
예제 #55
0
 public static void InitializeSounds(ContentManager Content)
 {
     LoadSounds(Content);
 }
예제 #56
0
 public void UpdateForm()
 {
     ContentManager.ShowContent(FormFactory <Product> .InitializeEditForm((Product)SelectedItem));
 }
예제 #57
0
 public void Load(ContentManager contentManager)
 {
     font = contentManager.Load <SpriteFont>("font");
 }
예제 #58
0
 public void LoadContent(ContentManager content)
 {
     image = content.Load <Texture2D>(imagePath);
 }
예제 #59
0
 private static void LoadSongFiles(ContentManager content)
 {
 }
예제 #60
0
 public Elf(CreatureStats stats, string allies, PlanService planService, Faction faction, ComponentManager manager, string name, ChunkManager chunks, GraphicsDevice graphics, ContentManager content, Vector3 position) :
     base(stats, allies, planService, faction, new Physics("Elf", manager.RootComponent, Matrix.CreateTranslation(position), new Vector3(0.5f, 0.5f, 0.5f), new Vector3(0.0f, -0.25f, 0.0f), 1.0f, 1.0f, 0.999f, 0.999f, new Vector3(0, -10, 0)),
          chunks, graphics, content, name)
 {
     Initialize();
 }