/// <summary> /// Creates a new BestScore panel. /// </summary> /// <param name="y">The y of the new element.</param> /// <param name="score">The score of the new element.</param> /// <returns></returns> public static StackPanel CreateBestScore(int y, int score) { var stackPanelScore = new StackPanel() { HorizontalAlignment = WaveEngine.Framework.UI.HorizontalAlignment.Center, Orientation = WaveEngine.Components.UI.Orientation.Horizontal, Margin = new Thickness( 0, y, 0, 0) }; var bestScoreText = new Image(WaveContent.Assets.Menus.best_score_png); var bestScoreNumber = new TextBlock() { FontPath = WaveContent.Assets.Fonts.BadaBoom_BB_wpk, Text = score.ToString(), TextAlignment = WaveEngine.Components.UI.TextAlignment.Right, Width = 50, }; stackPanelScore.Add(bestScoreText); stackPanelScore.Add(bestScoreNumber); return stackPanelScore; }
public ScorePanel() { StackPanel stack = new StackPanel() { Width = (int)WaveServices.ViewportManager.VirtualWidth, Height = 76, HorizontalAlignment = HorizontalAlignment.Right, VerticalAlignment = VerticalAlignment.Bottom, Orientation = Orientation.Horizontal, Margin = new Thickness(10), }; stack.Add(new Image(Directories.TexturePath + "starfish.wpk") { Width = 70, Height = 70, Stretch = Stretch.Fill, DrawOrder = 0.1f, VerticalAlignment = VerticalAlignment.Center, Margin = new Thickness(5), }); this.scoreText = new TextBlock("scoresText") { Width = 80, FontPath = Directories.FontsPath + "Bulky Pixels_26.wpk", VerticalAlignment = VerticalAlignment.Center, TextAlignment = WaveEngine.Components.UI.TextAlignment.Center, Margin = new Thickness(5, 10, 5, 5), DrawOrder = 0.1f, }; stack.Add(this.scoreText); this.entity = stack.Entity; this.Score = 0; }
protected override void CreateScene() { FixedCamera2D camera2d = new FixedCamera2D("camera"); camera2d.BackgroundColor = Color.Gray; EntityManager.Add(camera2d); // Panel stackPanel = new StackPanel() { HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Width = 400, Height = 400, }; EntityManager.Add(stackPanel.Entity); // Elements Button button; for (int i = 0; i < 4; i++) { button = new Button() { Text = i.ToString(), HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Width = 100, Height = 100, Foreground = Color.Yellow, BackgroundColor = Color.Red, }; stackPanel.Add(button); } // Set Orientation Button button1 = new Button() { HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Bottom, Text = "Change Orientation", Width = 200, Margin = new Thickness(20), Foreground = Color.LightPink, BackgroundColor = Color.Purple, BorderColor = Color.LightPink, }; button1.Click += b_Click; EntityManager.Add(button1.Entity); // Debug this.CreateDebugMode(); }
public ScorePanel(string name) { StackPanel stack = new StackPanel(name) { Width = (int)768, Height = 76, HorizontalAlignment = HorizontalAlignment.Right, VerticalAlignment = VerticalAlignment.Bottom, Orientation = Orientation.Horizontal, Margin = new Thickness(10), }; stack.Add(new Image(WaveContent.Assets.Textures.starfish_png) { Width = 70, Height = 70, Stretch = Stretch.Fill, DrawOrder = 0.1f, VerticalAlignment = VerticalAlignment.Center, Margin = new Thickness(5), }); this.scoreText = new TextBlock("scoresText") { Width = 80, FontPath = WaveContent.Assets.Fonts.Bulky_Pixels_26_TTF, VerticalAlignment = VerticalAlignment.Center, TextAlignment = WaveEngine.Components.UI.TextAlignment.Center, Margin = new Thickness(5, 10, 5, 5), DrawOrder = 0.1f, }; stack.Add(this.scoreText); this.entity = stack.Entity; this.Score = 0; }
private void CreateLoginPanel() { // Login var login = new Button() { Width = _buttonWidth, Height = _buttonHeight, Text = "Login into service", Foreground = _foregroundButton, BackgroundColor = _backgroundColor, }; login.Click += async (s, e) => { var loggedIn = await _socialService.Login(); if (!loggedIn) { await WaveServices.Platform.ShowMessageBoxAsync("Error", "Not logged in"); } }; // Logout var logout = new Button() { Width = _buttonWidth, Height = _buttonHeight, Text = "Logout", Foreground = _foregroundButton, BackgroundColor = _backgroundColor, Margin = new Thickness(_spaceControl, 0, 0, 0) }; logout.Click += async (s, e) => { await _socialService.Logout(); }; var sp1 = new StackPanel { Orientation = Orientation.Horizontal, Margin = new Thickness(_leftMargin, _topMargin, 0, 0), }; sp1.Add(login); sp1.Add(logout); EntityManager.Add(sp1); }
private void AchievementsByCodePanel() { var unlockAchievementlabel = new TextBlock() { Text = "Enter achievement code:", Width = 200, }; var unlockAchievementText = new TextBox() { Text = string.Empty, Height = 60, Width = _buttonWidth, Margin = new Thickness(_spaceControl, 0, 0, 0) }; // Unlock achievement by code var unlockAchievementCodeButton = new Button() { Width = _buttonWidth, Height = _buttonHeight, Text = "Unlock achievement by code", Foreground = _foregroundButton, BackgroundColor = _backgroundColor, Margin = new Thickness(_spaceControl, 0, 0, 0) }; unlockAchievementCodeButton.Click += async (s, e) => { var code = unlockAchievementText.Text; await _socialService.UnlockAchievement(code); }; var sp3 = new StackPanel { Orientation = Orientation.Horizontal, Margin = new Thickness(100, _topMargin + 5, 0, 0), }; sp3.Add(unlockAchievementlabel); sp3.Add(unlockAchievementText); sp3.Add(unlockAchievementCodeButton); EntityManager.Add(sp3); }
private void CreateLeaderBoardByCodePanel() { var leaderboardlabel = new TextBlock() { Text = "Enter leaderboard code:", Width = 200, }; var leaderboardCodeText = new TextBox() { Text = string.Empty, Height = 60, Width = _buttonWidth, Margin = new Thickness(_spaceControl, 0, 0, 0) }; // Show leaderboard by code var leaderboardCodeButton = new Button() { Width = _buttonWidth, Height = _buttonHeight, Text = "Show leaderboard by code", Foreground = _foregroundButton, BackgroundColor = _backgroundColor, Margin = new Thickness(_spaceControl, 0, 0, 0) }; leaderboardCodeButton.Click += (s, e) => { var code = leaderboardCodeText.Text; _socialService.ShowLeaderboard(code); }; var sp4 = new StackPanel { Orientation = Orientation.Horizontal, Margin = new Thickness(100, _topMargin + 5, 0, 0), }; sp4.Add(leaderboardlabel); sp4.Add(leaderboardCodeText); sp4.Add(leaderboardCodeButton); EntityManager.Add(sp4); }
private void CreateLeaderBoardsAndAchievementsPanel() { // Show Leaderboards var leaderboards = new Button() { Width = _buttonWidth, Height = _buttonHeight, Text = "Show all leaderboards", Foreground = _foregroundButton, BackgroundColor = _backgroundColor, }; leaderboards.Click += (s, e) => { _socialService.ShowAllLeaderboards(); }; // Show Achievements var achievements = new Button() { Width = _buttonWidth, Height = _buttonHeight, Text = "Show all achievements", Foreground = _foregroundButton, BackgroundColor = _backgroundColor, Margin = new Thickness(_spaceControl, 0, 0, 0) }; achievements.Click += (s, e) => { _socialService.ShowAchievements(); }; var sp2 = new StackPanel { Orientation = Orientation.Horizontal, Margin = new Thickness(_leftMargin, _topMargin, 0, 0), }; sp2.Add(leaderboards); sp2.Add(achievements); EntityManager.Add(sp2); }
protected override void CreateScene() { FixedCamera2D camera2d = new FixedCamera2D("camera"); camera2d.ClearFlags = ClearFlags.DepthAndStencil; EntityManager.Add(camera2d); Entity logo = new Entity() .AddComponent(new Transform2D() { X = WaveServices.ViewportManager.VirtualWidth / 2, Y = 300, Origin = new Vector2(0.5f, 0), DrawOrder = 0.1f }) .AddComponent(new Sprite("Content/GameOver.wpk")) .AddComponent(new AnimationUI()) .AddComponent(new SpriteRenderer(DefaultLayers.Alpha)); this.gameStorage = Catalog.GetItem<GameStorage>(); this.EntityManager.Add(logo); this.labelAnimation = logo.FindComponent<AnimationUI>(); this.playScaleAppear = new SingleAnimation(0.2f, 1f, TimeSpan.FromSeconds(2), EasingFunctions.Back); this.playOpacityAppear = new SingleAnimation(0, 1, TimeSpan.FromSeconds(1), EasingFunctions.Cubic); var button = new Button() { Margin = new Thickness(0, 657, 0, 0), HorizontalAlignment = WaveEngine.Framework.UI.HorizontalAlignment.Center, VerticalAlignment = WaveEngine.Framework.UI.VerticalAlignment.Top, Text = string.Empty, IsBorder = false, BackgroundImage = "Content/restart.wpk", PressedBackgroundImage = "Content/restart.wpk" }; button.Click += (o, e) => { GamePlayScene scene = WaveServices.ScreenContextManager.FindContextByName("GamePlayContext").FindScene<GamePlayScene>(); scene.State = Behaviors.GameState.Game; scene.Reset(); WaveServices.ScreenContextManager.Pop(new CrossFadeTransition(TimeSpan.FromSeconds(0.5f))); }; button.Entity.AddComponent(new AnimationUI()); this.playAnimation = button.Entity.FindComponent<AnimationUI>(); this.EntityManager.Add(button); var stackPanel = new StackPanel() { HorizontalAlignment = HorizontalAlignment.Right, VerticalAlignment = VerticalAlignment.Bottom, Orientation = Orientation.Horizontal, Margin = new Thickness(0, 0, (WaveServices.ViewportManager.VirtualWidth - WaveServices.ViewportManager.RightEdge), 20)// (WaveServices.ViewportManager.VirtualWidth - WaveServices.ViewportManager.RightEdge), 20) }; var bestScoreLabel = new Image("Content/BestScore.wpk") { VerticalAlignment = VerticalAlignment.Center }; stackPanel.Add(bestScoreLabel); var bestScoreText = new TextBlock() { Text = this.gameStorage.BestScore.ToString(), FontPath = "Content/Space Age.wpk", VerticalAlignment = VerticalAlignment.Center, Margin = new Thickness(5,0,0,10) }; stackPanel.Add(bestScoreText); this.EntityManager.Add(stackPanel); }
private void AddNewScorePanel() { var addNewScorelabel1 = new TextBlock() { Text = "Enter leaderboard code:", Width = 200, }; var addNewScoreCodeText1 = new TextBox() { Text = string.Empty, Height = 60, Width = _buttonWidth, Margin = new Thickness(_spaceControl, 0, 0, 0) }; var addNewScorelabel2 = new TextBlock() { Text = "Enter new score:", Width = 200, }; var addNewScoreCodeText2 = new TextBox() { Text = string.Empty, Height = 60, Width = _buttonWidth, Margin = new Thickness(_spaceControl, 0, 0, 0) }; var sp5 = new StackPanel { Orientation = Orientation.Horizontal, Margin = new Thickness(100, _topMargin + 5, 0, 0), }; sp5.Add(addNewScorelabel1); sp5.Add(addNewScoreCodeText1); _topMargin += 70; var sp6 = new StackPanel { Orientation = Orientation.Horizontal, Margin = new Thickness(100, _topMargin + 5, 0, 0), }; sp6.Add(addNewScorelabel2); sp6.Add(addNewScoreCodeText2); EntityManager.Add(sp5); EntityManager.Add(sp6); // Add new score var addNewScoreCodeButton = new Button() { Width = _buttonWidth, Height = _buttonHeight, Text = "Add new Score", Foreground = _foregroundButton, BackgroundColor = _backgroundColor, Margin = new Thickness(_topMargin + _spaceControl + 15, 580, 0, 0) }; addNewScoreCodeButton.Click += (s, e) => { var code = addNewScoreCodeText1.Text; var score = addNewScoreCodeText2.Text; if (string.IsNullOrEmpty(code) || string.IsNullOrEmpty(score)) { return; } var longScore = long.Parse(score); _socialService.AddNewScore(code, longScore); }; EntityManager.Add(addNewScoreCodeButton); }
protected override void CreateScene() { this.Load(WaveContent.Scenes.MyScene); this.bunnyVideo = WaveServices.VideoPlayer.VideoInfoFromPath(WaveContent.Assets.Video.bear_mp4); this.bearVideo = WaveServices.VideoPlayer.VideoInfoFromPath(WaveContent.Assets.Video.bunny_mp4); WaveServices.VideoPlayer.IsLooped = true; WaveServices.VideoPlayer.Play(this.bunnyVideo); StackPanel controlPanel = new StackPanel() { VerticalAlignment = WaveEngine.Framework.UI.VerticalAlignment.Bottom, HorizontalAlignment = WaveEngine.Framework.UI.HorizontalAlignment.Right, Margin = new WaveEngine.Framework.UI.Thickness(0, 0, 30, 30), BorderColor = Color.White, IsBorder = true, }; ToggleSwitch muteToggle = new ToggleSwitch() { OnText = "Mute", OffText = "Mute", Margin = new WaveEngine.Framework.UI.Thickness(5, 5, 5, 10) }; muteToggle.Toggled += (e, s) => { WaveServices.VideoPlayer.IsMuted = muteToggle.IsOn; }; controlPanel.Add(muteToggle); RadioButton radioButton1 = new RadioButton() { GroupName = "Videos", Text = "Channel 1", Margin = new WaveEngine.Framework.UI.Thickness(5, 0, 5, 0), IsChecked = true }; radioButton1.Checked += (e, s) => { WaveServices.VideoPlayer.Play(this.bunnyVideo); }; controlPanel.Add(radioButton1); RadioButton radioButton2 = new RadioButton() { GroupName = "Videos", Text = "Channel 2", Margin = new WaveEngine.Framework.UI.Thickness(5, 0, 5, 10) }; radioButton2.Checked += (e, s) => { WaveServices.VideoPlayer.Play(this.bearVideo); }; controlPanel.Add(radioButton2); PlayBtn = new Button("playBtn") { Text = "Play", Opacity = 0.5f, Margin = new WaveEngine.Framework.UI.Thickness(5, 0, 5, 0), Width = 170 }; PlayBtn.Click += (e, s) => { WaveServices.VideoPlayer.Resume(); PlayBtn.Opacity = 0.5f; PauseBtn.Opacity = 1f; }; controlPanel.Add(PlayBtn); PauseBtn = new Button("pauseBtn") { Text = "Pause", Width = 170, Margin = new WaveEngine.Framework.UI.Thickness(5, 0, 5, 5), }; PauseBtn.Click += (e, s) => { WaveServices.VideoPlayer.Pause(); PlayBtn.Opacity = 1f; PauseBtn.Opacity = 0.5f; }; controlPanel.Add(PauseBtn); EntityManager.Add(controlPanel); }
/// <summary> /// Creates the scene. /// </summary> /// <remarks> /// This method is called before all /// <see cref="T:WaveEngine.Framework.Entity" /> instances in this instance are initialized. /// </remarks> protected override void CreateScene() { FixedCamera2D camera2d = new FixedCamera2D("camera"); camera2d.ClearFlags = ClearFlags.DepthAndStencil; EntityManager.Add(camera2d); // Music Player MusicInfo musicInfo = new MusicInfo("Content/audiodolby.mp3"); WaveServices.MusicPlayer.Play(musicInfo); WaveServices.MusicPlayer.IsRepeat = true; WaveServices.MusicPlayer.Play(new MusicInfo("Content/audiodolby.mp3")); WaveServices.MusicPlayer.IsDolbyEnabled = true; WaveServices.MusicPlayer.DolbyProfile = DolbyProfiles.GAME; // Button Stack Panel buttonPanel = new StackPanel(); buttonPanel.Entity.AddComponent(new AnimationUI()); buttonPanel.VerticalAlignment = WaveEngine.Framework.UI.VerticalAlignment.Center; buttonPanel.HorizontalAlignment = WaveEngine.Framework.UI.HorizontalAlignment.Center; // Enable/Disable Dolby Button this.CreateButton(out this.enableDolbyButton, string.Empty, this.EnableDolbyButtonClick); buttonPanel.Add(this.enableDolbyButton); // Profile Buttons this.CreateButton(out this.profileGameButton, WaveEngine.Common.Media.DolbyProfiles.GAME.ToString(), this.ProfileGameButtonClick); buttonPanel.Add(this.profileGameButton); this.CreateButton(out this.profileMovieButton, WaveEngine.Common.Media.DolbyProfiles.MOVIE.ToString(), this.ProfileMovieButtonClick); buttonPanel.Add(this.profileMovieButton); this.CreateButton(out this.profileMusicButton, WaveEngine.Common.Media.DolbyProfiles.MUSIC.ToString(), this.ProfileMusicButtonClick); buttonPanel.Add(this.profileMusicButton); this.CreateButton(out this.profileVoiceButton, WaveEngine.Common.Media.DolbyProfiles.VOICE.ToString(), this.ProfileVoiceButtonClick); buttonPanel.Add(this.profileVoiceButton); EntityManager.Add(buttonPanel); // Information Text infoPanel = new StackPanel(); infoPanel.Entity.AddComponent(new AnimationUI()); infoPanel.VerticalAlignment = WaveEngine.Framework.UI.VerticalAlignment.Bottom; infoPanel.HorizontalAlignment = WaveEngine.Framework.UI.HorizontalAlignment.Center; infoPanel.Orientation = Orientation.Vertical; this.CreateLabel(out this.isDolbyEnabledTextBox, string.Empty); infoPanel.Add(this.isDolbyEnabledTextBox); this.CreateLabel(out this.selectedDolbyProfileTextBox, string.Empty); infoPanel.Add(this.selectedDolbyProfileTextBox); EntityManager.Add(infoPanel); // Sets text this.SetDolbyText(); //// Animations this.fadeIn = new SingleAnimation(0.0f, 1.0f, TimeSpan.FromSeconds(8), EasingFunctions.Cubic); }
protected override void CreateScene() { FreeCamera camera = new FreeCamera("camera", new Vector3(-1.3f, 1.6f, 2.5f), new Vector3(-0.25f, 1.375f, 1.275f)) { Speed = 5, NearPlane = 0.1f }; EntityManager.Add(camera); this.TvRoomEntity = new Entity("tvRoom") .AddComponent(new Transform3D()) .AddComponent(new Model("Content/TvRoom.wpk")) .AddComponent(new ModelRenderer()) .AddComponent(new MaterialsMap(new System.Collections.Generic.Dictionary<string, Material> { {"floor", new DualTextureMaterial("Content/parketFloor_Diffuse.wpk", "Content/TvRoomLightingMap.wpk", DefaultLayers.Opaque)}, {"tv", new DualTextureMaterial("Content/Tv_Diffuse.wpk", "Content/TvRoomLightingMap.wpk", DefaultLayers.Opaque)}, {"table", new DualTextureMaterial("Content/table_Diffuse.wpk", "Content/TvRoomLightingMap.wpk", DefaultLayers.Opaque)}, {"chair", new DualTextureMaterial("Content/Chair_Diffuse.wpk", "Content/TvRoomLightingMap.wpk", DefaultLayers.Opaque)}, // Camera preview texture used in a basic material {"tv_screen", new BasicMaterial(Color.Black)} } )); EntityManager.Add(this.TvRoomEntity); if (WaveServices.CameraCapture.IsConnected) { StackPanel controlPanel = new StackPanel() { VerticalAlignment = WaveEngine.Framework.UI.VerticalAlignment.Bottom, HorizontalAlignment = WaveEngine.Framework.UI.HorizontalAlignment.Right, Margin = new WaveEngine.Framework.UI.Thickness(0, 0, 30, 30), BorderColor = Color.White, IsBorder = true, }; this.RecBtn = new Button("RecBtn") { Text = "Start Rec", Margin = new WaveEngine.Framework.UI.Thickness(5, 5, 5, 0), Width = 170 }; controlPanel.Add(this.RecBtn); this.PlayRecordedBtn = new Button("PlayRecordedBtn") { Text = "Play", Width = 170, Margin = new WaveEngine.Framework.UI.Thickness(5, 0, 5, 5), Opacity = 0.5f }; controlPanel.Add(this.PlayRecordedBtn); this.RecBtn.Click += (e, s) => { if (!this.isRecording) { this.StartRecording(); } else { this.StopRecording(); } }; this.PlayRecordedBtn.Click += (e, s) => { if (!this.isVideoPlaying) { this.PlayVideo(); } else { this.StopVideo(); } }; EntityManager.Add(controlPanel); } else { TextBlock text = new TextBlock() { Text = "There is no connected camera", Width = 300, VerticalAlignment = WaveEngine.Framework.UI.VerticalAlignment.Bottom, HorizontalAlignment = WaveEngine.Framework.UI.HorizontalAlignment.Right, Margin = new WaveEngine.Framework.UI.Thickness(0, 0, 30, 30) }; EntityManager.Add(text); } }
protected override void CreateScene() { FreeCamera camera = new FreeCamera("camera", new Vector3(-3.8f, 2.2f, 5.6f), new Vector3(0, 0.8f, 2.2f)) { Speed = 5, NearPlane = 0.1f }; EntityManager.Add(camera); this.Video1 = WaveServices.VideoPlayer.VideoInfoFromPath("Content/Video/bunny.mp4"); this.Video2 = WaveServices.VideoPlayer.VideoInfoFromPath("Content/Video/bear.mp4"); WaveServices.VideoPlayer.IsLooped = true; WaveServices.VideoPlayer.Play(this.Video1); Entity tvRoomEntity = new Entity("tvRoom") .AddComponent(new Transform3D()) .AddComponent(new Model("Content/TvRoom.wpk")) .AddComponent(new ModelRenderer()) .AddComponent(new MaterialsMap(new System.Collections.Generic.Dictionary<string, Material> { {"floor", new DualTextureMaterial("Content/parketFloor_Diffuse.wpk", "Content/TvRoomLightingMap.wpk", DefaultLayers.Opaque)}, {"tv", new DualTextureMaterial("Content/Tv_Diffuse.wpk", "Content/TvRoomLightingMap.wpk", DefaultLayers.Opaque)}, {"table", new DualTextureMaterial("Content/table_Diffuse.wpk", "Content/TvRoomLightingMap.wpk", DefaultLayers.Opaque)}, {"chair", new DualTextureMaterial("Content/Chair_Diffuse.wpk", "Content/TvRoomLightingMap.wpk", DefaultLayers.Opaque)}, {"tv_screen", new BasicMaterial(WaveServices.VideoPlayer.VideoTexture)} } )); EntityManager.Add(tvRoomEntity); StackPanel controlPanel = new StackPanel() { VerticalAlignment = WaveEngine.Framework.UI.VerticalAlignment.Bottom, HorizontalAlignment = WaveEngine.Framework.UI.HorizontalAlignment.Right, Margin = new WaveEngine.Framework.UI.Thickness(0, 0, 30, 30), BorderColor = Color.White, IsBorder = true, }; ToggleSwitch muteToggle = new ToggleSwitch() { OnText = "Mute", OffText = "Mute", Margin = new WaveEngine.Framework.UI.Thickness(5, 5, 5, 10) }; muteToggle.Toggled += (e, s) => { WaveServices.VideoPlayer.IsMuted = muteToggle.IsOn; }; controlPanel.Add(muteToggle); RadioButton radioButton1 = new RadioButton() { GroupName = "Videos", Text = "Channel 1", Margin = new WaveEngine.Framework.UI.Thickness(5, 0, 5, 0), IsChecked = true }; radioButton1.Checked += (e, s) => { WaveServices.VideoPlayer.Play(this.Video1); }; controlPanel.Add(radioButton1); RadioButton radioButton2 = new RadioButton() { GroupName = "Videos", Text = "Channel 2", Margin = new WaveEngine.Framework.UI.Thickness(5,0,5,10) }; radioButton2.Checked += (e, s) => { WaveServices.VideoPlayer.Play(this.Video2); }; controlPanel.Add(radioButton2); PlayBtn = new Button("playBtn") { Text = "Play", Opacity = 0.5f, Margin = new WaveEngine.Framework.UI.Thickness(5, 0, 5, 0), Width = 170 }; PlayBtn.Click += (e, s) => { WaveServices.VideoPlayer.Resume(); PlayBtn.Opacity = 0.5f; PauseBtn.Opacity = 1f; }; controlPanel.Add(PlayBtn); PauseBtn = new Button("pauseBtn") { Text = "Pause", Width = 170, Margin = new WaveEngine.Framework.UI.Thickness(5, 0, 5, 5), }; PauseBtn.Click += (e, s) => { WaveServices.VideoPlayer.Pause(); PlayBtn.Opacity = 1f; PauseBtn.Opacity = 0.5f; }; controlPanel.Add(PauseBtn); EntityManager.Add(controlPanel); }
protected override void CreateScene() { this.Load(WaveContent.Scenes.MyScene); if (WaveServices.CameraCapture.IsConnected) { StackPanel controlPanel = new StackPanel() { VerticalAlignment = WaveEngine.Framework.UI.VerticalAlignment.Bottom, HorizontalAlignment = WaveEngine.Framework.UI.HorizontalAlignment.Right, Margin = new WaveEngine.Framework.UI.Thickness(0, 0, 30, 30), BorderColor = Color.White, IsBorder = true, }; this.RecButton = new Button("RecBtn") { Text = "Start Rec", Margin = new WaveEngine.Framework.UI.Thickness(5, 5, 5, 0), Width = 170 }; controlPanel.Add(this.RecButton); this.PlayRecordedButton = new Button("PlayRecordedBtn") { Text = "Play", Width = 170, Margin = new WaveEngine.Framework.UI.Thickness(5, 0, 5, 5), Opacity = 0.5f }; controlPanel.Add(this.PlayRecordedButton); this.RecButton.Click += (e, s) => { if (!this.isRecording) { this.StartRecording(); } else { this.StopRecording(); } }; this.PlayRecordedButton.Click += (e, s) => { if (!this.isVideoPlaying) { this.PlayVideo(); } else { this.StopVideo(); } }; EntityManager.Add(controlPanel); } else { TextBlock text = new TextBlock() { Text = "There is no connected camera", Width = 300, VerticalAlignment = WaveEngine.Framework.UI.VerticalAlignment.Bottom, HorizontalAlignment = WaveEngine.Framework.UI.HorizontalAlignment.Right, Margin = new WaveEngine.Framework.UI.Thickness(0, 0, 30, 30) }; EntityManager.Add(text); } }
/// <summary> /// Creates a new BestScore panel. /// </summary> /// <param name="y">The y of the new element.</param> /// <param name="score">The score of the new element.</param> /// <returns></returns> public static StackPanel CreateBestScore(int y, int score) { var stackPanelScore = new StackPanel() { HorizontalAlignment = WaveEngine.Framework.UI.HorizontalAlignment.Center, Orientation = WaveEngine.Components.UI.Orientation.Horizontal, Margin = new Thickness( 0, y, 0, 0) }; var bestScoreText = new Image(Textures.BEST_SCORE); var bestScoreNumber = new TextBlock() { FontPath = Fonts.SMALL_SCORE, Text = score.ToString(), TextAlignment = WaveEngine.Components.UI.TextAlignment.Right, Width = 50, }; stackPanelScore.Add(bestScoreText); stackPanelScore.Add(bestScoreNumber); return stackPanelScore; }
private void CreateGrid() { Grid grid = new Grid() { HorizontalAlignment = HorizontalAlignment.Right, Height = WaveServices.Platform.ScreenHeight, }; grid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Proportional) }); grid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(4, GridUnitType.Proportional) }); grid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Proportional) }); grid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Proportional) }); grid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Proportional) }); grid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Proportional) }); grid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(3, GridUnitType.Proportional) }); grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(200, GridUnitType.Pixel) }); EntityManager.Add(grid); #region Color UI TextBlock t_colors = new TextBlock() { Text = "Colors", VerticalAlignment = VerticalAlignment.Bottom, Margin = new Thickness(10), }; t_colors.SetValue(GridControl.RowProperty, 0); t_colors.SetValue(GridControl.ColumnProperty, 0); grid.Add(t_colors); StackPanel stackPanel = new StackPanel() { Margin = new Thickness(30, 0, 0, 0), }; stackPanel.SetValue(GridControl.RowProperty, 1); stackPanel.SetValue(GridControl.ColumnProperty, 0); grid.Add(stackPanel); RadioButton radio1 = new RadioButton() { Text = "Red", GroupName = "colors", Foreground = Color.Red, }; radio1.Checked += (s, o) => { this.cubeMaterial.DiffuseColor = Color.Red; }; stackPanel.Add(radio1); RadioButton radio2 = new RadioButton() { Text = "Green", GroupName = "colors", Foreground = Color.Green, }; radio2.Checked += (s, o) => { this.cubeMaterial.DiffuseColor = Color.Green; }; stackPanel.Add(radio2); RadioButton radio3 = new RadioButton() { Text = "Blue", GroupName = "colors", Foreground = Color.Blue, }; radio3.Checked += (s, o) => { this.cubeMaterial.DiffuseColor = Color.Blue; }; stackPanel.Add(radio3); RadioButton radio4 = new RadioButton() { Text = "White", GroupName = "colors", Foreground = Color.White, IsChecked = true, }; radio4.Checked += (s, o) => { this.cubeMaterial.DiffuseColor = Color.White; }; stackPanel.Add(radio4); #endregion #region Texture UI TextBlock t_texture = new TextBlock() { Text = "Textures", VerticalAlignment = VerticalAlignment.Bottom, Margin = new Thickness(10), }; t_texture.SetValue(GridControl.RowProperty, 2); t_texture.SetValue(GridControl.ColumnProperty, 0); grid.Add(t_texture); ToggleSwitch toggleTexture = new ToggleSwitch() { Margin = new Thickness(30, 0, 0, 0), Foreground = darkColor, Background = lightColor, IsOn = true, }; toggleTexture.Toggled += (s, o) => { this.cubeMaterial.TextureEnabled = toggleTexture.IsOn; }; toggleTexture.SetValue(GridControl.RowProperty, 3); toggleTexture.SetValue(GridControl.ColumnProperty, 0); grid.Add(toggleTexture); #endregion #region Scale UI TextBlock t_scale = new TextBlock() { Text = "Scale", VerticalAlignment = VerticalAlignment.Bottom, Margin = new Thickness(10), }; t_scale.SetValue(GridControl.RowProperty, 4); t_scale.SetValue(GridControl.ColumnProperty, 0); grid.Add(t_scale); Slider sliderScale = new Slider() { Width = 150, VerticalAlignment = VerticalAlignment.Bottom, Margin = new Thickness(30, 0, 0, 0), Foreground = darkColor, Background = lightColor, Value = 50, }; sliderScale.RealTimeValueChanged += (s, o) => { this.cubeTransform.Scale = Vector3.One / 2 + (Vector3.One * (o.NewValue / 100f)); }; sliderScale.SetValue(GridControl.RowProperty, 5); sliderScale.SetValue(GridControl.ColumnProperty, 0); grid.Add(sliderScale); #endregion #region Reset UI Button b_reset = new Button() { Text = "Reset", Margin = new Thickness(10, 0, 0, 20), VerticalAlignment = VerticalAlignment.Bottom, Foreground = Color.White, BackgroundColor = lightColor, }; b_reset.Click += (s, o) => { radio4.IsChecked = true; toggleTexture.IsOn = true; sliderScale.Value = 50; this.sliderRotX.Value = 0; this.sliderRotY.Value = 0; }; b_reset.SetValue(GridControl.RowProperty, 6); b_reset.SetValue(GridControl.ColumnProperty, 0); grid.Add(b_reset); #endregion }