Ejemplo n.º 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();
        }
Ejemplo n.º 2
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);
 }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        private void OnGUI_EditorItemIsBindPath(UITool_Attribute item, int index)
        {
            GUILayout.BeginHorizontal();
            GUI.color = item.GenAttribute_TranformPath == 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.GenAttribute_TranformPath = tpIsBindList[index];
                AssetDatabase.SaveAssets();
            }

            GUILayout.EndHorizontal();
        }
Ejemplo n.º 5
0
        private void OnGUI_WindowSelect()
        {
            GUILayout.BeginVertical();
            GUILayout.Label("已有窗口");
            Layout_DrawSeparator(Color.gray, 2);
            pbPaths.Clear();
            Editor_UITool.FindWindows(ref pbPaths);
            //竖列排版
            windowSelectPosition = GUILayout.BeginScrollView(windowSelectPosition, GUILayout.Width(220));
            {
                int count = 1;
                foreach (KeyValuePair <string, string> kv in pbPaths)
                {
                    GUILayout.BeginHorizontal();
                    GUILayout.Label(string.Format("{0}.{1}", count, kv.Key), GUILayout.Width(150));
                    if (GUILayout.Button("加载", GUILayout.Width(50)))
                    {
                        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.EndHorizontal();
                }
            }
            GUILayout.EndScrollView();

            GUILayout.EndVertical();
        }