/// <summary> /// initializes this screen. /// play a BGM sound. /// </summary> public override void InitializeScreen() { this.activeElapsedTime = TimeSpan.Zero; // creates a 2D layer. FrameworkCore.RenderContext.CreateScene2DLayer(1); this.refScene2DRoot = FrameworkCore.Scene2DLayers[0]; this.refScene2DRoot.AddChild(this.spriteMain); spriteObjMain = this.spriteMain.AddSprite(0, "MainTitle"); this.refScene2DRoot.AddChild(this.spriteButton); // Initialize start button spriteObjStartButton = this.spriteButton.AddSprite(0, "Start Button"); AddMenuEntry(spriteObjStartButton); // Entry a start button // Initialize versus button spriteObjVersusButton = this.spriteButton.AddSprite(1, "Versus Button"); AddMenuEntry(spriteObjVersusButton);// Entry a versus button // Initialize exit button spriteObjExitButton = this.spriteButton.AddSprite(2, "Exit Button"); AddMenuEntry(spriteObjExitButton); // Entry a exit button // calculates all image size. OnSize(); // play the title music. GameSound.Play(SoundTrack.MainTitle); // play an open menu sound. GameSound.Play(SoundTrack.MenuOpen); }
/// <summary> /// initializes this screen. /// </summary> public override void InitializeScreen() { this.activeElapsedTime = TimeSpan.Zero; // Create a 2D layer FrameworkCore.RenderContext.CreateScene2DLayer(1); this.refScene2DRoot = FrameworkCore.Scene2DLayers[0]; // Play a title music GameSound.Play(SoundTrack.ReadyRoom); SetHorizontalEntryIndex(0, 0); SetHorizontalEntryIndex(1, 1); focusIndex[0] = 0; // default set focusIndex[1] = 1; // default set this.refScene2DRoot.AddChild(this.spriteBG); spriteObjBG = this.spriteBG.AddSprite(0, "Versus bg image"); this.refScene2DRoot.AddChild(this.spriteSelect); spriteObjSelectMech = new Sprite2DObject[4]; // Create the Grund image spriteObjSelectMech[0] = this.spriteSelect.AddSprite(0, "Grund"); // Create the Mark image spriteObjSelectMech[1] = this.spriteSelect.AddSprite(1, "Mark"); // Create the Kiev image spriteObjSelectMech[2] = this.spriteSelect.AddSprite(2, "Kiev"); // Create the Yager image spriteObjSelectMech[3] = this.spriteSelect.AddSprite(3, "Yager"); // Entry select player image AddMenuEntry(spriteObjSelectMech[0]); AddMenuEntry(spriteObjSelectMech[1]); AddMenuEntry(spriteObjSelectMech[2]); AddMenuEntry(spriteObjSelectMech[3]); this.refScene2DRoot.AddChild(this.spriteTextImage); // Create the VS image spriteObjVersus = this.spriteTextImage.AddSprite(0, "VS text"); // 1P image spriteObjSelectCursor[0] = this.spriteTextImage.AddSprite(1, "1P"); // 2P image spriteObjSelectCursor[1] = this.spriteTextImage.AddSprite(2, "2P"); // Calculate all image size OnSize(); // Play a open menu sound GameSound.Play(SoundTrack.MenuOpen); }
/// <summary> /// initializes this screen. /// </summary> public override void InitializeScreen() { // creates a 2D layer. FrameworkCore.RenderContext.CreateScene2DLayer(1); this.refScene2DRoot = FrameworkCore.Scene2DLayers[0]; this.refScene2DRoot.AddChild(this.spriteBG); this.refScene2DRoot.AddChild(this.spriteLoadingText); // loading image. { loadingSprite = this.spriteBG.AddSprite(0, "Loading screen"); // Matching logo image size with screen size. loadingSprite.ScreenSize = new Vector2(FrameworkCore.ViewWidth, FrameworkCore.ViewHeight); float aspect = (float)FrameworkCore.ViewWidth / (float)FrameworkCore.ViewHeight; if (1.6f > aspect) // no wide screen { int recalcWidth = (int)(aspect / 1.6f * this.spriteBG.TextureResource.Width); loadingSprite.SourceRectangle = new Rectangle( ((this.spriteBG.TextureResource.Width - recalcWidth) / 2) - 140, 0, recalcWidth, this.spriteBG.TextureResource.Height); } } // loading text. { spriteObjNowLoading = this.spriteLoadingText.AddSprite(0, "Loading text"); spriteObjNowLoading.SourceRectangle = new Rectangle(362, 64, 333, 57); spriteObjNowLoading.Visible = true; spriteObjPressToContinue = this.spriteLoadingText.AddSprite(1, "Press A to Continue"); spriteObjPressToContinue.SourceRectangle = new Rectangle(170, 139, 653, 76); spriteObjPressToContinue.Visible = false; } // Calculate all image size OnSize(); }
/// <summary> /// creates Hud images for versus game. /// </summary> public override void CreateHud() { ViewCamera viewCamera = FrameworkCore.CurrentCamera; int viewCount = viewCamera.Count; this.textKillScore = new GameText[viewCount]; this.textKillConditionScore = new GameText[viewCount]; Color scoreColor = new Color(136, 217, 224); // kill score and condition score for (int i = 0; i < viewCount; i++) { this.textKillScore[i] = new GameText( this.fontHud, "0", 0, 0, scoreColor); this.refSceneHudRoot.AddChild(this.textKillScore[i]); this.textKillConditionScore[i] = new GameText( this.fontHud, string.Format("/ {0}", RobotGameGame.VersusGameInfo.killPoint), 0, 0, scoreColor); this.refSceneHudRoot.AddChild(this.textKillConditionScore[i]); } this.spriteHudVersus = new GameSprite2D(); this.spriteHudVersus.Create(4, "Textures/VS_Text"); this.refSceneHudRoot.AddChild(this.spriteHudVersus); // 1P image this.spriteObjHudVersus1P = this.spriteHudVersus.AddSprite(0, "Versus 1P"); // 2P image this.spriteObjHudVersus2P = this.spriteHudVersus.AddSprite(1, "Versus 2P"); // You win this.spriteObjHudVersusWin = this.spriteHudVersus.AddSprite(2, "Versus Win"); this.spriteObjHudVersusWin.Visible = false; // You lose this.spriteObjHudVersusLose = this.spriteHudVersus.AddSprite(3, "Versus Lose"); this.spriteObjHudVersusLose.Visible = false; base.CreateHud(); }
/// <summary> /// always gets called when the menu gets updated. /// </summary> /// <param name="gameTime">game time</param> /// <param name="verticalEntryIndex"> /// a vertical index of focused entry /// </param> /// <param name="horizontalEntryIndex"> /// a horizontal index of focused entry /// </param> public override void OnUpdateEntry(GameTime gameTime, int[] verticalEntryIndex, int[] horizontalEntryIndex) { if (IsActive) { Sprite2DObject selectedButton = MenuEntries[verticalEntryIndex[0]]; // Clear alpha value of the all entry buttons spriteObjStartButton.Alpha = 85; spriteObjVersusButton.Alpha = 85; spriteObjExitButton.Alpha = 85; // set the selected alpha selectedButton.Alpha = 255; } }
/// <summary> /// Load your graphics content. /// </summary> protected override void LoadContent() { // Load content belonging to the screen manager. fadeSprite.Create(1, "blank"); fadeObject = fadeSprite.AddSprite(0, "Screen fade"); fadeObject.ScreenSize = new Vector2(FrameworkCore.ViewWidth, FrameworkCore.ViewHeight); fadeObject.Visible = false; // Tell each of the screens to load their content. foreach (GameScreen screen in screens) { screen.LoadContent(); } }
/// <summary> /// loads graphics contents. This uses the shared ContentManager /// provided by the ScreenManager, so the content will remain loaded forever. /// Whenever a subsequent MessageBoxScreen tries to load this same content, /// it will just get back another reference to the already loaded instance. /// </summary> public override void LoadContent() { spriteBox = new GameSprite2D(); spriteBox.Create(1, "Textures/Text_Window"); refScene2DTopRoot.AddChild(spriteBox); spriteObjBox = spriteBox.AddSprite(0, "MessageBox frame"); textMessageItem = new TextItem(messageFont, message, 0, 0, new Color(136, 217, 224)); FrameworkCore.TextManager.AddText(textMessageItem); textControlsItem = new TextItem(messageFont, controls, 0, 0, Color.White); FrameworkCore.TextManager.AddText(textControlsItem); // Resizing all images OnSize(); }
public void RemoveMenuEntry(Sprite2DObject item) { MenuEntries.Remove(item); }
public void AddMenuEntry(Sprite2DObject item) { MenuEntries.Add(item); }