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.

47 lines
1.4 KiB

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class EmitValue : MonoBehaviour
{
public InputField xxl;
public InputField pldx;
public InputField ddcs;
public LookImg lookImg;
public GameObject errtip;
float xxlvalue;
float pldxvalue;
float ddcsvalue;
void Awake() {
xxl.onValueChanged.AddListener((string value) => {
xxlvalue = float.Parse(value);
});
pldx.onValueChanged.AddListener((string value) => {
pldxvalue = float.Parse(value);
});
ddcs.onValueChanged.AddListener((string value) => {
ddcsvalue = float.Parse(value);
});
GetComponent<Button>().onClick.AddListener(() => {
if ((xxlvalue >= 0 && xxlvalue <= 1) &&
(pldxvalue >= 1 && pldxvalue <= 6) &&
(ddcsvalue >= 1 && ddcsvalue <= 10))
{
lookImg.gameObject.SetActive(true);
lookImg.ChangeWAH(xxlvalue, pldxvalue, ddcsvalue);
transform.parent.gameObject.SetActive(false);
TaskBase.Instacne.FinishTask(6);
}
else {
errtip.SetActive(true);
errtip.transform.GetChild(0).GetComponent<Text>().text = "参数范围错误,请重新输入";
}
});
}
}