public CreditScene()
        {
            //create a panel
            Sce.PlayStation.HighLevel.UI.Panel panel = new Sce.PlayStation.HighLevel.UI.Panel();
            panel.Width = Director.Instance.GL.Context.GetViewport().Width;
            panel.Height = Director.Instance.GL.Context.GetViewport().Height;

            Button buttonUI1 = new Button(); //buttons
            buttonUI1.Name = "go back";
            buttonUI1.Text = "go back";
            buttonUI1.Width = 250;
            buttonUI1.Height = 50;
            buttonUI1.Alpha = 0.8f;
            buttonUI1.SetPosition(panel.Width/2.5f,panel.Height - 100);
            buttonUI1.TouchEventReceived += (sender, e) => {
                Support.SoundSystem.Instance.Play("ButtonClick.wav");
                Director.Instance.ReplaceScene(new MenuScene());
            };

            ImageBox ib = new ImageBox(); //set background images
            ib.Width = panel.Width;
            ib.Image = new ImageAsset("/Application/resources/Credits.png",false);
            ib.Height = panel.Height;
            ib.SetPosition(0.0f,0.0f);

            //add panel to rootwidget
            panel.AddChildLast(buttonUI1);
            _uiScene = new Sce.PlayStation.HighLevel.UI.Scene();
            _uiScene.RootWidget.AddChildLast(ib);
            _uiScene.RootWidget.AddChildLast(panel);
            UISystem.SetScene(_uiScene);
            Scheduler.Instance.ScheduleUpdateForTarget(this,0,false); //run the loop
        }
Example #2
0
        private void InitializeUI()
        {
            uiScene = new Sce.PlayStation.HighLevel.UI.Scene();
            Panel panel = new Panel();

            panel.Width  = Director.Instance.GL.Context.GetViewport().Width;
            panel.Height = Director.Instance.GL.Context.GetViewport().Height;

            uiScore      = new Sce.PlayStation.HighLevel.UI.Label();
            uiScore.Text = "Score: ";
            uiScore.HorizontalAlignment = HorizontalAlignment.Right;
            uiScore.VerticalAlignment   = VerticalAlignment.Top;
            uiScore.SetPosition(Director.Instance.GL.Context.GetViewport().Width - uiScore.Width, Director.Instance.GL.Context.GetViewport().Height *.01f);
            uiScore.TextColor = new UIColor(1.0f, 0.0f, 0.0f, 1.0f);
            uiScore.Font      = new UIFont(FontAlias.System, 25, FontStyle.Bold);

            uiTime      = new Sce.PlayStation.HighLevel.UI.Label();
            uiTime.Text = "Time: ";
            uiTime.HorizontalAlignment = HorizontalAlignment.Left;
            uiTime.VerticalAlignment   = VerticalAlignment.Top;
            uiTime.SetPosition(0.0f, Director.Instance.GL.Context.GetViewport().Height *.01f);
            uiTime.TextColor = new UIColor(1.0f, 1.0f, 0.0f, 1.0f);
            uiTime.Font      = new UIFont(FontAlias.System, 25, FontStyle.Bold);

            panel.AddChildLast(uiScore);
            panel.AddChildLast(uiTime);
            uiScene.RootWidget.AddChildLast(panel);
            UISystem.SetScene(uiScene);
        }
		public MenuScene ()
		{
			this.Camera.SetViewFromViewport();
			Sce.PlayStation.HighLevel.UI.Panel dialog = new Panel();
			dialog.Width = Director.Instance.GL.Context.GetViewport().Width;
			dialog.Height = Director.Instance.GL.Context.GetViewport().Height;
			
			ImageBox ib = new ImageBox();
			ib.Width = dialog.Width;
			ib.Image = new ImageAsset("/Application/images/title.png", false);
			ib.Height = dialog.Height;
			ib.SetPosition(0.0f, 0.0f);
			
			Button buttonPlay = new Button();
			buttonPlay.Name = "buttonPlay";
			buttonPlay.Text = "Play Game";
			buttonPlay.Width = 300;
			buttonPlay.Height = 50;
			buttonPlay.Alpha = 0.8f;
			buttonPlay.SetPosition(dialog.Width/2.0f - buttonPlay.Width/2.0f, 220.0f); 
			buttonPlay.TouchEventReceived += OnButtonPlay;
			
			dialog.AddChildLast(ib);
			dialog.AddChildLast(buttonPlay);
			m_uiScene = new Sce.PlayStation.HighLevel.UI.Scene();
			m_uiScene.RootWidget.AddChildLast(dialog);
			UISystem.SetScene(m_uiScene);
			Scheduler.Instance.ScheduleUpdateForTarget(this, 0, false);
		}
		public SubmitScore ()
		{
			this.Camera.SetViewFromViewport();
			Sce.PlayStation.HighLevel.UI.Panel dialog = new Panel();
			dialog.Width = Director.Instance.GL.Context.GetViewport().Width;
			dialog.Height = Director.Instance.GL.Context.GetViewport().Height;
			
			//textInfo = new TextureInfo(m_texture);
			//SpriteUV tScreen = new SpriteUV(textInfo);
			
			//tScreen.Scale = textInfo.TextureSizef;
			//tScreen.Pivot = new Vector2(0.5f,0.5f);
			//tScreen.Position = new Vector2(Director.Instance.GL.Context.GetViewport().Width/2,
			                            //Director.Instance.GL.Context.GetViewport().Height/2);
			//this.AddChild(tScreen);
			
			ImageBox ib = new ImageBox();
			ib.Width = dialog.Width;
			ib.Image = new ImageAsset("/Application/images/highScore.png", false);
			ib.Height = dialog.Height;
			ib.SetPosition(0.0f, 0.0f);
					
			Button submitScore = new Button();
			submitScore.Name = "submitScore";
			submitScore.Text = "Submit Score";
			submitScore.Width = 200;
			submitScore.Height = 50;
			submitScore.Alpha = 0.8f;
			submitScore.SetPosition(250.0f, 40.0f);
			submitScore.TouchEventReceived += OnSubmitScore;
			
			Button returnToMenu = new Button();
			returnToMenu.Name = "returnToMenu";
			returnToMenu.Text = "Menu";
			returnToMenu.Width = 200;
			returnToMenu.Height = 50;
			returnToMenu.Alpha = 0.8f;
			returnToMenu.SetPosition(700.0f, 40.0f);
			returnToMenu.TouchEventReceived += OnButtonPlay;
			
			playerNameField = new EditableText();
			playerNameField.Name = "playerNameField";
			playerNameField.Width = 200;
			playerNameField.Height = 50;
			playerNameField.Alpha = 0.8f;
			playerNameField.SetPosition(25.0f, 40.0f);
			
			UpdateImage(totalScore);
			
			dialog.AddChildLast(ib);
			dialog.AddChildLast(submitScore);
			dialog.AddChildLast(returnToMenu);
			dialog.AddChildLast(playerNameField);
			m_uiScene = new Sce.PlayStation.HighLevel.UI.Scene();
			m_uiScene.RootWidget.AddChildLast(dialog);
			UISystem.SetScene(m_uiScene);
			Scheduler.Instance.ScheduleUpdateForTarget(this, 0, false);
		}
        public static void Initialize()
        {
            //Set up director and UISystem.
            Director.Initialize();
            UISystem.Initialize(Director.Instance.GL.Context);

            //Set game scene
            gameScene = new Sce.PlayStation.HighLevel.GameEngine2D.Scene();
            gameScene.Camera.SetViewFromViewport();
            gameScene.Name = "gameScene";

            startScene = new Sce.PlayStation.HighLevel.GameEngine2D.Scene();
            startScene.Camera.SetViewFromViewport();
            startScene.Name = "startScene";

            endScene = new Sce.PlayStation.HighLevel.GameEngine2D.Scene();
            endScene.Camera.SetViewFromViewport();
            endScene.Name = "endScene";

            //Set the ui scene.
            uiScene = new Sce.PlayStation.HighLevel.UI.Scene();
            Panel panel = new Panel();

            panel.Width  = Director.Instance.GL.Context.GetViewport().Width;
            panel.Height = Director.Instance.GL.Context.GetViewport().Height;
            scoreLabel   = new Sce.PlayStation.HighLevel.UI.Label();
            scoreLabel.HorizontalAlignment = HorizontalAlignment.Center;
            scoreLabel.VerticalAlignment   = VerticalAlignment.Top;
            scoreLabel.SetPosition(
                Director.Instance.GL.Context.GetViewport().Width / 2 - scoreLabel.Width / 2,
                Director.Instance.GL.Context.GetViewport().Height *0.1f - scoreLabel.Height / 2);
            scoreLabel.Text = "0";
            panel.AddChildLast(scoreLabel);
            uiScene.RootWidget.AddChildLast(panel);
            UISystem.SetScene(uiScene);

            //Create the background.
            background      = new Background(gameScene, gameScene.Name);
            titleBackground = new Background(startScene, startScene.Name);
            endBackground   = new Background(endScene, endScene.Name);
            //Create the flappy douche
            bird = new Bird(gameScene);


            //Create some obstacles.
            obstacles    = new Obstacle[2];
            obstacles[0] = new Obstacle(Director.Instance.GL.Context.GetViewport().Width *0.5f, gameScene);
            obstacles[1] = new Obstacle(Director.Instance.GL.Context.GetViewport().Width, gameScene);

            score      = 0;
            keyPressed = false;

            //Run the scene.
            Director.Instance.RunWithScene(startScene, true);
        }
