Пример #1
0
        public void FadeOut()
        {
            if (Opacity != 1.0f)
            {
                return;
            }

            float duration = 2.0f;

            if (LoadScreenTip != null)
            {
                if (LoadScreenTip is GuessCharacter)
                {
                    GuessCharacter selected = (GuessCharacter)LoadScreenTip;
                    selected.Result = true;
                    duration        = duration + 3.0f;
                }
                else if (LoadScreenTip is Narration)
                {
                    Narration selected = (Narration)LoadScreenTip;
                    duration = duration + selected.ReadingTime;
                }
                else if (LoadScreenTip is GamingTip)
                {
                    GamingTip selected = (GamingTip)LoadScreenTip;
                    duration = duration + selected.ReadingTime;
                }
            }

            Fade = Animation.Tweener.Tween(this, new { Opacity = 0.0f }, duration);
            Fade.OnComplete(() => {
                Dispose();
            });
        }
Пример #2
0
 private void OnDisposed(object sender, EventArgs e)
 {
     if (LoadScreenTip != null)
     {
         if (LoadScreenTip is GuessCharacter)
         {
             GuessCharacter selected = (GuessCharacter)LoadScreenTip;
             selected.CharacterImage.Dispose();
         }
         LoadScreenTip.Dispose();
     }
 }
Пример #3
0
        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;
            });
        }
Пример #4
0
        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).Where(i => !SeenGamingTips.Contains(i));
                index = rand.Next(0, total - count);
                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).Where(i => !SeenNarrations.Contains(i));
                index = rand.Next(0, total - count);
                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).Where(i => !SeenGuessCharacters.Contains(i));
                index = rand.Next(0, total - count);
                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);
        }