예제 #1
0
        private void OnCreateButtonClick()
        {
            string goName = createName.Trim();

            if (string.IsNullOrEmpty(goName))
            {
                EditorUtility.DisplayDialog("失败", "输入生成的cs文件名", "确认");
                return;
            }

            if (Editor_UITool.CheckRepeatName(itemList))
            {
                EditorUtility.DisplayDialog("失败", "组件命名重复", "确认");
                return;
            }

            for (int i = itemList.Count - 1; i >= 0; i--)
            {
                if (itemList[i].GenAttribute_TranformPath == false)
                {
                    itemList.RemoveAt(i);
                }
            }

            Editor_UITool.CreateViewCS(itemList, goName, targetName, isGenHotfixDir);
            Editor_UITool.CreateContrlCS(itemList, goName, isGenHotfixDir);
            Editor_UITool.CreateWindowCS(goName, targetName, isGenHotfixDir);
            AssetDatabase.Refresh();
        }
 private void OnGUI_WindowSelect()
 {
     GUILayout.BeginVertical(GUILayout.Height(520), GUILayout.Width(120));
     GUILayout.Label("窗口");
     Layout_DrawSeparator(Color.gray, 2);
     pbPaths.Clear();
     Editor_UITool.FindWindows(ref pbPaths);
     windowSelectPosition = GUILayout.BeginScrollView(windowSelectPosition, GUILayout.Width(120), GUILayout.Height(500));
     //竖列排版
     {
         GUILayout.BeginVertical();
         foreach (KeyValuePair <string, string> kv in pbPaths)
         {
             if (GUILayout.Button(kv.Key, GUILayout.Width(110)))
             {
                 GameObject prefab = AssetDatabase.LoadAssetAtPath <GameObject>("Assets/Resource/Resources/" + kv.Value + ".prefab");
                 if (!prefab)
                 {
                     EditorUtility.DisplayDialog("警告", string.Format("未能在路径{0}下找到{1}prefab", "Assets/Resource/Resources/", kv.Value), "ok");
                 }
                 m_target = prefab;
                 //强制刷新
                 targetName = "";
                 CheckTarget();
             }
         }
         GUILayout.EndVertical();
     }
     GUILayout.EndScrollView();
     GUILayout.EndVertical();
 }
예제 #3
0
 private void ReGetLists()
 {
     //强刷避免增加item 数组越界 缺点修改的内容必须保存不然会重置 没办法TT
     if (!m_target)
     {
         return;
     }
     itemList.Clear();
     GetRegistViewItems(m_target.transform, ref itemList);
     _root = m_target.name;
     Editor_UITool.CloneValues(itemList, ref tpNameList, ref tpIsBindList, ref tpBindNameList);
 }
 private void CheckTarget()
 {
     if (m_target == null)
     {
         targetName = "";
         return;
     }
     if (targetName == m_target.name)
     {
         return;
     }
     targetName = m_target.name;
     itemList.Clear();
     GetRegistViewItems(m_target.transform, ref itemList);
     Editor_UITool.CloneValues(itemList, ref tpNameList, ref tpIsBindList, ref tpBindNameList);
 }
        private void OnGUI_EditorItemIsBindPath(RegistViewItem item, int index)
        {
            GUILayout.BeginHorizontal();
            GUI.color = item.IsBindPath == tpIsBindList[index] ? Color.white : Color.yellow;
            string tp = string.Format("  自动设置节点:{0}", tpIsBindList[index] ? Editor_UITool.GetBindPath(item.gameObject, targetName) : "");

            tpIsBindList[index] = GUILayout.Toggle(tpIsBindList[index], "", GUILayout.Width(10));
            //var oc = GUI.color;
            //GUI.color = Color.green;
            GUILayout.Label(tp);
            //GUI.color = oc;
            if (GUILayout.Button("保存", GUILayout.Width(70)))
            {
                item.IsBindPath = tpIsBindList[index];
                AssetDatabase.SaveAssets();
            }
            GUILayout.EndHorizontal();
        }
        private void OnCreateButtonClick()
        {
            string goName = createName.Trim();

            if (string.IsNullOrEmpty(goName))
            {
                EditorUtility.DisplayDialog("失败", "输入生成的cs文件名", "确认");
                return;
            }

            if (Editor_UITool.CheckRepeatName(itemList))
            {
                EditorUtility.DisplayDialog("失败", "组件命名重复", "确认");
                return;
            }

            Editor_UITool.CreateViewCS(itemList, goName, targetName);
            Editor_UITool.CreateContrlCS(itemList, goName);
            Editor_UITool.CreateWindowCS(goName, targetName);
            AssetDatabase.Refresh();
        }