public static void Initialize()
        {
            // Set up the graphics system
            graphics = new GraphicsContext();
            UISystem.Initialize(graphics);

            // Initiliaze a new scene
            scene = new Scene();

            // Build a play button
            Button play_btn = new Button();

            play_btn.X             = 50f;
            play_btn.Y             = 50f;
            play_btn.Width         = 50f;
            play_btn.Height        = 50f;
            play_btn.ButtonAction += HandlePlay_btnButtonAction;
            CustomButtonImageSettings play_btn_bg = new CustomButtonImageSettings();
            ImageAsset play_image = new ImageAsset("play.png");

            play_btn_bg.BackgroundNormalImage   = play_image;
            play_btn_bg.BackgroundDisabledImage = play_image;
            play_btn_bg.BackgroundPressedImage  = play_image;
            play_btn.CustomImage = play_btn_bg;
            play_btn.Style       = ButtonStyle.Custom;
            // Add the button to the scene
            scene.RootWidget.AddChildFirst(play_btn);


            // Build a Pause button
            Button pause_btn = new Button();

            pause_btn.X             = 120f;
            pause_btn.Y             = 50f;
            pause_btn.Width         = 50f;
            pause_btn.Height        = 50f;
            pause_btn.ButtonAction += HandlePause_btnButtonAction;
            CustomButtonImageSettings pause_btn_bg = new CustomButtonImageSettings();
            ImageAsset pause_image = new ImageAsset("pause.png");

            pause_btn_bg.BackgroundNormalImage   = pause_image;
            pause_btn_bg.BackgroundDisabledImage = pause_image;
            pause_btn_bg.BackgroundPressedImage  = pause_image;
            pause_btn.CustomImage = pause_btn_bg;
            pause_btn.Style       = ButtonStyle.Custom;
            // Add the button to the scene
            scene.RootWidget.AddChildFirst(pause_btn);


            // Build a Stop button
            Button stop_btn = new Button();

            stop_btn.X             = 190f;
            stop_btn.Y             = 50f;
            stop_btn.Width         = 50f;
            stop_btn.Height        = 50f;
            stop_btn.ButtonAction += HandleStop_btnButtonAction;
            CustomButtonImageSettings stop_btn_bg = new CustomButtonImageSettings();
            ImageAsset stop_image = new ImageAsset("stop.png");

            stop_btn_bg.BackgroundNormalImage   = stop_image;
            stop_btn_bg.BackgroundDisabledImage = stop_image;
            stop_btn_bg.BackgroundPressedImage  = stop_image;
            stop_btn.CustomImage = stop_btn_bg;
            stop_btn.Style       = ButtonStyle.Custom;
            // Add the button to the scene
            scene.RootWidget.AddChildFirst(stop_btn);

            // Set the scene
            UISystem.SetScene(scene, null);
        }
		public static void Initialize ()
		{
			// Set up the graphics system
			graphics = new GraphicsContext ();
			UISystem.Initialize(graphics);
			
			// Initiliaze a new scene
			scene = new Scene();
			
			// Build a play button
			Button play_btn = new Button();
			play_btn.X = 50f;
			play_btn.Y = 50f;
			play_btn.Width = 50f;
			play_btn.Height = 50f;
			play_btn.ButtonAction += HandlePlay_btnButtonAction;
			CustomButtonImageSettings play_btn_bg = new CustomButtonImageSettings();
			ImageAsset play_image = new ImageAsset("play.png");
			play_btn_bg.BackgroundNormalImage = play_image;
			play_btn_bg.BackgroundDisabledImage = play_image;
			play_btn_bg.BackgroundPressedImage = play_image;
			play_btn.CustomImage = play_btn_bg;
			play_btn.Style = ButtonStyle.Custom;
			// Add the button to the scene			
			scene.RootWidget.AddChildFirst(play_btn);
			
			
			// Build a Pause button
			Button pause_btn = new Button();
			pause_btn.X = 120f;
			pause_btn.Y = 50f;
			pause_btn.Width = 50f;
			pause_btn.Height = 50f;
			pause_btn.ButtonAction += HandlePause_btnButtonAction;
			CustomButtonImageSettings pause_btn_bg = new CustomButtonImageSettings();
			ImageAsset pause_image = new ImageAsset("pause.png");
			pause_btn_bg.BackgroundNormalImage = pause_image;
			pause_btn_bg.BackgroundDisabledImage = pause_image;
			pause_btn_bg.BackgroundPressedImage = pause_image;
			pause_btn.CustomImage = pause_btn_bg;
			pause_btn.Style = ButtonStyle.Custom;
			// Add the button to the scene			
			scene.RootWidget.AddChildFirst(pause_btn);
			
			
			// Build a Stop button
			Button stop_btn = new Button();
			stop_btn.X = 190f;
			stop_btn.Y = 50f;
			stop_btn.Width = 50f;
			stop_btn.Height = 50f;
			stop_btn.ButtonAction += HandleStop_btnButtonAction;
			CustomButtonImageSettings stop_btn_bg = new CustomButtonImageSettings();
			ImageAsset stop_image = new ImageAsset("stop.png");
			stop_btn_bg.BackgroundNormalImage = stop_image;
			stop_btn_bg.BackgroundDisabledImage = stop_image;
			stop_btn_bg.BackgroundPressedImage = stop_image;
			stop_btn.CustomImage = stop_btn_bg;
			stop_btn.Style = ButtonStyle.Custom;
			// Add the button to the scene			
			scene.RootWidget.AddChildFirst(stop_btn);
			
			// Set the scene
			UISystem.SetScene(scene, null);
		}
コード例 #3
0
        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;
        }