diff options
author | chai <chaifix@163.com> | 2020-12-30 20:59:04 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2020-12-30 20:59:04 +0800 |
commit | e9ea621b93fbb58d9edfca8375918791637bbd52 (patch) | |
tree | 19ce3b1c1f2d51eda6878c9d0f2c9edc27f13650 /Client/Assembly-CSharp/HowToPlayController.cs |
+init
Diffstat (limited to 'Client/Assembly-CSharp/HowToPlayController.cs')
-rw-r--r-- | Client/Assembly-CSharp/HowToPlayController.cs | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/Client/Assembly-CSharp/HowToPlayController.cs b/Client/Assembly-CSharp/HowToPlayController.cs new file mode 100644 index 0000000..2274478 --- /dev/null +++ b/Client/Assembly-CSharp/HowToPlayController.cs @@ -0,0 +1,67 @@ +using System; +using UnityEngine; +using UnityEngine.SceneManagement; + +public class HowToPlayController : MonoBehaviour +{ + public Transform DotParent; + + public SpriteRenderer leftButton; + + public SpriteRenderer rightButton; + + public SceneController PCMove; + + public SceneController[] Scenes; + + public int SceneNum; + + public void Start() + { + this.Scenes[2] = this.PCMove; + this.PCMove.gameObject.SetActive(false); + for (int i = 1; i < this.Scenes.Length; i++) + { + this.Scenes[i].gameObject.SetActive(false); + } + for (int j = 0; j < this.DotParent.childCount; j++) + { + this.DotParent.GetChild(j).localScale = Vector3.one; + } + this.ChangeScene(0); + } + + public void Update() + { + if (Input.GetKeyUp(KeyCode.Escape)) + { + this.Close(); + } + } + + public void NextScene() + { + this.ChangeScene(1); + } + + public void PreviousScene() + { + this.ChangeScene(-1); + } + + public void Close() + { + SceneManager.LoadScene("MainMenu"); + } + + private void ChangeScene(int del) + { + this.Scenes[this.SceneNum].gameObject.SetActive(false); + this.DotParent.GetChild(this.SceneNum).localScale = Vector3.one; + this.SceneNum = Mathf.Clamp(this.SceneNum + del, 0, this.Scenes.Length - 1); + this.Scenes[this.SceneNum].gameObject.SetActive(true); + this.DotParent.GetChild(this.SceneNum).localScale = new Vector3(1.5f, 1.5f, 1.5f); + this.leftButton.gameObject.SetActive(this.SceneNum > 0); + this.rightButton.gameObject.SetActive(this.SceneNum < this.Scenes.Length - 1); + } +} |