You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
1.4 KiB
55 lines
1.4 KiB
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;//使用 该引用,才能获得 Text 组件。
|
|
public class Language : MonoBehaviour
|
|
{
|
|
//public bool change = false;
|
|
public string state = "en";
|
|
float m_timer = 0;
|
|
Button btn;
|
|
public List<Text> texts = new List<Text>();
|
|
|
|
private void Start()
|
|
{
|
|
/* texts[0] = GameObject.Find("StartButton").GetComponent<Text>();
|
|
texts[1] = GameObject.Find("SettingButton").GetComponent<Text>();
|
|
texts[2] = GameObject.Find("HelpButton").GetComponent<Text>();
|
|
texts[3] = GameObject.Find("QuitButton").GetComponent<Text>();*/
|
|
}
|
|
private void Update()
|
|
{
|
|
|
|
|
|
|
|
if (state == "ch")
|
|
{
|
|
|
|
texts[0].text = "开始游戏";
|
|
texts[1].text = "设置";
|
|
texts[2].text = "帮助";
|
|
texts[3].text = "退出";
|
|
}
|
|
else if (state == "en")
|
|
{
|
|
texts[0].text= "StartGame";
|
|
texts[1].text= "Setting";
|
|
texts[2].text = "Help";
|
|
texts[3].text = "Quit";
|
|
}
|
|
|
|
|
|
}
|
|
public void changeLanguage()
|
|
{
|
|
if (state == "en") state = "ch";
|
|
else state = "en";
|
|
Debug.Log("你改变了语言!");
|
|
Debug.Log(texts[0].text);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|