TextBlock decorate class
Inheritance: UIBase
Exemple #1
0
        protected override void CreateScene()
        {
            RenderManager.BackgroundColor = Color.Black;

            // Adds record button.
            this.recordButton = new Button("recordButton")
            {
                Text = STARTTEXT,
                Margin = new WaveEngine.Framework.UI.Thickness(100),
                HorizontalAlignment = WaveEngine.Framework.UI.HorizontalAlignment.Left,
                VerticalAlignment = WaveEngine.Framework.UI.VerticalAlignment.Top
            };

            this.recordButton.Click += OnRecordButtonClicked;
            this.EntityManager.Add(this.recordButton);

            // Adds play button
            this.playButton = new Button("playButton")
            {
                Text = PLAYTEXT,
                Margin = new WaveEngine.Framework.UI.Thickness(100),
                HorizontalAlignment = WaveEngine.Framework.UI.HorizontalAlignment.Right,
                VerticalAlignment = WaveEngine.Framework.UI.VerticalAlignment.Top,
                IsVisible = false
            };
            this.playButton.Click += OnPlayButtonClicked;
            this.EntityManager.Add(this.playButton);

            // Shows error label if microphone is not available
            if (!WaveServices.Microphone.IsConnected)
            {
                TextBlock errorText = new TextBlock()
                {
                    Text = ERROREXT,
                    HorizontalAlignment = WaveEngine.Framework.UI.HorizontalAlignment.Center,
                    VerticalAlignment = WaveEngine.Framework.UI.VerticalAlignment.Bottom,
                    Margin = new WaveEngine.Framework.UI.Thickness(50)
                };

                this.EntityManager.Add(errorText);
            }

            this.progressBar = new ProgressBar()
            {
                Maximum = 255,
                Minimum = 0,
                Value = 0,
                Width = 400,
                Height = 10,
                VerticalAlignment = WaveEngine.Framework.UI.VerticalAlignment.Center,
                HorizontalAlignment = WaveEngine.Framework.UI.HorizontalAlignment.Center,
                IsVisible = false
            };

            this.EntityManager.Add(this.progressBar);

            //Register bank
            this.bank = new SoundBank(this.Assets);
            WaveServices.SoundPlayer.RegisterSoundBank(this.bank);
        }
