当前位置: 首页>>代码示例>>C#>>正文


C# GameScreen类代码示例

本文整理汇总了C#中GameScreen的典型用法代码示例。如果您正苦于以下问题:C# GameScreen类的具体用法?C# GameScreen怎么用?C# GameScreen使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


GameScreen类属于命名空间,在下文中一共展示了GameScreen类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PlayerSpaceInvaders

        public PlayerSpaceInvaders(GameScreen i_GameScreen, string i_PlayerNickname, eSpaceShipType i_SpaceShipType)
            : base(i_GameScreen.Game, i_PlayerNickname)
        {
            m_LoseLifeSound = SoundFactory.CreateSound(this.Game, SoundFactory.eSoundType.LifeDie) as Sound;
            m_Nickname = i_PlayerNickname;
            m_SpaceShipType = i_SpaceShipType;
            m_ScoreText = SpritesFactory.CreateSprite(i_GameScreen, SpritesFactory.eSpriteType.SmallText) as Text;
            SpritesFactory.eSpriteType lifeType = SpritesFactory.eSpriteType.LifeBlueSpaceShip;

            switch (m_SpaceShipType)
            {
                case eSpaceShipType.Blue:
                    m_SpaceShip = SpritesFactory.CreateSprite(i_GameScreen, SpritesFactory.eSpriteType.BlueSpaceShip) as SpaceShip;
                    m_ScoreText.TintColor = Color.Blue;
                    lifeType = SpritesFactory.eSpriteType.LifeBlueSpaceShip;
                    break;

                case eSpaceShipType.Green:
                    m_SpaceShip = SpritesFactory.CreateSprite(i_GameScreen, SpritesFactory.eSpriteType.GreenSpaceShip) as SpaceShip;
                    m_ScoreText.TintColor = Color.Green;
                    lifeType = SpritesFactory.eSpriteType.LifeGreenSpaceShip;
                    break;
            }

            for (int i = 0; i < this.Lifes; i++)
            {
                Life life = SpritesFactory.CreateSprite(i_GameScreen, lifeType) as Life;
                life.Initialize();
                this.LifesSprites.Add(life);
            }
        }
开发者ID:barcohen10,项目名称:Space-Invaders,代码行数:31,代码来源:PlayerSpaceInvaders.cs

示例2: MenuScreen

 public MenuScreen(GameScreen screen)
 {
     TransitionOnTime = TransitionOffTime = TimeSpan.FromSeconds(1.5);
     if (screen.ScreenState != ScreenState.Frozen)
         screen.ScreenState = ScreenState.Frozen;
     parent = screen;
 }
开发者ID:WINPROG20142015,项目名称:Selfie-Killer,代码行数:7,代码来源:MenuScreen.cs

示例3: ScreenManager

 public ScreenManager(Game game)
     : base(game)
 {
     menuScreen = new MenuScreen();
     gameScreen = new GameScreen();
     keyboard = new Input();
 }
开发者ID:Hisoka69,项目名称:Project-Phobia,代码行数:7,代码来源:ScreenManager.cs

示例4: Draw

        public override void Draw(GameScreen gameScreen, GameTime gameTime)
        {
            SpriteBatch spriteBatch = gameScreen.ScreenManager.SpriteBatch;
            SpriteFont font = gameScreen.ScreenManager.BigFont;

            ButtonTexture = ButtonTexture ?? gameScreen.ScreenManager.BlankTexture;

            var newPosition = Position;
            var textSize = font.MeasureString(Text);
            if (ShowText)
            {
                newPosition.Y -= textSize.Y / 1.5f;
            }

            Rectangle rec = new Rectangle((int)newPosition.X, (int)newPosition.Y, (int)Size.X, (int)Size.Y);
            if(!IsHovered)
                spriteBatch.Draw(Icon, rec, Color.White);
            else
                spriteBatch.Draw(Icon, rec, HoverColor);

            var textPosition = newPosition;
            textPosition.Y += Size.Y + 10;
            textPosition.X += (Size.X - textSize.X)/2;
            spriteBatch.DrawString(font, Text, textPosition, TextColor);
        }
