本文整理汇总了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);
}
示例2: ScreenManager
public ScreenManager(Game game)
: base(game)
{
menuScreen = new MenuScreen();
gameScreen = new GameScreen();
keyboard = new Input();
}
示例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;
}
示例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);
}
示例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)));
}
示例6: SplashScreen
public SplashScreen(MenuScreen nextScreen)
: base("")
{
ActiveTime = 7000f;
this.NextScreen = nextScreen;
logoPosition = Vector2.Zero;
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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 );
}
}
示例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();
}
示例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);
}
示例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;});
}
示例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);
}