Beispiel #1
0
    private void Update()
    {
        if (delay)
        {
            if (!delayTimer.UpdateEnd)
            {
                return;
            }
            delay = false;
            Line  = MultiLanguageMgr.GetTextById(PlayerPreference.Language, lines[linesIndex]);

            fadeFrom     = new Color(1, 1, 1, 0);
            fadeTo       = Color.white;
            fadeTimer    = new Timer(fadeInTime);
            fadeCallback = null;
            fadding      = true;
        }

        if (fadding)
        {
            if (!fadeTimer.UpdateEnd)
            {
                text.color = Color.Lerp(fadeFrom, fadeTo, fadeTimer.Progress);
                return;
            }
            else
            {
                text.color = fadeTo;
                fadding    = false;
                if (fadeCallback != null)
                {
                    fadeCallback();
                }
                return;
            }
        }

        if (linesTimer.UpdateEnd)
        {
            linesTimer.Reset();

            fadeFrom     = Color.white;
            fadeTo       = new Color(1, 1, 1, 0);
            fadding      = true;
            fadeTimer    = new Timer(fadeOutTime);
            fadeCallback = delegate {
                linesIndex++;
                delayTimer = new Timer(nextDelayTime);
                delay      = true;

                if (linesIndex >= lines.Length)
                {
                    gameObject.SetActive(false);
                    PlayerPreference.SkipIntro = true;
                    PlayerPreference.Save();
                }
            };
        }
    }
Beispiel #2
0
 public void Back()
 {
     enabled = canvas.enabled = false;
     if (closeSettingEvent != null)
     {
         closeSettingEvent();
     }
     PlayerPreference.Save();
 }