• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# MenuScreen类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: Draw

        /// <summary>
        /// Draws the menu entry. This can be overridden to customize the appearance.
        /// </summary>
        public virtual void Draw(MenuScreen screen, bool isSelected, GameTime gameTime)
        {
            // Draw the selected entry in yellow, otherwise whice.
            Color color = isSelected ? Color.OrangeRed : Color.Teal;

            // Pulsate the size of the selected menu entry.
            double time = gameTime.TotalGameTime.TotalSeconds;

            float pulsate = (float)Math.Sin(time * 6) + 1;

            float scale = 1 + pulsate * 0.05f * selectionFade;

            // Modify the alpha to fade out text during transitions.
            color *= screen.TransitionAlpha;

            // Draw text, centered on the middle of each line.
            ScreenManager screenManager = screen.ScreenManager;
            SpriteBatch spriteBatch = screenManager.SpriteBatch;
            SpriteFont font = screenManager.Font;

            Vector2 origin = new Vector2(0, font.LineSpacing / 2);

            spriteBatch.DrawString(font, text, position, color, 0,
                                   origin, scale, SpriteEffects.None, 0);
        }
开发者ID:jamesyp,项目名称:MazeGame,代码行数:28,代码来源:MenuEntry.cs


示例2: ScreenManager

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


示例3: Draw

        /// <summary>
        /// Draw the menu item.
        /// </summary>
        /// <param name="screen"></param>
        /// <param name="position"></param>
        /// <param name="isSelected"></param>
        /// <param name="gameTime"></param>
        public virtual void Draw(MenuScreen screen, Vector2 position,
            bool isSelected, GameTime gameTime)
        {
            Color color = isSelected ? Color.Yellow : Color.White;

            double time = gameTime.TotalGameTime.TotalSeconds;

            float pulsate = (float)Math.Sin(time * 6) + 1;

            float scale = 1 + pulsate * 0.05f * selectionFade;

            // Fade the text during transitions
            color = new Color(color.R, color.G, color.B, screen.TransitionAlpha);

            ScreenManager screenManager = screen.ScreenManager;
            SpriteBatch spriteBatch = screenManager.SpriteBatch;
            SpriteFont font = screenManager.Font;

            Vector2 origin = new Vector2(140, font.LineSpacing / 2);

            spriteBatch.DrawString(font, text, position, color, 0,
                                    origin, scale, SpriteEffects.None, 0);
            screen.ScreenManager.GraphicsDevice.RenderState.DepthBufferEnable = true;
            screen.ScreenManager.GraphicsDevice.RenderState.AlphaBlendEnable = false;
            screen.ScreenManager.GraphicsDevice.RenderState.AlphaTestEnable = false;
        }
开发者ID:rgee,项目名称:Skyblocks,代码行数:33,代码来源:MenuEntry.cs


示例4: HandleIL

		private void HandleIL(MenuScreen screen) {
			bool shouldSplit = false;

			if (currentSplit == 0) {
				MenuScreen prev = mem.GetPreviousMenu();
				if (state == 0 && screen == MenuScreen.Loading && (prev == MenuScreen.SinglePlayerMap || prev == MenuScreen.SinglePlayerDLCMap || prev == MenuScreen.CoopMap || prev == MenuScreen.CoopDLCMap)) {
					state++;
				} else if (state == 1 && prev == MenuScreen.Loading) {
					state++;
					mem.SetLevelScore(mem.GetPlatformLevelId(), 0);
				} else if (state == 2) {
					shouldSplit = true;
					startFrameCount = mem.FrameCount();
				}
			} else if (currentSplit < Model.CurrentState.Run.Count) {
				string[] splits = Model.CurrentState.Run[currentSplit - 1].Name.Split(' ');
				int pickups = -1;
				for (int i = 0; i < splits.Length; i++) {
					if (int.TryParse(splits[i], out pickups)) {
						break;
					}
				}

				shouldSplit = pickups > 0 && mem.GetCurrentScore() == pickups;
				if (shouldSplit) {
					lastLevelComplete++;
					splitFrameCount = mem.FrameCount();
				}
			} else {
				PersistentLevelStats level = mem.GetLevelStats(mem.GetPlatformLevelId());
				shouldSplit = level != null && level.minMillisecondsForMaxScore != int.MaxValue;
			}

			HandleSplit(shouldSplit, screen, screen == MenuScreen.SinglePlayerMap || screen == MenuScreen.SinglePlayerDLCMap || screen == MenuScreen.CoopMap || screen == MenuScreen.CoopDLCMap);
		}
开发者ID:ShootMe,项目名称:LiveSplit.Kalimba,代码行数:35,代码来源:KalimbaComponent.cs


