Inheritance: INotifyPropertyChanged
Exemplo n.º 1
0
 public ScoreboardView(BasketballGame game, Team homeTeam, Team guestTeam, Clock clock)
     : base(game)
 {
     this.Visible = false;
     this.homeTeam = homeTeam;
     this.guestTeam = guestTeam;
     this.clock = clock;
 }
Exemplo n.º 2
0
        protected override void Initialize()
        {
            this.homeTeam = new Team("HOME");
            this.guestTeam = new Team("GUEST");
            this.clock = new Clock();

            this.camera = new TouchCamera { Bounds = new BoundingBox(new Vector3(-195), new Vector3(195)) };
            this.camera.LookAt(new Vector3(135, 40, 0), new Vector3(200, 40, 0), Vector3.Up);
            this.camera.Perspective(MathHelper.PiOver4, 800 / 480f, 1f, 600);

            var scoreboardView = new ScoreboardView(this, this.homeTeam, this.guestTeam, this.clock);
            this.Components.Add(scoreboardView);
            this.Components.Add(new ScoreboardQuad(this, this.camera, scoreboardView));
            this.Components.Add(new Court(this, this.camera));

            this.ResetGraphicDeviceState();
            TouchPanel.EnabledGestures = GestureType.FreeDrag | GestureType.Pinch;

            AccelerometerHelper.Instance.ReadingChanged += this.OnAccelerometerHelperReadingChanged;
            AccelerometerHelper.Instance.Active = true;

            base.Initialize();
        }
Exemplo n.º 3
0
        private IElement CreateTeamDisplay(Team team)
        {
            var teamNameTextBlock = new TextBlock(this.lcd)
                {
                    Foreground = new SolidColorBrush(Colors.LightGray), 
                    HorizontalAlignment = HorizontalAlignment.Center, 
                    Padding = new Thickness(25)
                };

            var scoreTextBlock = new TextBlock(this.led)
                {
                    Foreground = new SolidColorBrush(Colors.Green), 
                    HorizontalAlignment = HorizontalAlignment.Center
                };

            teamNameTextBlock.Bind(TextBlock.TextProperty, BindingFactory.CreateOneWay<Team, string>(o => o.Name));
            scoreTextBlock.Bind(TextBlock.TextProperty, BindingFactory.CreateOneWay<Team, int, string>(o => o.Score));

            return new StackPanel { Children = { teamNameTextBlock, scoreTextBlock }, DataContext = team };
        }