public override void UpdateStateValue(BoxData newState) { StopBlink(); switch (newState._state) { case BlackBox.GuessNoneState: this.image.Source = BlackboxImageUtils.Image(BlackboxImageType.BlackBoxGuessNone); this.imageForeground.Source = null; break; case BlackBox.GuessingState: this.image.Source = BlackboxImageUtils.Image(BlackboxImageType.BlackBoxGuessNone); this.imageForeground.Source = BlackboxImageUtils.Image(BlackboxImageType.BlackBoxGuessing); this.imageForeground.Opacity = 0.0; timer.Start(); break; case BlackBox.GuessFailedState: this.image.Source = BlackboxImageUtils.Image(BlackboxImageType.BlackBoxGuessNone); this.imageForeground.Source = BlackboxImageUtils.Image(BlackboxImageType.BlackBoxGuessFailed); this.imageForeground.Opacity = 0.0; timer.Start(); if (!this.LayoutRoot.Children.Contains(_starEffectPane)) { this.LayoutRoot.Children.Add(_starEffectPane); } _starEffectPane.Start(StarEffectPane.StarEffectType.RedStar); break; case BlackBox.GuessedState: this.image.Source = BlackboxImageUtils.Image(BlackboxImageType.BlackBoxGuessNone); this.imageForeground.Source = BlackboxImageUtils.Image(BlackboxImageType.BlackBoxGuessed); this.imageForeground.Opacity = 0.0; timer.Start(); if (!this.LayoutRoot.Children.Contains(_starEffectPane)) { this.LayoutRoot.Children.Add(_starEffectPane); } _starEffectPane.Start(StarEffectPane.StarEffectType.YellowStar); break; default: break; } }
public NookBoxView() : base() { this.projection = new PlaneProjection(); this.image.Source = BlackboxImageUtils.Image(BlackboxImageType.NookBoxBackground); this.imageForeground.Source = BlackboxImageUtils.Image(BlackboxImageType.NookBoxForeground); this.imageForeground.Projection = new PlaneProjection(); this.projection = (PlaneProjection)this.imageForeground.Projection; this.rotatedTimer = new DispatcherTimer(); this.rotatedTimer.Interval = TimeSpan.FromMilliseconds(RotatedTimeSpane); this.rotatedTimer.Tick += new EventHandler(OnRotatedTimerTick); this.rotatedTimer.Start(); this.speed = NormalSpeed; this.acceleratedTimer = new DispatcherTimer(); this.acceleratedTimer.Interval = TimeSpan.FromMilliseconds(AcceleratedTimeSpan); this.acceleratedTimer.Tick += new EventHandler(OnAcceleratedTimerTick); }