Example #6
0
        private void InitializeUI()
        {
            uiScene = new Sce.PlayStation.HighLevel.UI.Scene();
            Panel panel = new Panel();

            panel.Width  = Director.Instance.GL.Context.GetViewport().Width;
            panel.Height = Director.Instance.GL.Context.GetViewport().Height;

            initScore();
            panel.AddChildLast(uiScore1);
            panel.AddChildLast(uiScore2);
            panel.AddChildLast(uiScore3);
            panel.AddChildLast(uiScore4);
            panel.AddChildLast(uiScore5);
            uiScene.RootWidget.AddChildLast(panel);
            UISystem.SetScene(uiScene);
        }
Example #7
0
        public MenuScene()
        {
            this.Camera.SetViewFromViewport();
            Panel dialog = new Panel();

            dialog.Width = Director.Instance.GL.Context.GetViewport().Width;
            dialog.Height = Director.Instance.GL.Context.GetViewport().Height;

            ImageBox ib = new ImageBox();
            ib.Width = dialog.Width;
            ib.Image = new ImageAsset("/Application/images/title.png", false);
            ib.Height = dialog.Height;
            ib.SetPosition(0.0f, 0.0f);

            Button playButton = new Button();
            playButton.Name = "buttonPlay";
            playButton.Text = "Play Game";
            playButton.Width = 300;
            playButton.Height = 50;
            playButton.Alpha = 0.8f;
            playButton.SetPosition(dialog.Width/2 - playButton.Width / 2, 200.0f);
            playButton.TouchEventReceived += (sender, e) => {
                Director.Instance.ReplaceScene(new GameScene());
            };

            Button menuButton = new Button();
            menuButton.Name = "buttonMenu";
            menuButton.Text = "Main Menu";
            menuButton.Width = 300;
            menuButton.Height = 50;
            menuButton.Alpha = 0.8f;
            menuButton.SetPosition(dialog.Width/2 - playButton.Width / 2, 250.0f);
            menuButton.TouchEventReceived += (sender, e) => {
                Director.Instance.ReplaceScene(new TitleScene());
            };

            dialog.AddChildLast(ib);
            dialog.AddChildLast(playButton);
            dialog.AddChildLast(menuButton);
            _uiScene = new Sce.PlayStation.HighLevel.UI.Scene();
            _uiScene.RootWidget.AddChildLast(dialog);
            UISystem.SetScene(_uiScene);
            Scheduler.Instance.ScheduleUpdateForTarget(this, 0, false);
        }
Example #8
0
        public static void Initialize()
        {
            //Set up director
            Director.Initialize();
            UISystem.Initialize(Director.Instance.GL.Context);

            Sce.PlayStation.HighLevel.UI.Scene blankUI = new Sce.PlayStation.HighLevel.UI.Scene();
            UISystem.SetScene(blankUI);

            //Create Game Scenes
            menuScene = new MenuScene();
            gameScene = new GameScene();
            menuScene.GetScene().Camera.SetViewFromViewport();
            gameScene.Camera.SetViewFromViewport();

            //Run the scene.
            //currentScene = Scene.Game;
            Director.Instance.RunWithScene(gameScene, true);
        }
		public LeaderBoard (string scores)
		{
			highScores = scores;
			this.Camera.SetViewFromViewport();
			Sce.PlayStation.HighLevel.UI.Panel dialog = new Panel();
			dialog.Width = Director.Instance.GL.Context.GetViewport().Width;
			dialog.Height = Director.Instance.GL.Context.GetViewport().Height;
			
			textInfo = new TextureInfo(m_texture);
			SpriteUV tScreen = new SpriteUV(textInfo);
			UpdateImage(highScores);
			
			tScreen.Scale = textInfo.TextureSizef;
			tScreen.Pivot = new Vector2(0.5f,0.5f);
			tScreen.Position = new Vector2(Director.Instance.GL.Context.GetViewport().Width/2,
			                            Director.Instance.GL.Context.GetViewport().Height/2);
			this.AddChild(tScreen);
			
			ImageBox ib = new ImageBox();
			ib.Width = dialog.Width;
			ib.Image = new ImageAsset("/Application/images/highScore.png", false);
			ib.Height = dialog.Height;
			ib.SetPosition(0.0f, 0.0f);
			
			Button returnToMenu = new Button();
			returnToMenu.Name = "returnToMenu";
			returnToMenu.Text = "Menu";
			returnToMenu.Width = 200;
			returnToMenu.Height = 50;
			returnToMenu.Alpha = 0.8f;
			returnToMenu.SetPosition(700.0f, 40.0f);
			returnToMenu.TouchEventReceived += OnButtonPlay;
			
			dialog.AddChildLast(ib);
			dialog.AddChildLast(returnToMenu);
			m_uiScene = new Sce.PlayStation.HighLevel.UI.Scene();
			m_uiScene.RootWidget.AddChildLast(dialog);
			UISystem.SetScene(m_uiScene);
			Scheduler.Instance.ScheduleUpdateForTarget(this, 0, false);
		}
Example #10
0
        public static void Initialize()
        {
            //Set up director and UISystem.
            Director.Initialize();
            UISystem.Initialize(Director.Instance.GL.Context);

            //Set game scene
            gameScene = new Sce.PlayStation.HighLevel.GameEngine2D.Scene();
            gameScene.Camera.SetViewFromViewport();

            //Set the ui scene.
            uiScene = new Sce.PlayStation.HighLevel.UI.Scene();
            Panel panel = new Panel();

            panel.Width  = Director.Instance.GL.Context.GetViewport().Width;
            panel.Height = Director.Instance.GL.Context.GetViewport().Height;

            uiScene.RootWidget.AddChildLast(panel);
            UISystem.SetScene(uiScene);

            //Run the scene.
            Director.Instance.RunWithScene(gameScene, true);
        }