Exemple #2
0
        protected override void CreateScene()
        {
            WaveServices.ScreenContextManager.SetDiagnosticsActive(true);

            this.Load(WaveContent.Scenes.MyScene);

            var kinectService = WaveServices.GetService<KinectService>();

            Texture2D texture = kinectService.ColorTexture;

            Entity sprite = new Entity()
                                .AddComponent(new Transform2D()
                                {
                                    XScale = (float)this.VirtualScreenManager.VirtualWidth / (float)texture.Width,
                                    YScale = (float)this.VirtualScreenManager.VirtualHeight / (float)texture.Height,
                                })
                                .AddComponent(new Sprite(texture))
                                .AddComponent(new SpriteRenderer(DefaultLayers.Opaque));
            EntityManager.Add(sprite);

            TextBlock label = new TextBlock()
            {
                Text = string.Format("Kinect sensor is available: {0} ", kinectService.IsAvailable.ToString()),
                Margin = new Thickness(20, 20, 20, 20),
                VerticalAlignment = VerticalAlignment.Bottom,
            };
            EntityManager.Add(label);
        }
        protected override void CreateScene()
        {
            this.Load(WaveContent.Scenes.MyScene);

            var textBlock = new TextBlock()
            {
                Text = "Touch the screen to control fireball",
                HorizontalAlignment = WaveEngine.Framework.UI.HorizontalAlignment.Left,
                VerticalAlignment = WaveEngine.Framework.UI.VerticalAlignment.Top,
                Margin = new WaveEngine.Framework.UI.Thickness(20),
                DrawOrder = 0.1f
            };
            this.EntityManager.Add(textBlock);

            var smoke = EntityManager.Find("meteor.smoke");
            smoke.AddComponent(new ParticleSystemRenderer2D());
            smoke.AddComponent(ParticleSystemFactory.CreateSmokeParticle());

            var fire = EntityManager.Find("meteor.fire");
            fire.AddComponent(new ParticleSystemRenderer2D());
            fire.AddComponent(ParticleSystemFactory.CreateFireParticle());

            var explosionParticles = EntityManager.Find("explosion.explosionParticles");
            explosionParticles.AddComponent(new ParticleSystemRenderer2D());
            explosionParticles.AddComponent(ParticleSystemFactory.CreateExplosion());

            var dinos = EntityManager.Find("explosion.dinos");
            dinos.AddComponent(new ParticleSystemRenderer2D());
            dinos.AddComponent(ParticleSystemFactory.CreateDinosaurs());
        }
 protected override void ResolveDependencies()
 {
     base.ResolveDependencies();
     
     // TODO: Pending of EntityManager.Find return decorator classes
     this.textBlock = (Owner.Scene as MyScene).textBlock1;
 }
        protected override void CreateScene()
        {
            var camera2D = new FixedCamera2D("Camera2D")
            {
                BackgroundColor = Color.CornflowerBlue
            };
            this.EntityManager.Add(camera2D);

            this.messageTextBlock = new TextBlock()
            {
                Width = 600,
                Height = 50,
                HorizontalAlignment = HorizontalAlignment.Left,
                VerticalAlignment = VerticalAlignment.Bottom,
                Margin = new Thickness(10, 0, 10, 10)
            };
            this.EntityManager.Add(this.messageTextBlock);

            this.playerEntity = new Entity("SelectedPlayer")
                .AddComponent(new Transform2D
                {
                    Position = new Vector2(100, 100),
                })
                .AddComponent(new Sprite())
                .AddComponent(new SpriteRenderer(DefaultLayers.Alpha));
            this.EntityManager.Add(this.playerEntity);

            this.SendHelloToServer();
        }
        public ObjectivesPanel(List<Objective> objectives, int width, int x, int y)
        {
            _time = TimeSpan.FromSeconds(60);
            _objectives = objectives;
            this.entity = new Entity()
                               .AddComponent(new Transform2D() { X = x, Y = y })
                               ;

            this.text = new TextBlock("text")
            {
                Width = width,
                Height = 42,
                Text = string.Empty,
            };
            CreateText();

            this.entity.AddChild(this.text.Entity);

            _timeText = new TextBlock()
            {
                Width = width,
                Height = 100,
                Text = string.Format("Time Left: {0:0}", _time.TotalSeconds),
                Margin = new Thickness(0, 100, 0, 0),

            };
            this.entity.AddChild(_timeText.Entity);
        }
 public BallBehavior(TextBlock scoreText)
     : base("BallBehavior")
 {
     body = null;
     this.scoreText = scoreText;
     score = 0;
 }
        /// <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;
        }
