private void Initialize() { FontMap map = FontManager.Instance.GetMap( FontManager.Instance.GetInGame("Bariol", 25, "Bold") ); FontMap bigMap = FontManager.Instance.GetMap( FontManager.Instance.GetInGame("Bariol", 44, "Bold") ); // CREATE PAUSE MENU pausePanel = new PausePanel(_scene); _scene.DialogLayer.AddChild(pausePanel); pausePanel.Hide(); // CREATE THE HUD BAR AT THE TOP OF THE SCREEN GameHudBar = new Node(){ Position = new Vector2(0.0f, 473.0f) }; this.AddChild(GameHudBar); HudBarMask = Support.UnicolorSprite("white", 255, 255, 255, 255); HudBarMask.Color = LevelManager.Instance.BackgroundColor; HudBarMask.Scale = new Vector2(60.0f, 4.4375f); GameHudBar.AddChild(HudBarMask); // CREATE THE LEVEL TITLE HUD levelTitle = new LevelTitleMkTwo() { SlideInDirection = SlideDirection.RIGHT, SlideOutDirection = SlideDirection.LEFT, Offset = new Vector2(0.0f, 0.0f), // Lifetime = 4.0f }; this.AddChild(levelTitle, -1); // CREATE THE END-OF-LEVEL DROP-DOWN PANEL if (GameScene.currentLevel == 999) { // INFINITE MODE VERSION _nextLevelPanel = new InfiniteModeEndPanel(){ Offset = new Vector2(Director.Instance.GL.Context.Screen.Width-248.0f, 0.0f), }; } else { // PUZZLE/TUTORIAL MODE VERSION _nextLevelPanel = new NextLevelPanel(){ Offset = new Vector2(510.0f, 0.0f), }; } GameHudBar.AddChild(_nextLevelPanel, -1); // CREATE MESSAGE PANEL _messagePanel = new MessagePanel(920.0f, 148.0f ){ SourceObject = this, Offset = new Vector2(20.0f, 0.0f), Position = new Vector2(0.0f, -148.0f), Lifetime = 0.0f }; this.AddChild(_messagePanel); _messagePanel.body = GamePhysics.Instance.RegisterPhysicsBody(GamePhysics.Instance.SceneShapes[4], float.MaxValue, 0.0f, _messagePanel.Position / GamePhysics.PtoM); _messagePanel.AdHocDraw += () => { _messagePanel.body.Position = _messagePanel.Position / GamePhysics.PtoM; }; // SCORE STUFF // ScoreIcon = Support.SpriteFromFile("/Application/assets/images/handIcon.png"); ScoreIcon = Support.SpriteFromAtlas("crystallonUI", "handIcon.png"); ScoreIcon.Position = new Vector2(184.0f, 16.0f); ScoreIcon.RegisterPalette(1); GameHudBar.AddChild(ScoreIcon); ScoreTitleText = new Label("score", map); ScoreTitleText.Position = new Vector2(287, 25.0f); ScoreTitleText.RegisterPalette(1); BlueBox = Support.UnicolorSprite("white", 255,255,255,255); BlueBox.Scale = new Vector2(6.25f, 4.4375f); BlueBox.Position = new Vector2(354.0f, 0.0f); BlueBox.RegisterPalette(2); ScoreText = new Label("", bigMap) { Position = SCORE_TEXT_POS }; ScoreText.RegisterPalette(1); GameHudBar.AddChild(ScoreText); // CUBE STUFF // CubeIcon = Support.SpriteFromFile("/Application/assets/images/stopIcon.png"); CubeIcon = Support.SpriteFromAtlas("crystallonUI", "stopIcon.png"); CubeIcon.Position = new Vector2(20.0f,16.0f); CubeIcon.RegisterPalette(2); GameHudBar.AddChild(CubeIcon); CubesTitleText = new Label("cubes", map); CubesTitleText.Position = new Vector2(63.0f, 25.0f); CubesTitleText.RegisterPalette(2); RedBox = Support.UnicolorSprite("white", 255,255,255,255); RedBox.Position = new Vector2(130.0f, 0.0f); RedBox.Scale = new Vector2(6.25f, 4.4375f); RedBox.RegisterPalette(1); CubeText = new Label("", bigMap){ Position = CUBES_TEXT_POS }; CubeText.RegisterPalette(2); GameHudBar.AddChild(CubeText); // TIMER & STRIKES STUFF GameTimer = new TimerEntity(); if (GameScene.currentLevel == 999) { // ------------------- IF CHALLENGE MODE if(GameScene.gameTimeLimit > 0.0f) { GameTimer.Position = new Vector2(348.0f, 16.0f); // ----- ADD THE TIME BAR GameHudBar.AddChild(GameTimer); } else { BonusBar = new BonusTimer() { // Position = new Vector2(348.0f, 44.0f) Position = new Vector2(348.0f, 16.0f) }; GameHudBar.AddChild(BonusBar); } Strikes = new StrikeHud() { Position = new Vector2(395.0f, 44.0f) }; GameHudBar.AddChild(Strikes); } // PAUSE BUTTON PauseButton = new BetterButton("/Application/assets/images/UI/BetterButtonTransparent.png", 115.0f, 71.0f) { Text = "", // Icon = Support.SpriteFromFile("Application/assets/images/UI/pause.png"), Icon = Support.SpriteFromAtlas("crystallonUI", "pause.png"), // Position = new Vector2(845.0f, 473.0f), Position = new Vector2(845.0f, 0.0f) }; // this.AddChild(PauseButton); GameHudBar.AddChild(PauseButton); PauseButton.background.RegisterPalette(2); PauseButton.background.Scale = new Vector2(115.0f/32.0f, 71.0f/16.0f); PauseButton.Icon.RegisterPalette(2); PauseButton.ButtonUpAction += HandlePauseButtonButtonUpAction; // HIT ME BUTTON HitMeButton = new BetterButton("/Application/assets/images/UI/BetterButtonTransparent.png", 115.0f, 71.0f) { Text = "", // Icon = Support.SpriteFromFile("Application/assets/images/UI/plus.png"), Icon = Support.SpriteFromAtlas("crystallonUI", "plus.png"), // Position = new Vector2(720.0f, 473.0f), Position = new Vector2(720.0f, 0.0f) }; HitMeButton.On(!LevelManager.Instance.HitMeDisabled); // this.AddChild(HitMeButton); GameHudBar.AddChild(HitMeButton); HitMeButton.background.RegisterPalette(1); HitMeButton.background.Scale = new Vector2(115.0f/32.0f, 71.0f/16.0f); HitMeButton.Icon.RegisterPalette(1); HitMeButton.ButtonUpAction += HandleHitMeButtonButtonUpAction; HudBarLine = Support.UnicolorSprite("white", 255, 255, 255, 255); HudBarLine.RegisterPalette(0); HudBarLine.Scale = new Vector2(60.0f, 0.125f); GameHudBar.AddChild(HudBarLine); _initialized = true; }
// METHODS ------------------------------------------------------------------------------------------------------------ protected void Initialize() { _initialized = true; FontMap map = Crystallography.UI.FontManager.Instance.GetMap( Crystallography.UI.FontManager.Instance.GetInGame("Bariol", 44, "Bold") ); Background = Support.UnicolorSprite("black", 0, 0, 0, 255); Background.Position = new Vector2(298.0f, 97.0f); Background.Scale = new Vector2(22.125f, 22.125f); PauseText = new Label("paused", map) { Position = new Vector2(415.0f, 342.0f), Color = LevelManager.Instance.BackgroundColor }; GiveUpButton = new BetterButton(354.0f, 61.0f) { Text = "quit", Position = Background.Position }; GiveUpButton.background.RegisterPalette(2); GiveUpButton.On(false); ResetButton = new BetterButton(354.0f, 61.0f) { Text = "restart", Position = new Vector2(GiveUpButton.Position.X, GiveUpButton.Position.Y + GiveUpButton.Height), }; ResetButton.background.RegisterPalette(1); ResetButton.On(false); ResumeButton = new BetterButton(354.0f, 61.0f) { Text = "resume", Position = new Vector2(ResetButton.Position.X, ResetButton.Position.Y + ResetButton.Height) }; ResumeButton.background.RegisterPalette(0); ResumeButton.On (false); this.AddChild(Background); this.AddChild(PauseText); this.AddChild(ResetButton); this.AddChild(ResumeButton); this.AddChild(GiveUpButton); #if DEBUG Console.WriteLine(GetType().ToString() + " created" ); #endif }