Example #11
0
        public MenuScene()
        {
            Console.WriteLine("--------- menu scene -------");

            this.Camera.SetViewFromViewport();//set camera view point
            Sce.PlayStation.HighLevel.UI.Panel dialog = new Panel();//create panel
            dialog.Width = Director.Instance.GL.Context.GetViewport().Width;
            dialog.Height = Director.Instance.GL.Context.GetViewport().Height;

            ImageBox ib = new ImageBox(); //set background images
            ib.Width = dialog.Width;
            ib.Image = new ImageAsset("/Application/resources/menuScene.png",false);
            ib.Height = dialog.Height;
            ib.SetPosition(0.0f,0.0f);

            Button buttonUI1 = new Button(); //set buttons positions
            buttonUI1.Name = "buttonPlay";
            buttonUI1.Text = "Play Game";
            buttonUI1.Width = 250;
            buttonUI1.Height = 50;
            buttonUI1.Alpha = 0.8f;
            buttonUI1.SetPosition(dialog.Width/15,dialog.Height - 100);
            buttonUI1.TouchEventReceived += (sender, e) => {
                Support.SoundSystem.Instance.Play("ButtonClick.wav");
                Director.Instance.ReplaceScene(new GameScene());
            };

            Button buttonUI2 = new Button();
            buttonUI2.Name = "buttonOption";
            buttonUI2.Text = "Option";
            buttonUI2.Width = 250;
            buttonUI2.Height = 50;
            buttonUI2.Alpha = 0.8f;
            buttonUI2.SetPosition(dialog.Width/2.7f,dialog.Height - 100);
            buttonUI2.TouchEventReceived += (sender, e) => {
                Support.SoundSystem.Instance.Play("ButtonClick.wav");
                Director.Instance.ReplaceScene(new OptionScene());
            };

            Button buttonUI3 = new Button();
            buttonUI3.Name = "buttonCredit";
            buttonUI3.Text = "Credit";
            buttonUI3.Width = 250;
            buttonUI3.Height = 50;
            buttonUI3.Alpha = 0.8f;
            buttonUI3.SetPosition(dialog.Width/1.5f,dialog.Height - 100);
            buttonUI3.TouchEventReceived += (sender, e) => {
                Support.SoundSystem.Instance.Play("ButtonClick.wav");
                Director.Instance.ReplaceScene(new CreditScene());
            };

            dialog.AddChildLast(ib);
            dialog.AddChildLast(buttonUI1);
            dialog.AddChildLast(buttonUI2);
            dialog.AddChildLast(buttonUI3);

            _uiScene = new Sce.PlayStation.HighLevel.UI.Scene();
            _uiScene.RootWidget.AddChildLast(dialog);
            UISystem.SetScene(_uiScene); // create menu scene
            Scheduler.Instance.ScheduleUpdateForTarget(this,0,false); //run the loop
        }
        public LevelComplete(Sce.PlayStation.HighLevel.GameEngine2D.Scene scene, Sce.PlayStation.HighLevel.UI.Scene uiScene) : base(scene)
        {
            textureInfo     = new TextureInfo("/Application/textures/levelComplete.png");
            sprite          = new SpriteUV();
            sprite          = new SpriteUV(textureInfo);
            sprite.Quad.S   = textureInfo.TextureSizef;
            sprite.Position = new Vector2(0.0f, 0.0f);
            scene.AddChild(sprite);
            sprite.Visible = false;

            stars1Texture        = new TextureInfo("/Application/textures/stars1.png");
            stars2Texture        = new TextureInfo("/Application/textures/stars2.png");
            stars3Texture        = new TextureInfo("/Application/textures/stars3.png");
            starsSprite          = new SpriteUV();
            starsSprite          = new SpriteUV(stars1Texture);
            starsSprite.Quad.S   = stars1Texture.TextureSizef;
            starsSprite.Position = new Vector2(0.0f, 0.0f);
            scene.AddChild(starsSprite);
            starsSprite.Visible = false;

            CustomButtonImageSettings customNextLevelImg = new CustomButtonImageSettings();

            customNextLevelImg.BackgroundNormalImage   = new ImageAsset("/Application/assets/buttons/NewNext.png");
            customNextLevelImg.BackgroundPressedImage  = new ImageAsset("/Application/assets/buttons/NewNext.png");
            customNextLevelImg.BackgroundDisabledImage = new ImageAsset("/Application/assets/buttons/NewNext.png");

            CustomButtonImageSettings customReplayImg = new CustomButtonImageSettings();

            customReplayImg.BackgroundNormalImage   = new ImageAsset("/Application/assets/buttons/NewReplay.png");
            customReplayImg.BackgroundPressedImage  = new ImageAsset("/Application/assets/buttons/NewReplay.png");
            customReplayImg.BackgroundDisabledImage = new ImageAsset("/Application/assets/buttons/NewReplay.png");

            CustomButtonImageSettings customBackImg = new CustomButtonImageSettings();

            customBackImg.BackgroundNormalImage   = new ImageAsset("/Application/assets/buttons/NewHome.png");
            customBackImg.BackgroundPressedImage  = new ImageAsset("/Application/assets/buttons/NewHome.png");
            customBackImg.BackgroundDisabledImage = new ImageAsset("/Application/assets/buttons/NewHome.png");

            backToLevelSelect = new Button();
            backToLevelSelect.SetPosition(750, 480);
            //backToLevelSelect.Text = "B";
            backToLevelSelect.SetSize(60, 60);
            //backToLevelSelect.BackgroundNinePatchMargin = new NinePatchMargin(10,10,10,10);
            backToLevelSelect.CustomImage = customBackImg;
            backToLevelSelect.Style       = ButtonStyle.Custom;
            //backToLevelSelect.BackgroundFilterColor = new UIColor(255.0f, 255.0f, 0.0f, 1.0f);
            backToLevelSelect.ButtonAction += HandleBackButton;
            backToLevelSelect.Visible       = false;
            uiScene.RootWidget.AddChildLast(backToLevelSelect);

            replayLevel = new Button();
            replayLevel.SetPosition(820, 480);
            //replayLevel.Text = "R";
            replayLevel.SetSize(60, 60);
            replayLevel.CustomImage = customReplayImg;
            replayLevel.Style       = ButtonStyle.Custom;
            //replayLevel.BackgroundFilterColor = new UIColor(255.0f, 255.0f, 0.0f, 1.0f);
            replayLevel.ButtonAction += HandleReplayButton;
            replayLevel.Visible       = false;
            uiScene.RootWidget.AddChildLast(replayLevel);

            nextLevel = new Button();
            nextLevel.SetPosition(890, 480);
            //nextLevel.Text = "N";
            nextLevel.SetSize(60, 60);
            nextLevel.CustomImage = customNextLevelImg;
            nextLevel.Style       = ButtonStyle.Custom;
            //nextLevel.BackgroundFilterColor = new UIColor(255.0f, 255.0f, 0.0f, 1.0f);
            nextLevel.ButtonAction += HandleNextLevelButton;
            nextLevel.Visible       = false;
            uiScene.RootWidget.AddChildLast(nextLevel);

            UISystem.SetScene(uiScene);
            nextState = State.WAITING;
        }
Example #13
0
        public static void Initialize()
        {
            //Set up director and UISystem.
            Director.Initialize();
            UISystem.Initialize(Director.Instance.GL.Context);

            //Set game scene
            gameScene = new Sce.PlayStation.HighLevel.GameEngine2D.Scene();
            gameScene.Camera.SetViewFromViewport();

            //Set the ui scene.
            uiScene = new Sce.PlayStation.HighLevel.UI.Scene();
            Panel panel = new Panel();

            panel.Width  = Director.Instance.GL.Context.GetViewport().Width;
            panel.Height = Director.Instance.GL.Context.GetViewport().Height;

            scoreLabel = new Sce.PlayStation.HighLevel.UI.Label();
            scoreLabel.HorizontalAlignment = HorizontalAlignment.Left;
            scoreLabel.VerticalAlignment   = VerticalAlignment.Top;

            scoreLabel.TextShadow                  = new TextShadowSettings();
            scoreLabel.TextShadow.Color            = new UIColor(0.0f, 0.0f, 0.0f, 1.0f);
            scoreLabel.TextShadow.HorizontalOffset = 2.0f;
            scoreLabel.TextShadow.VerticalOffset   = 2.0f;

            scoreLabel.SetPosition(
                Director.Instance.GL.Context.GetViewport().Width / 2 - scoreLabel.Width / 2,
                Director.Instance.GL.Context.GetViewport().Width *0.1f - scoreLabel.Height / 2);

            scoreLabel.Text = "Score: " + score.ToString();

            airLabel = new Sce.PlayStation.HighLevel.UI.Label();
            airLabel.HorizontalAlignment = HorizontalAlignment.Right;
            airLabel.VerticalAlignment   = VerticalAlignment.Top;

            airLabel.TextShadow                  = new TextShadowSettings();
            airLabel.TextShadow.Color            = new UIColor(0.0f, 0.0f, 0.0f, 1.0f);
            airLabel.TextShadow.HorizontalOffset = 2.0f;
            airLabel.TextShadow.VerticalOffset   = 2.0f;

            airLabel.SetPosition(
                Director.Instance.GL.Context.GetViewport().Width / 2 - airLabel.Width / 2,
                Director.Instance.GL.Context.GetViewport().Width *0.1f - airLabel.Height / 2);
            airLabel.Text = "Air: " + air.ToString();

            windowWidth  = Director.Instance.GL.Context.GetViewport().Width;
            windowHeight = Director.Instance.GL.Context.GetViewport().Height;

            panel.AddChildLast(scoreLabel);
            panel.AddChildLast(airLabel);
            uiScene.RootWidget.AddChildLast(panel);
            UISystem.SetScene(uiScene);

            //Create the background.
            background = new Background(gameScene);

            //Create the flappy guy
            bird = new Bird(gameScene);

            //Create some chains.
            chain    = new Chain[OBSTACLE_COUNT];
            chain[0] = new Chain(windowWidth * 0.5f, gameScene);
            chain[1] = new Chain(windowWidth, gameScene);

            //Create seamines and attach to chain
            seamine    = new Mine[OBSTACLE_COUNT];
            seamine[0] = new Mine((X = chain[0].GetX + chain[0].GetMaxX) - 80, Y = chain[0].GetY + chain[0].GetMaxY, gameScene);
            seamine[1] = new Mine((X = chain[1].GetX + chain[1].GetMaxX) - 80, Y = chain[1].GetY + chain[1].GetMaxY, gameScene);

            //Create Bubbles
            bubble = new List <Bubble>();
            bubble.Add(new Bubble(windowWidth / 4, -70.0f, 0.75f, gameScene));
            bubble.Add(new Bubble(windowWidth / 2, -42.0f, 0.25f, gameScene));
            bubble.Add(new Bubble((windowWidth / 4) * 3, -103.0f, 0.5f, gameScene));
            bubble.Add(new Bubble(windowWidth, -129.0f, 0.5f, gameScene));

            //Run the scene.
            Director.Instance.RunWithScene(gameScene, true);
        }
        public LoadingScreen(Sce.PlayStation.HighLevel.GameEngine2D.Scene scene, Sce.PlayStation.HighLevel.UI.Scene uiScene) : base(scene)
        {
//			loadingTexture0     = new TextureInfo("/Application/textures/LoadingScreens/Level0Load.png");
//			loadingTexture1     = new TextureInfo("/Application/textures/LoadingScreens/Level1Load.png");
//			loadingTexture2     = new TextureInfo("/Application/textures/LoadingScreens/Level2Load.png");
//			loadingTexture3     = new TextureInfo("/Application/textures/LoadingScreens/Level3Load.png");
//			loadingTexture4     = new TextureInfo("/Application/textures/LoadingScreens/Level4Load.png");
//			loadingTexture5     = new TextureInfo("/Application/textures/LoadingScreens/Level5Load.png");
//			loadingTexture6     = new TextureInfo("/Application/textures/LoadingScreens/Level6Load.png");
//			loadingTexture7     = new TextureInfo("/Application/textures/LoadingScreens/Level7Load.png");
//			loadingTexture8     = new TextureInfo("/Application/textures/LoadingScreens/Level8Load.png");
//			loadingTexture9     = new TextureInfo("/Application/textures/LoadingScreens/Level9Load.png");
//			loadingTexture10    = new TextureInfo("/Application/textures/LoadingScreens/Level10Load.png");
//			loadingTexture11    = new TextureInfo("/Application/textures/LoadingScreens/Level11Load.png");
//			loadingTexture12    = new TextureInfo("/Application/textures/LoadingScreens/Level12Load.png");
//			loadingTexture13    = new TextureInfo("/Application/textures/LoadingScreens/Level13Load.png");
//			//loadingTexture14  = new TextureInfo("/Application/textures/LoadingScreens/Level13Load.png");
//			//loadingTexture15  = new TextureInfo("/Application/textures/LoadingScreens/Level13Load.png");
//			//loadingTexture16  = new TextureInfo("/Application/textures/LoadingScreens/Level13Load.png");
//			//loadingTexture17  = new TextureInfo("/Application/textures/LoadingScreens/Level0Load.png");
//			//loadingTexture18	= new TextureInfo("/Application/textures/LoadingScreens/Level13Load.png");
//			//loadingTexture19  = new TextureInfo("/Application/textures/LoadingScreens/Level13Load.png");
//			//loadingTexture20  = new TextureInfo("/Application/textures/LoadingScreens/Level13Load.png");
//			//loadingTexture21  = new TextureInfo("/Application/textures/LoadingScreens/Level13Load.png");
//			//loadingTexture22  = new TextureInfo("/Application/textures/LoadingScreens/Level13Load.png");
//			//loadingTexture23  = new TextureInfo("/Application/textures/LoadingScreens/Level13Load.png");
//			//loadingTexture24  = new TextureInfo("/Application/textures/LoadingScreens/Level13Load.png");
//			//loadingTexture25  = new TextureInfo("/Application/textures/LoadingScreens/Level13Load.png");
//			//loadingTexture26  = new TextureInfo("/Application/textures/LoadingScreens/Level13Load.png");

            textureInfo     = AppMain.loadingTexture0;
            sprite          = new SpriteUV();
            sprite          = new SpriteUV(textureInfo);
            sprite.Quad.S   = textureInfo.TextureSizef;
            sprite.Position = new Vector2(-5000.0f, -5000.0f);
            sprite.CenterSprite(new Vector2(0.5f, 0.5f));

            loadingLabel           = new Sce.PlayStation.HighLevel.UI.Label();
            loadingLabel.X         = 804.0f;
            loadingLabel.Y         = 503.0f;
            loadingLabel.Text      = "Loading...";
            loadingLabel.TextColor = new UIColor(0.0f, 0.0f, 0.0f, 1.0f);
            uiScene.RootWidget.AddChildLast(loadingLabel);

            levelLabel           = new Sce.PlayStation.HighLevel.UI.Label();
            levelLabel.X         = 15.0f;
            levelLabel.Y         = 503.0f;
            levelLabel.Text      = "";
            levelLabel.TextColor = new UIColor(1.0f, 1.0f, 1.0f, 1.0f);
            //levelLabel.Font = new UIFont(FontAlias.System, 32, FontStyle.Regular);
            uiScene.RootWidget.AddChildLast(levelLabel);

            loadingSymbol = new BusyIndicator(true);
            loadingSymbol.SetPosition(910, 495);
            loadingSymbol.SetSize(48, 48);
            loadingSymbol.Anchors = Anchors.Height | Anchors.Width;
            uiScene.RootWidget.AddChildLast(loadingSymbol);
            loadingSymbol.Start();

            readyButton = new Button();
            readyButton.SetPosition(860, 490);
            readyButton.Text = "PLAY";
            readyButton.SetSize(88, 48);
            readyButton.BackgroundFilterColor = new UIColor(255.0f, 255.0f, 0.0f, 1.0f);
            readyButton.ButtonAction         += HandleButtonAction;
            readyButton.Visible = false;
            uiScene.RootWidget.AddChildLast(readyButton);

            readyButton2 = new Button();
            readyButton2.SetPosition(190, 450);
            readyButton2.Text = "JOIN X";
            readyButton2.SetSize(88, 48);
            readyButton2.BackgroundFilterColor = new UIColor(255.0f, 255.0f, 0.0f, 1.0f);
            readyButton2.ButtonAction         += HandleButtonAction;
            readyButton2.Visible = false;
            uiScene.RootWidget.AddChildLast(readyButton2);

            scene.AddChild(sprite);
            UISystem.SetScene(uiScene);

            startBox.Min = new Vector2(sprite.Position.X + loadingLabel.X - 500, sprite.Position.Y + loadingLabel.Y - 500);
            startBox.Max = new Vector2(sprite.Position.X + loadingLabel.X + 500, sprite.Position.Y + loadingLabel.Y + 500);
        }
