public void FadeOut() { if (Fade != null) { return; } float duration = 2.0f; if (this.CurrentLoadScreenTip != null) { if (this.CurrentLoadScreenTip is GuessCharacter) { GuessCharacter selected = (GuessCharacter)this.CurrentLoadScreenTip; selected.Result = true; duration = duration + 3.0f; } else if (this.CurrentLoadScreenTip is Narration) { Narration selected = (Narration)this.CurrentLoadScreenTip; duration = duration + selected.ReadingTime; } else if (this.CurrentLoadScreenTip is GamingTip) { GamingTip selected = (GamingTip)this.CurrentLoadScreenTip; duration = duration + selected.ReadingTime; } } Fade = Animation.Tweener.Tween(this, new { Opacity = 0.0f }, duration); Fade.OnComplete(() => { this.Visible = false; this.NextHint(); Fade.Cancel(); Fade = null; }); }
public void NextHint() { int total = 3; int count = ShuffledHints.Count; if (count >= total) { ShuffledHints.Clear(); count = 0; } var range = Enumerable.Range(1, total).Where(i => !ShuffledHints.Contains(i)); int index = rand.Next(0, total - count - 1); int hint = range.ElementAt(index); ShuffledHints.Add(hint); if (CurrentLoadScreenTip != null) { if (CurrentLoadScreenTip is GuessCharacter) { GuessCharacter selected = (GuessCharacter)CurrentLoadScreenTip; selected.CharacterImage.Dispose(); } CurrentLoadScreenTip.Dispose(); } switch (hint) { case 1: total = GamingTip.Tips.Count; count = SeenGamingTips.Count; if (count >= total) { SeenGamingTips.Clear(); count = 0; } range = Enumerable.Range(0, total - 1).Where(i => !SeenGamingTips.Contains(i)); index = rand.Next(0, total - count - 2); hint = range.ElementAt(index); SeenGamingTips.Add(hint); CurrentLoadScreenTip = new GamingTip(hint) { Parent = this, Size = this.Size, Location = new Point(0, 0) }; break; case 2: total = Narration.Narratives.Count; count = SeenNarrations.Count; if (count >= total) { SeenNarrations.Clear(); count = 0; } range = Enumerable.Range(0, total - 1).Where(i => !SeenNarrations.Contains(i)); index = rand.Next(0, total - count - 2); hint = range.ElementAt(index); SeenNarrations.Add(hint); CurrentLoadScreenTip = new Narration(hint) { Parent = this, Size = this.Size, Location = new Point(0, 0) }; break; case 3: total = GuessCharacter.Characters.Count; count = SeenGuessCharacters.Count; if (count >= total) { SeenGuessCharacters.Clear(); count = 0; } range = Enumerable.Range(0, total - 1).Where(i => !SeenGuessCharacters.Contains(i)); index = rand.Next(0, total - count - 2); hint = range.ElementAt(index); SeenGuessCharacters.Add(hint); CurrentLoadScreenTip = new GuessCharacter(hint, this) { Location = new Point(0, 0) }; break; default: throw new NotSupportedException(); } this.AddChild(CurrentLoadScreenTip); }