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 MenuUI() : base() { // Set the scene title this.Title = "Menu UI"; this.Transition = new SlideTransition(); // Create title panel Panel titlePanel = new Panel(); titlePanel.Width = AppMain.ScreenWidth; // Create title text Label titleLabel = new Label(); titleLabel.Text = "Good Luck, Ebola-kun!"; titleLabel.SetPosition(AppMain.ScreenWidth * .37f, AppMain.ScreenHeight * .2f); titleLabel.Width = AppMain.ScreenWidth * .5f; titlePanel.AddChildLast(titleLabel); this.RootWidget.AddChildLast(titlePanel); // Create buttons panel Panel buttonsPanel = new Panel(); buttonsPanel.SetPosition(.0f, AppMain.ScreenHeight * .5f); // Create menu play button playButton = new Button(); playButton.ButtonAction += HandleButtonPress; playButton.IconImage = new ImageAsset("/Application/assets/play.png"); playButton.Width = playButton.Height; playButton.X = AppMain.ScreenWidth * .25f; buttonsPanel.AddChildLast(playButton); // Create menu exit button exitButton = new Button(); exitButton.ButtonAction += HandleButtonPress; exitButton.IconImage = new ImageAsset("/Application/assets/exit.png"); exitButton.Width = exitButton.Height; exitButton.X = AppMain.ScreenWidth * .5f; buttonsPanel.AddChildLast(exitButton); //Create menu highscore button highscoreButton = new Button(); highscoreButton.IconImage = new ImageAsset("/Application/assets/highscore.png"); highscoreButton.Width = highscoreButton.Height; highscoreButton.X = AppMain.ScreenWidth * .75f; buttonsPanel.AddChildLast(highscoreButton); this.RootWidget.AddChildLast(buttonsPanel); }
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); }
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); }
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); }
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); }
private void InitializeWidget(LayoutOrientation orientation) { Button_1 = new Button(); Button_1.Name = "Button_1"; Panel_1 = new Panel(); Panel_1.Name = "Panel_1"; Button_2 = new Button(); Button_2.Name = "Button_2"; Panel_2 = new Panel(); Panel_2.Name = "Panel_2"; Button_3 = new Button(); Button_3.Name = "Button_3"; Panel_3 = new Panel(); Panel_3.Name = "Panel_3"; Button_4 = new Button(); Button_4.Name = "Button_4"; Panel_4 = new Panel(); Panel_4.Name = "Panel_4"; Button_5 = new Button(); Button_5.Name = "Button_5"; Panel_5 = new Panel(); Panel_5.Name = "Panel_5"; Button_6 = new Button(); Button_6.Name = "Button_6"; Panel_6 = new Panel(); Panel_6.Name = "Panel_6"; Button_7 = new Button(); Button_7.Name = "Button_7"; Panel_7 = new Panel(); Panel_7.Name = "Panel_7"; Button_8 = new Button(); Button_8.Name = "Button_8"; Panel_8 = new Panel(); Panel_8.Name = "Panel_8"; Button_9 = new Button(); Button_9.Name = "Button_9"; Panel_9 = new Panel(); Panel_9.Name = "Panel_9"; Button_10 = new Button(); Button_10.Name = "Button_10"; Panel_10 = new Panel(); Panel_10.Name = "Panel_10"; Button_11 = new Button(); Button_11.Name = "Button_11"; Panel_11 = new Panel(); Panel_11.Name = "Panel_11"; Button_12 = new Button(); Button_12.Name = "Button_12"; Panel_12 = new Panel(); Panel_12.Name = "Panel_12"; // Button_1 Button_1.IconImage = null; Button_1.Style = ButtonStyle.Custom; Button_1.CustomImage = new CustomButtonImageSettings() { BackgroundNormalImage = new ImageAsset("/Application/assets/images/UI/cubeUI6.png"), BackgroundPressedImage = new ImageAsset("/Application/assets/images/UI/cubeUIRollOver6.png"), BackgroundDisabledImage = null, BackgroundNinePatchMargin = new NinePatchMargin(0, 0, 0, 0), }; Button_1.BackgroundFilterColor = new UIColor(226f / 255f, 20f / 255f, 20f / 255f, 255f / 255f); // Panel_1 Panel_1.BackgroundColor = new UIColor(0f / 255f, 0f / 255f, 0f / 255f, 255f / 255f); Panel_1.Clip = true; Panel_1.AddChildLast(Button_1); // Button_2 Button_2.IconImage = null; Button_2.Style = ButtonStyle.Custom; Button_2.CustomImage = new CustomButtonImageSettings() { BackgroundNormalImage = new ImageAsset("/Application/assets/images/UI/cubeUI6.png"), BackgroundPressedImage = new ImageAsset("/Application/assets/images/UI/cubeUIRollOver6.png"), BackgroundDisabledImage = null, BackgroundNinePatchMargin = new NinePatchMargin(0, 0, 0, 0), }; Button_2.BackgroundFilterColor = new UIColor(206f / 255f, 255f / 255f, 0f / 255f, 255f / 255f); // Panel_2 Panel_2.BackgroundColor = new UIColor(0f / 255f, 0f / 255f, 0f / 255f, 255f / 255f); Panel_2.Clip = true; Panel_2.AddChildLast(Button_2); // Button_3 Button_3.IconImage = null; Button_3.Style = ButtonStyle.Custom; Button_3.CustomImage = new CustomButtonImageSettings() { BackgroundNormalImage = new ImageAsset("/Application/assets/images/UI/cubeUI6.png"), BackgroundPressedImage = new ImageAsset("/Application/assets/images/UI/cubeUIRollOver6.png"), BackgroundDisabledImage = null, BackgroundNinePatchMargin = new NinePatchMargin(0, 0, 0, 0), }; Button_3.BackgroundFilterColor = new UIColor(206f / 255f, 244f / 255f, 226f / 255f, 255f / 255f); // Panel_3 Panel_3.BackgroundColor = new UIColor(0f / 255f, 0f / 255f, 0f / 255f, 255f / 255f); Panel_3.Clip = true; Panel_3.AddChildLast(Button_3); // Button_4 Button_4.IconImage = null; Button_4.Style = ButtonStyle.Custom; Button_4.CustomImage = new CustomButtonImageSettings() { BackgroundNormalImage = new ImageAsset("/Application/assets/images/UI/cubeUI6.png"), BackgroundPressedImage = new ImageAsset("/Application/assets/images/UI/cubeUIRollOver6.png"), BackgroundDisabledImage = null, BackgroundNinePatchMargin = new NinePatchMargin(0, 0, 0, 0), }; Button_4.BackgroundFilterColor = new UIColor(226f / 255f, 20f / 255f, 20f / 255f, 255f / 255f); // Panel_4 Panel_4.BackgroundColor = new UIColor(0f / 255f, 0f / 255f, 0f / 255f, 255f / 255f); Panel_4.Clip = true; Panel_4.AddChildLast(Button_4); // Button_5 Button_5.IconImage = null; Button_5.Style = ButtonStyle.Custom; Button_5.CustomImage = new CustomButtonImageSettings() { BackgroundNormalImage = new ImageAsset("/Application/assets/images/UI/cubeUI6.png"), BackgroundPressedImage = new ImageAsset("/Application/assets/images/UI/cubeUIRollOver6.png"), BackgroundDisabledImage = null, BackgroundNinePatchMargin = new NinePatchMargin(0, 0, 0, 0), }; Button_5.BackgroundFilterColor = new UIColor(206f / 255f, 255f / 255f, 0f / 255f, 255f / 255f); // Panel_5 Panel_5.BackgroundColor = new UIColor(0f / 255f, 0f / 255f, 0f / 255f, 255f / 255f); Panel_5.Clip = true; Panel_5.AddChildLast(Button_5); // Button_6 Button_6.IconImage = null; Button_6.Style = ButtonStyle.Custom; Button_6.CustomImage = new CustomButtonImageSettings() { BackgroundNormalImage = new ImageAsset("/Application/assets/images/UI/cubeUI6.png"), BackgroundPressedImage = new ImageAsset("/Application/assets/images/UI/cubeUIRollOver6.png"), BackgroundDisabledImage = null, BackgroundNinePatchMargin = new NinePatchMargin(0, 0, 0, 0), }; Button_6.BackgroundFilterColor = new UIColor(206f / 255f, 244f / 255f, 226f / 255f, 255f / 255f); // Panel_6 Panel_6.BackgroundColor = new UIColor(0f / 255f, 0f / 255f, 0f / 255f, 255f / 255f); Panel_6.Clip = true; Panel_6.AddChildLast(Button_6); // Button_7 Button_7.IconImage = null; Button_7.Style = ButtonStyle.Custom; Button_7.CustomImage = new CustomButtonImageSettings() { BackgroundNormalImage = new ImageAsset("/Application/assets/images/UI/cubeUI6.png"), BackgroundPressedImage = new ImageAsset("/Application/assets/images/UI/cubeUIRollOver6.png"), BackgroundDisabledImage = null, BackgroundNinePatchMargin = new NinePatchMargin(0, 0, 0, 0), }; Button_7.BackgroundFilterColor = new UIColor(226f / 255f, 20f / 255f, 20f / 255f, 255f / 255f); // Panel_7 Panel_7.BackgroundColor = new UIColor(0f / 255f, 0f / 255f, 0f / 255f, 255f / 255f); Panel_7.Clip = true; Panel_7.AddChildLast(Button_7); // Button_8 Button_8.IconImage = null; Button_8.Style = ButtonStyle.Custom; Button_8.CustomImage = new CustomButtonImageSettings() { BackgroundNormalImage = new ImageAsset("/Application/assets/images/UI/cubeUI6.png"), BackgroundPressedImage = new ImageAsset("/Application/assets/images/UI/cubeUIRollOver6.png"), BackgroundDisabledImage = null, BackgroundNinePatchMargin = new NinePatchMargin(0, 0, 0, 0), }; Button_8.BackgroundFilterColor = new UIColor(206f / 255f, 255f / 255f, 0f / 255f, 255f / 255f); // Panel_8 Panel_8.BackgroundColor = new UIColor(0f / 255f, 0f / 255f, 0f / 255f, 255f / 255f); Panel_8.Clip = true; Panel_8.AddChildLast(Button_8); // Button_9 Button_9.IconImage = null; Button_9.Style = ButtonStyle.Custom; Button_9.CustomImage = new CustomButtonImageSettings() { BackgroundNormalImage = new ImageAsset("/Application/assets/images/UI/cubeUI6.png"), BackgroundPressedImage = new ImageAsset("/Application/assets/images/UI/cubeUIRollOver6.png"), BackgroundDisabledImage = null, BackgroundNinePatchMargin = new NinePatchMargin(0, 0, 0, 0), }; Button_9.BackgroundFilterColor = new UIColor(206f / 255f, 244f / 255f, 226f / 255f, 255f / 255f); // Panel_9 Panel_9.BackgroundColor = new UIColor(0f / 255f, 0f / 255f, 0f / 255f, 255f / 255f); Panel_9.Clip = true; Panel_9.AddChildLast(Button_9); // Button_10 Button_10.IconImage = null; Button_10.Style = ButtonStyle.Custom; Button_10.CustomImage = new CustomButtonImageSettings() { BackgroundNormalImage = new ImageAsset("/Application/assets/images/UI/cubeUI6.png"), BackgroundPressedImage = new ImageAsset("/Application/assets/images/UI/cubeUIRollOver6.png"), BackgroundDisabledImage = null, BackgroundNinePatchMargin = new NinePatchMargin(0, 0, 0, 0), }; Button_10.BackgroundFilterColor = new UIColor(226f / 255f, 20f / 255f, 20f / 255f, 255f / 255f); // Panel_10 Panel_10.BackgroundColor = new UIColor(0f / 255f, 0f / 255f, 0f / 255f, 255f / 255f); Panel_10.Clip = true; Panel_10.AddChildLast(Button_10); // Button_11 Button_11.IconImage = null; Button_11.Style = ButtonStyle.Custom; Button_11.CustomImage = new CustomButtonImageSettings() { BackgroundNormalImage = new ImageAsset("/Application/assets/images/UI/cubeUI6.png"), BackgroundPressedImage = new ImageAsset("/Application/assets/images/UI/cubeUIRollOver6.png"), BackgroundDisabledImage = null, BackgroundNinePatchMargin = new NinePatchMargin(0, 0, 0, 0), }; Button_11.BackgroundFilterColor = new UIColor(206f / 255f, 255f / 255f, 0f / 255f, 255f / 255f); // Panel_11 Panel_11.BackgroundColor = new UIColor(0f / 255f, 0f / 255f, 0f / 255f, 255f / 255f); Panel_11.Clip = true; Panel_11.AddChildLast(Button_11); // Button_12 Button_12.IconImage = null; Button_12.Style = ButtonStyle.Custom; Button_12.CustomImage = new CustomButtonImageSettings() { BackgroundNormalImage = new ImageAsset("/Application/assets/images/UI/cubeUI6.png"), BackgroundPressedImage = new ImageAsset("/Application/assets/images/UI/cubeUIRollOver6.png"), BackgroundDisabledImage = null, BackgroundNinePatchMargin = new NinePatchMargin(0, 0, 0, 0), }; Button_12.BackgroundFilterColor = new UIColor(206f / 255f, 244f / 255f, 226f / 255f, 255f / 255f); // Panel_12 Panel_12.BackgroundColor = new UIColor(0f / 255f, 0f / 255f, 0f / 255f, 255f / 255f); Panel_12.Clip = true; Panel_12.AddChildLast(Button_12); // LevelSelectPanel3 this.BackgroundColor = new UIColor(0f / 255f, 0f / 255f, 0f / 255f, 255f / 255f); this.Clip = true; this.AddChildLast(Panel_1); this.AddChildLast(Panel_2); this.AddChildLast(Panel_3); this.AddChildLast(Panel_4); this.AddChildLast(Panel_5); this.AddChildLast(Panel_6); this.AddChildLast(Panel_7); this.AddChildLast(Panel_8); this.AddChildLast(Panel_9); this.AddChildLast(Panel_10); this.AddChildLast(Panel_11); this.AddChildLast(Panel_12); SetWidgetLayout(orientation); UpdateLanguage(); }
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 DeathUI() { this.Title = "Death UI"; this.Transition = new CrossFadeTransition(); TextShadowSettings textShadow = new TextShadowSettings(); textShadow.Color = new UIColor(0f, 0f, 0f, 0f); // Create a score label Label score = new Label(); score.Text = AppMain.PlayerScore.ToString(); score.TextColor = new UIColor(1f, 1f, 1f, 1f); score.TextShadow = textShadow; score.HorizontalAlignment = HorizontalAlignment.Center; score.VerticalAlignment = VerticalAlignment.Middle; score.X = AppMain.ScreenWidth * .5f - (score.Width / 2); score.Y = AppMain.ScreenHeight * .05f - (score.Height / 2); this.RootWidget.AddChildLast(score); // Create mesage label Label dead = new Label(); dead.Text = "S-senpai..."; dead.TextColor = new UIColor(1f, 1f, 1f, 1f); dead.TextShadow = textShadow; dead.X = AppMain.ScreenWidth * .5f; dead.Y = AppMain.ScreenHeight * 0.2f; this.RootWidget.AddChildLast(dead); // Create buttons panel Panel buttonsPanel = new Panel(); buttonsPanel.SetPosition(.0f, AppMain.ScreenHeight * .5f); // Create menu play button playButton = new Button(); playButton.ButtonAction += HandleButtonPress; playButton.IconImage = new ImageAsset("/Application/assets/play.png"); playButton.Width = playButton.Height; playButton.X = AppMain.ScreenWidth * .25f; buttonsPanel.AddChildLast(playButton); // Create menu exit button exitButton = new Button(); exitButton.ButtonAction += HandleButtonPress; exitButton.IconImage = new ImageAsset("/Application/assets/exit.png"); exitButton.Width = exitButton.Height; exitButton.X = AppMain.ScreenWidth * .5f; buttonsPanel.AddChildLast(exitButton); //Create menu highscore button highscoreButton = new Button(); highscoreButton.IconImage = new ImageAsset("/Application/assets/highscore.png"); highscoreButton.Width = highscoreButton.Height; highscoreButton.X = AppMain.ScreenWidth * .75f; buttonsPanel.AddChildLast(highscoreButton); this.RootWidget.AddChildLast(buttonsPanel); }
private void InitializeWidget(LayoutOrientation orientation, StageID stageID) { ImageBox_1 = new ImageBox(); ImageBox_1.Name = "ImageBox_1"; Button_1 = new Button(); Button_1.Name = "Button_1"; Panel_1 = new Panel(); Panel_1.Name = "Panel_1"; Label_1 = new Label(); Label_1.Name = "Label_1"; Label_2 = new Label(); Label_2.Name = "Label_2"; // ImageBox_1 ImageBox_1.ImageScaleType = ImageScaleType.Center; // Button_1 Button_1.TextColor = new UIColor(255f / 255f, 255f / 255f, 255f / 255f, 255f / 255f); Button_1.TextFont = new UIFont(FontAlias.System, 25, FontStyle.Regular); // Panel_1 Panel_1.BackgroundColor = new UIColor(153f / 255f, 153f / 255f, 153f / 255f, 255f / 255f); Panel_1.Clip = true; Panel_1.AddChildLast(ImageBox_1); Panel_1.AddChildLast(Button_1); // Label_1 Label_1.TextColor = new UIColor(255f / 255f, 255f / 255f, 255f / 255f, 255f / 255f); Label_1.Font = new UIFont(FontAlias.System, 80, FontStyle.Bold); Label_1.LineBreak = LineBreak.Character; Label_1.HorizontalAlignment = HorizontalAlignment.Center; Label_1.TextShadow = new TextShadowSettings() { Color = new UIColor(128f / 255f, 128f / 255f, 128f / 255f, 127f / 255f), HorizontalOffset = 2f, VerticalOffset = 2f, }; // Label_2 Label_2.TextColor = new UIColor(255f / 255f, 255f / 255f, 255f / 255f, 255f / 255f); Label_2.Font = new UIFont(FontAlias.System, 50, FontStyle.Bold); Label_2.LineBreak = LineBreak.Character; Label_2.HorizontalAlignment = HorizontalAlignment.Center; Label_2.TextShadow = new TextShadowSettings() { Color = new UIColor(128f / 255f, 128f / 255f, 128f / 255f, 127f / 255f), HorizontalOffset = 2f, VerticalOffset = 2f, }; // PanelStage this.BackgroundColor = new UIColor(153f / 255f, 153f / 255f, 153f / 255f, 255f / 255f); this.Clip = true; this.AddChildLast(Panel_1); this.AddChildLast(Label_1); this.AddChildLast(Label_2); SetWidgetLayout(orientation); Update(stageID); }
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 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 }
private void InitializeWidget(LayoutOrientation orientation) { Panel_1 = new Panel(); Panel_1.Name = "Panel_1"; label1 = new Label(); label1.Name = "label1"; connectToServerButton = new Button(); connectToServerButton.Name = "connectToServerButton"; textboxIPAddress = new EditableText(); textboxIPAddress.Name = "textboxIPAddress"; isConnected = new Label(); isConnected.Name = "isConnected"; connectedResults = new Label(); connectedResults.Name = "connectedResults"; Label_1 = new Label(); Label_1.Name = "Label_1"; // MainWindow this.RootWidget.AddChildLast(Panel_1); this.RootWidget.AddChildLast(Label_1); // Panel_1 Panel_1.BackgroundColor = new UIColor(153f / 255f, 153f / 255f, 153f / 255f, 255f / 255f); Panel_1.Clip = true; Panel_1.AddChildLast(label1); Panel_1.AddChildLast(connectToServerButton); Panel_1.AddChildLast(textboxIPAddress); Panel_1.AddChildLast(isConnected); Panel_1.AddChildLast(connectedResults); // label1 label1.TextColor = new UIColor(0f / 255f, 0f / 255f, 0f / 255f, 255f / 255f); label1.Font = new UIFont(FontAlias.System, 25, FontStyle.Regular); label1.LineBreak = LineBreak.Character; // connectToServerButton connectToServerButton.TextColor = new UIColor(0f / 255f, 0f / 255f, 0f / 255f, 255f / 255f); connectToServerButton.TextFont = new UIFont(FontAlias.System, 25, FontStyle.Regular); // textboxIPAddress textboxIPAddress.TextColor = new UIColor(0f / 255f, 0f / 255f, 0f / 255f, 255f / 255f); textboxIPAddress.Font = new UIFont(FontAlias.System, 25, FontStyle.Regular); textboxIPAddress.LineBreak = LineBreak.Character; // isConnected isConnected.TextColor = new UIColor(255f / 255f, 0f / 255f, 0f / 255f, 255f / 255f); isConnected.Font = new UIFont(FontAlias.System, 25, FontStyle.Regular); isConnected.LineBreak = LineBreak.Character; // connectedResults connectedResults.TextColor = new UIColor(0f / 255f, 0f / 255f, 0f / 255f, 255f / 255f); connectedResults.Font = new UIFont(FontAlias.System, 25, FontStyle.Regular); connectedResults.LineBreak = LineBreak.Character; // Label_1 Label_1.TextColor = new UIColor(0f / 255f, 0f / 255f, 0f / 255f, 255f / 255f); Label_1.Font = new UIFont(FontAlias.System, 25, FontStyle.Regular); Label_1.LineBreak = LineBreak.Character; SetWidgetLayout(orientation); UpdateLanguage(); }
private void InitializeWidget(LayoutOrientation orientation) { Button_1 = new Button(); Button_1.Name = "Button_1"; Label_1 = new Label(); Label_1.Name = "Label_1"; Label_2 = new Label(); Label_2.Name = "Label_2"; Panel_2 = new Panel(); Panel_2.Name = "Panel_2"; // Button_1 Button_1.IconImage = new ImageAsset("/Application/assets/new/newUI/gotIt.png"); Button_1.Style = ButtonStyle.Custom; Button_1.CustomImage = new CustomButtonImageSettings() { BackgroundNormalImage = null, BackgroundPressedImage = null, BackgroundDisabledImage = null, BackgroundNinePatchMargin = new NinePatchMargin(42, 27, 42, 27), }; // Label_1 Label_1.TextColor = new UIColor(255f / 255f, 255f / 255f, 255f / 255f, 255f / 255f); Label_1.Font = new UIFont(FontAlias.System, 30, FontStyle.Bold); Label_1.LineBreak = LineBreak.Character; // Label_2 Label_2.TextColor = new UIColor(41f / 255f, 226f / 255f, 226f / 255f, 255f / 255f); Label_2.Font = new UIFont(FontAlias.System, 24, FontStyle.Regular); Label_2.LineBreak = LineBreak.Character; // Panel_2 Panel_2.BackgroundColor = new UIColor(30f / 255f, 30f / 255f, 30f / 255f, 255f / 255f); Panel_2.Clip = true; Panel_2.AddChildLast(Button_1); Panel_2.AddChildLast(Label_1); Panel_2.AddChildLast(Label_2); // InstructionsBox this.RootWidget.AddChildLast(Panel_2); SetWidgetLayout(orientation); UpdateLanguage(); }
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 }
private void InitializeWidget(LayoutOrientation orientation) { ImageBox_1 = new ImageBox(); ImageBox_1.Name = "ImageBox_1"; ImageBox_2 = new ImageBox(); ImageBox_2.Name = "ImageBox_2"; ImageBox_3 = new ImageBox(); ImageBox_3.Name = "ImageBox_3"; ImageBox_4 = new ImageBox(); ImageBox_4.Name = "ImageBox_4"; ImageBox_5 = new ImageBox(); ImageBox_5.Name = "ImageBox_5"; ImageBox_6 = new ImageBox(); ImageBox_6.Name = "ImageBox_6"; currentTime = new Label(); currentTime.Name = "currentTime"; bestTime = new Label(); bestTime.Name = "bestTime"; vs = new Label(); vs.Name = "vs"; Panel_1 = new Panel(); Panel_1.Name = "Panel_1"; ImageBox_7 = new ImageBox(); ImageBox_7.Name = "ImageBox_7"; ImageBox_8 = new ImageBox(); ImageBox_8.Name = "ImageBox_8"; ImageBox_9 = new ImageBox(); ImageBox_9.Name = "ImageBox_9"; Panel_2 = new Panel(); Panel_2.Name = "Panel_2"; // ImageBox_1 ImageBox_1.Image = new ImageAsset("/Application/assets/new/newUI/hud/score.png"); ImageBox_1.ImageScaleType = ImageScaleType.Center; // ImageBox_2 ImageBox_2.Image = new ImageAsset("/Application/assets/new/newUI/hud/goal.png"); ImageBox_2.ImageScaleType = ImageScaleType.Center; // ImageBox_3 ImageBox_3.Image = new ImageAsset("/Application/assets/new/newUI/hud/hitMe.png"); ImageBox_3.ImageScaleType = ImageScaleType.Center; // ImageBox_4 ImageBox_4.Image = new ImageAsset("/Application/assets/new/newUI/blueBox.png"); ImageBox_4.ImageScaleType = ImageScaleType.Center; // ImageBox_5 ImageBox_5.Image = new ImageAsset("/Application/assets/new/newUI/redBox.png"); ImageBox_5.ImageScaleType = ImageScaleType.Center; // ImageBox_6 ImageBox_6.Image = new ImageAsset("/Application/assets/new/newUI/timerIcon.png"); ImageBox_6.ImageScaleType = ImageScaleType.Center; // currentTime currentTime.TextColor = new UIColor(255f / 255f, 255f / 255f, 255f / 255f, 255f / 255f); currentTime.Font = new UIFont(FontAlias.System, 20, FontStyle.Regular); currentTime.LineBreak = LineBreak.Character; // bestTime bestTime.TextColor = new UIColor(255f / 255f, 255f / 255f, 255f / 255f, 255f / 255f); bestTime.Font = new UIFont(FontAlias.System, 20, FontStyle.Regular); bestTime.LineBreak = LineBreak.Character; // vs vs.TextColor = new UIColor(226f / 255f, 20f / 255f, 20f / 255f, 255f / 255f); vs.Font = new UIFont(FontAlias.System, 25, FontStyle.Regular); vs.LineBreak = LineBreak.Character; // Panel_1 Panel_1.BackgroundColor = new UIColor(30f / 255f, 30f / 255f, 30f / 255f, 255f / 255f); Panel_1.Clip = true; Panel_1.AddChildLast(ImageBox_1); Panel_1.AddChildLast(ImageBox_2); Panel_1.AddChildLast(ImageBox_3); Panel_1.AddChildLast(ImageBox_4); Panel_1.AddChildLast(ImageBox_5); Panel_1.AddChildLast(ImageBox_6); Panel_1.AddChildLast(currentTime); Panel_1.AddChildLast(bestTime); Panel_1.AddChildLast(vs); // ImageBox_7 ImageBox_7.Image = new ImageAsset("/Application/assets/new/newUI/quitBtn.png"); ImageBox_7.ImageScaleType = ImageScaleType.Center; // ImageBox_8 ImageBox_8.Image = new ImageAsset("/Application/assets/new/newUI/levelSelect.png"); ImageBox_8.ImageScaleType = ImageScaleType.Center; // ImageBox_9 ImageBox_9.Image = new ImageAsset("/Application/assets/new/newUI/nextLevel.png"); ImageBox_9.ImageScaleType = ImageScaleType.Center; // Panel_2 Panel_2.BackgroundColor = new UIColor(30f / 255f, 30f / 255f, 30f / 255f, 255f / 255f); Panel_2.Clip = true; Panel_2.AddChildLast(ImageBox_7); Panel_2.AddChildLast(ImageBox_8); Panel_2.AddChildLast(ImageBox_9); // NewHud this.RootWidget.AddChildLast(Panel_1); this.RootWidget.AddChildLast(Panel_2); SetWidgetLayout(orientation); UpdateLanguage(); }
private void InitializeWidget(LayoutOrientation orientation) { // Set all initials for startup, draw and set data. getData(); view_TEXT = "Welcome to Virtual Terminal\n(C)2014 Tactician Studios LLC Software Team\nVersion:" + software + "\nUse '?' for list of common commands\n"; sceneBackgroundPanel = new Panel(); sceneBackgroundPanel.Name = "sceneBackgroundPanel"; CMD_LINE = new EditableText(); CMD_LINE.Name = "CMD_LINE"; dev = new MessageDialog(); dev.Name = "dev"; bg = new Panel(); bg.Name = "bg"; cmd = new Label(); cmd.Name = "cmd"; Enter = new Button(); Enter.Name = "Enter"; Hack = new Button(); Hack.Name = "Hack"; Free = new Button(); Free.Name = "Free"; isSudo = false; Initialize = false; packets = 0; // sceneBackgroundPanel sceneBackgroundPanel.BackgroundColor = new UIColor(0f / 255f, 0f / 255f, 0f / 255f, 255f / 255f); // Terminal this.RootWidget.AddChildLast(sceneBackgroundPanel); this.RootWidget.AddChildLast(CMD_LINE); this.RootWidget.AddChildLast(bg); this.RootWidget.AddChildLast(Enter); this.RootWidget.AddChildLast(Hack); this.RootWidget.AddChildLast(Free); this.RootWidget.AddChildLast(dev); // CMD_LINE CMD_LINE.TextColor = new UIColor(102f / 255f, 255f / 255f, 0f / 255f, 255f / 255f); CMD_LINE.Font = new UIFont(FontAlias.System, 25, FontStyle.Regular); CMD_LINE.LineBreak = LineBreak.Character; // bg bg.BackgroundColor = new UIColor(0f / 255f, 0f / 255f, 0f / 255f, 255f / 255f); bg.Clip = true; bg.AddChildLast(cmd); // cmd cmd.TextColor = new UIColor(0f / 255f, 255f / 255f, 87f / 255f, 255f / 255f); cmd.Font = new UIFont(FontAlias.System, 18, FontStyle.Bold); cmd.TextTrimming = TextTrimming.Character; cmd.LineBreak = LineBreak.Word; cmd.VerticalAlignment = VerticalAlignment.Top; // Enter Enter.TextColor = new UIColor(0f / 255f, 0f / 255f, 0f / 255f, 255f / 255f); Enter.TextFont = new UIFont(FontAlias.System, 25, FontStyle.Regular); Enter.BackgroundFilterColor = new UIColor(0f / 255f, 255f / 255f, 36f / 255f, 255f / 255f); Enter.TouchEventReceived += (sender, e) => update(); Enter.KeyEventReceived += (sender, e) => update(e); Hack.TextColor = new UIColor(0f / 255f, 0f / 255f, 0f / 255f, 255f / 255f); Hack.TextFont = new UIFont(FontAlias.System, 25, FontStyle.Regular); Hack.BackgroundFilterColor = new UIColor(0f / 255f, 255f / 255f, 36f / 255f, 255f / 255f); Hack.TouchEventReceived += (sender, e) => hackPSN(); Hack.KeyEventReceived += (sender, e) => hackPSN(e); Hack.Enabled = false; Free.TextColor = new UIColor(0f / 255f, 0f / 255f, 0f / 255f, 255f / 255f); Free.TextFont = new UIFont(FontAlias.System, 25, FontStyle.Regular); Free.BackgroundFilterColor = new UIColor(0f / 255f, 255f / 255f, 36f / 255f, 255f / 255f); Free.TouchEventReceived += (sender, e) => PSN(); Free.KeyEventReceived += (sender, e) => PSN(e); Free.Enabled = false; dev.Visible = false; dev.Enabled = false; dev.ButtonPressed += (sender, e) => closeInfo(); dev.CustomBackgroundColor = new UIColor(1.0f, 1.0f, 1.0f, 0.5f); dev.KeyEventReceived += (sender, e) => closeInfo(e); dev.TouchEventReceived += (sender, e) => closeInfo(); SetWidgetLayout(orientation); UpdateLanguage(); }
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); }
private void InitializeWidget(LayoutOrientation orientation) { ImageBox_1 = new ImageBox(); ImageBox_1.Name = "ImageBox_1"; Panel_1 = new Panel(); Panel_1.Name = "Panel_1"; Button_1 = new Button(); Button_1.Name = "Button_1"; ImageBox_2 = new ImageBox(); ImageBox_2.Name = "ImageBox_2"; ImageBox_3 = new ImageBox(); ImageBox_3.Name = "ImageBox_3"; // ImageBox_1 ImageBox_1.Image = new ImageAsset("/Application/assets/new/newUI/bestTimevsCurrentTime.png"); ImageBox_1.ImageScaleType = ImageScaleType.Center; // Panel_1 Panel_1.BackgroundColor = new UIColor(30f / 255f, 30f / 255f, 30f / 255f, 255f / 255f); Panel_1.Clip = true; Panel_1.AddChildLast(ImageBox_1); // Button_1 Button_1.IconImage = new ImageAsset("/Application/assets/new/newUI/quit.png"); Button_1.BackgroundFilterColor = new UIColor(255f / 255f, 255f / 255f, 255f / 255f, 0f / 255f); // ImageBox_2 ImageBox_2.Image = new ImageAsset("/Application/assets/new/newUI/mainMenu.png"); ImageBox_2.ImageScaleType = ImageScaleType.Center; // ImageBox_3 ImageBox_3.Image = new ImageAsset("/Application/assets/new/newUI/newsetup.png"); ImageBox_3.ImageScaleType = ImageScaleType.Center; // won this.RootWidget.AddChildLast(Panel_1); this.RootWidget.AddChildLast(Button_1); this.RootWidget.AddChildLast(ImageBox_2); this.RootWidget.AddChildLast(ImageBox_3); SetWidgetLayout(orientation); UpdateLanguage(); }
private void InitializeWidget(LayoutOrientation orientation) { Label_1 = new Label(); Label_1.Name = "Label_1"; Label_2 = new Label(); Label_2.Name = "Label_2"; Panel_1 = new Panel(); Panel_1.Name = "Panel_1"; // Label_1 Label_1.TextColor = new UIColor(255f / 255f, 255f / 255f, 255f / 255f, 255f / 255f); Label_1.Font = new UIFont(FontAlias.System, 72, FontStyle.Regular); Label_1.LineBreak = LineBreak.Character; // Label_2 Label_2.TextColor = new UIColor(41f / 255f, 226f / 255f, 226f / 255f, 255f / 255f); Label_2.Font = new UIFont(FontAlias.System, 72, FontStyle.Bold); Label_2.LineBreak = LineBreak.Character; // Panel_1 Panel_1.BackgroundColor = new UIColor(30f / 255f, 30f / 255f, 30f / 255f, 255f / 255f); Panel_1.Clip = true; Panel_1.AddChildLast(Label_1); Panel_1.AddChildLast(Label_2); // levelInfo this.RootWidget.AddChildLast(Panel_1); SetWidgetLayout(orientation); UpdateLanguage(); }
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); }
private void InitializeWidget(LayoutOrientation orientation) { ImageBox_2 = new ImageBox(); ImageBox_2.Name = "ImageBox_2"; ScoreText = new Label(); ScoreText.Name = "ScoreText"; ImageBox_1 = new ImageBox(); ImageBox_1.Name = "ImageBox_1"; TimerSeparatorText = new Label(); TimerSeparatorText.Name = "TimerSeparatorText"; TimerSecondsText = new Label(); TimerSecondsText.Name = "TimerSecondsText"; TimerMinutesText = new Label(); TimerMinutesText.Name = "TimerMinutesText"; Panel_1 = new Panel(); Panel_1.Name = "Panel_1"; PauseMenuText = new Label(); PauseMenuText.Name = "PauseMenuText"; ResumeButton = new Button(); ResumeButton.Name = "ResumeButton"; GiveUpButton = new Button(); GiveUpButton.Name = "GiveUpButton"; PauseMenu = new Panel(); PauseMenu.Name = "PauseMenu"; NextLevelButton = new Button(); NextLevelButton.Name = "NextLevelButton"; // ImageBox_2 ImageBox_2.Image = new ImageAsset("/Application/assets/images/UI/score_now.png"); ImageBox_2.ImageScaleType = ImageScaleType.Center; // ScoreText ScoreText.TextColor = new UIColor(255f / 255f, 255f / 255f, 255f / 255f, 255f / 255f); ScoreText.Font = new UIFont(FontAlias.System, 18, FontStyle.Bold); ScoreText.LineBreak = LineBreak.Character; // ImageBox_1 ImageBox_1.Image = new ImageAsset("/Application/assets/images/UI/time_now.png"); ImageBox_1.ImageScaleType = ImageScaleType.Center; // TimerSeparatorText TimerSeparatorText.TextColor = new UIColor(255f / 255f, 255f / 255f, 255f / 255f, 255f / 255f); TimerSeparatorText.Font = new UIFont(FontAlias.System, 18, FontStyle.Bold); TimerSeparatorText.TextTrimming = TextTrimming.None; TimerSeparatorText.LineBreak = LineBreak.Character; TimerSeparatorText.HorizontalAlignment = HorizontalAlignment.Center; // TimerSecondsText TimerSecondsText.TextColor = new UIColor(255f / 255f, 255f / 255f, 255f / 255f, 255f / 255f); TimerSecondsText.Font = new UIFont(FontAlias.System, 18, FontStyle.Bold); TimerSecondsText.TextTrimming = TextTrimming.None; TimerSecondsText.LineBreak = LineBreak.Character; // TimerMinutesText TimerMinutesText.TextColor = new UIColor(255f / 255f, 255f / 255f, 255f / 255f, 255f / 255f); TimerMinutesText.Font = new UIFont(FontAlias.System, 18, FontStyle.Bold); TimerMinutesText.LineBreak = LineBreak.Character; TimerMinutesText.HorizontalAlignment = HorizontalAlignment.Right; // Panel_1 Panel_1.BackgroundColor = new UIColor(40f / 255f, 40f / 255f, 40f / 255f, 255f / 255f); Panel_1.Clip = true; Panel_1.AddChildLast(ImageBox_2); Panel_1.AddChildLast(ScoreText); Panel_1.AddChildLast(ImageBox_1); Panel_1.AddChildLast(TimerSeparatorText); Panel_1.AddChildLast(TimerSecondsText); Panel_1.AddChildLast(TimerMinutesText); // PauseMenuText PauseMenuText.TextColor = new UIColor(255f / 255f, 255f / 255f, 255f / 255f, 255f / 255f); PauseMenuText.Font = new UIFont(FontAlias.System, 44, FontStyle.Regular); PauseMenuText.LineBreak = LineBreak.Character; // ResumeButton ResumeButton.TextColor = new UIColor(255f / 255f, 255f / 255f, 255f / 255f, 255f / 255f); ResumeButton.TextFont = new UIFont(FontAlias.System, 25, FontStyle.Regular); ResumeButton.Style = ButtonStyle.Custom; ResumeButton.CustomImage = new CustomButtonImageSettings() { BackgroundNormalImage = new ImageAsset("/Application/assets/images/UI/blueBtn.png"), BackgroundPressedImage = new ImageAsset("/Application/assets/images/UI/blueBtnOver.png"), BackgroundDisabledImage = null, BackgroundNinePatchMargin = new NinePatchMargin(42, 27, 42, 27), }; ResumeButton.BackgroundFilterColor = new UIColor(41f / 255f, 226f / 255f, 226f / 255f, 255f / 255f); // GiveUpButton GiveUpButton.TextColor = new UIColor(255f / 255f, 255f / 255f, 255f / 255f, 255f / 255f); GiveUpButton.TextFont = new UIFont(FontAlias.System, 25, FontStyle.Regular); GiveUpButton.Style = ButtonStyle.Custom; GiveUpButton.CustomImage = new CustomButtonImageSettings() { BackgroundNormalImage = new ImageAsset("/Application/assets/images/UI/redBtn.png"), BackgroundPressedImage = null, BackgroundDisabledImage = null, BackgroundNinePatchMargin = new NinePatchMargin(42, 27, 42, 27), }; GiveUpButton.BackgroundFilterColor = new UIColor(229f / 255f, 19f / 255f, 19f / 255f, 255f / 255f); // PauseMenu PauseMenu.BackgroundColor = new UIColor(153f / 255f, 153f / 255f, 153f / 255f, 255f / 255f); PauseMenu.Clip = true; PauseMenu.AddChildLast(PauseMenuText); PauseMenu.AddChildLast(ResumeButton); PauseMenu.AddChildLast(GiveUpButton); // NextLevelButton NextLevelButton.IconImage = null; NextLevelButton.Style = ButtonStyle.Custom; NextLevelButton.CustomImage = new CustomButtonImageSettings() { BackgroundNormalImage = new ImageAsset("/Application/assets/images/UI/next_level_sm.png"), BackgroundPressedImage = new ImageAsset("/Application/assets/images/UI/next_level_smRoll.png"), BackgroundDisabledImage = null, BackgroundNinePatchMargin = new NinePatchMargin(0, 0, 0, 0), }; // ScoreScene this.RootWidget.AddChildLast(Panel_1); this.RootWidget.AddChildLast(PauseMenu); this.RootWidget.AddChildLast(NextLevelButton); SetWidgetLayout(orientation); UpdateLanguage(); }
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); }