Example #15
0
        public void Initialize()
        {
            //graphics = new GraphicsContext();
            //UISystem.Initialize(graphics);
            Console.WriteLine("---- game scene -----");

            ImageRect rectScreen = AppMain.graphics.Screen.Rectangle;
            generator = new Random ();

            dots = new List<SimpleSprite> ();

            //dots_2 = new List<SimpleSprite> ();
            hits = new List<Hits> ();
            //creating texture2D in prep for the Simple Sprites
            //texture = new Texture2D ("/Application/resources/world.png", false);
            texture2 = new Texture2D ("/Application/resources/Bomb_mini.png", false);
            texture2_left = new Texture2D("/Application/resources/Bomb_mini_left.png", false);
            texture2_right = new Texture2D("/Application/resources/Bomb_mini_right.png", false);
            texture3 = new Texture2D ("/Application/resources/dot_1.png", false);
            Atlanta = new Texture2D ("/Application/resources/Atlanta.png", false);
            Paris_1 = new Texture2D ("/Application/resources/Paris_01.png", false);
            Paris_2 = new Texture2D ("/Application/resources/Paris_02.png", false);
            Paris_3 = new Texture2D ("/Application/resources/Paris_03.png", false);
            Paris_4 = new Texture2D ("/Application/resources/Paris_04.png", false);
            Atlanta_01 = new Texture2D("/Application/resources/Atlanta_01.png", false);
            Atlanta_02 = new Texture2D("/Application/resources/Atlanta_02.png", false);
            Atlanta_03 = new Texture2D("/Application/resources/Atlanta_03.png", false);
            Atlanta_04 = new Texture2D("/Application/resources/Atlanta_04.png", false);
            LA_01 = new Texture2D("/Application/resources/LA_01.png", false);
            LA_02 = new Texture2D("/Application/resources/LA_02.png", false);
            LA_03 = new Texture2D("/Application/resources/LA_03.png", false);
            LA_04 = new Texture2D("/Application/resources/LA_04.png", false);
            NYC_01= new Texture2D("/Application/resources/NYC_01.png", false);
            NYC_02= new Texture2D("/Application/resources/NYC_02.png", false);
            NYC_03= new Texture2D("/Application/resources/NYC_03.png", false);
            NYC_04= new Texture2D("/Application/resources/NYC_04.png", false);
            LosAngeles = new Texture2D ("/Application/resources/LA.png", false);
            NewYork = new Texture2D ("/Application/resources/NYC.png", false);
            particle_Tex = new Texture2D ("/Application/resources/fire_particle.png", false);
            skyline_1_fire = new Texture2D ("/Application/resources/Paris_01_hit.png", false);
            skyline_2_fire = new Texture2D ("/Application/resources/Paris_02_hit.png", false);
            skyline_3_fire = new Texture2D ("/Application/resources/Paris_03_hit.png", false);
            skyline_4_fire = new Texture2D ("/Application/resources/Paris_04_hit.png", false);
            explosionPic = new Texture2D("/Application/resources/GraySmoke.png",false);

            //create array to put different player maps in.
            SimpleSprite[] skylines = new SimpleSprite[]
            {
                ATL1 = new SimpleSprite (AppMain.graphics, Atlanta_01),//0
                paris_1 = new SimpleSprite (AppMain.graphics, Paris_1),//1
                LA = new SimpleSprite (AppMain.graphics, LA_01),
                NYC = new SimpleSprite (AppMain.graphics, NYC_01),
                ATL = new SimpleSprite (AppMain.graphics, Atlanta_01),
            };

            for (int s = 0; s <= skylines.Length; ++s) {
                if (s == Convert.ToInt32 (ID)) {

                    play_Sky_Line_1 = skylines [s];
                    play_Sky_Line_1.Position.X = 0;
                    play_Sky_Line_1.Position.Y = 0;

                }
                if (play_Sky_Line_1 == skylines [1]) {
                    play_Sky_Line_2 = new SimpleSprite (AppMain.graphics, Paris_2);
                    play_Sky_Line_3 = new SimpleSprite (AppMain.graphics, Paris_3);
                    play_Sky_Line_4 = new SimpleSprite (AppMain.graphics, Paris_4);
                }
                if (play_Sky_Line_1 == skylines [2]) {
                    play_Sky_Line_2 = new SimpleSprite (AppMain.graphics, LA_02);
                    play_Sky_Line_3 = new SimpleSprite (AppMain.graphics, LA_03);
                    play_Sky_Line_4 = new SimpleSprite (AppMain.graphics, LA_04);
                }
                if (play_Sky_Line_1 == skylines [3]) {
                    play_Sky_Line_2 = new SimpleSprite (AppMain.graphics, NYC_02);
                    play_Sky_Line_3 = new SimpleSprite (AppMain.graphics, NYC_03);
                    play_Sky_Line_4 = new SimpleSprite (AppMain.graphics, NYC_04);
                }
                if (play_Sky_Line_1 == skylines [4]) {
                    play_Sky_Line_2 = new SimpleSprite (AppMain.graphics, Atlanta_02);
                    play_Sky_Line_3 = new SimpleSprite (AppMain.graphics, Atlanta_03);
                    play_Sky_Line_4 = new SimpleSprite (AppMain.graphics, Atlanta_04);
                }
                //if(skylines[s] == LA_1)
                //{//
                //play_Sky_Line_2 = skylines [LA_2];
                //play_Sky_Line_3 = skylines [LA_3];
                //play_Sky_Line_4 = skylines [LA_4];
                //}

            }
            play_Sky_Line_2.Position.X = 240;
            play_Sky_Line_2.Position.Y = 0;
            play_Sky_Line_3.Position.X = 480;
            play_Sky_Line_3.Position.Y = 0;
            play_Sky_Line_4.Position.X = 720;
            play_Sky_Line_4.Position.Y = 0;
            skyline_1 = new Rectangle (0, 410, Paris_1.Width, 134);
            //skyline_2 = new Rectangle(240, 410, Paris_2.Width, 134);
            //skyline_3 = new Rectangle(480, 410, Paris_3.Width, 134);
            //skyline_4 = new Rectangle(720, 410, Paris_4.Width, 134);

            //World = new SimpleSprite (AppMain.graphics, texture);
            Fire_skyline_1 = new SimpleSprite (AppMain.graphics, skyline_1_fire);
            Fire_skyline_2 = new SimpleSprite (AppMain.graphics, skyline_2_fire);
            Fire_skyline_3 = new SimpleSprite (AppMain.graphics, skyline_3_fire);
            Fire_skyline_4 = new SimpleSprite (AppMain.graphics, skyline_4_fire);
            yellow_Dot = new SimpleSprite (AppMain.graphics, texture3);
            red_Dot = new SimpleSprite (AppMain.graphics, texture2);
            particle = new SimpleSprite (AppMain.graphics, particle_Tex);
            spriteArray [0] = red_Dot;
            spriteArray [1] = yellow_Dot;

            timeCount = new Sce.PlayStation.HighLevel.UI.Label();
            score = new Sce.PlayStation.HighLevel.UI.Label();
            labelOfScore = new Sce.PlayStation.HighLevel.UI.Label();
            labelSetting(timeCount,                    //time count
                         "30",
                         960/2 - 20,
                         0,
                         150,
                         100,
                         32,
                         FontStyle.Regular,
                         new UIColor(0, 0, 0, 255));
            timer = new System.Diagnostics.Stopwatch();//timer

            labelSetting(score,                       //score
                         "0",
                         960 - 100,
                         0,
                         150,
                         100,
                         20,
                         FontStyle.Regular,
                         new UIColor(0, 0, 0, 255));

            labelSetting(labelOfScore,                //score board
                         "Score: ",
                         960 - 200,
                         0,
                         150,
                         100,
                         20,
                         FontStyle.Regular,
                         new UIColor(0, 0, 0, 255));

            //heath bar -- saparate to 5 parts
            _uiScene = new Sce.PlayStation.HighLevel.UI.Scene();
            ImageBox healthIcon = new ImageBox();
            healthIcon.Image = new ImageAsset("/Application/resources/shield-grey.png");
            healthIcon.PivotType = PivotType.MiddleCenter;
            healthIcon.Width = healthIcon.Image.Width/4.5f;
            healthIcon.Height = healthIcon.Image.Height/4.5f;
            healthIcon.SetPosition(35,40);

            healthbar_01 = new ImageBox();
            healthbar_01.Image = new ImageAsset("/Application/resources/red-rectangle.jpg");
            healthbar_01.PivotType = PivotType.MiddleCenter;
            healthbar_01.Width = healthbar_01.Image.Width/4.5f;
            healthbar_01.Height = healthbar_01.Image.Height/4.5f;
            healthbar_01.SetPosition(100,40);

            healthbar_02 = new ImageBox();
            healthbar_02.Image = new ImageAsset("/Application/resources/red-rectangle.jpg");
            healthbar_02.PivotType = PivotType.MiddleCenter;
            healthbar_02.Width = healthbar_02.Image.Width/4.5f;
            healthbar_02.Height = healthbar_02.Image.Height/4.5f;
            healthbar_02.SetPosition(155,40);

            healthbar_03 = new ImageBox();
            healthbar_03.Image = new ImageAsset("/Application/resources/red-rectangle.jpg");
            healthbar_03.PivotType = PivotType.MiddleCenter;
            healthbar_03.Width = healthbar_03.Image.Width/4.5f;
            healthbar_03.Height = healthbar_03.Image.Height/4.5f;
            healthbar_03.SetPosition(210,40);

            healthbar_04 = new ImageBox();
            healthbar_04.Image = new ImageAsset("/Application/resources/red-rectangle.jpg");
            healthbar_04.PivotType = PivotType.MiddleCenter;
            healthbar_04.Width = healthbar_04.Image.Width/4.5f;
            healthbar_04.Height = healthbar_04.Image.Height/4.5f;
            healthbar_04.SetPosition(265,40);

            _uiScene.RootWidget.AddChildLast(timeCount);
            _uiScene.RootWidget.AddChildLast(score);
            _uiScene.RootWidget.AddChildLast(healthIcon);
            _uiScene.RootWidget.AddChildLast(healthbar_01);
            _uiScene.RootWidget.AddChildLast(healthbar_02);
            _uiScene.RootWidget.AddChildLast(healthbar_03);
            _uiScene.RootWidget.AddChildLast(healthbar_04);
            _uiScene.RootWidget.AddChildLast(labelOfScore);
            UISystem.SetScene(_uiScene); // create menu scene
        }