示例5: Initialize

        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            base.Initialize();

            SimpleLevel samplelevel1 = new SimpleLevel(this);

            OptionsMenu optionsScreen = GlobalGameOptions.OptionsMenu;

            MenuScreen menuScreen = new MenuScreen("", true);

            menuScreen.AddMenuItem("", EntryType.Separator, null);
            menuScreen.AddMenuItem("", EntryType.Separator, null);
            menuScreen.AddMenuItem("", EntryType.Separator, null);

            menuScreen.AddMenuItem("Game Levels", EntryType.Separator, null);
            menuScreen.AddMenuItem(samplelevel1.GetTitle(), EntryType.Screen, samplelevel1);

            menuScreen.AddMenuItem(optionsScreen.MenuTitle, EntryType.Screen, optionsScreen);

            menuScreen.AddMenuItem("", EntryType.Separator, null);
            menuScreen.AddMenuItem("", EntryType.Separator, null);
            menuScreen.AddMenuItem("", EntryType.Separator, null);
            menuScreen.AddMenuItem("Exit", EntryType.GlobalExitItem, null);
            
            ScreenManager.AddScreen(new BackgroundScreen());
            ScreenManager.AddScreen(menuScreen);
            ScreenManager.AddScreen(new LogoScreen(TimeSpan.FromSeconds(3.0)));
        }
开发者ID:kevroy314,项目名称:XNA-Farseer-Prototype,代码行数:34,代码来源:GameMain.cs


示例6: SplashScreen

        public SplashScreen(MenuScreen nextScreen)
            : base("")
        {
            ActiveTime = 7000f;
            this.NextScreen = nextScreen;

            logoPosition = Vector2.Zero;
        }
开发者ID:joshsiegl,项目名称:MillionaireEntertainment,代码行数:8,代码来源:SplashScreen.cs


示例7: Update

        public virtual void Update(MenuScreen screen, bool isSelected, GameTime gameTime)
        {
            float fadeSpeed = (float)gameTime.ElapsedGameTime.TotalSeconds * 4;

            if (isSelected)
                selectionFade = Math.Min(selectionFade + fadeSpeed, 1);
            else
                selectionFade = Math.Max(selectionFade - fadeSpeed, 0);
        }
开发者ID:tdeeb,项目名称:DEPW,代码行数:9,代码来源:MenuEntry.cs


示例8: Draw

 public virtual void Draw(MenuScreen screen, bool isSelected, SpriteBatch spriteBatch)
 {
     #if WINDOWS_PHONE
     isSelected = false;
     #endif
     Color color = isSelected ? Color.Blue : Color.Black;
     color *= screen.TransitionAlpha;
     ScreenManager screenManager = screen.ScreenManager;
     SpriteFont font = screenManager.Font;
     Vector2 origin = new Vector2(0, font.LineSpacing / 2);
     spriteBatch.DrawString(font, Text, position, color, 0,
                            origin, 1, SpriteEffects.None, 0);
 }
开发者ID:Xellss,项目名称:RougyMon,代码行数:13,代码来源:MenuEntry.cs


示例9: LevelSelectScreen

        public LevelSelectScreen(MenuScreen parent)
        {
            this.Parent = parent;

            //Load the action titles
            prevEntry = "MenuUp";
            nextEntry = "MenuDown";
            selectedEntry = "MenuAccept";
            cancelMenu = "MenuCancel";

            //Customize the text colors.
            Selected = Color.Purple;
            Highlighted = Color.Purple;
            Normal = Color.Gray;
        }
开发者ID:midlas10,项目名称:XNA_mappe3_Bouncing,代码行数:15,代码来源:LevelSelectScreen.cs


示例10: Awake

    public SpawnDrop spawnDrop; //where player starts the game

    #endregion Fields

    #region Methods

    void Awake()
    {
        jgs = GameObject.FindGameObjectWithTag(TagsAndLayers.gameController).GetComponent<JumpGameState>();
        musicController = GameObject.FindGameObjectWithTag(TagsAndLayers.musicController).GetComponent<MusicController>();
        gameTimer = GameObject.FindGameObjectWithTag(TagsAndLayers.gameTimer).GetComponent<GameTimer>();
        deathArea = GameObject.FindGameObjectWithTag(TagsAndLayers.deathArea).GetComponent<DeathArea>();
        spawnDrop = GameObject.FindGameObjectWithTag(TagsAndLayers.spawnDrop).GetComponent<SpawnDrop>();
        menuScreen = GameObject.FindGameObjectWithTag(TagsAndLayers.menuController).GetComponent<MenuScreen>();
        pause = Camera.main.GetComponent<Pause>();
        crosshair = Camera.main.GetComponent<Crosshair>();

        objectSpawners = GameObject.FindGameObjectsWithTag(TagsAndLayers.objectSpawner);
        jumppadPillars = GameObject.FindGameObjectsWithTag(TagsAndLayers.jumppadPillar);
        player = GameObject.FindGameObjectWithTag(TagsAndLayers.player);
    }
