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


C# MenuScreen类代码示例

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


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


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