Example #16
0
        public HighScoreScene(int highscore)
        {
            m_highscore = highscore;

            this.Camera.SetViewFromViewport();
            Sce.PlayStation.HighLevel.UI.Panel dialog = new Panel();
            dialog.Width  = Director.Instance.GL.Context.GetViewport().Width;
            dialog.Height = Director.Instance.GL.Context.GetViewport().Height;

            ImageBox ib = new ImageBox();

            ib.Width  = dialog.Width;
            ib.Image  = new ImageAsset("/Application/images/title.png", false);
            ib.Height = dialog.Height;
            ib.SetPosition(0.0f, 0.0f);

            // editable text box parameters
            editTextBox.Name   = "editText";
            editTextBox.Text   = "You got a new high score, Enter your name (do not enter ',' or spaces)";
            editTextBox.Width  = 400;
            editTextBox.Height = 100;
            editTextBox.SetPosition(dialog.Width / 2.0f - editTextBox.Width / 2.0f, 220.0f);

            // retrieve highscores
            // retrieve highscore from server
            Client m_client = new Client(new string[1] {
                "Highscorers1234567890"
            });

            string[] highScorers     = new string[10];
            string[] sectionsMessage = m_client.responseMessage.Split(' ');
            highScorers = sectionsMessage[sectionsMessage.Length - 1].Split(',');

            string labelText = "Highscores" + Environment.NewLine +
                               highScorers[0] + ": " + highScorers[1] + Environment.NewLine +
                               highScorers[2] + ": " + highScorers[3] + Environment.NewLine +
                               highScorers[4] + ": " + highScorers[5] + Environment.NewLine +
                               highScorers[6] + ": " + highScorers[7] + Environment.NewLine +
                               highScorers[8] + ": " + highScorers[9] + Environment.NewLine;

            lb.Label highscores = new lb.Label();
            highscores.Name   = "highscores";
            highscores.Text   = labelText;
            highscores.Width  = 300;
            highscores.Height = 400;
            highscores.Alpha  = 0.8f;
            highscores.SetPosition(50, 220.0f);

            // when text box changed - fire event ( change player name and replace scene )
            editTextBox.TextChanged += OnTextEdit;

            dialog.AddChildLast(ib);
            dialog.AddChildLast(editTextBox);
            dialog.AddChildLast(highscores);

            m_uiScene = new Sce.PlayStation.HighLevel.UI.Scene();
            m_uiScene.RootWidget.AddChildLast(dialog);
            m_uiScene.RootWidget.AddChildLast(highscores);

            UISystem.SetScene(m_uiScene);
            Scheduler.Instance.ScheduleUpdateForTarget(this, 0, false);
        }
        public OptionScene()
        {
            Console.WriteLine("---- option scene ----");
            this.Camera.SetViewFromViewport();

            Sce.PlayStation.HighLevel.UI.Panel panel = new Panel();//create panel
            panel.Width = Director.Instance.GL.Context.GetViewport().Width;
            panel.Height = Director.Instance.GL.Context.GetViewport().Height;

            Sce.PlayStation.HighLevel.UI.Label title_label = new Sce.PlayStation.HighLevel.UI.Label();//title label
            Sce.PlayStation.HighLevel.UI.Label music_label = new Sce.PlayStation.HighLevel.UI.Label();//music label
            Sce.PlayStation.HighLevel.UI.Label sound_label = new Sce.PlayStation.HighLevel.UI.Label();//sound label

            labelSetting(title_label,                   //label name
                         "Option",   					//label content
                         panel.Width/10,				//x position
                         10,							//y position
                         250,							//x size
                         100,							//y size
                         64,							//font size
                         FontStyle.Bold,				//font style
                         new UIColor(0, 255, 0, 255));	//font color

            labelSetting(music_label,
                         "Music :",
                         panel.Width/7,
                         panel.Height/5,
                         150,
                         100,
                         32,
                         FontStyle.Regular,
                         new UIColor(0, 255, 0, 255));

            labelSetting(sound_label,
                         "Sound :",
                         panel.Width/7,
                         panel.Height/3f,
                         150,
                         100,
                         32,
                         FontStyle.Regular,
                         new UIColor(0, 255, 0, 255));

            Sce.PlayStation.HighLevel.UI.CheckBox checkMusicButton = new CheckBox(); //music
            checkMusicButton.Checked = isMusicCheckboxChanged;
            checkMusicButton.SetPosition(panel.Width/3,panel.Height/4.5f);
            checkMusicButton.SetSize(50,50);
            checkMusicButton.CheckedChanged += HandleCheckMusicButtonCheckedChanged;

            sliderForMusic = new Sce.PlayStation.HighLevel.UI.Slider();
            sliderForMusic.SetPosition(panel.Width/2f,panel.Height/4.5f);
            sliderForMusic.SetSize(200,50);
            sliderForMusic.MinValue = 0;
            sliderForMusic.MaxValue = 1;
            sliderForMusic.Value = 0.5f;
            sliderForMusic.ValueChanging += HandleSliderForMusicValueChanging;//end music

            Sce.PlayStation.HighLevel.UI.CheckBox checkSoundButton = new CheckBox();//sound
            checkSoundButton.Checked = isSoundCheckboxChanged;
            checkSoundButton.SetPosition(panel.Width/3,panel.Height/2.5f);
            checkSoundButton.SetSize(50,50);
            checkSoundButton.CheckedChanged += HandleCheckSoundButtonCheckedChanged;

            sliderForSound = new Sce.PlayStation.HighLevel.UI.Slider();
            sliderForSound.SetPosition(panel.Width/2f,panel.Height/2.5f);
            sliderForSound.SetSize(200,50);
            sliderForSound.MinValue = 0;
            sliderForSound.MaxValue = 1;
            sliderForSound.Value = Support.SoundSystem.volumOfSound;
            sliderForSound.ValueChanging += HandleSliderForSoundValueChanging;//end sound

            Button buttonUI1 = new Button(); //buttons
            buttonUI1.Name = "go back";
            buttonUI1.Text = "go back";
            buttonUI1.Width = 250;
            buttonUI1.Height = 50;
            buttonUI1.Alpha = 0.8f;
            buttonUI1.SetPosition(panel.Width/5,panel.Height - 100);
            buttonUI1.TouchEventReceived += (sender, e) => {
                Support.SoundSystem.Instance.PlayNoClobber("ButtonClick.wav");
                Director.Instance.ReplaceScene(new MenuScene());
            };

            Button buttonUI2 = new Button();
            buttonUI2.Name = "reset";
            buttonUI2.Text = "reset";
            buttonUI2.Width = 250;
            buttonUI2.Height = 50;
            buttonUI2.Alpha = 0.8f;
            buttonUI2.SetPosition(panel.Width/2f,panel.Height - 100);
            buttonUI2.TouchEventReceived += (sender, e) => {
                Support.SoundSystem.Instance.PlayNoClobber("ButtonClick.wav");
            };

            _uiScene = new Sce.PlayStation.HighLevel.UI.Scene();
            panel.AddChildLast(title_label);//add widgets in panel
            panel.AddChildLast(music_label);
            panel.AddChildLast(sound_label);
            panel.AddChildLast(checkMusicButton);
            panel.AddChildLast(checkSoundButton);
            panel.AddChildLast(sliderForMusic);
            panel.AddChildLast(sliderForSound);
            panel.AddChildLast(buttonUI1);
            panel.AddChildLast(buttonUI2);

            _uiScene.RootWidget.AddChildLast(panel);//add panel in rootwidget
            UISystem.SetScene(_uiScene); //add rootwidget in scene
            Scheduler.Instance.ScheduleUpdateForTarget(this,0,false); //run the loop
        }
