|
|
|
|
using SpringGUI;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
|
|
|
|
|
//Author:ZCG
|
|
|
|
|
//CreatTime:12/15/2017
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class UIPlanSetArea : BaseInstanceMono
|
|
|
|
|
{
|
|
|
|
|
private static UIPlanSetArea instance;
|
|
|
|
|
//private new GameObject chooseObj;
|
|
|
|
|
//private GameObject oldChooseObj;
|
|
|
|
|
//[SerializeField]
|
|
|
|
|
private InputField Input_Name;
|
|
|
|
|
//[SerializeField]
|
|
|
|
|
private Slider Slider_SetHigh;
|
|
|
|
|
//[SerializeField]
|
|
|
|
|
private Transform mainColor;
|
|
|
|
|
//[SerializeField]
|
|
|
|
|
private Text Text_High;
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// <EFBFBD><EFBFBD>¼<EFBFBD><EFBFBD>ɫʰȡȦ<EFBFBD><EFBFBD>λ<EFBFBD><EFBFBD>
|
|
|
|
|
/// </summary>
|
|
|
|
|
private Vector2 colorNoniusPos;
|
|
|
|
|
//<EFBFBD><EFBFBD>ɫʰȡȦ
|
|
|
|
|
private RectTransform colorNonius;
|
|
|
|
|
private GameObject chooseObj;
|
|
|
|
|
|
|
|
|
|
public static UIPlanSetArea Instance
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
if (instance == null)
|
|
|
|
|
{
|
|
|
|
|
GameObject obj = Resources.Load<GameObject>("Prefab/Tool/UIPlanSetArea");
|
|
|
|
|
GameObject clone = Instantiate(obj, GameObject.Find("Canvas").transform);
|
|
|
|
|
clone.transform.SetAsFirstSibling();
|
|
|
|
|
clone.SetActive(false);
|
|
|
|
|
instance = clone.GetComponent<UIPlanSetArea>();
|
|
|
|
|
instance.Init();
|
|
|
|
|
}
|
|
|
|
|
return instance;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void Init()
|
|
|
|
|
{
|
|
|
|
|
Slider_SetHigh = transform.Find("SetHight").GetComponent<Slider>();
|
|
|
|
|
Input_Name = transform.Find("InputField_Name").GetComponent<InputField>();
|
|
|
|
|
mainColor = transform.Find("ColorPicker").Find("MainColor");
|
|
|
|
|
Text_High = transform.Find("Text_High").GetComponent<Text>();
|
|
|
|
|
colorNonius = transform.Find("ColorPicker").Find("ColorPalette").Find("ColorNonius") as RectTransform;
|
|
|
|
|
colorNoniusPos = colorNonius.localPosition;
|
|
|
|
|
}
|
|
|
|
|
///// <summary>
|
|
|
|
|
///// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
///// </summary>
|
|
|
|
|
//public override void OpenPanel()
|
|
|
|
|
//{
|
|
|
|
|
// if (!this.gameObject.activeInHierarchy)
|
|
|
|
|
// this.gameObject.SetActive(true);
|
|
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
/// </summary>
|
|
|
|
|
public override void LoadObjData(GameObject obj)
|
|
|
|
|
{
|
|
|
|
|
//chooseObj = SelectedObjs.selectedObj;
|
|
|
|
|
chooseObj = obj;
|
|
|
|
|
var type = chooseObj.GetComponent<SetArea>();
|
|
|
|
|
mainColor.GetComponent<MainColorTape>().Color = type.Color;
|
|
|
|
|
Slider_SetHigh.value = type.High;
|
|
|
|
|
Input_Name.text = type.Name;
|
|
|
|
|
Text_High.text = type.High.ToString();
|
|
|
|
|
gameObject.SetActive(true);
|
|
|
|
|
}
|
|
|
|
|
public override void ResetData(GameObject dataObj)
|
|
|
|
|
{
|
|
|
|
|
dataObj.GetComponent<SetArea>().Revocation();
|
|
|
|
|
}
|
|
|
|
|
public void SetColor(Color value)
|
|
|
|
|
{
|
|
|
|
|
if (chooseObj)
|
|
|
|
|
chooseObj.GetComponent<SetArea>().SetColor(value);
|
|
|
|
|
}
|
|
|
|
|
public void SetName(string value)
|
|
|
|
|
{
|
|
|
|
|
chooseObj.GetComponent<SetArea>().SetName(value);
|
|
|
|
|
}
|
|
|
|
|
public void SetHigh(float value)
|
|
|
|
|
{
|
|
|
|
|
chooseObj.GetComponent<SetArea>().SetHigh(value);
|
|
|
|
|
Text_High.text = value.ToString();
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// ȷ<EFBFBD><EFBFBD>
|
|
|
|
|
/// </summary>
|
|
|
|
|
public void Confirm()
|
|
|
|
|
{
|
|
|
|
|
gameObject.SetActive(false);
|
|
|
|
|
chooseObj.GetComponent<SetArea>().Confirm();
|
|
|
|
|
colorNoniusPos = colorNonius.localPosition;
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// ȡ<EFBFBD><EFBFBD>
|
|
|
|
|
/// </summary>
|
|
|
|
|
public void Cancel()
|
|
|
|
|
{
|
|
|
|
|
//Revocation();
|
|
|
|
|
gameObject.SetActive(false);
|
|
|
|
|
}
|
|
|
|
|
public void Revocation()
|
|
|
|
|
{
|
|
|
|
|
colorNonius.localPosition = colorNoniusPos;
|
|
|
|
|
chooseObj.GetComponent<SetArea>().Revocation();
|
|
|
|
|
LoadObjData(chooseObj);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void EditorRight()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|