Exemple #9
0
        private void CreateUI()
        {
            Button changeCameraBtn = new Button()
            {
                Text = "Change Camera",
                HorizontalAlignment = WaveEngine.Framework.UI.HorizontalAlignment.Left,
                VerticalAlignment = WaveEngine.Framework.UI.VerticalAlignment.Top,
                Margin = new WaveEngine.Framework.UI.Thickness(20),
                Width = 160,
                Height = 60
            };

            changeCameraBtn.Click += changeCameraBtn_Click;

            EntityManager.Add(changeCameraBtn);

            this.textBlock = new TextBlock()
            {
                Text = "",
                VerticalAlignment = WaveEngine.Framework.UI.VerticalAlignment.Top,
                HorizontalAlignment = WaveEngine.Framework.UI.HorizontalAlignment.Left,
                Margin = new WaveEngine.Framework.UI.Thickness(20, 100,0,0)
            };

            EntityManager.Add(this.textBlock);
        }
        protected override void CreateScene()
        {
            //Set up game engine stuff.
            RenderManager.BackgroundColor = Color.CornflowerBlue;
            PhysicsManager.Gravity2D = new Vector2(0, 0);

            //Initialize UI entities.
            TextBlock scoreText = new TextBlock()
            {
                Text = "Score: " + score,
                VerticalAlignment = VerticalAlignment.Top,
                HorizontalAlignment = HorizontalAlignment.Center,
                Margin = new Thickness(0, 30, 0, 0)
            };

            //Initialize in-game entities.
            Entity ball = this.CreateCircularSprite("Ball", BALL_STARTING_X, BALL_STARTING_Y, BALL_FILENAME, false)
                .AddComponent(new BallBehavior(scoreText));

            Entity leftPaddle = this.CreateSquareSprite("Left Paddle", LEFT_PADDLE_STARTING_X, PADDLE_STARTING_Y, PADDLE_FILENAME, true).AddComponent(new LeftPaddleBehavior());
            Entity rightPaddle = this.CreateSquareSprite("Right Paddle", RIGHT_PADDLE_STARTING_X, PADDLE_STARTING_Y, PADDLE_FILENAME, true).AddComponent(new ComputerPaddleBehavior(ball.FindComponentOfType<RigidBody2D>()));//RightPaddleBehavior());//

            Entity topWall = this.CreateSquareSprite("Top Wall", 400, 0, WALL_FILENAME, true);
            Entity bottomWall = this.CreateSquareSprite("Bottom Wall", 400, 600, WALL_FILENAME, true);

            //Add UI entities to the entity manager.
            EntityManager.Add(scoreText);

            //Add in-game entities to the entity manager.
            EntityManager.Add(leftPaddle);
            EntityManager.Add(rightPaddle);
            EntityManager.Add(topWall);
            EntityManager.Add(bottomWall);
            EntityManager.Add(ball);
        }
        public ComboPanel(Vector2 position)
        {
            this.multiplier = 1;

            // Text
            this.comboText = new TextBlock()
            {
                Width = 151,
                Text = "",
                FontPath = WaveContent.Assets.Fonts.Gotham_Bold_16_ttf,
                TextAlignment = TextAlignment.Center,
            };
            var transform = this.comboText.Entity.FindComponent<Transform2D>();
            transform.X = -45;
            transform.Y = -17;

            // Flames
            this.entity = new Entity("ComboPanel")
                        {
                            IsVisible = false
                        }
                        .AddComponent(new Transform2D()
                        {
                            X = position.X,
                            Y = position.Y,
                            Origin = Vector2.Center
                        })
                        .AddComponent(new ShakeBehavior())
                        .AddComponent(new Sprite(WaveContent.Assets.Textures.bg_combo_PNG))
                        .AddComponent(new SpriteRenderer(DefaultLayers.Alpha))
                        .AddChild(this.comboText.Entity);
        }
        public ScoreboardPanel()
        {
            this.entity = new Entity("scoreboardPanel").AddComponent(new Transform2D())
                .AddComponent(new PanelControl(300, 100))
                .AddComponent(new PanelControlRenderer());
            Configuration config = new Configuration();
            config.ReadConfiguration();

            this.timeText = new TextBlock("timeText")
            {
                Width = 132,
                Height = 42,
                Text = this.time.ToString(@"mm\:ss\:ff"),
                Margin = new Thickness(34, 19, 0, 0),
                Foreground = Color.LightGreen,
            };
            this.entity.AddChild(this.timeText.Entity);

            _scoreText = new TextBlock("scoreText")
            {
                Width = 132,
                Height = 42,
                Text = string.Format("{0:0000}", _scores),
                Margin = new WaveEngine.Framework.UI.Thickness(207, 19, 0,0)
            };
            this.entity.AddChild(_scoreText.Entity);
        }
Exemple #13
0
        /// <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()
        {
            // Scene behaviors
            this.AddSceneBehavior(new StartSceneBehavior(), SceneBehavior.Order.PostUpdate);

            // Creates a 2D camera
            var camera2D = new FixedCamera2D("Camera2D") { ClearFlags = ClearFlags.DepthAndStencil }; // Transparent background need this clearFlags.
            this.EntityManager.Add(camera2D);

            // "Catch to Start" Text
            var startTextBlock = new TextBlock("StartEntity")
            {
                Width = 885,
                Height = 65,
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment = VerticalAlignment.Center,
                TextAlignment = TextAlignment.Center,
                FontPath = "Content/PFDarkBigFont",
                Text = "Catch this to START",
                Foreground = Color.Red,
            };
            startTextBlock.Entity.AddComponent(new BlinkBehavior(TimeSpan.FromSeconds(0.2f))
                            {
                                MinOpacity = 0.4f
                            });
            this.EntityManager.Add(startTextBlock);
        }