Example #18
0
        private void addUI()
        {
            Panel panel = new Panel();
            panel.Width = Director.Instance.GL.Context.GetViewport().Width;
            panel.Height = Director.Instance.GL.Context.GetViewport().Height;
            ImageBox backgroundImageBox = new ImageBox();
            backgroundImageBox.Width = panel.Width;
            backgroundImageBox.Height = panel.Height;
            backgroundImageBox.SetPosition(0.0f,0.0f);
            backgroundImageBox.Image = new ImageAsset(backgroundImagePath, false);

            Button playButton = new Button();
            playButton.Name = "Play Game";
            playButton.Text = "Play Game";
            playButton.Width = 300;
            playButton.Height = 50;
            playButton.Alpha = 0.8f;
            playButton.SetPosition(panel.Width/2 - 150, 200.0f);
            playButton.TouchEventReceived += (sender, e) => {
                Director.Instance.ReplaceScene(new MainGameScene());
            };

            panel.AddChildLast(backgroundImageBox);
            panel.AddChildLast(playButton);

            this.uiScene = new Sce.PlayStation.HighLevel.UI.Scene();
            this.uiScene.RootWidget.AddChildLast(panel);
            UISystem.SetScene(this.uiScene);
        }
Example #19
0
        public static void Initialize()
        {
            graphics = new GraphicsContext();

            // Initialize UI Toolkit
            UISystem.Initialize(graphics);
            screenWidth  = UISystem.FramebufferWidth;
            screenHeight = UISystem.FramebufferHeight;

            // Create scene
            Scene scene = new Sce.PlayStation.HighLevel.UI.Scene();

            #region Big Bang - Fun with Flags - Intro sound


            #endregion
            #region Scotland Flag and sounds
            ImageBox scotlandFlag = new ImageBox();
            scotlandFlag.Image          = new ImageAsset("/Application/flags/scotland.png");
            scotlandFlag.ImageScaleType = ImageScaleType.AspectInside;

            scotlandFlag.Width  = scotlandFlag.Image.Width / 2;
            scotlandFlag.Height = scotlandFlag.Image.Height / 2;

            scotlandFlag.X = screenWidth * 0.25f - (scotlandFlag.Width / 2);
            scotlandFlag.Y = screenHeight * 0.25f - (scotlandFlag.Height / 2);

            scotlandRect = new Rectangle(scotlandFlag.X, scotlandFlag.Y, scotlandFlag.Width, scotlandFlag.Height);
            /***********************sounds***************************/


            #endregion
            scene.RootWidget.AddChildLast(scotlandFlag);

            #region England Flag
            ImageBox englandFlag = new ImageBox();
            englandFlag.Image          = new ImageAsset("/Application/flags/england.png");
            englandFlag.ImageScaleType = ImageScaleType.AspectInside;

            englandFlag.Width  = englandFlag.Image.Width / 2;
            englandFlag.Height = englandFlag.Image.Height / 2;

            englandFlag.X = screenWidth * 0.75f - (englandFlag.Width / 2);
            englandFlag.Y = screenHeight * 0.25f - (englandFlag.Height / 2);

            englandRect = new Rectangle(englandFlag.X, englandFlag.Y, englandFlag.Width, englandFlag.Height);

            #endregion
            scene.RootWidget.AddChildLast(englandFlag);

            #region Northern Ireland Flag
            ImageBox n_irelandFlag = new ImageBox();
            n_irelandFlag.Image          = new ImageAsset("/Application/flags/n_ireland.png");
            n_irelandFlag.ImageScaleType = ImageScaleType.AspectInside;

            n_irelandFlag.Width  = n_irelandFlag.Image.Width / 2;
            n_irelandFlag.Height = n_irelandFlag.Image.Height / 2;

            n_irelandFlag.X = screenWidth * 0.25f - (n_irelandFlag.Width / 2);
            n_irelandFlag.Y = screenHeight * 0.75f - (n_irelandFlag.Height / 2);

            n_irelandRect = new Rectangle(n_irelandFlag.X, n_irelandFlag.Y, n_irelandFlag.Width, n_irelandFlag.Height);

            #endregion
            scene.RootWidget.AddChildLast(n_irelandFlag);

            #region Wales Flag
            ImageBox walesFlag = new ImageBox();
            walesFlag.Image          = new ImageAsset("/Application/flags/wales.png");
            walesFlag.ImageScaleType = ImageScaleType.AspectInside;

            walesFlag.Width  = walesFlag.Image.Width / 2;
            walesFlag.Height = walesFlag.Image.Height / 2;

            walesFlag.X = screenWidth * 0.75f - (walesFlag.Width / 2);
            walesFlag.Y = screenHeight * 0.75f - (walesFlag.Height / 2);

            walesRect = new Rectangle(walesFlag.X, walesFlag.Y, walesFlag.Width, walesFlag.Height);
            #endregion
            scene.RootWidget.AddChildLast(walesFlag);
            // Set scene
            UISystem.SetScene(scene, null);

            #region Instantiate and Setup audio
            Bgm funWithFlags = new Bgm("/Application/sounds/funWithFlags.mp3");
            mp3Player = funWithFlags.CreatePlayer();
            #endregion
            /*************Play starting mp3 - funWithFlag s***********/
            mp3Player.Play();
        }
        public TitleScreen(Sce.PlayStation.HighLevel.GameEngine2D.Scene scene, Sce.PlayStation.HighLevel.UI.Scene uiScene) : base(scene)
        {
            scene1 = scene;

            textureInfo     = new TextureInfo("/Application/textures/GravityNinja.png");
            sprite          = new SpriteUV();
            sprite          = new SpriteUV(textureInfo);
            sprite.Quad.S   = textureInfo.TextureSizef;
            sprite.Position = new Vector2(0.0f, 0.0f);

            playTexture         = new TextureInfo("/Application/textures/play.png");
            playSelectTexture   = new TextureInfo("/Application/textures/playSelected.png");
            playSprite          = new SpriteUV();
            playSprite          = new SpriteUV(playSelectTexture);
            playSprite.Quad.S   = playTexture.TextureSizef * 0.7f;
            playSprite.Position = new Vector2(Director.Instance.GL.Context.GetViewport().Width *0.78f - (playTexture.TextureSizef.X / 2), 200);

            controlTexture         = new TextureInfo("/Application/textures/cog.png");
            controlSprite          = new SpriteUV();
            controlSprite          = new SpriteUV(controlTexture);
            controlSprite.Quad.S   = controlTexture.TextureSizef * 0.05f;
            controlSprite.Position = new Vector2(10.0f, 10.0f);

            playBox.Min = playSprite.Position;
            playBox.Max = playSprite.Position + playSprite.TextureInfo.TextureSizef;

            controlsBox.Min = controlSprite.Position;
            controlsBox.Max = controlSprite.Position + controlSprite.TextureInfo.TextureSizef * 0.05f;

            label = new Sce.PlayStation.HighLevel.UI.Label();
            label.SetPosition(10, 90);
            label.Text = "Awaiting Input...";

            backButton = new Button();
            backButton.SetPosition(10, 140);
            backButton.SetSize(100, 50);
            backButton.Text          = "Back";
            backButton.ButtonAction += HandleButtonAction;

            inputButton = new Button();
            inputButton.SetPosition(380, 10);
            inputButton.SetSize(100, 50);
            inputButton.Text          = "Enter";
            inputButton.ButtonAction += HandleInputAction;

            command = new EditableText();
            command.SetPosition(10, 10);
            command.Text = "Enter Command";

            dialog = new Dialog();
            dialog.SetSize(500, 200);
            dialog.ShowEffect = new BunjeeJumpEffect(dialog, 0.4f);
            dialog.HideEffect = new TiltDropEffect();
            dialog.AddChildFirst(label);
            dialog.AddChildFirst(command);
            dialog.AddChildFirst(backButton);
            dialog.AddChildFirst(inputButton);

            scene.AddChild(sprite);
            scene.AddChild(playSprite);
            scene.AddChild(controlSprite);

            UISystem.SetScene(uiScene);
        }
        public LevelSelectScreen(Sce.PlayStation.HighLevel.GameEngine2D.Scene scene, Sce.PlayStation.HighLevel.UI.Scene uiScene, int maxLevel) : base(scene)
        {
            highestUnlockedLevel = maxLevel;
            textureInfo          = new TextureInfo("/Application/textures/LevelSelectBackground.png");
            sprite          = new SpriteUV();
            sprite          = new SpriteUV(textureInfo);
            sprite.Quad.S   = textureInfo.TextureSizef;
            sprite.Position = new Vector2(0.0f, 0.0f);
//
//			loadingTexture0     = AppMain.loadingTexture0;
//			loadingTexture1     = AppMain.loadingTexture1;
//			loadingTexture2     = AppMain.loadingTexture2;
//			loadingTexture3     = AppMain.loadingTexture3;
//			loadingTexture4     = AppMain.loadingTexture4;
//			loadingTexture5     = AppMain.loadingTexture5;
//			loadingTexture6     = AppMain.loadingTexture6;
//			loadingTexture7     = AppMain.loadingTexture7;
//			loadingTexture8     = AppMain.loadingTexture8;
//			loadingTexture9     = new TextureInfo("/Application/textures/LoadingScreens/Level9Load.png");
//			loadingTexture10    = new TextureInfo("/Application/textures/LoadingScreens/Level10Load.png");
//			loadingTexture11    = new TextureInfo("/Application/textures/LoadingScreens/Level11Load.png");
//			loadingTexture12    = new TextureInfo("/Application/textures/LoadingScreens/Level12Load.png");
//			loadingTexture13    = new TextureInfo("/Application/textures/LoadingScreens/Level13Load.png");
//			//loadingTexture14  = new TextureInfo("/Application/textures/LoadingScreens/Level13Load.png");
//			//loadingTexture15  = new TextureInfo("/Application/textures/LoadingScreens/Level13Load.png");
//			//loadingTexture16  = new TextureInfo("/Application/textures/LoadingScreens/Level13Load.png");
//			//loadingTexture17  = new TextureInfo("/Application/textures/LoadingScreens/Level13Load.png");//
//			//loadingTexture18	= new TextureInfo("/Application/textures/LoadingScreens/Level13Load.png");
//			//loadingTexture19  = new TextureInfo("/Application/textures/LoadingScreens/Level13Load.png");
//			//loadingTexture20  = new TextureInfo("/Application/textures/LoadingScreens/Level13Load.png");
//			//loadingTexture21  = new TextureInfo("/Application/textures/LoadingScreens/Level13Load.png");
//			//loadingTexture22  = new TextureInfo("/Application/textures/LoadingScreens/Level13Load.png");
//			//loadingTexture23  = new TextureInfo("/Application/textures/LoadingScreens/Level13Load.png");
//			//loadingTexture24  = new TextureInfo("/Application/textures/LoadingScreens/Level13Load.png");
//			//loadingTexture25  = new TextureInfo("/Application/textures/LoadingScreens/Level13Load.png");
//			//loadingTexture26  = new TextureInfo("/Application/textures/LoadingScreens/Level13Load.png");

//			Sequence seq = new Sequence();
//			TintTo fadeIn = new TintTo (new Vector4 (1.0f, 1.0f, 1.0f, 1.0f), 1.0f);
//			TintTo fadeOut = new TintTo (new Vector4 (1.0f, 1.0f, 1.0f, 0.0f), 1.0f);
//			fadeIn.Tween = new DTween(f => f);
//			fadeOut.Tween = new DTween(f => f);
//			seq.Add(fadeIn);
//			seq.Add(fadeOut);
//			RepeatForever flash = new RepeatForever();
//			flash.InnerAction = seq;

            levelButtons = new Button[numOfLevels];

            for (int i = 0; i < numOfLevels; i++)
            {
                levelButtons[i]               = new Button();
                levelButtons[i].Text          = i.ToString();
                levelButtons[i].Name          = i.ToString();
                levelButtons[i].ButtonAction += HandleButtonAction;
                if (i <= 8)
                {
                    levelButtons[i].SetPosition(108f * i + 18, 180f);
                }
                if (i > 8 && i <= 17)
                {
                    levelButtons[i].SetPosition(108f * (i - 9) + 18, 280f);
                }
                if (i > 17 && i <= 26)
                {
                    levelButtons[i].SetPosition(108f * (i - 18) + 18, 380f);
                }
                if (i < highestUnlockedLevel)
                {
                    levelButtons[i].BackgroundFilterColor = new UIColor(0.0f, 255.0f, 0.0f, 1.0f);
                }
                if (i == highestUnlockedLevel)
                {
                    levelButtons[i].BackgroundFilterColor = new UIColor(0.0f, 191.0f, 255.0f, 1.0f);
                }

                levelButtons[i].SetSize(65, 65);
                uiScene.RootWidget.AddChildFirst(levelButtons[i]);
            }

            backButton = new Button();
            backButton.SetPosition(10, 485);
            backButton.SetSize(100, 50);
            backButton.Text = "BACK";
            backButton.BackgroundFilterColor = new UIColor(255.0f, 255.0f, 0.0f, 1.0f);
            backButton.ButtonAction         += HandleBackButtonAction;
            uiScene.RootWidget.AddChildLast(backButton);

            scene.AddChild(sprite);
            UISystem.SetScene(uiScene);
        }
