From 3d141c6be63024d265301d0a2788163accd2c5fd Mon Sep 17 00:00:00 2001 From: 2394425147 <2394425147@qq.com> Date: Thu, 9 Dec 2021 00:31:25 +0800 Subject: [PATCH] Add files via upload --- TitleManager.cs | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 TitleManager.cs diff --git a/TitleManager.cs b/TitleManager.cs new file mode 100644 index 0000000..ce91505 --- /dev/null +++ b/TitleManager.cs @@ -0,0 +1,45 @@ +using System.Collections; +using System.Collections.Generic; +using Helpers; +using UnityEngine; +using UnityEngine.UI; + +namespace Title +{ + public class TitleManager : MonoBehaviour + { + public Text anyKeyPressed; + + public List textList; + + private int _textIndex; + private void Start() + { + textList = new List + { + Localization.ParseAuto($"TITLE_ANYKEY"), + Localization.ParseAuto($"TITLE_THANKS"), + $"{Localization.ParseAuto($"TITLE_BUILDVERSION")} {Application.version}" + }; + + StartCoroutine(CycleThroughText()); + } + + private IEnumerator CycleThroughText() + { + while (true) + { + _textIndex = (_textIndex + 1) % textList.Count; + anyKeyPressed.text = textList[_textIndex]; + yield return new WaitForSeconds(3); + } + + // ReSharper disable once IteratorNeverReturns + } + + public void ChangeScene() + { + SceneSwapper.LoadScene("ModeSelection"); + } + } +}