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.

99 lines
2.7 KiB

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class TiePian : MonoBehaviour
{
public Button leftPian;
public Button rightPian;
public Button leftUpPos;
public Button rightUpPos;
public Button leftDownPos;
public Button rightDownPos;
public Text tip;
private int currentPart;
public Sprite slecetedSpr;
public Sprite unSlecetedSpr;
private void Start()
{
leftPian.onClick.AddListener(() => {
currentPart = 1;
leftPian.image.sprite = slecetedSpr;
rightPian.image.sprite = unSlecetedSpr;
});
rightPian.onClick.AddListener(() => {
currentPart = 2;
leftPian.image.sprite = unSlecetedSpr;
rightPian.image.sprite = slecetedSpr;
});
leftUpPos.onClick.AddListener(() => {
if (currentPart == 0)
{
PassManager.Instance.ErrorTip("请先点击左侧面板中的贴片,再进行位置选择");
}
else if(currentPart==1)
{
PassManager.Instance.SetStudentAni("LeftTiePian");
leftUpPos.gameObject.SetActive(false);
leftPian.gameObject.SetActive(false);
}
});
rightUpPos.onClick.AddListener(() => {
if (currentPart == 0)
{
PassManager.Instance.ErrorTip("请先点击左侧面板中的贴片,再进行位置选择");
}
else
{
PassManager.Instance.ErrorTip("选择位置有误,请重新选择");
}
});
leftDownPos.onClick.AddListener(() => {
if (currentPart == 0)
{
PassManager.Instance.ErrorTip("请先点击左侧面板中的贴片,再进行位置选择");
}
else
{
PassManager.Instance.ErrorTip("选择位置有误,请重新选择");
}
});
rightDownPos.onClick.AddListener(() => {
if (currentPart == 0)
{
PassManager.Instance.ErrorTip("请先点击左侧面板中的贴片,再进行位置选择");
}
else if(currentPart==2)
{
PassManager.Instance.SetStudentAni("RightTiePian");
rightDownPos.gameObject.SetActive(false);
rightPian.gameObject.SetActive(false);
leftPian.gameObject.SetActive(true);
tip.text = "请将左电极片贴在正确位置";
PassManager.Instance.AddHisitoryInfo("贴电极片");
}
});
}
}