Example #22
0
        public void Initialize()
        {
            Sce.PlayStation.HighLevel.UI.Panel dialog = new Panel();//create panel
            dialog.Width = 960;//only for vita
            dialog.Height = 544;

            ImageBox ib = new ImageBox(); //set background images
            ib.Width = dialog.Width;
            ib.Image = new ImageAsset("/Application/resources/lose.png",false);
            ib.Height = dialog.Height;
            ib.SetPosition(0.0f,0.0f);

            Button buttonUI1 = new Button(); //set buttons positions
            buttonUI1.Name = "replay";
            buttonUI1.Text = "replay";
            buttonUI1.Width = 250;
            buttonUI1.Height = 50;
            buttonUI1.Alpha = 0.8f;
            buttonUI1.SetPosition(dialog.Width/15,dialog.Height - 100);
            buttonUI1.TouchEventReceived += (sender, e) => {
                Support.SoundSystem.Instance.Play("ButtonClick.wav");
                Director.Instance.ReplaceScene(new GameScene());
            };

            Button buttonUI2 = new Button();
            buttonUI2.Name = "home";
            buttonUI2.Text = "home";
            buttonUI2.Width = 250;
            buttonUI2.Height = 50;
            buttonUI2.Alpha = 0.8f;
            buttonUI2.SetPosition(dialog.Width/2.7f,dialog.Height - 100);
            buttonUI2.TouchEventReceived += (sender, e) => {
                Support.SoundSystem.Instance.Play("ButtonClick.wav");
                Director.Instance.ReplaceScene(new MenuScene());
            };

            Sce.PlayStation.HighLevel.UI.Label scoreLabel = new Sce.PlayStation.HighLevel.UI.Label();
            labelSetting(scoreLabel,                    				//total score
                         "Total Score: " + GameScene.totalScore,
                         690,
                         0,
                         300,
                         100,
                         30,
                         FontStyle.Regular,
                         new UIColor(255, 0, 0, 255));

            dialog.AddChildLast(ib);
            dialog.AddChildLast(buttonUI1);
            dialog.AddChildLast(buttonUI2);
            dialog.AddChildLast(scoreLabel);

            _uiScene = new Sce.PlayStation.HighLevel.UI.Scene();
            _uiScene.RootWidget.AddChildLast(dialog);
            UISystem.SetScene(_uiScene); // create menu scene
        }
        public MenuScene()
        {
            this.Camera.SetViewFromViewport();
            dialog = new Panel();
            dialog.Name = "backgroundPanel";
            dialog.Width = Director.Instance.GL.Context.GetViewport().Width;
            dialog.Height = Director.Instance.GL.Context.GetViewport().Height;
            dialog.SetPosition(0,0);
            dialog.SetSize(960,544);
            dialog.Anchors = Anchors.Top | Anchors.Bottom | Anchors.Left | Anchors.Right;
            dialog.Visible = true;

            // BUTTON 1
            buttonUI1 = new Button();
            buttonUI1.Name = "buttonUI1";
            buttonUI1.IconImage = null;
            buttonUI1.Style = ButtonStyle.Custom;
            buttonUI1.SetPosition(dialog.Width/2 - 150,250.0f);

            buttonUI1.CustomImage = new CustomButtonImageSettings()
            {
                BackgroundNormalImage = new ImageAsset("/Application/assets/images/play.png",false),
                BackgroundPressedImage = new ImageAsset("/Application/assets/images/playOver.png",false),
                BackgroundDisabledImage = new ImageAsset("/Application/assets/images/playOver.png",false),
                BackgroundNinePatchMargin = new NinePatchMargin(42, 27, 42, 27),
            };
            buttonUI1.SetPosition(356, 24);
            buttonUI1.SetSize(289, 280);
            buttonUI1.Anchors = Anchors.None;
            buttonUI1.Visible = true;

            buttonUI1.TouchEventReceived += (sender, e) =>  {
                Director.Instance.ReplaceScene(new GameScene( 0 )); // TODO Add support for starting at other levels.
            };

            // BUTTON 2
            buttonUI2 = new Button();
            buttonUI2.Name = "buttonMenu";
             // buttonUI2
            buttonUI2.IconImage = null;
            buttonUI2.Style = ButtonStyle.Custom;
            buttonUI2.CustomImage = new CustomButtonImageSettings()
            {
                BackgroundNormalImage = new ImageAsset("/Application/assets/images/instructions.png",false),
                BackgroundPressedImage = new ImageAsset("/Application/assets/images/instructionsOver.png",false),
                BackgroundDisabledImage = null,
                BackgroundNinePatchMargin = new NinePatchMargin(42, 27, 42, 27),
            };

            buttonUI2.TouchEventReceived += (sender, e) => {
            Director.Instance.ReplaceScene(new InstructionsScene());
            };

            buttonUI2.SetPosition(356, 281);
            buttonUI2.SetSize(289, 233);
            buttonUI2.Anchors = Anchors.None;
            buttonUI2.Visible = true;

            dialog.AddChildLast(buttonUI1);
            dialog.AddChildLast(buttonUI2);
            _uiScene = new Sce.PlayStation.HighLevel.UI.Scene();
            _uiScene.RootWidget.AddChildLast(dialog);
            UISystem.SetScene(_uiScene);
            Scheduler.Instance.ScheduleUpdateForTarget(this,0,false);
        }