Exemple #14
0
        protected override void CreateScene()
        {            
            // Main Camera
            ViewCamera camera = new ViewCamera("MainCamera", new Vector3(0, 400, 1200), new Vector3(0, 400, 0));
            camera.BackgroundColor = Color.Black;
            EntityManager.Add(camera.Entity);            

            // Initialize particle system

            Entity entitySystem = new Entity("Particles")
                .AddComponent(new Transform3D())
                .AddComponent(new ParticleBehavior())
                .AddComponent(new ParticleSystemRenderer3D());

            var behavior = entitySystem.FindComponent<ParticleBehavior>();
            behavior.ApplyChanges();
            behavior.ApplyMaterial();

            EntityManager.Add(entitySystem);

            textBlock1 = new TextBlock()
            {
                Margin = new Thickness(10),
                Text = "Fire",
                TextWrapping = true,
            };
            EntityManager.Add(textBlock1.Entity);
        }
Exemple #15
0
        protected override void CreateScene()
        {
            FixedCamera2D camera2d = new FixedCamera2D("camera");
            EntityManager.Add(camera2d);

            var credits = new TextBlock()
            {
                Text = "Braid's art copyright from their original owners\n" +
                       "Sprites from Cyrus Annihilator, background from David Hellman's web\n" +
                       "We just love this game and wanted to make a small tribute within this sample :-)",
                Margin = new Thickness(10, 10, 0, 0),
                Foreground = Color.Black
            };

            var sky = new Entity("Sky")
                .AddComponent(new Sprite("Content/Sky.wpk"))
                .AddComponent(new SpriteRenderer(DefaultLayers.Alpha))
                .AddComponent(new Transform2D()
                {
                    Origin = new Vector2(0.5f, 1),
                    X = WaveServices.Platform.ScreenWidth / 2,
                    Y = WaveServices.Platform.ScreenHeight
                });
            var floor = new Entity("Floor")
                .AddComponent(new Sprite("Content/Floor.wpk"))
                .AddComponent(new SpriteRenderer(DefaultLayers.Alpha))
                .AddComponent(new Transform2D()
                {
                    Origin = new Vector2(0.5f, 1),
                    X = WaveServices.Platform.ScreenWidth / 2,
                    Y = WaveServices.Platform.ScreenHeight
                });

            // Tim
            var tim = new Entity("Tim")
                .AddComponent(new Transform2D()
                {
                    X = WaveServices.Platform.ScreenWidth / 2,
                    Y = WaveServices.Platform.ScreenHeight - 46,
                    Origin = new Vector2(0.5f, 1)
                })
                .AddComponent(new Sprite("Content/TimSpriteSheet.wpk"))
                .AddComponent(Animation2D.Create<TexturePackerGenericXml>("Content/TimSpriteSheet.xml")
                    .Add("Idle", new SpriteSheetAnimationSequence() { First = 1, Length = 22, FramesPerSecond = 11 })
                    .Add("Running", new SpriteSheetAnimationSequence() { First = 23, Length = 27, FramesPerSecond = 27 }))
                .AddComponent(new AnimatedSpriteRenderer())
                .AddComponent(new TimBehavior());

            // We add the floor the first so the rocks are on top of Tim
            EntityManager.Add(credits.Entity);
            EntityManager.Add(floor);
            EntityManager.Add(tim);
            EntityManager.Add(sky);

            var anim2D = tim.FindComponent<Animation2D>();
            anim2D.Play(true);
        }
        public ButtonOption(string option, Action action)
        {
            this.grid = new Grid();

            grid.HorizontalAlignment = WaveEngine.Framework.UI.HorizontalAlignment.Center;
            grid.VerticalAlignment = WaveEngine.Framework.UI.VerticalAlignment.Center;
            grid.Width = 475;
            grid.Height = 139;

            grid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Proportional) });

            grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Auto) });
            grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Proportional) });

            Button b_option = new Button()
            {
                Text = string.Empty,
                IsBorder = false,
                BackgroundImage = Directories.Textures + option + "_bt.png.wpk",
                PressedBackgroundImage = Directories.Textures + option + "_bt_pressed.png.wpk",
                VerticalAlignment = WaveEngine.Framework.UI.VerticalAlignment.Center,
                HorizontalAlignment = WaveEngine.Framework.UI.HorizontalAlignment.Center,
            };
            b_option.Click += (s, o) => action();
            b_option.SetValue(GridControl.RowProperty, 0);
            b_option.SetValue(GridControl.ColumnProperty, 0);
            grid.Add(b_option);
           
            TextBlock t_option = new TextBlock()
            {
                Width = 322, 
                Height = 65,
                FontPath = WaveContent.Assets.Fonts.Gotham_Bold_16_ttf,
                Text = option.ToUpper(),
                VerticalAlignment = WaveEngine.Framework.UI.VerticalAlignment.Center,
                HorizontalAlignment = WaveEngine.Framework.UI.HorizontalAlignment.Center,
                DrawOrder = 0.4f,
                Margin = new WaveEngine.Framework.UI.Thickness(0, 13, 0,0)
            };
            t_option.SetValue(GridControl.RowProperty, 0);
            t_option.SetValue(GridControl.ColumnProperty, 1);
            grid.Add(t_option);

            Image bg_option = new Image(WaveContent.Assets.Textures.bg_options_pause_PNG)
            {
                VerticalAlignment = WaveEngine.Framework.UI.VerticalAlignment.Center,
                HorizontalAlignment = WaveEngine.Framework.UI.HorizontalAlignment.Center,
                Margin = new WaveEngine.Framework.UI.Thickness(-45,0,0,0),
                DrawOrder = 0.9f,
            };
            bg_option.SetValue(GridControl.RowProperty, 0);
            bg_option.SetValue(GridControl.ColumnProperty, 1);
            grid.Add(bg_option);

            this.entity = grid.Entity;
        }
        protected override void CreateScene()
        {
            this.Load(WaveContent.Scenes.MyScene);

            this.leftJoystick = EntityManager.Find("leftJoystickParent").FindChild("leftJoystick");
            this.rightJoystick = EntityManager.Find("rightJoystickParent").FindChild("rightJoystick");
            this.buttonA = EntityManager.Find("buttonA");
            this.buttonB = EntityManager.Find("buttonB");
            this.buttonX = EntityManager.Find("buttonX");
            this.buttonY = EntityManager.Find("buttonY");
            this.buttonBack = EntityManager.Find("buttonBack");
            this.buttonStart = EntityManager.Find("buttonStart");
            this.dpadUp = EntityManager.Find("dpadUp");
            this.dpadDown = EntityManager.Find("dpadDown");
            this.dpadLeft = EntityManager.Find("dpadLeft");
            this.dpadRight = EntityManager.Find("dpadRight");
            this.leftShoulder = EntityManager.Find("leftShoulder");
            this.rightShoulder = EntityManager.Find("rightShoulder");
            this.leftTrigger = EntityManager.Find("leftTrigger");
            this.rightTrigger = EntityManager.Find("rightTrigger");

            // Texts
            this.leftStickText = new TextBlock()
            {
                Text = "LeftStick: " + Vector2.Zero,
                Foreground = Color.Gray,
                Margin = new Thickness(263, 627, 0, 0),
            };
            EntityManager.Add(this.leftStickText);

            this.rightStickText = new TextBlock()
            {
                Text = "RightStick: " + Vector2.Zero,
                Foreground = Color.Gray,
                Margin = new Thickness(263, 657, 0, 0),
            };
            EntityManager.Add(this.rightStickText);

            this.leftTriggerText = new TextBlock()
            {
                Text = "LeftTrigger: 0",
                Foreground = Color.Gray,
                Margin = new Thickness(856, 627, 0, 0),
            };
            EntityManager.Add(this.leftTriggerText);

            this.rightTriggerText = new TextBlock()
            {
                Text = "RightTrigger: 0",
                Foreground = Color.Gray,
                Margin = new Thickness(856, 657, 0, 0),
            };
            EntityManager.Add(this.rightTriggerText);

            this.AddSceneBehavior(new GamePadSceneBehavior(), SceneBehavior.Order.PostUpdate);
        }
