//フェードアウト処理 public void FadeOut(float time, Action onComplete) { if (TargetObject == null) { if (onComplete != null) { onComplete(); } return; } float begin = this.EffectColor.FadeAlpha; float end = 0; FadeTimer.StartTimer( time, x => { this.EffectColor.FadeAlpha = x.GetCurve(begin, end); }, x => { if (onComplete != null) { onComplete(); } } ); }
private void AlertDisplay_Load(object sender, EventArgs e) { ptbIcon.BackgroundImage = icon; label1.Text = message; Location = new Point(Screen.PrimaryScreen.WorkingArea.Width - this.Width, Screen.PrimaryScreen.WorkingArea.Height - this.Height * i); current = State.start; FadeTimer.Start(); }
private void UserAnswerWrong() { pointFade = new FadeTimer(255, 0, 0); pointFade.PositiveOrNegativePoints = false; FadeTimer.Start(); if (cbFocus.Checked) { sessionFocus.RecordUserResults(userKeyListObject.CurrentRandomKey, 0); } sessionStatistics.Total++; sessionStatistics.TotalPoints -= 3; GetScoreAndDisplayStatistics(); }
private void FadeTimer_Tick(object sender, EventArgs e) { // Animation which allows points added or subtracted to fade away pointFade.FadeTimerCount--; int endColor = 105; // this was static RGB 105 - will have to mod depend on GUI picture int fadeRate = 5; if (pointFade.PositiveOrNegativePoints) { // if positive points apply green color + fade lblPointsDisplay.ForeColor = Color.FromArgb(pointFade.R, pointFade.G, pointFade.B); lblPointsDisplay.Text = "+5"; if (pointFade.R < endColor) { pointFade.R += fadeRate; } if (pointFade.G > endColor) { pointFade.G -= fadeRate; } if (pointFade.B < endColor) { pointFade.B += fadeRate; } } else { // if negative points apply red color + fade lblPointsDisplay.ForeColor = Color.FromArgb(pointFade.R, pointFade.G, pointFade.B); lblPointsDisplay.Text = "-3"; if (pointFade.R > endColor) { pointFade.R -= fadeRate; } if (pointFade.G < endColor) { pointFade.G += fadeRate; } if (pointFade.B < endColor) { pointFade.B += fadeRate; } } if (pointFade.FadeTimerCount == 0) { FadeTimer.Stop(); } }
private void trackTotal() { // user answer incorrect if (cbFocus.Checked) { sessionFocus.recordUserResults(userKeyListObject.CurrentRandomKey, 0); } sessionStatistics.Total++; sessionStatistics.TotalPoints -= 3; pointFade = new FadeTimer(255, 0, 0); pointFade.PositiveOrNegativePoints = false; FadeTimer.Start(); getScoreAndDisplayStatistics(); }
//フェードをスキップする public void SkipFade() { IAdvCrossFadeImageObject crossFadeImage = TargetObject as IAdvCrossFadeImageObject; if (crossFadeImage != null && crossFadeImage.IsCrossFading) { crossFadeImage.SkipCrossFade(); } FadeTimer.SkipToEnd(); foreach (var obj in swapFadeObjects) { if (obj != null) { obj.Clear(); } } swapFadeObjects.Clear(); }
private void UserAnswerRight() { pointFade = new FadeTimer(0, 255, 0); // for green and red score display pointFade.PositiveOrNegativePoints = true; FadeTimer.Start(); if (cbFocus.Checked) // if in focus mode, collect user performance data { sessionFocus.RecordUserResults(userKeyListObject.CurrentRandomKey, 1); } sessionStatistics.Correct++; sessionStatistics.Total++; sessionStatistics.TotalPoints += 5; NoteClear(); LedgerLineClear(); GetRandomKeyAndDisplay(); GetScoreAndDisplayStatistics(); }
private void playAgain() { // user answered correct - collect user performance data // track score + display to user if (cbFocus.Checked) // if in focus mode, collect user performance data { sessionFocus.recordUserResults(userKeyListObject.CurrentRandomKey, 1); } sessionStatistics.Correct++; sessionStatistics.Total++; sessionStatistics.TotalPoints += 5; pointFade = new FadeTimer(0, 255, 0); // for green and red score display pointFade.PositiveOrNegativePoints = true; FadeTimer.Start(); getScoreAndDisplayStatistics(); getRandomKeyAndDisplay(); }
//フェードイン処理 public void FadeIn(float fadeTime, Action onComplete) { float begin = 0; float end = 1; FadeTimer.StartTimer( fadeTime, x => { this.EffectColor.FadeAlpha = x.GetCurve(begin, end); }, x => { if (onComplete != null) { onComplete(); } } ); }
/// <summary> /// Create the bitmaps, temp dc, and Start the Fade Timer /// </summary> private void StartSwishTimer() { if (_cSwishTimer == null) { _bSwishTimerOn = true; CreateSwish(); // set up the dc if (_cTempDc != null) _cTempDc.Dispose(); _cTempDc = new cStoreDc(); _cTempDc.Width = _cButtonDc.Width; _cTempDc.Height = _cButtonDc.Height; // blit in clean button BitBlt(_cTempDc.Hdc, 0, 0, _cButtonDc.Width, _cButtonDc.Height, _cButtonDc.Hdc, 0, 0, 0xCC0020); // reset stage _tSwishStage = new SwishStage(false); // timer setup _cSwishTimer = new FadeTimer(this); _cSwishTimer.Tick += new FadeTimer.TickDelegate(_cSwishTimer_Tick); _cSwishTimer.Complete += new FadeTimer.CompleteDelegate(_cSwishTimer_Complete); _cSwishTimer.Interval = 10; _cSwishTimer.Fade(FadeTimer.FadeType.Loop); } }
/// <summary> /// Create dc, and setup Fade Timer /// </summary> private void StartPulseTimer() { if (_cPulseTimer == null) { _bPulseTimerOn = true; _iPulseTick = 0; if (_cTempDc != null) _cTempDc.Dispose(); _cTempDc = new cStoreDc(); _cTempDc.Width = _cButtonDc.Width; _cTempDc.Height = _cButtonDc.Height; // blit clean image in BitBlt(_cTempDc.Hdc, 0, 0, _cButtonDc.Width, _cButtonDc.Height, _cButtonDc.Hdc, 0, 0, 0xCC0020); // timer setup _cPulseTimer = new FadeTimer(this); _cPulseTimer.Tick += new FadeTimer.TickDelegate(_cPulseTimer_Tick); _cPulseTimer.Complete += new FadeTimer.CompleteDelegate(_cPulseTimer_Complete); _cPulseTimer.Interval = 40; _cPulseTimer.Fade(FadeTimer.FadeType.Loop); } }
private void StopPulseTimer() { if (_cPulseTimer != null) { _iLinePos = 0; if (_cAnimationDc != null) _cAnimationDc.Dispose(); // tear down the timer class _cPulseTimer.Reset(); _cPulseTimer.Tick -= _cPulseTimer_Tick; _cPulseTimer.Complete -= _cPulseTimer_Complete; _cPulseTimer.Dispose(); _cPulseTimer = null; _bPulseTimerOn = false; } }
private void StartPulseTimer() { if (_cPulseTimer == null) { _bPulseTimerOn = true; if (_cAnimationDc != null) _cAnimationDc.Dispose(); _cAnimationDc = new cStoreDc(); _cAnimationDc.Width = _cControlDc.Width; _cAnimationDc.Height = _cControlDc.Height; BitBlt(_cAnimationDc.Hdc, 0, 0, _cControlDc.Width, _cControlDc.Height, _cControlDc.Hdc, 0, 0, 0xCC0020); // timer setup _cPulseTimer = new FadeTimer(this); _cPulseTimer.Tick += _cPulseTimer_Tick; _cPulseTimer.Complete += _cPulseTimer_Complete; _cPulseTimer.Interval = (int)AnimationSpeed; _cPulseTimer.Fade(FadeTimer.FadeType.Loop); } }
/// <summary> /// Dispose resources and timer teardown /// </summary> private void StopSwishTimer() { if (_cSwishTimer != null) { if (_cTempDc != null) _cTempDc.Dispose(); // tear down the timer class _cSwishTimer.Reset(); _cSwishTimer.Tick -= _cSwishTimer_Tick; _cSwishTimer.Complete -= _cSwirlTimer_Complete; _cSwishTimer.Dispose(); _cSwishTimer = null; _bSwishTimerOn = false; _eButtonState = ButtonSelectedState.Focused; ClickThis(); DrawButton(); } }
/// <summary> /// Dispose Fader and resources /// </summary> private void StopSwirlTimer() { if (_cSwirlTimer != null) { if (_cTempDc != null) _cTempDc.Dispose(); // tear down the timer class _cSwirlTimer.Reset(); _cSwirlTimer.Tick -= _cSwirlTimer_Tick; _cSwirlTimer.Complete -= _cSwirlTimer_Complete; _cSwirlTimer.Dispose(); _cSwirlTimer = null; _bSwirlTimerOn = false; } }
/// <summary> /// Create the images and initiate Fader class /// </summary> private void StartResizeTimer(bool sizein) { if (_cResizeTimer != null) StopResizeTimer(); // start the timer if (_cResizeTimer == null) { CreateResize(); _bResizeTimerOn = true; _cResizeTimer = new FadeTimer(this); _cResizeTimer.Tick += new FadeTimer.TickDelegate(_cResizeTimer_Tick); _cResizeTimer.Complete += new FadeTimer.CompleteDelegate(_cResizeTimer_Complete); _cResizeTimer.Interval = 10; _cResizeTimer.TickMaximum = 8; if (sizein) { _cResizeTimer.TickCount = 8; _cResizeTimer.Fade(FadeTimer.FadeType.FadeOut); } else { _cResizeTimer.Fade(FadeTimer.FadeType.FadeIn); } } }
/// <summary> /// Setup of buffer dc and Fade timer /// </summary> private void StartSwirlTimer() { if (_cSwirlTimer == null) { _bSwirlTimerOn = true; if (_cTempDc != null) _cTempDc.Dispose(); _cTempDc = new cStoreDc(); _cTempDc.Width = _cButtonDc.Width; _cTempDc.Height = _cButtonDc.Height; BitBlt(_cTempDc.Hdc, 0, 0, _cButtonDc.Width, _cButtonDc.Height, _cButtonDc.Hdc, 0, 0, 0xCC0020); // timer setup _cSwirlTimer = new FadeTimer(this); _cSwirlTimer.Tick += new FadeTimer.TickDelegate(_cSwirlTimer_Tick); _cSwirlTimer.Complete += new FadeTimer.CompleteDelegate(_cSwirlTimer_Complete); if (this.Image != null) { if (Image.Width > 128)//v1.1 added some delay adjsutments ju _cSwirlTimer.Interval = 28; else if (Image.Width < 128) _cSwirlTimer.Interval = 36; else _cSwirlTimer.Interval = 32; } else { _cSwirlTimer.Interval = 32; } _cSwirlTimer.Fade(FadeTimer.FadeType.Loop); } }
/// <summary> /// Dispose of Fader class and reset /// </summary> private void StopResizeTimer() { if (_cResizeTimer != null) { // tear down the timer class _cResizeTimer.Reset(); _cResizeTimer.Tick -= _cResizeTimer_Tick; _cResizeTimer.Complete -= _cResizeTimer_Complete; _cResizeTimer.Dispose(); _cResizeTimer = null; _bResizeTimerOn = false; _eButtonState = ButtonSelectedState.Focused; DrawButton(); ClickThis(); } }
private void StartFadeOut() { FadeTimer.Tick += this.FadeOut; FadeTimer.Start(); }