Example #24
0
        public static void Initialize()
        {
            //Set up director and UISystem.
            Director.Initialize();
            UISystem.Initialize(Director.Instance.GL.Context);

            //Set game scene
            gameScene = new Sce.PlayStation.HighLevel.GameEngine2D.Scene();
            gameScene.Camera.SetViewFromViewport();

            //Set the ui scene.
            uiScene = new Sce.PlayStation.HighLevel.UI.Scene();
            Panel panel = new Panel();

            panel.Width  = Director.Instance.GL.Context.GetViewport().Width;
            panel.Height = Director.Instance.GL.Context.GetViewport().Height;
            uiScene.RootWidget.AddChildLast(panel);

            //Set the highscores scene.
            highscoresManager = new HighScoreManager(gameScene);
            highscoresScene   = new Sce.PlayStation.HighLevel.UI.Scene();
            Panel highscoresPanel = new Panel();

            highscoresPanel.Width  = Director.Instance.GL.Context.GetViewport().Width;
            highscoresPanel.Height = Director.Instance.GL.Context.GetViewport().Height;
            highscoresScene.RootWidget.AddChildLast(highscoresPanel);

            // Setup highscores label
            highscoresLabel        = new Sce.PlayStation.HighLevel.UI.Label();
            highscoresLabel.Height = 200.0f;
            highscoresLabel.Text   = "Retrieving Data";
            highscoresPanel.AddChildLast(highscoresLabel);
            highscoresScene.RootWidget.AddChildLast(highscoresPanel);

            // Setup ui scene labels
            scoreLabel = new Sce.PlayStation.HighLevel.UI.Label();
            scoreLabel.SetPosition(10, 8);
            int roundedScore = (int)FMath.Floor(score / 100) * 100;

            scoreLabel.Text = "Score: " + roundedScore.ToString("N0");
            panel.AddChildLast(scoreLabel);

            gameSpeedLabel = new Sce.PlayStation.HighLevel.UI.Label();
            gameSpeedLabel.SetPosition(770, 8);
            float speed = FMath.Round(moveSpeed * 10) / 10;             // round to 1dp

            gameSpeedLabel.Text = "Game Speed: " + moveSpeed.ToString("N1");
            panel.AddChildLast(gameSpeedLabel);

            soundManager = new SoundManager();

            //Create Sprite
            rTextureInfo     = new TextureInfo("/Application/textures/reset.png");
            rSprite          = new SpriteUV();
            rSprite          = new SpriteUV(rTextureInfo);
            rSprite.Quad.S   = rTextureInfo.TextureSizef;
            rSprite.Scale    = new Vector2(1.0f, 1.0f);
            rSprite.Position = new Vector2(0.0f, 0.0f);
            rSprite.CenterSprite();

            //Run the scene.
            Director.Instance.RunWithScene(gameScene, true);
            screenManager = new ScreenManager(gameScene);
        }
Example #25
0
        public MenuScene()
        {
            this.Camera.SetViewFromViewport();
            Panel dialog = new Panel();

            dialog.Width  = Director.Instance.GL.Context.GetViewport().Width;
            dialog.Height = Director.Instance.GL.Context.GetViewport().Height;

            ImageBox ib = new ImageBox();

            ib.Width  = dialog.Width;
            ib.Image  = new ImageAsset("/Application/images/title.png", false);
            ib.Height = dialog.Height;
            ib.SetPosition(0.0f, 0.0f);

            Button buttonPlay = new Button();

            buttonPlay.Name   = "buttonPlay";
            buttonPlay.Text   = "Play Game";
            buttonPlay.Width  = 300;
            buttonPlay.Height = 50;
            buttonPlay.Alpha  = 0.8f;
            buttonPlay.SetPosition(dialog.Width / 2.0f - buttonPlay.Width / 2.0f, 220.0f);
            buttonPlay.TouchEventReceived += OnButtonPlay;

            Button localMultiplayer = new Button();

            localMultiplayer.Name   = "localMultiplayer";
            localMultiplayer.Text   = "Local Multiplayer";
            localMultiplayer.Width  = 300;
            localMultiplayer.Height = 50;
            localMultiplayer.Alpha  = 0.8f;
            localMultiplayer.SetPosition(dialog.Width / 2.0f - buttonPlay.Width / 2.0f, 300.0f);
            localMultiplayer.TouchEventReceived += OnMultiplayerPlay;

            // retrieve highscores
            // retrieve highscore from server
            Client m_client = new Client(new string[1] {
                "Highscorers1234567890"
            });

            // check if server init
            if (m_client.responseMessage == "ERROR: no entries found")
            {
                m_client = new Client(new string[2] {
                    "Highscorers1234567890", "Sean,10,Bob,5,Fred,4,Will,3,Jim,1"
                });
            }

            string[] highScorers     = new string[10];
            string[] sectionsMessage = m_client.responseMessage.Split(' ');
            highScorers = sectionsMessage[sectionsMessage.Length - 1].Split(',');
            string labelText = "Highscores" + Environment.NewLine +
                               highScorers[0] + ": " + highScorers[1] + Environment.NewLine +
                               highScorers[2] + ": " + highScorers[3] + Environment.NewLine +
                               highScorers[4] + ": " + highScorers[5] + Environment.NewLine +
                               highScorers[6] + ": " + highScorers[7] + Environment.NewLine +
                               highScorers[8] + ": " + highScorers[9] + Environment.NewLine;

            lb.Label highscores = new lb.Label();
            highscores.Name   = "highscores";
            highscores.Text   = labelText;
            highscores.Width  = 300;
            highscores.Height = 400;
            highscores.Alpha  = 0.8f;
            highscores.SetPosition(50, 220.0f);

            dialog.AddChildLast(ib);
            dialog.AddChildLast(buttonPlay);
            dialog.AddChildLast(highscores);
            dialog.AddChildLast(localMultiplayer);
            m_uiScene = new Sce.PlayStation.HighLevel.UI.Scene();
            m_uiScene.RootWidget.AddChildLast(dialog);
            m_uiScene.RootWidget.AddChildLast(highscores);
            m_uiScene.RootWidget.AddChildLast(localMultiplayer);
            UISystem.SetScene(m_uiScene);
            Scheduler.Instance.ScheduleUpdateForTarget(this, 0, false);
        }