Exemple #18
0
        protected override void CreateScene()
        {
            this.Load(WaveContent.Scenes.MyScene);

            var instructions = new TextBlock
            {
                Text = "Left-button click or tap to throw a ball",
                Margin = new Thickness(10)
            };
            this.EntityManager.Add(instructions);
        }
        protected override void CreateScene()
        {
            this.Load(WaveContent.Scenes.MyScene);

            // Add the textbox to show the picked entity
            instructions = new TextBlock()
            {
                VerticalAlignment = VerticalAlignment.Bottom,
                HorizontalAlignment = HorizontalAlignment.Left,
                Text = "Selected Entity",
            };
            EntityManager.Add(instructions.Entity);
        }
        protected override void CreateScene()
        {
            RenderManager.BackgroundColor = Color.Gray;
            //RenderManager.DebugLines = true;

            Entity background = new Entity()
                 .AddComponent(new Transform2D()
                {
                    DrawOrder = 1
                })
                .AddComponent(new StretchBehavior())
                .AddComponent(new Sprite("Content/background.wpk"))
                .AddComponent(new SpriteRenderer(DefaultLayers.Alpha));
            EntityManager.Add(background);

            Entity tyrion = new Entity()
                .AddComponent(new Transform2D()
                {
                    Origin = new Vector2(0.5f,1f),
                    X = WaveServices.ViewportManager.VirtualWidth / 2,
                    Y = WaveServices.ViewportManager.VirtualHeight - 67
                })
                .AddComponent(new RectangleCollider())
                .AddComponent(new KickBehavior())
                .AddComponent(new Sprite("Content/tyrion.wpk"))
                .AddComponent(new SpriteRenderer(DefaultLayers.Alpha));
            EntityManager.Add(tyrion);

            //Entity touchPanel = new Entity("TouchPanel")
            //    .AddComponent(new TouchesRenderer("Content/touch.wpk"));

            // Score
            TextBlock texblock = new TextBlock("ScoreTextBlock")
            {
                Text = "Score: 0",
                VerticalAlignment = WaveEngine.Framework.UI.VerticalAlignment.Top,
                HorizontalAlignment = WaveEngine.Framework.UI.HorizontalAlignment.Left,
                //FontPath = "8BIT WONDER"
            };

            TextBlock attempt = new TextBlock("AttemptTextBlock")
            {
                Text = "0/4",
                VerticalAlignment = WaveEngine.Framework.UI.VerticalAlignment.Top,
                HorizontalAlignment = WaveEngine.Framework.UI.HorizontalAlignment.Right
            };

            EntityManager.Add(texblock);
            //EntityManager.Add(touchPanel);
            EntityManager.Add(attempt);
        }
        protected override void CreateScene()
        {
            RenderManager.BackgroundColor = Color.White;

            var help = new TextBlock()
            {
                Text = "Drop a WPK here",
                Foreground = Color.Black,
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment = VerticalAlignment.Center,
                FontPath = "Content/Fonts/Script MT.wpk"
            };
            this.EntityManager.Add(help);
        }
