Ejemplo n.º 1
0
        /// <summary>
        /// 滚动视图中的按钮点击
        /// </summary>
        /// <param name="btnTF">按钮的变体</param>
        public void ButtonClicked(Transform btnTF)
        {
            selected = btnTF;

            KeyPointButton kpb = selected.GetComponent <KeyPointButton>();

            uiText.text = kpb.point.name + ":" + kpb.point.position + ",type:" + kpb.point.pointType;

            buttonAdd.interactable    = false;
            buttonDelete.interactable = true;
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 添加关键点
 /// </summary>
 private void AddKeyPoint()
 {
     if (inputField.text != "")
     {
         //根据预制件生成游戏对象
         KeyPointButton kpb = Instantiate <KeyPointButton>(prefab, svContent);
         //设置关键点对象
         kpb.point.name      = inputField.text;
         kpb.point.position  = selected.position;
         kpb.point.rotation  = selected.rotation;
         kpb.point.pointType = dropdown.value;
         //设置按钮名称
         kpb.GetComponentInChildren <Text>().text = inputField.text;
         //设置其他UI
         inputField.text        = "";
         dropdown.value         = 0;
         uiText.text            = "添加成功。";
         buttonAdd.interactable = false;
     }
 }