StartGameUIController.cs 1.0 KB

12345678910111213141516171819202122232425262728293031323334
  1. using UnityEngine;
  2. using UnityEngine.UIElements;
  3. /* 本段代码控制Start Game UI
  4. */
  5. public class StartGameUIController : MonoBehaviour
  6. {
  7. // Start is called once before the first execution of Update after the MonoBehaviour is created
  8. private Label infoLabel;
  9. private Button startButton;
  10. void Start()
  11. {
  12. var root = GetComponent<UIDocument>().rootVisualElement;
  13. infoLabel = root.Q<Label>("InfoLabel");
  14. startButton = root.Q<Button>("StartButton");
  15. infoLabel.text = UserProperty.name + "-" + EnviromentSetting.version;
  16. string textValue = GameTool.GetValueAtPath(EnviromentSetting.languageData, new string[] { "canvas", "start_game", "button", "start", EnviromentSetting.languageCode });
  17. startButton.text = textValue;
  18. startButton.clicked += StartClick;
  19. }
  20. // Update is called once per frame
  21. // void Update()
  22. // {
  23. // }
  24. void StartClick(){
  25. MaskTransitions.TransitionManager.Instance.LoadLevel("Home");
  26. }
  27. }