1118OPSSNew/Assets/Zion/Scripts/指挥界面/CurrentStepObj.cs

52 lines
1.4 KiB
C#

using DataModel.Model;
using UnityEngine;
using UnityEngine.UI;
public class CurrentStepObj : MonoBehaviour
{
[DisplayOnly]
public int id = 0;
[DisplayOnly]
public bool isCheckButton = false;
public Sprite[] sprites;
public practicesubjectstep currentStep;
private Button button;
public AudioClip audioClip;
public AudioSource audioSource;
public void SetId(int id)
{
this.id = id;
}
public void Start()
{
if (audioSource == null) audioSource = GetComponent<AudioSource>();
}
// Update is called once per frame
void Update()
{
}
public void InitButtonState()
{
button = GetComponentInChildren<Button>();
switch (currentStep.StepState)
{
case "-1":
button.gameObject.GetComponent<Image>().sprite = sprites[0];
break;
case "0":
button.gameObject.GetComponent<Image>().sprite = sprites[1];
break;
case "1":
isCheckButton = true;
button.interactable = false;
button.gameObject.GetComponent<Image>().sprite = sprites[2];
if (currentStep.OrderIndex.Equals(CommandPanel.Instance.GetEndSubject())) CommandPanel.Instance.endCurrentSubject = true;
break;
default:
break;
}
}
}