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.
88 lines
2.3 KiB
88 lines
2.3 KiB
using System.Collections.Generic; |
|
using UnityEngine; |
|
using UnityEngine.UI; |
|
using SpringGUI; |
|
using AX.TrackRecord; |
|
public class SetNameTextUI : MonoBehaviour { |
|
|
|
/// <summary> |
|
/// 设置文字脚本 |
|
/// </summary> |
|
|
|
|
|
private ColorPicker colorPicker; |
|
|
|
private InputField fieldAreaName; |
|
|
|
private Button CloseBtn; |
|
|
|
private Button SureBtn; |
|
|
|
private Slider SliderValue; |
|
|
|
private MainColorTape mainColorTape; |
|
|
|
public static SetNameTextUI instance = null; |
|
|
|
private void Awake() |
|
{ |
|
if (instance == null) |
|
{ |
|
instance = this; |
|
} |
|
} |
|
void Start () |
|
{ |
|
SliderValue = transform.Find("Slider").GetComponent<Slider>(); |
|
colorPicker = transform.Find("ColorPicker").GetComponent<ColorPicker>(); |
|
mainColorTape= transform.Find("ColorPicker/MainColor").GetComponent<MainColorTape>(); |
|
CloseBtn = transform.Find("Close").GetComponent<Button>(); |
|
SureBtn = transform.Find("Sure").GetComponent<Button>(); |
|
fieldAreaName= transform.Find("InputField").GetComponent<InputField>(); |
|
|
|
SliderValue.onValueChanged.AddListener(ScaleSlider); |
|
colorPicker.onPicker.AddListener(ChangeColor); |
|
CloseBtn.onClick.AddListener(CloseClick); |
|
SureBtn.onClick.AddListener(SureClick); |
|
fieldAreaName.onValueChanged.AddListener(s => |
|
{ |
|
objArea.GetComponent<TextMesh>().text=s; |
|
}); |
|
|
|
} |
|
float Data = 0; |
|
public void ScaleSlider(float value) |
|
{ |
|
objArea.transform.localScale = new Vector3(value * 9f, value * 13.5f, 1); |
|
} |
|
|
|
GameObject objArea; |
|
public void SetNameArea(GameObject obj) |
|
{ |
|
objArea = obj; |
|
SetAttri(); |
|
SliderValue.value = objArea.transform.localScale.x / 9; |
|
} |
|
private void SetAttri() |
|
{ |
|
fieldAreaName.text = objArea.GetComponent<TextMesh>().text; |
|
mainColorTape.Color = objArea.GetComponent<TextMesh>().color; |
|
} |
|
private void ChangeColor(Color color) |
|
{ |
|
objArea.GetComponent<TextMesh>().color = color; |
|
} |
|
public void SureClick() |
|
{ |
|
gameObject.SetActive(false); |
|
if (RecordManager.Instance.IsRecording) |
|
{ |
|
TrackRecordHelpClass.RecordNameTextEvent(objArea); |
|
} |
|
} |
|
public void CloseClick() |
|
{ |
|
gameObject.SetActive(false); |
|
} |
|
|
|
}
|
|
|