Esempio n. 1
0
        /// <summary>
        /// 添加路径
        /// </summary>
        public void Add()
        {
            SelectButton btn = Instantiate(prefab, svContent);

            btn.road.startName     = dpdStart.captionText.text;
            btn.road.endName       = dpdEnd.captionText.text;
            btn.road.startPosition = GetPositionByName(btn.road.startName);
            btn.road.endPosition   = GetPositionByName(btn.road.endName);
            btn.GetComponentInChildren <Text>().text = btn.road.startName + "<===>" + btn.road.endName;
            textInfo.text = "添加完成。";
        }
Esempio n. 2
0
 /// <summary>
 /// 加载关键点
 /// </summary>
 private void Load()
 {
     if (game)
     {
         var list = game.LoadKeyPoint();
         foreach (var item in list)
         {
             SelectButton btn = Instantiate(prefab, svContent);
             btn.keyPoint = JsonUtility.FromJson <KeyPoint>(item);
             btn.GetComponentInChildren <Text>().text = btn.keyPoint.name;
         }
     }
 }
Esempio n. 3
0
        /// <summary>
        /// 添加关键点
        /// </summary>
        public void Add()
        {
            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;
                textInfo.text       = "添加完成。";
                btnAdd.interactable = false;
            }
        }