开发者ID:Rxanadu,项目名称:EscapePlan,代码行数:21,代码来源:JumpGameReferences.cs


示例11: Draw

		public override void Draw( MenuScreen screen, Vector2 position, bool isSelected, GameTime gameTime ) {
			if( texture == null ) {
				base.Draw( screen, position, isSelected, gameTime );
			} else {
				double time = gameTime.TotalGameTime.TotalSeconds;
				float pulsate = (float)Math.Sin( time * 6 ) + 1;
				float scale = 1 + pulsate * 0.05f * selectionFade;

				Color color = new Color( Vector4.One * ( 1.0f - screen.TransitionPosition ) );

				ScreenManager screenManager = screen.ScreenManager;
				SpriteBatch spriteBatch = screenManager.SpriteBatch;

				spriteBatch.Draw( texture, position, null, color, 0, textureOrigin, scale, SpriteEffects.None, 0 );
			}
		}
开发者ID:GodLesZ,项目名称:svn-dump,代码行数:16,代码来源:ImageMenuEntry.cs


示例12: Game

        public Game(MenuScreen mainForm)
        {
            this.mainForm = mainForm;

            //load story line for game state
            if (!GameState.loadStoryLine(Path.Combine(Application.StartupPath, "Data", "story.dll")))
                throw new FileNotFoundException("Could not find the storyLine file, /Data/stroy.dll");//do nothing at the moment;

            hostForm = new HostForm();

            hostForm.ShowDialog();

            mainForm.Show();

            //new System.Threading.Thread(GameLoop).Start();
        }
开发者ID:rdpeake,项目名称:CodeRunners,代码行数:16,代码来源:Game.cs


示例13: Draw

        public virtual void Draw(MenuScreen screen, Vector2 position, bool isSelected, GameTime gameTime)
        {
            // Draw the selected entry in yellow, otherwise white.
            Color color = isSelected ? Color.Gold : Color.White;

            // Modify the alpha to fade text out during transitions.
            color = new Color(color.R, color.G, color.B, screen.TransitionAlphaValue);

            // Draw text, centered on the middle of each line.
            ScreenManager screenManager = screen.ScreenManager;
            SpriteBatch spriteBatch = screenManager.SpriteBatch;
            SpriteFont font = screenManager.GameFont;
            Vector2 origin = new Vector2(0, font.LineSpacing / 2);

            spriteBatch.DrawString(font, DisplayText, position, color, 0, origin, 1, SpriteEffects.None, 0);
        }
开发者ID:nchoumitsky,项目名称:Meatieroids,代码行数:16,代码来源:MenuEntry.cs


示例14: ShowMenu

    public void ShowMenu(MenuScreen menuScreen, float transitionTime = 0.5f)
    {
        if(m_currentMenu != null)
        {
            CanvasGroup screenToFadeOut = m_currentMenu;
            LeanTween.value(m_currentMenu.gameObject, m_currentMenu.alpha, 0, transitionTime)
                .setOnUpdate((float newVal)=>{screenToFadeOut.alpha = newVal;})
                .setOnComplete(()=>{screenToFadeOut.alpha = 0;});
        }

        m_currentMenu = m_menuScreens[(int)menuScreen];

        CanvasGroup screenToFadeIn = m_currentMenu;
        LeanTween.value(m_currentMenu.gameObject, m_currentMenu.alpha, 1, transitionTime)
            .setOnUpdate((float newVal)=>{screenToFadeIn.alpha = newVal;})
            .setOnComplete(()=>{screenToFadeIn.alpha = 1;});
    }
开发者ID:ruffenman,项目名称:CosmicCorral,代码行数:17,代码来源:UIMenus.cs


示例15: Draw

        public virtual void Draw(GameTime gameTime, MenuScreen menuScreen, bool isSelected, int linesSoFar)
        {
            Color color = isSelected ? Color.Yellow : Color.Black;
            double time = gameTime.TotalGameTime.TotalSeconds;
            float pulsate = (float)Math.Sin(time * 6) + 1;
            float scale = 1 + pulsate * 0.01f * selectionFade;
            color *= menuScreen.TransitionAlpha;

            ScreenManager screenManager = menuScreen.ScreenManager;
            SpriteBatch spriteBatch = screenManager.SpriteBatch;
            SpriteFont font = screenManager.FontHUD;

            string textToDraw = ParseText(Text, font);
            Vector2 origin = new Vector2(0, font.LineSpacing / 20 * linesSoFar);

            spriteBatch.DrawString(font, textToDraw, Position, color, 0.0f, origin, scale, SpriteEffects.None, 0.0f);
        }
