public void OnlyFadeIn() { abh.MinMaxReached -= new AlphaBlendHelper.OnMinMaxReached(abh_MinMaxReached); abh = new AlphaBlendHelper(0, 255, 255, -Speed); State = eState.FadingIn; abh.MinMaxReached += new AlphaBlendHelper.OnMinMaxReached(abh_MinMaxReached); }
void abh_MinMaxReached(AlphaBlendHelper abh) { switch (State) { case eState.None: throw new Exception(""); case eState.FadingOut: State = eState.FadingIn; if (StartFadeIn != null) { StartFadeIn(this); } break; case eState.FadingIn: State = eState.None; if (Finish != null) { Finish(this); } break; default: throw new CaseStatementMissingException(); } }
/// <summary> /// Fades the screen out and in again /// </summary> /// <param name="screenSize"></param> /// <param name="speed"></param> public ScreenFader(Size screenSize, int speed) { Speed = speed; abh = new AlphaBlendHelper(0, 255, 0, Speed); abh.MinMaxReached += new AlphaBlendHelper.OnMinMaxReached(abh_MinMaxReached); ScreenSize = screenSize; State = eState.FadingOut; }