/// <summary> /// 加载关键点 /// </summary> private void LoadKeyPoints() { var list = gameController.LoadKeyPoins(); foreach (var item in list) { SelectButton btn = Instantiate(prefab, svContent); btn.keyPoint = JsonUtility.FromJson <KeyPoint>(item); btn.GetComponentInChildren <Text>().text = btn.keyPoint.name; } }
/// <summary> /// 添加关键点 /// </summary> private void AddKeyPoint() { if (!string.IsNullOrEmpty(inputField.text) && selected != null) { SelectButton btn = Instantiate(prefab, svContent); btn.keyPoint.name = inputField.text; btn.keyPoint.position = selected.localPosition; btn.keyPoint.pointType = dropdown.value; btn.GetComponentInChildren <Text>().text = inputField.text; inputField.text = ""; selected = null; info.text = "添加成功。"; btnAdd.interactable = false; } }