开发者ID:BenFradet,项目名称:OldXnaStuff,代码行数:17,代码来源:MenuEntry.cs


示例16: Draw

 public void Draw(MenuScreen screen, MenuEntryState state, GameTime gameTime)
 {
     SpriteBatch spriteBatch = screen.ScreenManager.SpriteBatch;
     Texture2D drawTexture;
     switch (state)
     {
         case MenuEntryState.OVER:
             drawTexture = this._over;
             break;
         case MenuEntryState.DOWN:
             drawTexture = this._down;
             break;
         default:
             drawTexture = this._up;
             break;
     }
     spriteBatch.Draw(drawTexture, this._pos, Color.White);
 }
开发者ID:dcordoba,项目名称:Imagination-Labs,代码行数:18,代码来源:GestureMenuEntry.cs


示例17: OptionsScreen

        public OptionsScreen(MenuScreen parent)
        {
            //Like the pause screen, we will reset the parent to active
            //when this screen is finished.  Therefore, we must have a reference
            //to the parent
            this.Parent = parent;

            //Load the action titles
            prevEntry = "MenuUp";
            nextEntry = "MenuDown";
            selectedEntry = "MenuAccept";
            cancelMenu = "MenuCancel";

            //Customize the text colors.
            Selected = Color.Yellow;
            Highlighted = Color.Green;
            Normal = Color.White;
        }
开发者ID:midlas10,项目名称:XNA_mappe3_Bouncing,代码行数:18,代码来源:OptionsScreen.cs


示例18: Draw

        public virtual void Draw(MenuScreen screen, bool isSelected, GameTime gameTime)
        {
            Color color = isSelected ? Color.Yellow : Color.White;

            double time = gameTime.TotalGameTime.TotalSeconds;
            float pulsate = (float)Math.Sin(time * 6) + 1;
            float scale = 1 + pulsate * 0.05f * selectionFade;

            color *= screen.TransitionAlpha;

            ScreenManager screenManager = screen.ScreenManager;
            SpriteBatch spriteBatch = screenManager.SpriteBatch;
            SpriteFont font = screenManager.Font;

            Vector2 origin = new Vector2(0, font.LineSpacing + 24 / 4f);

            spriteBatch.DrawString(font, text, new Vector2(position.X, position.Y - 30), color, 0,
                                   origin, scale, SpriteEffects.None, 0);
        }
开发者ID:tdeeb,项目名称:DEPW,代码行数:19,代码来源:MenuEntry.cs


示例19: Draw

        public override void Draw(MenuScreen screen, GameTime gameTime)
        {
            if (IsVisible)
            {
                // Draw the selected entry in teal, otherwise white.
                Color color =  Color.White;

                // Draw text, centered on the middle of each line.
                var spriteBatch = Game.Services.GetService<SpriteBatch>();
                spriteBatch.Begin();
                if ((Font != null) && !String.IsNullOrEmpty(Text))
                {
                    spriteBatch.DrawString(Font, Text, Position, color, 0, Vector2.Zero, _currentScale,
                                           SpriteEffects.None,
                                           0);
                }

                spriteBatch.End();
            }
        }
开发者ID:sergik,项目名称:Cardio,代码行数:20,代码来源:GrowingMenuEntry.cs


示例20: Draw

 public void Draw(MenuScreen screen, MenuEntryState state, GameTime gameTime, float sortmode)
 {
     SpriteBatch spriteBatch = screen.ScreenManager.SpriteBatch;
     Texture2D drawTexture;
     switch (state)
     {
         case MenuEntryState.OVER:
             drawTexture = this._over;
             break;
         case MenuEntryState.DOWN:
             drawTexture = this._down;
             break;
         case MenuEntryState.UP:
             drawTexture = this._up;
             break;
         default:
             drawTexture = this._disabled;
             break;
     }
     spriteBatch.Draw(drawTexture, this._pos, null, Color.White, 0, Vector2.Zero, SpriteEffects.None, 0.48F + sortmode);
 }
开发者ID:khoshino,项目名称:Imagination-Labs,代码行数:21,代码来源:GestureMenuEntry.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# MenuState类代码示例发布时间:2022-05-24
下一篇:
C# MenuItem类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap