public HighScoreEntry() { var map = Crystallography.UI.FontManager.Instance.GetMap( Crystallography.UI.FontManager.Instance.GetInGame("Bariol", 102, "Bold") ); _bestCubes = _bestPoints = 0; _bestCubesTitle = new Label() { FontMap = Crystallography.UI.FontManager.Instance.GetMap( Crystallography.UI.FontManager.Instance.GetInGame("Bariol", 25, "Bold") ), Text = "the most cubes", Position = new Vector2(0.0f, 279.0f) }; _bestCubesTitle.RegisterPalette(0); this.AddChild(_bestCubesTitle); _cubeIcon = Support.SpriteFromFile("/Application/assets/images/UI/cubes_big.png"); _cubeIcon.Position = new Vector2(0.0f, 194.0f); _cubeIcon.RegisterPalette(0); this.AddChild(_cubeIcon); _bestCubesText = new Label() { Text = _bestCubes.ToString(), FontMap = map, Position = new Vector2(97.0f, 174.0f) }; _bestCubesText.RegisterPalette(0); this.AddChild(_bestCubesText); _bestPointsTitle = new Label() { FontMap = Crystallography.UI.FontManager.Instance.GetMap( Crystallography.UI.FontManager.Instance.GetInGame("Bariol", 25, "Bold") ), Text = "the most points", Position = new Vector2(0.0f, 108.0f) }; _bestPointsTitle.RegisterPalette(1); this.AddChild(_bestPointsTitle); _scoreIcon = Support.SpriteFromFile("/Application/assets/images/UI/points_big.png"); _scoreIcon.Position = new Vector2(0.0f, 20.0f); _scoreIcon.RegisterPalette(1); this.AddChild(_scoreIcon); _bestPointsText = new Label() { Text = _bestPoints.ToString(), FontMap = map, Position = new Vector2(97.0f, 0.0f) }; _bestPointsText.RegisterPalette(1); this.AddChild(_bestPointsText); }
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; }
protected void Initialize( float pWidth, float pHeight ) { DismissDelay = 1.0f; Height = pHeight; Width = pWidth; var xScale = pWidth/16.0f; var yScale = pHeight/16.0f; SlideInDirection = SlideDirection.UP; SlideOutDirection = SlideDirection.DOWN; Background = Support.UnicolorSprite("Grey", 40, 40, 40, 255); Background.Scale = new Vector2(xScale, yScale); Background.Color = new Vector4(Background.Color.R, Background.Color.G, Background.Color.B, 200.0f/255.0f); this.AddChild(Background); Bar = Support.UnicolorSprite("white", 255, 255, 255, 255); Bar.Scale = new Vector2(xScale, 0.25f); Bar.Position = new Vector2(0.0f, pHeight - 4.0f); Bar.RegisterPalette(0); this.AddChild(Bar); MessageTitleText = new Label() { Text = "Lorem ipsum dolor sit amet, consectetur", FontMap = Crystallography.UI.FontManager.Instance.GetMap( Crystallography.UI.FontManager.Instance.GetInGame("Bariol", 32, "Bold") ), // Color = new Vector4(0.161f, 0.886f, 0.886f, 1.0f), Position = new Vector2(40.0f, pHeight - 41.0f) }; MessageTitleText.RegisterPalette(0); this.AddChild(MessageTitleText); MessageText = new Label() { Text = "Lorem ipsum dolor sit amet, consectetur adipisicing \n" + "elit, sed do eiusmod tempor incididunt ut labore et \n" + "dolore magna aliqua. Ut enim ad minim veniam, quis \n"+ "nostrud exercitation ullamco laboris nisi ut aliquip \n" + "ex ea commodo consequat. Duis aute irure dolor in \n", //+ // "reprehenderit in voluptate velit esse cillum dolore eu \n" + // "fugiat nulla pariatur. Excepteur sint occaecat cupidatat \n" + // "non proident, sunt in culpa qui officia deserunt mollit \n" + // "anim id est laborum.", FontMap = Crystallography.UI.FontManager.Instance.GetMap( Crystallography.UI.FontManager.Instance.GetInGame("Bariol", 25) ), Position = new Vector2(40.0f, pHeight - 69.0f) }; this.AddChild(MessageText); #if DEBUG Console.WriteLine(GetType().ToString() + " created. " + MessageText.Text ); #endif }
// METHODS ------------------------------------------------------------------------------ protected void Initialize() { _initialized = true; Background = Support.SpriteFromFile("/Application/assets/images/LevelTitleBG.png"); Background.Position = new Vector2(0.0f, 0.0f); this.AddChild(Background); this.Height = Background.CalcSizeInPixels().Y; this.Width = Background.CalcSizeInPixels().X; QualityNames = new List<Label>(); map = Crystallography.UI.FontManager.Instance.GetMap(Crystallography.UI.FontManager.Instance.GetInGame("Bariol", 18, "Regular")); LevelNumberText = new Label(){ Text = "00", FontMap = Crystallography.UI.FontManager.Instance.GetMap(Crystallography.UI.FontManager.Instance.GetInGame("Bariol", 102, "Bold")), Position = new Vector2( 44.0f, 250.0f), // Color = new Vector4( 0.16078431f, 0.88627451f, 0.88627451f, 1.0f) }; LevelNumberText.RegisterPalette(0); Background.AddChild(LevelNumberText); TapToDismissText = new Label() { Text = "tap to dismiss", FontMap = map, Position = new Vector2( 39.0f, 20.0f) }; TapToDismissText.RegisterPalette(0); Background.AddChild(TapToDismissText); Icons = new SpriteTile[4]; for( int i=0; i < Icons.Length; i++) { Icons[i] = Support.TiledSpriteFromFile("/Application/assets/images/icons/icons.png", 4, 2); float y = 176.0f - 88.0f * (float)System.Math.Floor(i/2.0f); Icons[i].Position = new Vector2( 44.0f + 68.0f*(i%2), y); Background.AddChild(Icons[i]); Icons[i].Visible = false; } }
// METHODS ---------------------------------------------------- /// <summary> /// Initialize this instance. /// </summary> private void Initialize() { SlideInDirection = SlideDirection.RIGHT; SlideOutDirection = SlideDirection.LEFT; Width = Director.Instance.GL.Context.Screen.Width; Height = Director.Instance.GL.Context.Screen.Height; LevelTitleSlider = new HudPanel(){ SlideInDirection = this.SlideInDirection, SlideOutDirection = this.SlideOutDirection }; this.AddChild(LevelTitleSlider); LevelTitleLabel = new Label() { Text = "00", FontMap = Crystallography.UI.FontManager.Instance.GetMap(Crystallography.UI.FontManager.Instance.GetInGame("Bariol", 44, "Bold")), Position = new Vector2(30.0f, 0.75f * 544.0f) }; this.AddChild(LevelTitleLabel); LevelTitleLabel.RegisterPalette(0); TapToDismissLabel = new Label() { Text = "tap to dismiss", FontMap = Crystallography.UI.FontManager.Instance.GetMap(Crystallography.UI.FontManager.Instance.GetInGame("Bariol", 25, "Bold")), Position = new Vector2( 20.0f, 20.0f) }; TapToDismissLabel.RegisterPalette(0); this.AddChild(TapToDismissLabel); TapToDismissLabel.Visible = false; QualityNames = new List<Label>(); IconSliders = new HudPanel[4]; for( int i=0; i < IconSliders.Length; i++ ) { IconSliders[i] = new HudPanel() { SlideInDirection = this.SlideInDirection, SlideOutDirection = this.SlideOutDirection, Width = Director.Instance.GL.Context.Screen.Width, Height = Director.Instance.GL.Context.Screen.Height, MoveDuration = ICON_MOVE_DURATION }; float x = ( (float)IconSliders.Length - (float)i ) * 960.0f/( 1.0f + (float)IconSliders.Length ); IconSliders[i].Position = new Vector2( x, 0.0f ); IconSliders[i].Offset = new Vector2(x, 0.0f); IconSliders[i].Visible = false; this.AddChild(IconSliders[i]); } Icons = new Node[4]; for( int i=0; i < Icons.Length; i++) { Icons[i] = Support.TiledSpriteFromFile("/Application/assets/images/icons/icons.png", 4, 2); float y = 544.0f/2.0f - (Icons[i] as SpriteTile).CalcSizeInPixels().Y/2.0f; Icons[i].RegisterPalette(i%3); Icons[i].Position = new Vector2(0.0f, y); IconSliders[i].AddChild(Icons[i]); // Icons[i].Visible = false; } iconWidth = (Icons[0] as SpriteTile).CalcSizeInPixels().X; iconHeight = (Icons[0] as SpriteTile).CalcSizeInPixels().Y; }
// CONSTRUCTOR --------------------------------------------------------------------------------------- public LoadingScene(string pDestination, GameSceneData pData = null) { if(pData==null) { pData = DEFAULT_GAME_SCENE_DATA; GAME_SCENE_DATA = pData; } this.Camera.SetViewFromViewport(); stopwatch = Stopwatch.StartNew(); _levelNumber = pData.level; _gameTimer = pData.timeLimit; _angle = 0.0f; _timer = 0.0f; _loadIndex = 0; Hub = new Node(); Hub.Position = new Vector2(480.0f, 272.0f); this.AddChild(Hub); // LoadingSpinner = Support.SpriteFromFile("/Application/assets/images/UI/loading.png"); LoadingSpinner = Support.SpriteFromAtlas("crystallonUI", "loading.png"); LoadingSpinner.Pivot = new Vector2(0.5f, 0.5f); LoadingSpinner.Position = new Vector2(-145.0f, -119.0f); LoadingSpinner.RegisterPalette(1); Hub.AddChild(LoadingSpinner); LoadingText = new Label("loading", UI.FontManager.Instance.GetMap(Crystallography.UI.FontManager.Instance.GetInGame("Bariol", 25, "Bold"))); LoadingText.Position = new Vector2(445.0f, 257.0f); LoadingText.RegisterPalette(2); this.AddChild(LoadingText); // LOADING PROCEDURE HEADER loadProc = new List<Action>{ () => { ;//dummy }, () => { InputManager.Instance.enabled = false; }, // PRE-LOAD LEVEL DATA () => { LevelManager.Instance.LoadGameData(); } }; switch(pDestination) { case("Level Select"): AddLevelSelectProcs(); break; case("Menu"): AddMenuProcs(); break; case("Game"): default: AddGameProcs(); break; } loadProc.AddRange( new List<Action> { () => { InputManager.Instance.enabled = true; } } ); Scheduler.Instance.ScheduleUpdateForTarget(this, 0, false); }