73 lines
2.3 KiB
C#
73 lines
2.3 KiB
C#
|
|
using UnityEngine;
|
||
|
|
using UnityEngine.UI;
|
||
|
|
using UnityEngine.SceneManagement;
|
||
|
|
|
||
|
|
public class ModeSelectionUI : MonoBehaviour
|
||
|
|
{
|
||
|
|
[Header("Tip")]
|
||
|
|
public Text tipText;
|
||
|
|
|
||
|
|
[Header("Fixation Mode")]
|
||
|
|
public Button limbFixationButton;
|
||
|
|
public Button splintFixationButton;
|
||
|
|
public GameObject limbFixationCheck;
|
||
|
|
public GameObject splintFixationCheck;
|
||
|
|
|
||
|
|
[Header("Run Mode")]
|
||
|
|
public Button learnModeButton;
|
||
|
|
public Button examModeButton;
|
||
|
|
public GameObject learnModeCheck;
|
||
|
|
public GameObject examModeCheck;
|
||
|
|
|
||
|
|
[Header("Actions")]
|
||
|
|
public Button startButton;
|
||
|
|
public Button backButton;
|
||
|
|
|
||
|
|
private FixationMethod selectedFixation = FixationMethod.LimbFixation;
|
||
|
|
private ExperimentMode selectedRunMode = ExperimentMode.Learn;
|
||
|
|
|
||
|
|
private void Start()
|
||
|
|
{
|
||
|
|
tipText.text = "Tip:请选择实验模式";
|
||
|
|
|
||
|
|
limbFixationButton.onClick.AddListener(() => SelectFixation(FixationMethod.LimbFixation));
|
||
|
|
splintFixationButton.onClick.AddListener(() => SelectFixation(FixationMethod.SplintFixation));
|
||
|
|
learnModeButton.onClick.AddListener(() => SelectRunMode(ExperimentMode.Learn));
|
||
|
|
examModeButton.onClick.AddListener(() => SelectRunMode(ExperimentMode.Exam));
|
||
|
|
startButton.onClick.AddListener(OnStart);
|
||
|
|
backButton.onClick.AddListener(() => SceneManager.LoadScene("main"));
|
||
|
|
|
||
|
|
UpdateSelectionVisuals();
|
||
|
|
}
|
||
|
|
|
||
|
|
private void SelectFixation(FixationMethod mode)
|
||
|
|
{
|
||
|
|
selectedFixation = mode;
|
||
|
|
UpdateSelectionVisuals();
|
||
|
|
}
|
||
|
|
|
||
|
|
private void SelectRunMode(ExperimentMode mode)
|
||
|
|
{
|
||
|
|
selectedRunMode = mode;
|
||
|
|
UpdateSelectionVisuals();
|
||
|
|
}
|
||
|
|
|
||
|
|
private void UpdateSelectionVisuals()
|
||
|
|
{
|
||
|
|
limbFixationCheck.SetActive(selectedFixation == FixationMethod.LimbFixation);
|
||
|
|
splintFixationCheck.SetActive(selectedFixation == FixationMethod.SplintFixation);
|
||
|
|
learnModeCheck.SetActive(selectedRunMode == ExperimentMode.Learn);
|
||
|
|
examModeCheck.SetActive(selectedRunMode == ExperimentMode.Exam);
|
||
|
|
}
|
||
|
|
|
||
|
|
private void OnStart()
|
||
|
|
{
|
||
|
|
if (GameManager.Instance != null)
|
||
|
|
{
|
||
|
|
GameManager.Instance.CurrentFixationMethod = selectedFixation;
|
||
|
|
GameManager.Instance.CurrentMode = selectedRunMode;
|
||
|
|
}
|
||
|
|
SceneManager.LoadScene("Experiment");
|
||
|
|
}
|
||
|
|
}
|