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 }
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); }