| | |
| | | |
| | | public Button SelectBtn; |
| | | |
| | | public GameObject EffectObj; |
| | | |
| | | private Vector3[] effectPosArr = { new Vector3(-21.6f, 73.4f, 5.5f), new Vector3(0, 73.4f, 5.5f), new Vector3(21.6f, 73.4f, 5.5f) }; |
| | | |
| | | // Start is called before the first frame update |
| | | private void Start() |
| | | { |
| | |
| | | SelectBtn.onClick.AddListener(OnClickSelectBtn); |
| | | } |
| | | |
| | | private void OnDisable() |
| | | { |
| | | Reset(); |
| | | } |
| | | |
| | | private void Reset() |
| | | private void OnEnable() |
| | | { |
| | | isCompleted = false; |
| | | SelectedIndex = -1; |
| | |
| | | { |
| | | IconList[i].Reset(); |
| | | } |
| | | |
| | | EndlessMaskUI.instance.Show(); |
| | | } |
| | | |
| | | public void OnClick(int index) |
| | |
| | | |
| | | // 如果已经选择过了,设置一个之前选择的item |
| | | if (SelectedIndex != -1) |
| | | { |
| | | IconList[SelectedIndex].SetState(false); |
| | | |
| | | } |
| | | |
| | | SelectedIndex = index; |
| | | IconList[index].SetState(true); |
| | | PlayEffect(); |
| | | } |
| | | |
| | | private void PlayEffect() |
| | | { |
| | | EffectObj.transform.localPosition = effectPosArr[SelectedIndex]; |
| | | ParticleSystem ps = EffectObj.transform.GetChild(0).GetComponent<ParticleSystem>(); |
| | | ps.Play(); |
| | | } |
| | | |
| | | private void StopEffect() |
| | | { |
| | | ParticleSystem ps = EffectObj.transform.GetChild(0).GetComponent<ParticleSystem>(); |
| | | ps.Stop(); |
| | | ps.Clear(); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | |
| | | public void HideBuffUI() |
| | | { |
| | | EndlessMaskUI.instance.Hide(); |
| | | StopEffect(); |
| | | gameObject.SetActive(false); |
| | | } |
| | | |