Exemple #22
0
 /// <summary>
 /// Create Help text
 /// </summary>
 private void CreateHelpText()
 {
     helpText = new TextBlock()
     {
         VerticalAlignment = VerticalAlignment.Top,
         Margin = new Thickness(20, 20, 0, 0),
         Text = "Key H show/hide help text \n" +
                   "Key F1 diagnostics mode \n" +
                   "Key F5 Emiter boxes scene \n" +
                   "Key F6 Wall boxes scene \n" +
                   "Key F7 Bridge scene \n" +
                   "Key R restart scene \n" +
                   "Key G change gravity direction"
     };
     EntityManager.Add(helpText.Entity);
 }
        protected override void Initialize()
        {
            base.Initialize();

            this.logo = this.EntityManager.Find("Logo");
            this.tap_to_start = this.EntityManager.Find("TapToStart");
            this.game_over = this.EntityManager.Find("GameOver");
            this.bestScores = this.EntityManager.Find<TextBlock>("BestScores");

            this.player = this.EntityManager.Find("Player").FindComponent<PlayerBehavior>();
            this.enemyEmitter = this.EntityManager.Find("EnemyEmitter").FindComponent<EnemyEmitter>();
            this.leftJoystick = this.EntityManager.Find<Joystick>("leftJoystick");
            this.rightJoystick = this.EntityManager.Find<Joystick>("rightJoystick");
            this.hubPanel = this.EntityManager.Find<HubPanel>("HubPanel");

            this.CurrentState = States.Menu;
        }
        protected override void CreateScene()
        {
            this.Load(WaveContent.Scenes.GamePlayScene);

            this.scoreText = new TextBlock()
            {
                Text = "0",
                FontPath = WaveContent.Fonts.Space_Age_TTF,
                HorizontalAlignment = HorizontalAlignment.Left,
                VerticalAlignment = VerticalAlignment.Bottom,
                Margin = new Thickness(80, 0, 0, 30),
                Foreground = new Color(117, 243, 237, 255)
            };

            this.EntityManager.Add(scoreText);

            WaveServices.GetService<ScoreManager>().CurrentScoreChanged += this.GamePlaySceneCurrentScoreChanged;
        }
