public override void OnExit() { _okButton.ButtonUpAction -= Handle_okButtonButtonUpAction; _okButton = null; circleOneImg = null; circleTwoImg = null; circleThreeImg = null; wildcardImg = null; cubeOneTop = null; cubeOneRight = null; cubeOneLeft = null; heartOne = null; heartTwo = null; heartThree = null; strikeFour = null; heartFive = null; heartSix = null; plus = null; arrow = null; cubeTwoTop = null; cubeTwoRight = null; cubeTwoLeft = null; instructionOneLabel = null; instructionTwoLabel = null; instructionThreeLabel = null; RemoveAllChildren(true); }
public override void OnExit() { ResumeButton.ButtonUpAction -= HandleResumeButtonButtonUpAction; GiveUpButton.ButtonUpAction -= HandleGiveUpButtonButtonUpAction; InputManager.Instance.StartJustUpDetected -= HandleInputManagerInstanceStartJustUpDetected; base.OnExit (); Background = null; PauseText = null; ResetButton = null; ResumeButton = null; GiveUpButton = null; RemoveAllChildren(true); InputManager.Instance.StartJustUpDetected -= HandleInputManagerInstanceStartJustUpDetected; }
public SplashScreen(MenuSystemScene pMenuSystem) { // stopwatch = Stopwatch.StartNew(); _timer = 0.0f; MenuSystem = pMenuSystem; loadProc = new List<Action>{ () => { ;//dummy }, () => { SplashImage = Support.SpriteFromFile("/Application/assets/images/UI/eyes.png"); this.AddChild(SplashImage); }, () => { var temp = Support.SpriteFromFile("/Application/assets/images/UI/header.png"); temp = Support.SpriteFromFile("/Application/assets/images/UI/menuBtnBG_blue2.png"); temp = Support.SpriteFromFile("/Application/assets/images/UI/menuBtnBG_red2.png"); temp = Support.SpriteFromFile("/Application/assets/images/UI/menuBtnBG_bottom.png"); temp = Support.SpriteFromFile("/Application/assets/images/UI/menuBtnBG_top.png"); var b = new BetterButton(); b.Cleanup(); Support.LoadAtlas("crystallonUI", ".png"); Support.LoadAtlas("gamePieces", ".png"); }, () => { Scheduler.Instance.Schedule( this, (dt) => { _timer += dt; if (_timer > 3.0f) { MenuSystem.SetScreen("Title"); this.UnscheduleAll(); } }, 0.0f, false, 0); } }; this.ScheduleUpdate(0); }
public override void OnExit() { ColorIcon.Destroy(); BackButton.UnregisterPalette(); PlayButton.UnregisterPalette(); LevelSelectItem.LevelSelectionDetected -= HandleLevelSelectItemLevelSelectionDetected; BackButton.ButtonUpAction -= HandleBackButtonButtonUpAction; PlayButton.ButtonUpAction -= HandlePlayButtonButtonUpAction; this.SwipePanels.OnSwipeComplete -= HandleSwipePanelshandleOnSwipeComplete; base.OnExit (); MenuSystem = null; Panels.Clear(); this.SwipePanels = null; LevelSelectTitleText = null; LevelSelectInstructionsText = null; BlackBlock1 = null; BlackBlock2 = null; BackButton = null; PlayButton = null; for (int i=0; i < Icons.Length; i++){ Icons[i] = null; } Icons = null; // Solutions.Clear(); Solutions = null; }
// CONSTRUCTOR ---------------------------------------------------------------------------------------------------------------------- public LevelSelectScreen(MenuSystemScene pMenuSystem) { SelectedLevel = 0; var init = ColorIcon.Instance; MenuSystem = pMenuSystem; var pages = FMath.Ceiling((GameScene.TOTAL_LEVELS-1) / (float)LevelPage.ITEMS_PER_PAGE); Panels = new List<Node>{}; for (int i=0; i < pages; i++) { Panels.Add( new LevelPage(i) ); (Panels[i] as LevelPage).Disable(); } (Panels[0] as LevelPage).Enable(); this.SwipePanels = new SwipePanels(Panels) { Width = 457.0f, Position = new Vector2(95.0f,46.0f) }; Indicator = new LevelSelectIndicator(); // BLACK MASKS TO HIDE MORE LEVELS BEHIND BlackBlock1 = Support.UnicolorSprite("white", 255,255,255,255); BlackBlock1.Color = Support.ExtractColor("333330"); BlackBlock1.Scale = new Vector2(361.0f/16.0f, Director.Instance.GL.Context.Screen.Height/16.0f); BlackBlock1.Position = new Vector2(Director.Instance.GL.Context.Screen.Width-361.0f, 0.0f); BlackBlock2 = Support.UnicolorSprite("white", 255,255,255,255); BlackBlock2.Color = LevelManager.Instance.BackgroundColor; BlackBlock2.Position = Vector2.Zero; BlackBlock2.Scale = new Vector2(50.0f/16.0f, Director.Instance.GL.Context.Screen.Height/16.0f); BlackBlock3 = Support.UnicolorSprite("white", 255,255,255,255); BlackBlock3.Color = Support.ExtractColor("333330"); BlackBlock3.Scale = new Vector2(361.0f/16.0f, 115.0f/16.0f); BlackBlock3.Position = new Vector2(Director.Instance.GL.Context.Screen.Width-361.0f, Director.Instance.GL.Context.Screen.Height - 115.0f); BlackBlock4 = Support.UnicolorSprite("white", 255,255,255,255); BlackBlock4.Color = Support.ExtractColor("333330"); BlackBlock4.Scale = new Vector2(361.0f/16.0f, 253.0f/16.0f); BlackBlock4.Position = new Vector2(Director.Instance.GL.Context.Screen.Width-361.0f, 0.0f); LevelNumberText = new Label(){ Text = SelectedLevel.ToString(), Position = new Vector2(Director.Instance.GL.Context.Screen.Width-339.0f, Director.Instance.GL.Context.Screen.Height-78.0f), FontMap = UI.FontManager.Instance.GetMap(Crystallography.UI.FontManager.Instance.GetInGame("Bariol", 64, "Bold") ), Color = LevelManager.Instance.BackgroundColor }; // CenterText(LevelNumberText); // SolutionPanel = new HudPanel(){ // }; PossibleSolutionsText = new Label(){ Text = "possible solutions", Position = new Vector2(Director.Instance.GL.Context.Screen.Width - 339.0f, Director.Instance.GL.Context.Screen.Height-100.0f), FontMap = UI.FontManager.Instance.GetMap(Crystallography.UI.FontManager.Instance.GetInGame("Bariol", 25, "Bold") ), Color = LevelManager.Instance.BackgroundColor }; Solutions = new SolutionSlider(); // Solutions = new List<SolutionIcon>(); //{ // new SolutionIcon(){ // CubeText = "99", // ScoreText = "88" // }, // new SolutionIcon(){ // CubeText = "99", // ScoreText = "88" // }, // new SolutionIcon(){ // CubeText = "99", // ScoreText = "88" // }, // new SolutionIcon(){ // CubeText = "99", // ScoreText = "88" // }, // new SolutionIcon(){ // CubeText = "99", // ScoreText = "88" // } // }; // for( int i=0; i < Solutions.Count; i++) { // Solutions[i].Visible = false; // var column = i % 4; // var row = ( i - column ) / 4; // Solutions[i].Position = new Vector2(Director.Instance.GL.Context.Screen.Width - 339.0f + 60.0f * column, // Director.Instance.GL.Context.Screen.Height - 200.0f - row * 80.0f); // this.AddChild(Solutions[i]); // } QualitiesText = new Label() { Text = "qualities", Position = new Vector2(623.0f, 223.0f), FontMap = UI.FontManager.Instance.GetMap(Crystallography.UI.FontManager.Instance.GetInGame("Bariol", 25, "Bold") ), Color = LevelManager.Instance.BackgroundColor }; // CompletionPercentageText = new Label() { // Text = (1.0f).ToString("P0"), // Position = new Vector2(638.0f, 150.0f), // FontMap = UI.FontManager.Instance.GetMap(Crystallography.UI.FontManager.Instance.GetInGame("Bariol", 25, "Bold") ), //// Color = new Vector4( 0.16078431f, 0.88627451f, 0.88627451f, 1.0f) // }; // CenterText(CompletionPercentageText); // this.AddChild(CompletionPercentageText); Icons = new Node[4]; IconLabels = new Label[4]; for( int i=0; i < Icons.Length; i++) { Icons[i] = Support.TiledSpriteFromFile("/Application/assets/images/icons/icons.png", 4, 2); Icons[i].Position = new Vector2(623.0f + 68.0f * (float)i, 2.0f * BUTTON_HEIGHT + 20.0f); // Icons[i].Scale = new Vector2(0.25f, 0.25f); IconLabels[i] = new Label() { FontMap = UI.FontManager.Instance.GetMap(Crystallography.UI.FontManager.Instance.GetInGame("Bariol", 36, "Bold") ), Color = LevelManager.Instance.BackgroundColor }; } LevelSelectTitleText = new Label(){ Text="level select", Position = new Vector2(50.0f, 488.0f), FontMap = UI.FontManager.Instance.GetMap(Crystallography.UI.FontManager.Instance.GetInGame("Bariol", 36, "Regular") ), Color = Support.ExtractColor("333330") }; LevelSelectInstructionsText = new Label(){ Text="select a cube and then press play.", Position = new Vector2(50.0f, 465.0f), FontMap = UI.FontManager.Instance.GetMap(Crystallography.UI.FontManager.Instance.GetInGame("Bariol", 25, "Regular") ), Color = Support.ExtractColor("333330") }; BackButton = new BetterButton(361.0f, BUTTON_HEIGHT) { Text = "back", Position = new Vector2(Director.Instance.GL.Context.Screen.Width-361.0f, BUTTON_HEIGHT) }; BackButton.background.RegisterPalette(2); PlayButton = new BetterButton(361.0f, BUTTON_HEIGHT) { Text = "play", Position = new Vector2(Director.Instance.GL.Context.Screen.Width-361.0f, 0.0f) }; PlayButton.background.RegisterPalette(1); // SWIPE LAYER this.AddChild(this.SwipePanels); foreach( LevelPage panel in Panels) { this.AddChild(panel); } (Panels[0] as LevelPage).Items[0].AddChild(Indicator); // UI LAYERS BackLayer = new Layer(); this.AddChild(BackLayer); FrontLayer = new Layer(); this.AddChild(FrontLayer); // BACK LAYER ELEMENTS BackLayer.AddChild(BlackBlock1); BackLayer.AddChild(BlackBlock2); BackLayer.AddChild(Solutions); // FRONT LAYER ELEMENTS FrontLayer.AddChild(BlackBlock3); FrontLayer.AddChild(BlackBlock4); FrontLayer.AddChild(LevelNumberText); FrontLayer.AddChild(PossibleSolutionsText); FrontLayer.AddChild(QualitiesText); for( int i=0; i < Icons.Length; i++) { FrontLayer.AddChild(Icons[i]); } FrontLayer.AddChild(LevelSelectTitleText); FrontLayer.AddChild(LevelSelectInstructionsText); FrontLayer.AddChild(BackButton); FrontLayer.AddChild(PlayButton); }
protected void Initialize(float pWidth, float pHeight) { DismissDelay = 0.0f; // dismiss only with ok button! Height = pHeight; Width = pWidth; var xScale = pWidth/16.0f; var yScale = pHeight/16.0f; SlideInDirection = SlideDirection.RIGHT; SlideOutDirection = SlideDirection.LEFT; Background = Support.UnicolorSprite("bg", (byte)(LevelManager.Instance.BackgroundColor.R * 255.0f), (byte)(LevelManager.Instance.BackgroundColor.G * 255.0f), (byte)(LevelManager.Instance.BackgroundColor.B * 255.0f), 255); Background.Scale = new Vector2(xScale, yScale); this.AddChild(Background); _okButton = new BetterButton(256.0f, 64.0f) { Text = "okay", Position = Vector2.Zero }; _okButton.background.RegisterPalette(2); // this.AddChild(_okButton); // BIG CIRCLE BULLET POINT ICONS circleOneImg = Support.SpriteFromAtlas("crystallonUI", "1.png"); circleOneImg.Position = new Vector2(CIRCLE_ONE_X, CIRCLE_ONE_Y); circleTwoImg = Support.SpriteFromAtlas("crystallonUI", "2.png"); circleTwoImg.Position = new Vector2(CIRCLE_ONE_X, CIRCLE_ONE_Y - CIRCLE_DELTA_Y); circleThreeImg = Support.SpriteFromAtlas("crystallonUI", "3.png"); circleThreeImg.Position = new Vector2(CIRCLE_ONE_X, CIRCLE_ONE_Y - 2.0f * CIRCLE_DELTA_Y); // DIAGRAMS //--------- ORIENTATION DOESN'T MATTER cubeOneTop = Support.SpriteFromAtlas("gamePieces", "set1_v0_T.png"); cubeOneTop.RegisterPalette(0); cubeOneTop.Position = new Vector2(344.0f, (float)(544-81)); cubeOneTop.Scale = new Vector2(0.66f, 0.66f); cubeOneRight = Support.SpriteFromAtlas("gamePieces", "set1_v0_R.png"); cubeOneRight.RegisterPalette(1); cubeOneRight.Position = new Vector2(386.0f, (float)(544-130)); cubeOneRight.Scale = new Vector2(0.66f, 0.66f); cubeOneLeft = Support.SpriteFromAtlas("gamePieces", "set1_v0_T.png"); cubeOneLeft.RegisterPalette(2); cubeOneLeft.Position = new Vector2(247.0f, (float)(544-114)); cubeOneLeft.Scale = new Vector2(0.66f, 0.66f); //--------- WILDCARD wildcardImg = Support.SpriteFromAtlas("gamePieces", "set1_v0_T.png"); wildcardImg.RegisterPalette(0); wildcardImg.Scale = new Vector2(0.66f, 0.66f); wildcardImg.Position = new Vector2(247.0f, (float)(544-240)); Sequence sequence = new Sequence(); sequence.Add( new CallFunc( () => { wildcardImg.ShiftSpriteColor(QColor.palette[1], 0.08f); }) ); sequence.Add( new DelayTime(0.08f) ); sequence.Add( new CallFunc( () => { wildcardImg.ShiftSpriteColor(QColor.palette[2], 0.08f); }) ); sequence.Add( new DelayTime(0.08f) ); sequence.Add( new CallFunc( () => { wildcardImg.ShiftSpriteColor(QColor.palette[0], 0.08f); }) ); sequence.Add( new DelayTime(0.08f) ); wildcardImg.RunAction( new RepeatForever() { InnerAction=sequence, Tag = 40 } ); //---------- STRIKES heartOne = Support.SpriteFromAtlas("crystallonUI", "heart.png"); heartOne.RegisterPalette(1); heartOne.Position = new Vector2(247.0f, (float)(544-380)); heartTwo = Support.SpriteFromAtlas("crystallonUI", "heart.png"); heartTwo.RegisterPalette(1); heartTwo.Position = new Vector2(304.0f, (float)(544-380)); heartThree = Support.SpriteFromAtlas("crystallonUI", "heart.png"); heartThree.RegisterPalette(1); heartThree.Position = new Vector2(362.0f, (float)(544-380)); strikeFour = Support.SpriteFromAtlas("crystallonUI", "strike.png"); strikeFour.RegisterPalette(2); strikeFour.Position = new Vector2(666.0f, (float)(544-379)); heartFive = Support.SpriteFromAtlas("crystallonUI", "heart.png"); heartFive.RegisterPalette(1); heartFive.Position = new Vector2(716.0f, (float)(544-380)); heartSix = Support.SpriteFromAtlas("crystallonUI", "heart.png"); heartSix.RegisterPalette(1); heartSix.Position = new Vector2(774.0f, (float)(544-380)); cubeTwoTop = Support.SpriteFromAtlas("gamePieces", "set1_v0_T.png"); cubeTwoTop.RegisterPalette(2); cubeTwoTop.Position = new Vector2(491.0f, (float)(544-360)); cubeTwoTop.Scale = new Vector2(0.66f, 0.66f); cubeTwoRight = Support.SpriteFromAtlas("gamePieces", "set1_v0_R.png"); cubeTwoRight.RegisterPalette(1); cubeTwoRight.Position = new Vector2(533.0f, (float)(544-409)); cubeTwoRight.Scale = new Vector2(0.66f, 0.66f); cubeTwoLeft = Support.SpriteFromAtlas("gamePieces", "set1_v0_L.png"); cubeTwoLeft.RegisterPalette(1); cubeTwoLeft.Position = new Vector2(491.0f, (float)(544-409)); cubeTwoLeft.Scale = new Vector2(0.66f, 0.66f); plus = Support.SpriteFromAtlas("crystallonUI", "plus.png"); plus.Color = Colors.Black; plus.Scale = new Vector2(0.66f, 0.66f); plus.Position = new Vector2(432.0f, (float)(544-372)); arrow = Support.SpriteFromAtlas("crystallonUI", "arrow.png"); arrow.Color = Colors.Black; arrow.Scale = new Vector2(0.5f, 0.5f); arrow.Position = new Vector2(607.0f, (float)(544-372)); // equationLabel = new Label() { // Text = "+ =", // Color = Colors.Black, // FontMap = FontManager.Instance.GetMap( FontManager.Instance.GetInGame("Bariol", 25, "Bold") ), // Position = new Vector2(432.0f, (float)(544-372)) // }; // TEXT LABELS instructionOneLabel = new Label() { Text = INSTRUCTION_ONE_TEXT, Color = Colors.Black, FontMap = FontManager.Instance.GetMap( FontManager.Instance.GetInGame("Bariol", 25, "Bold") ), Position = new Vector2(453.0f, 466.0f) }; instructionTwoLabel = new Label() { Text = INSTRUCTION_TWO_TEXT, Color = Colors.Black, FontMap = FontManager.Instance.GetMap( FontManager.Instance.GetInGame("Bariol", 25, "Bold") ), Position = new Vector2(358.0f, 315.0f) }; instructionThreeLabel = new Label() { Text = INSTRUCTION_THREE_TEXT, Color = Colors.Black, FontMap = FontManager.Instance.GetMap( FontManager.Instance.GetInGame("Bariol", 25, "Bold") ), Position = new Vector2(249.0f, 98.0f) }; this.AddChild(_okButton); this.AddChild(circleOneImg); this.AddChild(circleTwoImg); this.AddChild(circleThreeImg); this.AddChild(cubeOneTop); this.AddChild(cubeOneRight); this.AddChild(cubeOneLeft); this.AddChild(wildcardImg); this.AddChild(heartOne); this.AddChild(heartTwo); this.AddChild(heartThree); this.AddChild(strikeFour); this.AddChild(heartFive); this.AddChild(heartSix); this.AddChild(cubeTwoTop); this.AddChild(cubeTwoRight); this.AddChild(cubeTwoLeft); // this.AddChild(equationLabel); this.AddChild(plus); this.AddChild(arrow); this.AddChild(instructionOneLabel); this.AddChild(instructionTwoLabel); this.AddChild(instructionThreeLabel); }
// 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 }
public override void OnExit() { base.OnExit (); NewGameButton.ButtonUpAction -= HandleNewGameButtonButtonUpAction; LevelSelectButton.ButtonUpAction -= HandleLevelSelectButtonButtonUpAction; CreditsButton.ButtonUpAction -= HandleCreditsButtonButtonUpAction; InstructionsButton.ButtonUpAction -= HandleInstructionsButtonButtonUpAction; #if METRICS PrintAnalyticsButton.ButtonUpAction -= HandlePrintAnalyticsButtonButtonUpAction; ClearAnalyticsButton.ButtonUpAction -= HandleClearAnalyticsButtonButtonUpAction; #endif this.RemoveAllChildren(true); MenuSystem = null; MenuBGBottom = null; MenuBGSpacer1 = null; MenuBGSpacer2 = null; MenuBGSpacer3 = null; MenuBGTop = null; MaskBGBottom = null; MaskBGButton1 = null; MaskBGButton2 = null; MaskBGButton3 = null; MaskBGButton4 = null; MaskBGSpacer1 = null; MaskBGSpacer2 = null; MaskBGSpacer3 = null; MaskBGTop = null; NewGameButton = null; LevelSelectButton = null; CreditsButton = null; InstructionsButton = null; RemoveAllAssets(); }
public override void OnExit() { OKButton.UnregisterPalette(); ClearButton.UnregisterPalette(); ClearOKButton.UnregisterPalette(); CancelButton.UnregisterPalette(); OKButton.ButtonUpAction -= HandleOKButtonButtonUpAction; ClearButton.ButtonUpAction -= HandleClearButtonButtonUpAction; ClearPanel.OnSlideInStart -= HandleClearPanelOnSlideInStart;; ClearPanel.OnSlideInComplete -= HandleClearPanelOnSlideInComplete; ClearPanel.OnSlideOutStart -= HandleClearPanelOnSlideOutStart; ClearPanel.OnSlideOutComplete -= HandleClearPanelOnSlideOutComplete; ClearOKButton.ButtonUpAction -= HandleClearOKButtonButtonUpAction; CancelButton.ButtonUpAction -= HandleCancelButtonButtonUpAction; base.OnExit (); stickySlider = null; orbitSlider = null; effectsSlider = null; musicSlider = null; OKButton = null; MenuSystem = null; }
// CONSTRUCTOR -------------------------------------------------------------------------------------------------------------------------------------- public InfiniteModeEndPanel() { DismissDelay = 0.0f; Width = 248.0f; Background = Support.UnicolorSprite("white", 255, 255, 255, 255); Background.Scale = new Vector2(Width/16.0f, 128.0f/16.0f); Background.RegisterPalette(0); this.AddChild(Background); // PossibleSolutionsText = new Label() { // Text = "all possible solutions:", // FontMap = Crystallography.UI.FontManager.Instance.GetMap( Crystallography.UI.FontManager.Instance.GetInGame("Bariol", 25, "Bold" ) ), // Position = new Vector2(40.0f, 180.0f) // }; // PossibleSolutionsText.RegisterPalette(0); // this.AddChild( PossibleSolutionsText ); // MessageText = new Label() { // Text = "you clever thing.", // FontMap = Crystallography.UI.FontManager.Instance.GetMap( Crystallography.UI.FontManager.Instance.GetInGame("Bariol", 32, "Bold" ) ), // }; // MessageText.RegisterPalette(0); // this.AddChild( MessageText ); ReplayButton = new BetterButton(94.0f + 30.0f, Background.CalcSizeInPixels().Y * Background.Scale.Y) { Text = "replay", TextFont = FontManager.Instance.GetInGame("Bariol", 25), Icon = Support.SpriteFromFile("/Application/assets/images/UI/replay.png"), IconAndTextOffset = new Vector2(32.0f, 10.0f), TextOffset = new Vector2(-45.0f, -45.0f), Position = new Vector2(Width - 124.0f, 0.0f), // Color = new Vector4(0.1608f, 0.8863f, 0.8863f, 1.0f) }; ReplayButton.background.RegisterPalette(0); ReplayButton.Icon.Color = LevelManager.Instance.BackgroundColor; ReplayButton.TextColor = LevelManager.Instance.BackgroundColor; this.AddChild(ReplayButton); QuitButton = new BetterButton(94.0f + 30.0f, Background.CalcSizeInPixels().Y * Background.Scale.Y) { Text = "menu", TextFont = FontManager.Instance.GetInGame("Bariol", 25), Icon = Support.SpriteFromFile("/Application/assets/images/UI/arrow.png"), IconAndTextOffset = new Vector2(32.0f, 80.0f), TextOffset = new Vector2(-38.0f, -45.0f), Position = new Vector2(Width - ReplayButton.Width - 124.0f, 0.0f), // Color = new Vector4(0.1608f, 0.8863f, 0.8863f, 1.0f) }; QuitButton.background.RegisterPalette(0); QuitButton.Icon.Color = LevelManager.Instance.BackgroundColor; QuitButton.Icon.Rotation = new Vector2(0.0f, -1.0f); QuitButton.TextColor = LevelManager.Instance.BackgroundColor; this.AddChild(QuitButton); Height = QuitButton.Height; // var charHeight = MessageText.FontMap.CharPixelHeight; // Height = (charHeight * 5.0f) + QuitButton.Height; // MessageText.Position = new Vector2(40.0f, QuitButton.Height + 20 ); // CenterText(); #if DEBUG Console.WriteLine(GetType().ToString() + " created" ); #endif }
public override void OnExit() { ReplayButton.ButtonUpAction -= HandleReplayButtonButtonUpAction; QuitButton.ButtonUpAction -= HandleQuitButtonButtonUpAction; OnSlideInComplete -= HandleOnSlideInComplete; OnSlideOutComplete -= HandleOnSlideOutComplete; OnSlideOutStart -= HandleOnSlideOutStart; OnSlideInStart -= HandleOnSlideInStart; Background = null; MessageText = null; PossibleSolutionsText = null; QuitButton = null; ReplayButton = null; CleanUpSolutions(); base.OnExit (); RemoveAllChildren(true); }
// protected SpriteTile _cubeIcon; // protected SpriteTile _scoreIcon; // protected SpriteTile _timeIcon; // CONSTRUCTOR ------------------------------------------ public InfiniteModeScreen(MenuSystemScene pMenuSystem) { MenuSystem = pMenuSystem; var map = Crystallography.UI.FontManager.Instance.GetMap( Crystallography.UI.FontManager.Instance.GetInGame("Bariol", 25, "Bold") ); _bestCubes = _bestPoints = 0; _bestTime = 0.0f; _timeLimitText = new Label() { FontMap = map, Color = Colors.Black }; // _timeLimitText.RegisterPalette(0); this.AddChild(_timeLimitText); timeLimitSlider = new Slider(540) { Text = "time limit", Position = new Vector2(33.0f, 440.0f), max = 60.0f, min = 5.0f, discreteOptions = new List<float>() { 5.0f, 10.0f, 20.0f, 35.0f, 60.0f }, OnChange = (unused) => { if ( timeLimitSlider.Value != timeLimitSlider.max ) { _timeLimitText.Text = timeLimitSlider.Value.ToString() + " minutes"; _bestTitleText.Text = _timeLimitText.Text; if(_highScoreEntries != null) { // _highScoreEntries[0].ShowBestTime(false); _highScoreEntries[0].BestCubes = DataStorage.timedCubes[timeLimitSlider.SelectedOption,0,0]; _highScoreEntries[0].BestPoints = DataStorage.timedScores[timeLimitSlider.SelectedOption,0,1]; } } else { _timeLimitText.Text = "infinite"; if(_highScoreEntries != null) { // _highScoreEntries[0].ShowBestTime(true); _highScoreEntries[0].BestCubes = DataStorage.infiniteCubes[0,0]; _highScoreEntries[0].BestPoints = DataStorage.infiniteScores[0,1]; // _highScoreEntries[0].BestTime = DataStorage.infiniteTimes[0,2]; } } } }; timeLimitSlider.AddTickmarks(); timeLimitSlider.RegisterPalette(2); timeLimitSlider.SetSliderValue( (float)DataStorage.options[4] ); this.AddChild(timeLimitSlider); // _timeLimitText.Position = new Vector2(timeLimitSlider.Position.X + timeLimitSlider.Length + 20.0f, timeLimitSlider.Position.Y); _timeLimitText.Position = new Vector2(timeLimitSlider.Position.X + 4.0f, timeLimitSlider.Position.Y - 41.0f); // _fourthQualityText = new Label() { // FontMap = map // }; // _fourthQualityText.RegisterPalette(1); // this.AddChild(_fourthQualityText); // fourthQualitySlider = new Slider() { // Text = "fourth quality", // Position = new Vector2(timeLimitSlider.Position.X, timeLimitSlider.Position.Y - 100.0f), // max = 2.0f, // min = 0.0f, // discreteOptions = new List<float>() { 0.0f, 1.0f, 2.0f }, // OnChange = (unused) => { // switch(fourthQualitySlider.Value.ToString("#0.#")) { // case("0"): // _fourthQualityText.Text = "none"; // break; // case("1"): // _fourthQualityText.Text = "particles"; // break; // case("2"): // _fourthQualityText.Text = "sound"; // break; // } // } // }; // fourthQualitySlider.AddTickmarks(); // fourthQualitySlider.RegisterPalette(1); // fourthQualitySlider.SetSliderValue( 1.0f ); //// this.AddChild(fourthQualitySlider); // // _fourthQualityText.Position = new Vector2(fourthQualitySlider.Position.X + fourthQualitySlider.Length + 20.0f, fourthQualitySlider.Position.Y); // _fourthQualityTitle = new Label() { Text = "bonus quality", FontMap = Crystallography.UI.FontManager.Instance.GetMap( Crystallography.UI.FontManager.Instance.GetInGame("Bariol", 32, "Bold") ), Position = new Vector2(33.0f, 326.0f), Color = Colors.Black }; this.AddChild(_fourthQualityTitle); _buttonHighlight = Support.UnicolorSprite("Black", 0,0,0,255); _buttonHighlight.Scale = new Vector2(10.8125f, 12.125f); this.AddChild(_buttonHighlight); _soundButton = new BetterButton(173.0f, 176.0f) { Text = "sound", TextFont = FontManager.Instance.GetInGame("Bariol", 25, "Bold"), Icon = Support.TiledSpriteFromFile("/Application/assets/images/icons/icons.png", 4, 2), IconAndTextOffset = new Vector2(31.0f, 17.0f), TextOffset = new Vector2(-58.0f, -50.0f), Position = new Vector2(33.0f, 109.0f) }; _soundButton.Icon.TileIndex1D = 4; _soundButton.background.RegisterPalette(0); _soundButton.Icon.Color = LevelManager.Instance.BackgroundColor; this.AddChild(_soundButton); _particleButton = new BetterButton(173.0f, 176.0f) { Text = "particles", TextFont = FontManager.Instance.GetInGame("Bariol", 25, "Bold"), Icon = Support.TiledSpriteFromFile("/Application/assets/images/icons/icons.png", 4, 2), IconAndTextOffset = new Vector2(31.0f, 17.0f), TextOffset = new Vector2(-58.0f, -50.0f), Position = new Vector2(216.0f, 109.0f) }; _particleButton.Icon.TileIndex1D = 2; _particleButton.background.RegisterPalette(1); _particleButton.Icon.Color = LevelManager.Instance.BackgroundColor; this.AddChild(_particleButton); _noneButton = new BetterButton(173.0f, 176.0f) { Text = "none", TextFont = FontManager.Instance.GetInGame("Bariol", 25, "Bold"), Icon = Support.TiledSpriteFromFile("/Application/assets/images/icons/icons.png", 4, 2), IconAndTextOffset = new Vector2(31.0f, 17.0f), TextOffset = new Vector2(-64.0f, -50.0f), Position = new Vector2(399.0f, 109.0f) }; _noneButton.Icon.TileIndex1D = 6; _noneButton.background.RegisterPalette(2); this.AddChild(_noneButton); _instructionsButton = new BetterButton(362.0f, 62.0f) { Text = "instructions", Position = Vector2.Zero }; _instructionsButton.background.RegisterPalette(2); this.AddChild(_instructionsButton); _bestBG = Support.UnicolorSprite("black", 0,0,0,255); _bestBG.Position = new Vector2(598.0f, 0.0f); _bestBG.Scale = new Vector2(22.625f, 34.0f); this.AddChild(_bestBG); _bestTitleText = new Label() { Text = _timeLimitText.Text, FontMap = Crystallography.UI.FontManager.Instance.GetMap( Crystallography.UI.FontManager.Instance.GetInGame("Bariol", 32, "Bold") ), Position = new Vector2(_bestBG.Position.X + 41.0f, 465.0f) }; // _bestTitleText.RegisterPalette(2); _bestTitleText.Color = LevelManager.Instance.BackgroundColor; this.AddChild(_bestTitleText); _highScoreEntries = new HighScoreEntry[3]; _highScoreEntries[0] = new HighScoreEntry() { BestCubes = DataStorage.infiniteCubes[0,0], BestPoints = DataStorage.infiniteCubes[0,1], // BestTime = (float)DataStorage.infiniteCubes[0,2], Position = new Vector2(_bestTitleText.Position.X, _bestTitleText.Position.Y - 316.0f) }; // _highScoreEntries[1] = new HighScoreEntry() { // BestCubes = DataStorage.infiniteScores[0,0], // BestPoints = DataStorage.infiniteScores[0,1], // BestTime = (float)DataStorage.infiniteScores[0,2], // Position = new Vector2(_bestTitleText.Position.X, _bestTitleText.Position.Y - 120) // }; // _highScoreEntries[2] = new HighScoreEntry() { // BestCubes = DataStorage.infiniteTimes[0,0], // BestPoints = DataStorage.infiniteTimes[0,1], // BestTime = (float)DataStorage.infiniteTimes[0,2], // Position = new Vector2(_bestTitleText.Position.X, _bestTitleText.Position.Y - 180) // }; // for(int i=0; i<3; i++){ // this.AddChild(_highScoreEntries[i]); // } this.AddChild(_highScoreEntries[0]); cancelButton = new BetterButton(362.0f, 62.0f) { Text = "main menu", Position = new Vector2(598.0f, 62.0f) }; cancelButton.background.RegisterPalette(1); this.AddChild(cancelButton); playButton = new BetterButton(362.0f, 62.0f) { Text = "play", Position = new Vector2(598.0f, 0.0f) }; playButton.background.RegisterPalette(0); this.AddChild(playButton); _instructionsPanel = new ChallengeModeInstructionsPanel(); this.AddChild(_instructionsPanel); }
// CONSTRUCTOR -------------------------------------------------------------------------------------------------------------------------------------- public NextLevelPanel() { DismissDelay = 0.0f; Width = 458.0f; Background = Support.UnicolorSprite("white", 255, 255, 255, 255); Background.Scale = new Vector2(448.0f/16.0f, 128.0f/16.0f); Background.RegisterPalette(0); this.AddChild(Background); // MessageText = new Label() { // Text = "you clever thing.", // FontMap = Crystallography.UI.FontManager.Instance.GetMap( Crystallography.UI.FontManager.Instance.GetInGame("Bariol", 32, "Bold" ) ), // }; // MessageText.RegisterPalette(0); // this.AddChild( MessageText ); NextLevelButton = new BetterButton(78.0f + 30.0f, Background.CalcSizeInPixels().Y * Background.Scale.Y) { Text = "next", TextFont = FontManager.Instance.GetInGame("Bariol", 25), // IconOnLeft = false, // Icon = Support.SpriteFromFile("/Application/assets/images/UI/arrow.png"), Icon = Support.SpriteFromAtlas("crystallonUI", "arrow.png"), IconAndTextOffset = new Vector2(22.0f, 10.0f), TextOffset = new Vector2(-40.0f, -45.0f), Position = new Vector2(Width - 108.0f, 0.0f), // Color = new Vector4(0.8980f, 0.0745f, 0.0745f, 1.0f) }; NextLevelButton.background.RegisterPalette(0); NextLevelButton.Icon.Color = LevelManager.Instance.BackgroundColor; NextLevelButton.TextColor = LevelManager.Instance.BackgroundColor; // NextLevelButton.Icon.RegisterPalette(1); // NextLevelButton.ButtonLabel.RegisterPalette(1); this.AddChild(NextLevelButton); LevelSelectButton = new BetterButton(80.0f + 30.0f, Background.CalcSizeInPixels().Y * Background.Scale.Y) { Text = "select", Icon = Support.SpriteFromFile("/Application/assets/images/UI/levels.png"), IconAndTextOffset = new Vector2(55.0f, 40.0f), TextOffset = new Vector2(-65.0f, -45.0f), // Icon = Support.SpriteFromAtlas("crystallonUI", "levels.png"), // IconAndTextOffset = new Vector2(30.0f, 10.0f), // TextOffset = new Vector2(-35.0f, -45.0f), TextFont = FontManager.Instance.GetInGame("Bariol", 25), Position = new Vector2(Width - NextLevelButton.Width - 110.0f, 0.0f), }; LevelSelectButton.background.RegisterPalette(0); LevelSelectButton.Icon.Color = LevelManager.Instance.BackgroundColor; LevelSelectButton.TextColor = LevelManager.Instance.BackgroundColor; this.AddChild(LevelSelectButton); ReplayButton = new BetterButton(94.0f + 30.0f, Background.CalcSizeInPixels().Y * Background.Scale.Y) { Text = "replay", TextFont = FontManager.Instance.GetInGame("Bariol", 25), // Icon = Support.SpriteFromFile("/Application/assets/images/UI/replay.png"), Icon = Support.SpriteFromAtlas("crystallonUI", "replay.png"), IconAndTextOffset = new Vector2(32.0f, 10.0f), TextOffset = new Vector2(-45.0f, -45.0f), Position = new Vector2(Width - NextLevelButton.Width - LevelSelectButton.Width - 124.0f, 0.0f), // Color = new Vector4(0.1608f, 0.8863f, 0.8863f, 1.0f) }; ReplayButton.background.RegisterPalette(0); ReplayButton.Icon.Color = LevelManager.Instance.BackgroundColor; ReplayButton.TextColor = LevelManager.Instance.BackgroundColor; // this.AddChild(ReplayButton); QuitButton = new BetterButton(94.0f + 30.0f, Background.CalcSizeInPixels().Y * Background.Scale.Y) { Text = "menu", TextFont = FontManager.Instance.GetInGame("Bariol", 25), // Icon = Support.SpriteFromFile("/Application/assets/images/UI/arrow.png"), Icon = Support.SpriteFromAtlas("crystallonUI", "arrow.png"), IconAndTextOffset = new Vector2(32.0f, 80.0f), TextOffset = new Vector2(-38.0f, -45.0f), Position = new Vector2(Width - NextLevelButton.Width - LevelSelectButton.Width - 124.0f, 0.0f), // Color = new Vector4(0.1608f, 0.8863f, 0.8863f, 1.0f) }; QuitButton.background.RegisterPalette(0); QuitButton.Icon.Color = LevelManager.Instance.BackgroundColor; QuitButton.Icon.Rotation = new Vector2(0.0f, -1.0f); QuitButton.TextColor = LevelManager.Instance.BackgroundColor; // this.AddChild(QuitButton); if(GameScene.currentLevel != 0) { this.AddChild(ReplayButton); } else { this.AddChild(QuitButton); } // DiagonalLine = Support.SpriteFromFile("/Application/assets/images/UI/diagonalLine.png"); DiagonalLine = Support.SpriteFromAtlas("crystallonUI", "diagonalLine.png"); DiagonalLine.Position = new Vector2( QuitButton.Position.X - DiagonalLine.CalcSizeInPixels().X - 5.0f , 15.0f); DiagonalLine.Color = LevelManager.Instance.BackgroundColor; this.AddChild(DiagonalLine); PossibleSolutionsText = new Label() { Text = "solutions\n found", FontMap = Crystallography.UI.FontManager.Instance.GetMap( Crystallography.UI.FontManager.Instance.GetInGame("Bariol", 14, "Bold" ) ), Position = new Vector2(15.0f, 80.0f) }; // PossibleSolutionsText.RegisterPalette(0); PossibleSolutionsText.Color = LevelManager.Instance.BackgroundColor; this.AddChild( PossibleSolutionsText ); OutOfText = new Label() { Text = "out of", FontMap = PossibleSolutionsText.FontMap, Position = new Vector2(60.0f, 40.0f) }; OutOfText.Color = LevelManager.Instance.BackgroundColor; this.AddChild( OutOfText ); FoundSolutionsText = new Label() { Text = "00", FontMap = Crystallography.UI.FontManager.Instance.GetMap( Crystallography.UI.FontManager.Instance.GetInGame("Bariol", 25, "Bold" ) ), Position = new Vector2(24.0f, 90.0f) }; FoundSolutionsText.Color = LevelManager.Instance.BackgroundColor; this.AddChild(FoundSolutionsText); TotalSolutionsText = new Label{ Text = "00", FontMap = Crystallography.UI.FontManager.Instance.GetMap( Crystallography.UI.FontManager.Instance.GetInGame("Bariol", 25, "Bold" ) ), Position = new Vector2(62.0f, 15.0f) }; TotalSolutionsText.Color = LevelManager.Instance.BackgroundColor; this.AddChild(TotalSolutionsText); // var charHeight = MessageText.FontMap.CharPixelHeight; // Height = (charHeight * 5.0f) + QuitButton.Height; Height = QuitButton.Height; // MessageText.Position = new Vector2(40.0f, QuitButton.Height + 20 ); // CenterText(); #if DEBUG Console.WriteLine(GetType().ToString() + " created" ); #endif }
// CONSTRUCTORS ----------------------------------------------------------------------------------------- public MainMenuScreen(MenuSystemScene pMenuSystem) { MenuSystem = pMenuSystem; // var bgcolor = Director.Instance.GL.Context.GetClearColor(); var bgcolor = LevelManager.Instance.BackgroundColor; bgcolor.A = 1.0f; MenuBGTop = Support.SpriteFromFile("/Application/assets/images/UI/menuBtnBG_top.png"); MenuBGTop.Position = new Vector2(351.0f, 436.0f); MenuBGTop.RegisterPalette(1); MaskBGTop = Support.UnicolorSprite("white", 255, 255, 255, 255); MaskBGTop.Color = bgcolor; MaskBGTop.Position = MenuBGTop.Position.Xy; MaskBGTop.Scale = new Vector2(16.0f, 4.875f); NewGameButton = new BetterButton(256.0f, 64.0f) { Text = "tutorial", Position = new Vector2(94.0f, 372.0f), }; NewGameButton.background.RegisterPalette(1); MaskBGButton1 = Support.UnicolorSprite("white", 255, 255, 255, 255); MaskBGButton1.Color = bgcolor; MaskBGButton1.Position = NewGameButton.Position.Xy; MaskBGButton1.Scale = new Vector2(16.1f, 4.0f); MenuBGSpacer1 = Support.SpriteFromFile("/Application/assets/images/UI/menuBtnBG_blue2.png"); MenuBGSpacer1.Position = new Vector2(351.0f, 285.0f); MenuBGSpacer1.FlipU = true; MenuBGSpacer1.RegisterPalette(2); MaskBGSpacer1 = Support.UnicolorSprite("white", 255, 255, 255, 255); MaskBGSpacer1.Color = bgcolor; MaskBGSpacer1.Position = MenuBGSpacer1.Position.Xy; MaskBGSpacer1.Scale = new Vector2(16.2f, 9.4375f); LevelSelectButton = new BetterButton(256.0f, 64.0f) { Text = "puzzle mode", Position = new Vector2(94.0f, 285.0f), // Color = new Vector4(0.1608f, 0.8863f, 0.8863f, 1.0f) }; LevelSelectButton.background.RegisterPalette(2); MaskBGButton2 = Support.UnicolorSprite("white", 255, 255, 255, 255); MaskBGButton2.Color = bgcolor; MaskBGButton2.Position = LevelSelectButton.Position.Xy; MaskBGButton2.Scale = new Vector2(16.1f, 4.0f); MenuBGSpacer2 = Support.SpriteFromFile("/Application/assets/images/UI/menuBtnBG_red2.png"); MenuBGSpacer2.Position = new Vector2(351.0f, 198.0f); MenuBGSpacer2.FlipU = true; MenuBGSpacer2.RegisterPalette(1); MaskBGSpacer2 = Support.UnicolorSprite("white", 255, 255, 255, 255); MaskBGSpacer2.Color = bgcolor;; MaskBGSpacer2.Position = MenuBGSpacer2.Position.Xy; MaskBGSpacer2.Scale = new Vector2(16.2f, 9.4375f); InstructionsButton = new BetterButton(256.0f, 64.0f) { Text = "challenge mode", Position = new Vector2(94.0f, 198.0f), }; InstructionsButton.background.RegisterPalette(1); MaskBGButton3 = Support.UnicolorSprite("white", 255, 255, 255, 255); MaskBGButton3.Color = bgcolor; MaskBGButton3.Position = InstructionsButton.Position.Xy; MaskBGButton3.Scale = new Vector2(16.1f, 4.0f); MenuBGSpacer3 = Support.SpriteFromFile("/Application/assets/images/UI/menuBtnBG_blue2.png"); MenuBGSpacer3.Position = new Vector2(351.0f, 111.0f); MenuBGSpacer3.FlipU = true; MenuBGSpacer3.RegisterPalette(2); MaskBGSpacer3 = Support.UnicolorSprite("white", 255, 255, 255, 255); MaskBGSpacer3.Color = bgcolor; MaskBGSpacer3.Position = MenuBGSpacer3.Position.Xy; MaskBGSpacer3.Scale = new Vector2(16.2f, 9.4375f); CreditsButton = new BetterButton(256.0f, 64.0f) { Text = "options", Position = new Vector2(94.0f, 111.0f), // Color = new Vector4(0.1608f, 0.8863f, 0.8863f, 1.0f) }; CreditsButton.background.RegisterPalette(2); MaskBGButton4 = Support.UnicolorSprite("white", 255, 255, 255, 255); MaskBGButton4.Color = bgcolor; MaskBGButton4.Position = CreditsButton.Position.Xy; MaskBGButton4.Scale = new Vector2(16.1f, 4.0f); MenuBGBottom = Support.SpriteFromFile("/Application/assets/images/UI/menuBtnBG_bottom.png"); MenuBGBottom.Position = new Vector2(351.0f, 32.0f); MenuBGBottom.RegisterPalette(1); MaskBGBottom = Support.UnicolorSprite("white", 255, 255, 255, 255); MaskBGBottom.Color = bgcolor; MaskBGBottom.Position = MenuBGBottom.Position.Xy; MaskBGBottom.Scale = new Vector2(16.0f, 4.9375f); this.AddChild(MenuBGBottom); this.AddChild(MaskBGBottom); this.AddChild(MenuBGSpacer3); this.AddChild(MaskBGSpacer3); this.AddChild(MenuBGSpacer2); this.AddChild(MaskBGSpacer2); this.AddChild(MenuBGSpacer1); this.AddChild(MaskBGSpacer1); this.AddChild(MenuBGTop); this.AddChild(MaskBGTop); this.AddChild(NewGameButton); this.AddChild(LevelSelectButton); this.AddChild(InstructionsButton); this.AddChild(CreditsButton); this.AddChild(MaskBGButton1); this.AddChild(MaskBGButton2); this.AddChild(MaskBGButton3); this.AddChild(MaskBGButton4); #if METRICS HoldTimer = 0.0f; PrintAnalyticsButton = new BetterButton(256.0f, 64.0f) { Text = "print metrics", Position = new Vector2(704.0f, 281.0f), Color = new Vector4(0.8980f, 0.0745f, 0.0745f, 1.0f), On = false } ClearAnalyticsButton = new BetterButton(256.0f, 64.0f) { Text = "clear metrics", Position = new Vector2(704.0f, 281.0f), Color = new Vector4(0.8980f, 0.0745f, 0.0745f, 1.0f), On = false } #endif }
public override void OnExit() { base.OnExit(); HitMeButton.ButtonUpAction -= HandleHitMeButtonButtonUpAction; PauseButton.ButtonUpAction -= HandlePauseButtonButtonUpAction; QualityManager.MatchScoreDetected -= HandleQualityManagerMatchScoreDetected; QualityManager.FailedMatchDetected -= HandleQualityManagerFailedMatchDetected; CardManager.Instance.NoMatchesPossibleDetected -= HandleCardManagerInstanceNoMatchesPossibleDetected; GameScene.LevelChangeDetected -= HandleGameSceneLevelChangeDetected; GroupCrystallonEntity.BreakDetected -= HandleGroupCrystallonEntityBreakDetected; PausePanel.QuitButtonPressDetected -= HandlePausePanelQuitButtonPressDetected; PausePanel.ResetButtonPressDetected -= HandlePausePanelResetButtonPressDetected; CubeCrystallonEntity.CubeCompleteDetected -= HandleCubeCrystallonEntityCubeCompleteDetected; CardManager.Instance.CardSpawned -= HandleCardManagerInstanceCardSpawned; if(GameScene.currentLevel == 999) { GameTimer.BarEmptied -= HandleGameTimerBarEmptied; GameTimer.BarFilled -= HandleGameTimerBarFilled; if (BonusBar != null) { BonusBar.BarFilled -= HandleBonusBarBarFilled; BonusBar.BarEmptied -= HandleBonusBarBarEmptied; } (_nextLevelPanel as InfiniteModeEndPanel).RetryDetected -= HandlePausePanelResetButtonPressDetected; (_nextLevelPanel as InfiniteModeEndPanel).QuitDetected -= Handle_nextLevelPanelQuitButtonPressDetected; } else { (_nextLevelPanel as NextLevelPanel).ReplayDetected -= HandlePausePanelResetButtonPressDetected; (_nextLevelPanel as NextLevelPanel).NextLevelDetected -= Handle_nextLevelPanelButtonButtonUpAction; (_nextLevelPanel as NextLevelPanel).QuitDetected -= Handle_nextLevelPanelQuitButtonPressDetected; (_nextLevelPanel as NextLevelPanel).LevelSelectDetected -= Handle_nextLevelPanelLevelSelectDetected; } _nextLevelPanel = null; HitMeButton = null; PauseButton = null; pausePanel = null; levelTitle = null; _messagePanel = null; _scene = null; #if METRICS if(ExitCode == LevelExitCode.NULL){ DataStorage.CollectMetrics(); } DataStorage.RemoveMetric("Goal"); DataStorage.RemoveMetric("Score"); DataStorage.RemoveMetric("Time"); DataStorage.RemoveMetric("No-Match Time"); DataStorage.RemoveMetric("Met-Goal Time"); DataStorage.RemoveMetric("Breaks"); DataStorage.RemoveMetric("Hit Me"); DataStorage.RemoveMetric("Exit Code"); #endif }
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; }
// CONSTRUCTOR --------------------------------------------------------- public OptionsMenuScreen(MenuSystemScene pMenuSystem) { MenuSystem = pMenuSystem; // SLIDERS ----------------------- // MUSIC SLIDER musicVolume = Support.MusicSystem.Instance.Volume; effectsVolume = Support.SoundSystem.Instance.Volume; orbitDistance = SelectionGroup.EASE_DISTANCE; stickiness = SelectionGroup.MAXIMUM_PICKUP_VELOCITY; float anchorX = (960.0f - (2.0f * (float)SLIDER_TRACK_LENGTH + SLIDER_H_GAP)) / 2.0f; float anchorY = 397.0f; musicSlider = new Slider(SLIDER_TRACK_LENGTH) { Text = "music volume", max = 1.0f, min = 0.0f, Position = new Vector2(anchorX, anchorY), OnChange = (volume) => { Support.MusicSystem.Instance.SetVolume(volume); } }; musicSlider.SetSliderValue((float)(DataStorage.options[0]/100.0f)); musicSlider.RegisterPalette(2); // SOUND EFFECTS SLIDER effectsSlider = new Slider(SLIDER_TRACK_LENGTH) { Text = "sound effects volume", max = 1.0f, min = 0.0f, Position = new Vector2(anchorX, anchorY - SLIDER_V_GAP), OnChange = (volume) => { Support.SoundSystem.Instance.SetVolume(volume); Support.SoundSystem.Instance.Play( LevelManager.Instance.SoundPrefix + "high.wav" ); } }; effectsSlider.SetSliderValue((float)(DataStorage.options[1]/100.0f)); effectsSlider.RegisterPalette(1); // SELECTION SENSITIVITY SLIDER stickySlider = new Slider(SLIDER_TRACK_LENGTH) { Text = "selection sensitivity", max = 1000.0f, min = 300.0f, Position = new Vector2(anchorX + musicSlider.Length + SLIDER_H_GAP, anchorY), OnChange = (velocity) => { SelectionGroup.MAXIMUM_PICKUP_VELOCITY = velocity; } }; stickySlider.SetSliderValue((float)DataStorage.options[3]); stickySlider.RegisterPalette(1); // ORBIT DISTANCE SLIDER orbitSlider = new Slider(SLIDER_TRACK_LENGTH) { Text = "selection float distance", max = 120.0f, min = 60.0f, Position = new Vector2(stickySlider.Position.X, anchorY - SLIDER_V_GAP), OnChange = (radius) => { SelectionGroup.EASE_DISTANCE = radius; } }; orbitSlider.SetSliderValue((float)DataStorage.options[2]); orbitSlider.RegisterPalette(0); // BUTTONS ------------------------------- // OK BUTTON OKButton = new BetterButton(BUTTON_WIDTH, BUTTON_HEIGHT) { Text = "ok", Position = new Vector2(960.0f-BUTTON_WIDTH, 0.0f), // Color = new Vector4(0.8980f, 0.0745f, 0.0745f, 1.0f) }; OKButton.background.RegisterPalette(1); // CANCEL BUTTON CancelButton = new BetterButton(BUTTON_WIDTH, BUTTON_HEIGHT) { Text = "cancel", Position = new Vector2(OKButton.Position.X, BUTTON_HEIGHT), // Color = new Vector4(0.1608f, 0.8863f, 0.8863f, 1.0f) }; CancelButton.background.RegisterPalette(2); // CLEAR DATA BUTTON ClearButton = new BetterButton(BUTTON_WIDTH, BUTTON_HEIGHT) { Text = "clear all data", Position = new Vector2(0.0f, 0.0f), // Color = new Vector4(0.1608f, 0.8863f, 0.8863f, 1.0f) }; ClearButton.background.RegisterPalette(2); // CLEAR DATA CONFIRMATION PANEL ------------------------- // CLEAR MESSAGE PANEL ClearPanel = new MessagePanel(BUTTON_WIDTH, 165.0f) { TitleText = "really?", Text = "erase all your progress?\nthis cannot be undone.", Offset = new Vector2(0.0f, 0.0f),//OKButton.Height), Width = OKButton.Width }; ClearPanel.BackgroundAlpha = 1.0f; // CLEAR DATA CONFIRMATION BUTTON ClearOKButton = new BetterButton(BUTTON_WIDTH, BUTTON_HEIGHT) { Text = "make it so", Position = new Vector2(0.0f, 0.0f), // Color = new Vector4(0.8980f, 0.0745f, 0.0745f, 1.0f) }; ClearOKButton.background.RegisterPalette(1); this.AddChild(musicSlider); this.AddChild(effectsSlider); this.AddChild(stickySlider); this.AddChild(orbitSlider); this.AddChild(OKButton); this.AddChild(CancelButton); this.AddChild(ClearButton); this.AddChild(ClearPanel); ClearPanel.AddChild(ClearOKButton); }