Example #1
0
        private bool DoAnimation()
        {
            if (!runningAnimation)
                return true;
            if (pauseAnimation > 0) {
                pauseAnimation--;

                if (delayBlink < 1) {
                    delayBlink = 3;
                    if (cursorIsVisible)
                        theBox.BackgroundColor = Color.Transparent;
                    else
                        theBox.BackgroundColor = theColor;
                    cursorIsVisible = !cursorIsVisible;
                } else
                    delayBlink--;

                return true;
            }
            if (!cursorIsVisible) {
                theBox.BackgroundColor = theColor;
                cursorIsVisible = !cursorIsVisible;
            }
            try {

                switch (currentAnimation) {

                case TextAnimation.Wait:
                    if (delayBeforeNextAnimation < 1) {
                        delayBeforeNextAnimation = Global.Random.Next (3) * 10;
                        ChooseRandomAnimation ();
                    } else {
                        delayBeforeNextAnimation--;
                    }
                    break;

                case TextAnimation.Appear:
                    if (currentPos > theText.Length)
                        return true;
                    currentPos++;
                    if (currentPos > 1)
                        labelText.Text = theText.Substring (0, currentPos - 1);
                    else
                        labelText.Text = " ";
                    if (currentPos <= theText.Length)
                        labelAnim.Text = theText.Substring (currentPos - 1, 1);
                    else {
                        labelAnim.Text = " ";
                        DoPauseAnimation ();
                        currentAnimation = TextAnimation.Disappear;
                    }
                    break;

                case TextAnimation.AppearAurekBesh:
                    if (currentPos > theText.Length)
                        return true;
                    currentPos++;
                    if (currentPos <= theText.Length)
                        labelAnim.Text = theText.Substring (0, currentPos);
                    else {
                        DoPauseAnimation ();
                        currentAnimation = TextAnimation.DisappearAurekBesh;
                    }
                    break;

                case TextAnimation.Disappear:
                    if (currentPos < 1)
                        return true;
                    currentPos--;
                    if (currentPos > 1)
                        labelText.Text = theText.Substring (0, currentPos - 1);
                    else {
                        labelText.Text = " ";
                        currentAnimation = TextAnimation.Wait;
                    }
                    break;

                case TextAnimation.DisappearAurekBesh:
                    if (currentPos < 1)
                        return true;
                    currentPos--;
                    if (currentPos > 1)
                        labelAnim.Text = theText.Substring (0, currentPos - 1);
                    else {
                        labelAnim.Text = " ";
                        currentAnimation = TextAnimation.Wait;
                    }
                    break;

                }

            } catch (Exception) {
            }
            return true;
        }
Example #2
0
 private void ChooseRandomAnimation()
 {
     switch (Global.Random.Next (2)) {
     case 0:
         currentAnimation = TextAnimation.Appear;
         break;
     case 1:
         currentAnimation = TextAnimation.AppearAurekBesh;
         break;
     }
 }