Exemple #25
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MessagePanel" /> class.
        /// </summary>
        /// <param name="type">The type.</param>
        public MessagePanel(MessageType type)
        {
            this.entity = new Entity("MessagePanel")
                               .AddComponent(new Transform2D())
                               .AddComponent(new PanelControl(1280, 720))
                               .AddComponent(new PanelControlRenderer())
                               ;
            this.text = new TextBlock("text")
            {
                Width = 132,
                Height = 42,
                Text = string.Empty,
                Margin = new Thickness(640, 360, 0,0),

            };
            this.entity.AddChild(this.text.Entity);

            this.Type = type;
        }
Exemple #26
0
        protected override void CreateScene()
        {
            RenderManager.BackgroundColor = Color.CornflowerBlue;
            //RenderManager.DebugLines = true;
            var random = WaveServices.Random;

            var freeCamera = new FreeCamera("FreeCamera", new Vector3(0, 10, -10), Vector3.Zero) { FarPlane = 100 };
            freeCamera.Entity.AddComponent(new CameraFrustum());
            EntityManager.Add(freeCamera);

            var fixedCamera = new FixedCamera("FixedCamera", new Vector3(20, 50, -20), new Vector3(20, 0, 20));

            EntityManager.Add(fixedCamera);

            RenderManager.SetActiveCamera(fixedCamera.Entity);
            RenderManager.SetFrustumCullingCamera(freeCamera.Entity);

            int num = 15;

            for (int i = 0; i < num; i++)
            {
                for (int j = 0; j < num; j++)
                {
                    if (random.NextBool())
                    {
                        Entity cube = CreateCube("Cube" + (j + (i * num)), new Vector3(j * 3, 0, i * 3));
                        EntityManager.Add(cube);
                    }
                    else
                    {
                        Entity sphere = CreateSphere("Sphere" + (j + (i * num)), new Vector3(j * 3, 0, i * 3));
                        EntityManager.Add(sphere);

                    }
                }
            }

            TextBlock textBlock = new TextBlock("Message");
            textBlock.Text = "Press 1 or 2 to change the camera";
            EntityManager.Add(textBlock);

            AddSceneBehavior(new SelectCamera(freeCamera, fixedCamera), SceneBehavior.Order.PreUpdate);
        }
Exemple #27
0
        protected override void CreateScene()
        {
            // Create the camera
            FreeCamera mainCamera = new FreeCamera("MainCamera", Vector3.Zero, new Vector3(0f, 0f, -50f));
            mainCamera.BackgroundColor = Color.CornflowerBlue;
            // Add the Picking Behavior to the camera
            mainCamera.Entity.AddComponent(new PickingBehavior());            
            EntityManager.Add(mainCamera.Entity);

            // Add the ground
            Entity ground = new Entity("Ground")
               .AddComponent(new Transform3D() { Position = new Vector3(0, -1, 0) })
               .AddComponent(new BoxCollider())
               .AddComponent(Model.CreatePlane(Vector3.Up, 50))
               .AddComponent(new MaterialsMap(new BasicMaterial(Color.Gray)))
               .AddComponent(new ModelRenderer());

            EntityManager.Add(ground);

            // Create a few models to add in the world
            CreateRandomModel("Cube_1", Model.CreateCube());
            CreateRandomModel("Cube_2", Model.CreateCube());
            CreateRandomModel("Cube_3", Model.CreateCube());
            CreateRandomModel("Cone", Model.CreateCone());
            CreateRandomModel("Cylinder", Model.CreateCylinder());
            CreateRandomModel("Pyramid", Model.CreatePyramid());
            CreateRandomModel("Sphere", Model.CreateSphere());
            CreateRandomModel("Torus_1", Model.CreateTorus());
            CreateRandomModel("Capsule", Model.CreateCapsule());
            CreateRandomModel("Capsule_2", Model.CreateCapsule());
            CreateRandomModel("Capsule_3", Model.CreateCapsule());
            CreateRandomModel("Torus_2", Model.CreateTorus());
            CreateRandomModel("Torus_3", Model.CreateTorus());

            // Add the textbox to show the picked entity
            instructions = new TextBlock()
            {
                VerticalAlignment = VerticalAlignment.Bottom,
                HorizontalAlignment = HorizontalAlignment.Left,
                Text = "Selected Entity",
            };
            EntityManager.Add(instructions.Entity);
        }
