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.
64 lines
2.0 KiB
64 lines
2.0 KiB
3 years ago
|
using UnityEngine;
|
||
|
using System.Collections;
|
||
|
using UnityEngine.UI;
|
||
|
using AX.MessageSystem;
|
||
|
using AX.TrackRecord;
|
||
|
public class CarItemAttribute : CarAttriMessage {
|
||
|
|
||
|
public int carType;
|
||
|
public Text Name;
|
||
|
public InputField Water;
|
||
|
public InputField PaoMo;
|
||
|
public InputField GanFen;
|
||
|
public InputField People;
|
||
|
public InputField Heigh;
|
||
|
void Start()
|
||
|
{
|
||
|
Heigh.onValueChanged.AddListener(delegate { ValueChangeCheck(); });
|
||
|
}
|
||
|
public void ValueChangeCheck()//显示保存按钮
|
||
|
{
|
||
|
double num = 0;
|
||
|
if(double.TryParse(Heigh.text,out num))
|
||
|
{
|
||
|
if (num > 100)
|
||
|
{
|
||
|
Heigh.transform.Find("Text").GetComponent<Text>().color = Color.red;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
Heigh.transform.Find("Text").GetComponent<Text>().color = Color.black;
|
||
|
}
|
||
|
|
||
|
}
|
||
|
}
|
||
|
private CarAttri attri;// = new CarAttribute();
|
||
|
public CarAttri Attri
|
||
|
{
|
||
|
get
|
||
|
{
|
||
|
CarAttri attri = new CarAttri();
|
||
|
attri.HasWater = string.IsNullOrEmpty(Water.text) ? 0 : int.Parse(Water.text);
|
||
|
attri.HasPaoMo = string.IsNullOrEmpty(PaoMo.text) ? 0 : int.Parse(PaoMo.text);
|
||
|
attri.HasGanFen = string.IsNullOrEmpty(GanFen.text) ? 0 : int.Parse(GanFen.text);
|
||
|
attri.XFYCount = string.IsNullOrEmpty(People.text) ? 0 : int.Parse(People.text);
|
||
|
attri.Hegih = string.IsNullOrEmpty(Heigh.text) ? "0" : Heigh.text;
|
||
|
return attri;
|
||
|
}
|
||
|
set
|
||
|
{
|
||
|
CarAttri attri = value;
|
||
|
Water.text = attri.HasWater.ToString();
|
||
|
PaoMo.text = attri.HasPaoMo.ToString();
|
||
|
GanFen.text = attri.HasGanFen.ToString();
|
||
|
People.text = attri.XFYCount.ToString();
|
||
|
Heigh.text = attri.Hegih;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public override void CollectCarAttri(IMessage message)
|
||
|
{
|
||
|
CarAttributeControl.Instance.TheCarAttriList[carType] = Attri;
|
||
|
}
|
||
|
}
|