开发者ID:HaKDMoDz,项目名称:DynaInterface,代码行数:25,代码来源:IconButton.cs

示例5: Effects

 public Effects(GameScreen gameScreen)
 {
     this.gameScreen = gameScreen;
     //Create List Models
     ListModelEffects = new List<ModelStruct>();
     DiccModelsEffects = new Dictionary<int, string>();
 }
开发者ID:jacs700,项目名称:Ganimedes,代码行数:7,代码来源:Effects.cs

示例6: Game

		public Game(StartupScreen startScreen, GameScreen gameScreen)
		{
			this.startScreen = startScreen;
			startScreen.GameStarted += OnStartupScreenGameStarted;
			this.gameScreen = gameScreen;
			gameScreen.Hide();
		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:7,代码来源:Game.cs

示例7: PathCPUParticleEmitter

		public PathCPUParticleEmitter(GameScreen scrn, Vector2 pos, VectorPath path, ParticleEmitterConfig cfg) : base(scrn, cfg)
		{
			vectorPath = path;
			vectorPathCenter = path.Boundings.Center;

			Position = pos;
		}
开发者ID:Mikescher,项目名称:GridDominance,代码行数:7,代码来源:PathCPUParticleEmitter.cs

示例8: ShowScreen

		public void ShowScreen()
		{
			Resolve<Window>().ViewportPixelSize = new Size(1280, 800);
			var screen = new GameScreen();
			screen.FadeIn();
			screen.StartNextLevel();
		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:7,代码来源:GameScreenTests.cs

示例9: Button

 /// <summary>
 /// Button class constructor.
 /// </summary>
 /// <param name="position">The top-left corner of the Button.</param>
 /// <param name="width">The Button's width.</param>
 /// <param name="height">The Button's height.</param>
 /// <param name="screen">Reference to the screen on which the Button exists.</param>
 public Button( Point position, int width, int height, GameScreen screen )
     : base(position, width, height, screen)
 {
     // Starting state is inert
     state = 0;
     textColours = new Color[4];
 }
开发者ID:nezek6,项目名称:Wizardry,代码行数:14,代码来源:Button.cs

示例10: Initialize

 public override void Initialize(GraphicsDevice Device, ScreenManager manager)
 {
     base.Initialize(Device, manager);
     Settings.LoadSettings();
     Panel panel = new Panel(this, new Vector2(300, 160), new Vector2(200, 280), Content.ContentInterface.LoadTexture("UITest"));
     Button button = new Button(this, new Vector2(60, 30), new Vector2(80, 40), Content.ContentInterface.LoadTexture("UITest"),
         delegate { Settings.ServerAddress = "localhost";
             _manager.RemoveScreen(this); GameScreen screen = new GameScreen();
             screen.SetupLocalServer(); _manager.AddScreen(screen); },
         "Local");
     AddChild(panel);
     panel.AddChild(button);
     button = new Button(this, new Vector2(20, 90), new Vector2(160, 40), Content.ContentInterface.LoadTexture("UITest"),
     delegate { _manager.RemoveScreen(this); _manager.AddScreen(new GameScreen()); },
     "Online");
     panel.AddChild(button);
     button = new Button(this, new Vector2(20, 150), new Vector2(160, 40), Content.ContentInterface.LoadTexture("UITest"),
     delegate { Console.WriteLine("Test2"); },
     "Testbutton2");
     panel.AddChild(button);
     button = new Button(this, new Vector2(20, 210), new Vector2(160, 40), Content.ContentInterface.LoadTexture("UITest"),
     delegate { Console.WriteLine("Test3"); },
     "Testbutton3");
     panel.AddChild(button);
 }
开发者ID:MyEyes,项目名称:Igorr,代码行数:25,代码来源:MainMenuScreen.cs

示例11: Marble

 public Marble(GameScreen game)
     : base(game, "marble")
 {
     preferPerPixelLighting = true;
     // Load the texture of the marble
     m_marbleTexture = Engine.Content.Load<Texture2D>(@"Textures\Marble");
 }
开发者ID:jwoschitz,项目名称:Lava,代码行数:7,代码来源:Marble.cs

示例12: ActionToggleButton

 /// <summary>
 /// Initializes a new instance of the <see cref="ActionToggleButton"/> class.
 /// </summary>
 /// <param name="screen">The screen.</param>
 /// <param name="text">The text to display.</param>
 /// <param name="stateText">The state text.</param>
 /// <param name="id">The id of this element.</param>
 public ActionToggleButton(GameScreen screen, string text, string stateText, int id)
 {
     this.text = text;
       this.Id = id;
       this.Owner = screen;
       this.stateText = stateText;
 }
开发者ID:urmuelle,项目名称:MonoGameBallerburg,代码行数:14,代码来源:ActionToggleButton.cs

示例13: LoadingScreen

        /// <summary>
        /// The constructor is private: loading screens should
        /// be activated via the static Load method instead.
        /// </summary>
        private LoadingScreen(ScreenManager screenManager, bool loadingIsSlow, GameScreen[] screensToLoad)
        {
            this.loadingIsSlow = loadingIsSlow;
            this.screensToLoad = screensToLoad;

            TransitionOnTime = TimeSpan.FromSeconds(0.5);
        }
开发者ID:salvadorc17,项目名称:Prince-Monogame,代码行数:11,代码来源:LoadingScreen.cs

示例14: ListView

        /// <summary>
        /// ListView class constructor.
        /// </summary>
        /// <param name="elements">The number of visible elements in ListView.</param>
        /// <param name="position">The top-left corner of the ListView.</param>
        /// <param name="width">The ListView's width.</param>
        /// <param name="height">The ListView's height.</param>
        /// <param name="screen">Reference to the screen on which the ListView exists.</param>
        public ListView(int elements, Point position, int width, int height, GameScreen screen)
            : base(position, width, height, screen)
        {
            // up button initialization
            up = new Button(new Point(base.Position.X + 10 + base.width, position.Y), 50, 50, base.screen);

            this.elements = elements;

            //listview button height
            int buttonHeight = base.height / elements;

            //down button initialization
            down = new Button(new Point(base.Position.X + 10 + base.width, position.Y + buttonHeight * (elements - 1)), 50, 50, base.screen);

            //arrow button callbacks
            up.RegisterCallback(Up_OnClick);
            down.RegisterCallback(Down_OnClick);

            //minimum threshold check for listview buttons height
            if (buttonHeight < 21)
            {
                buttonHeight = 21;
            }

            //initialize listview buttons
            for (int i = 0; i < elements; i++)
            {
                Buttons.Add(new Button(new Point(base.position.X, base.position.Y + (i * buttonHeight)), base.width, buttonHeight, base.screen));
            }
        }
开发者ID:nezek6,项目名称:Wizardry,代码行数:38,代码来源:ListView.cs

示例15: OnOffToggleButton

 /// <summary>
 /// Initializes a new instance of the <see cref="OnOffToggleButton"/> class.
 /// </summary>
 /// <param name="screen">The screen.</param>
 /// <param name="text">The text to display.</param>
 /// <param name="on">if set to <c>true</c> [on].</param>
 /// <param name="id">The id of this element.</param>
 public OnOffToggleButton(GameScreen screen, string text, bool on, int id)
 {
     this.text = text;
       this.Id = id;
       this.Owner = screen;
       this.value = on;
 }
开发者ID:urmuelle,项目名称:MonoGameBallerburg,代码行数:14,代码来源:OnOffToggleButton.cs


注:本文中的GameScreen类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。