Exemple #28
0
        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);
        }
        protected override void CreateScene()
        {
            RenderManager.BackgroundColor = Color.Black;
            /*Entity title = new Entity("Title")
                   .AddComponent(new Sprite("Content/TitlePong.wpk"))
                   .AddComponent(new SpriteRenderer(DefaultLayers.Alpha))
                   .AddComponent(new Transform2D()
                   {
                       Y = WaveServices.Platform.ScreenHeight / 2,
                       X = WaveServices.Platform.ScreenWidth / 2
                   });

            EntityManager.Add(title);*/
            TextBlock scoreEnd = new TextBlock("scoreEndTextBlock")
            {
                Text = "Score\n" + this.score.ToString(),
                VerticalAlignment = WaveEngine.Framework.UI.VerticalAlignment.Top,
                HorizontalAlignment = WaveEngine.Framework.UI.HorizontalAlignment.Center,
                DrawOrder = 3f,
            };

            EntityManager.Add(scoreEnd);

            Button button = new Button()
                {
                    Text = "Restart?",
                    IsBorder = false,
                    Width = 700,
                    Height = 500,
                    HorizontalAlignment = WaveEngine.Framework.UI.HorizontalAlignment.Right,
                    VerticalAlignment = WaveEngine.Framework.UI.VerticalAlignment.Center,
                    //BackgroundImage = "Content/button.wpk",
                    //PressedBackgroundImage = "Content/buttonPressed.wpk",
                    Margin = new WaveEngine.Framework.UI.Thickness(100, 400, 0, 0)
                };
            button.Click += (s, o) =>
            {
                WaveServices.ScreenContextManager.To(new ScreenContext(new MyScene()), new SpinningSquaresTransition(TimeSpan.FromSeconds(2.0f)));
            };
            EntityManager.Add(button);
        }
        private void CreateUI()
        {
            // Play Button
            Button play = new Button("Play")
            {
                Text = string.Empty,
                IsBorder = false,
                BackgroundImage = WaveContent.Assets.Textures.play_png,
                PressedBackgroundImage = WaveContent.Assets.Textures.playPressed_png,
                Margin = new Thickness(244, 580, 0, 0),
            };

            play.Click += this.Play_Click;

            play.Entity.FindChild("ImageEntity").FindComponent<Transform2D>().Origin = Vector2.Center;
            play.Entity.AddComponent(new AnimationUI());
            EntityManager.Add(play);

            // Best Scores
            TextBlock bestScores = new TextBlock("BestScores")
            {
                FontPath = WaveContent.Assets.Fonts.Bulky_Pixels_16_TTF,
                Text = "your best score:",
                Foreground = new Color(223 / 255f, 244 / 255f, 255 / 255f),
                HorizontalAlignment = HorizontalAlignment.Left,
                VerticalAlignment = VerticalAlignment.Bottom,
                Margin = new Thickness(161, 0, 0, 30),
            };
            EntityManager.Add(bestScores);

            // Scores
            TextBlock scores = new TextBlock()
            {
                FontPath = WaveContent.Assets.Fonts.Bulky_Pixels_26_TTF,
                Text = this.gameStorage.BestScore.ToString(),
                HorizontalAlignment = HorizontalAlignment.Left,
                VerticalAlignment = VerticalAlignment.Bottom,
                Margin = new Thickness(440, 0, 0, 40),
            };
            EntityManager.Add(scores);
        }