Example #1
0
 public static void Init()
 {
     if (_instance == null)
     {
         _instance = GetWindow <UtilityEditor>();
     }
 }
Example #2
0
        public override void OnInspectorGUI()
        {
            UtilityEditor.PropertyField("Normal", Normal);
            UtilityEditor.PropertyField("Choose", Choose);

            GUILayout.BeginHorizontal();
            if (GUILayout.Button("Normal"))
            {
                ToggleButtonComponent.SetToggleEditor(false);
            }
            if (GUILayout.Button("Choose"))
            {
                ToggleButtonComponent.SetToggleEditor(true);
            }
            GUILayout.EndHorizontal();

            //base.OnInspectorGUI();
            if (!ToggleButtonComponent.bInit)
            {
                ToggleButtonComponent.bInit = true;
                SetDefaultValue(ToggleButtonComponent);
            }

            if (GUI.changed)
            {
                serializedObject.ApplyModifiedProperties();
            }
        }
    public override void OnInspectorGUI()
    {
        UtilityEditor.VersioningTool("TCT", 0, 1, 0, 0);

        EditorLayout.Space(2);

        EditorReflectionLayout.TextField(eTarget, "name", "SmartCam's Name");

        EditorLayout.Space();

        EditorReflectionLayout.EnumPopup <TypeSmartCam>(eTarget, "typeSmartCam", "TYPE SMART CAM");

        if (Reflection.Field <TypeSmartCam>(eTarget, "typeSmartCam") == TypeSmartCam.NONE)
        {
            return;
        }

        EditorLayout.Space();

        SetTargetSmartCam();

        EditorLayout.Space();

        EditorReflectionLayout.Toggle(smartCamOption, "fixeRotationCam", "Fixe Rotation Camera");

        EditorLayout.Space();

        EditorReflectionLayout.Toggle(smartCamOption, "fixeMovementCam", "Fixe Movement Camera");

        EditorLayout.Space();

        SetOffSetSmartCam();

        EditorLayout.Space();

        EditorReflectionLayout.Slider(smartCamOption, "lerp", "Lerp", 0f, 1f);

        EditorLayout.Space();

        SetSensibilitySmartCam();

        EditorLayout.Space();

        if (Reflection.Field <TypeSmartCam>(eTarget, "typeSmartCam") == TypeSmartCam.TPS)
        {
            smartCamOption.RadiusTPS = EditorLayout.Slider(smartCamOption.RadiusTPS, "Radius", 1, 15);
        }

        else
        {
            smartCamOption.RadiusTPS = 0;
        }

        EditorLayout.Space(2);

        UpdateReflection(ref smartCamOption);

        SceneView.RepaintAll();
    }
Example #4
0
        public static QText AddComponent()
        {
            QText component = UtilityEditor.ExtensionComponentWhenCreate <QText>(typeof(QText).Name.ToString());

            //设置默认值
            SetDefaultValue(component);
            return(component);
        }
Example #5
0
        public static QRawImage AddComponent()
        {
            QRawImage component = UtilityEditor.ExtensionComponentWhenCreate <QRawImage>(typeof(QRawImage).Name.ToString());

            //设置默认值
            SetDefaultValue(component);
            return(component);
        }
Example #6
0
    void OnGUI()
    {
        tabIndex = UtilityEditor.Tabs(Types, tabIndex);
        GUILayout.Space(10);

        BtnStyle           = new GUIStyle(GUI.skin.button);
        BtnStyle.fontSize  = 16;
        BtnStyle.alignment = TextAnchor.MiddleLeft;

        selectObj.Clear();
        selectObj = Selection.gameObjects.ToList();

        for (int i = selectObj.Count - 1; i >= 0; i--)
        {
            if (GetFiltered(selectObj[i]))
            {
                selectObj.Remove(selectObj[i]);
            }
        }

        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.LabelField("Choose GameObjects", EditorStyles.boldLabel);
        EditorGUILayout.LabelField("Count : " + selectObj.Count, EditorStyles.boldLabel);
        EditorGUILayout.EndHorizontal();

        if (selectObj.Count == 0)
        {
            EditorGUILayout.HelpBox(GetHelpString(), MessageType.Warning);
            return;
        }

        selectObj.Sort(delegate(GameObject a, GameObject b)
        {
            return(a.name.CompareTo(b.name));
        });

        EditorGUILayout.BeginVertical();
        scrollPos = EditorGUILayout.BeginScrollView(scrollPos, false, false);
        EditorGUILayout.Space();


        foreach (GameObject obj in selectObj)
        {
            if (GUILayout.Button(obj.name, BtnStyle))
            {
                EditorGUIUtility.PingObject(obj);
            }
        }

        EditorGUILayout.EndScrollView();
        EditorGUILayout.EndVertical();


        if (UtilityEditor.GetCommonButton(Types[tabIndex]))
        {
            Execute();
        }
    }
Example #7
0
        public static QButton AddComponent()
        {
            QImageBox image     = UtilityEditor.ExtensionComponentWhenCreate <QImageBox>(typeof(QButton).Name.ToString());
            QButton   component = Utility.GetOrAddCompoment <QButton>(image.gameObject);

            //设置默认值
            SetDefaultValue(component);
            return(component);
        }
Example #8
0
    void OnGUI()
    {
        EditorGUILayout.LabelField("Choose Folders", EditorStyles.boldLabel);

        EditorGUILayout.BeginVertical();
        this.scrollPos = EditorGUILayout.BeginScrollView(this.scrollPos, false, false);
        EditorGUILayout.Space();

        isToggleAll = EditorGUILayout.ToggleLeft("  Toggle All", isToggleAll);

        if (isToggleAll != isToggleAllLast)
        {
            ToggleAll(isToggleAll);
        }

        EditorGUILayout.Space();

        for (int i = 0; i < folderList.Count; i++)
        {
            CreateToogle(i, folderList[i]);
        }

        EditorGUILayout.EndScrollView();
        EditorGUILayout.EndVertical();

        EditorGUILayout.Space();

        if (UtilityEditor.GetCommonButton("Make MakeFolders"))
        {
            if (Check() == false)
            {
                if (EditorUtility.DisplayDialog("Alert", "Please Choose Folder!!", "OK"))
                {
                    return;
                }
            }

            if (EditorUtility.DisplayDialog("",
                                            "Are you sure?",
                                            "Yes",
                                            "No"))
            {
                for (int i = 0; i < isCreateFolder.Length; i++)
                {
                    if (isCreateFolder[i] == true)
                    {
                        CreateFolders(folderList[i].name);
                    }
                }


                this.Close();
            }
        }

        EditorGUILayout.Space();
    }
Example #9
0
 public override void OnInspectorGUI()
 {
     base.OnInspectorGUI();
     UtilityEditor.PropertyField("KEY", key);
     if (GUI.changed)
     {
         serializedObject.ApplyModifiedProperties();
     }
     if (!RawImageComponent.bInit)
     {
         RawImageComponent.bInit = true;
         SetDefaultValue(RawImageComponent);
     }
 }
    public override void OnInspectorGUI()
    {
        //base.OnInspectorGUI();

        UtilityEditor.VersioningTool("TCT", 0, 1, 0, 0);

        EditorLayout.Space(2);

        EditorReflectionLayout.TextField(eTarget, "name", "Character Name");

        EditorLayout.Space();

        EditorLayout.Button("Add Component Character", eTarget.AddComponent, currentComponent);
    }
Example #11
0
    public static void BuildAllPlatform()
    {
        if (EditorUtility.DisplayDialog("",
                                        "Are you sure?",
                                        "Yes",
                                        "No"))
        {
            for (int i = 0; i < BUILD_TARGET_NAMES.Length; i++)
            {
                UtilityEditor.CreateFolder(folder + "/" + BUILD_TARGET_NAMES[i]);

                BuildPipeline.BuildAssetBundles(Application.dataPath + "/" + folder + "/" + BUILD_TARGET_NAMES[i], BuildAssetBundleOptions.CollectDependencies, GetTarget(BUILD_TARGET_NAMES[i]));
            }
        }
    }
Example #12
0
        public static QToggleButtonGroup AddComponent()
        {
            QToggleButtonGroup component = UtilityEditor.ExtensionComponentWhenCreate <QToggleButtonGroup>(typeof(QToggleButtonGroup).Name.ToString());

            component.list.Clear();

            for (int i = 0; i < 2; i++)
            {
                Selection.activeObject = component;
                QToggleButton button = QToggleButtonEditor.AddComponent();
                component.list.Add(button);
            }
            Selection.activeObject = component;
            return(component);
        }
Example #13
0
    void OnGUI()
    {
        EditorGUILayout.LabelField("Choose Build Target", EditorStyles.boldLabel);
        EditorGUILayout.BeginHorizontal();
        GUILayout.Space(25.0f);

        for (int i = 0; i < BUILD_TARGET_NAMES.Length; i++)
        {
            CreateToogle(i, BUILD_TARGET_NAMES[i], isTargetToggle[i]);
        }

        EditorGUILayout.EndHorizontal();
        GUILayout.Space(25.0f);


        if (UtilityEditor.GetCommonButton("Create"))
        {
            if (EditorUtility.DisplayDialog("",
                                            "Are you sure?",
                                            "Yes",
                                            "No"))
            {
                for (int i = 0; i < isTargetToggle.Length; i++)
                {
                    if (isTargetToggle[i])
                    {
                        UtilityEditor.CreateFolder(folder + "/" + BUILD_TARGET_NAMES[i]);

                        BuildPipeline.BuildAssetBundles(Application.dataPath + "/" + folder + "/" + BUILD_TARGET_NAMES[i], BuildAssetBundleOptions.CollectDependencies, GetTarget(BUILD_TARGET_NAMES[i]));
                    }
                }

                this.Close();
            }
        }
    }
Example #14
0
        public static QImageBox AddComponent()
        {
            QImageBox component = UtilityEditor.ExtensionComponentWhenCreate <QImageBox>(typeof(QImageBox).Name.ToString());

            return(component);
        }
Example #15
0
    void OnGUI()
    {
        BtnStyle           = new GUIStyle(GUI.skin.button);
        BtnStyle.fontSize  = 16;
        BtnStyle.alignment = TextAnchor.MiddleLeft;

        LableStyle           = new GUIStyle(GUI.skin.label);
        LableStyle.fontSize  = 16;
        LableStyle.alignment = TextAnchor.MiddleLeft;

        BoxStyle = new GUIStyle(GUI.skin.box);

        assetBundleNames = AssetDatabase.GetAllAssetBundleNames();


        if (assetBundleNames.Length == 0)
        {
            EditorGUILayout.HelpBox("No AssetBundle Data", MessageType.Warning);
            return;
        }

        tabIndex = UtilityEditor.Tabs(Types, tabIndex);
        GUILayout.Space(10);

        string[] assetName = null;

        switch (tabIndex)
        {
        case 0:
            EditorGUILayout.LabelField("Select AssetBundle Names", EditorStyles.boldLabel);

            index = EditorGUILayout.Popup(index, assetBundleNames);
            GUILayout.Space(10f);

            assetName = AssetDatabase.FindAssets("b:" + assetBundleNames[index]);

            EditorGUILayout.BeginVertical();
            this.scrollPos = EditorGUILayout.BeginScrollView(this.scrollPos, false, false);
            EditorGUILayout.Space();


            foreach (string item in assetName)
            {
                string   path  = AssetDatabase.GUIDToAssetPath(item);
                string[] level = path.Split('/');

                if (GUILayout.Button(GetLevelString(level.Length - 1) + path, BtnStyle))
                {
                    EditorGUIUtility.PingObject(AssetDatabase.LoadAssetAtPath <Object>(path));
                }
            }


            EditorGUILayout.EndScrollView();
            EditorGUILayout.EndVertical();

            GUILayout.Space(25.0f);
            break;


        case 1:
            EditorGUILayout.LabelField("AssetBundle", EditorStyles.boldLabel);

            EditorGUILayout.BeginVertical();
            this.scrollPos = EditorGUILayout.BeginScrollView(this.scrollPos, false, false);

            int count = 1;
            foreach (string name in assetBundleNames)
            {
                assetName = AssetDatabase.FindAssets("b:" + name);

                EditorGUILayout.BeginVertical(BoxStyle);
                GUILayout.Label(count.ToString("000") + ".  " + name + ":", LableStyle);
                foreach (string item in assetName)
                {
                    string   path  = AssetDatabase.GUIDToAssetPath(item);
                    string[] level = path.Split('/');

                    if (GUILayout.Button(GetLevelString(level.Length - 1) + path, BtnStyle))
                    {
                        EditorGUIUtility.PingObject(AssetDatabase.LoadAssetAtPath <Object>(path));
                    }
                }
                EditorGUILayout.EndVertical();

                count++;
                GUILayout.Space(25.0f);
            }

            EditorGUILayout.EndScrollView();
            EditorGUILayout.EndVertical();

            GUILayout.Space(25.0f);
            break;
        }
    }
Example #16
0
        public void GenerateCodeEditor()
        {
            transformGroup.Clear();
            Transform[] children = CacheTransform.GetComponentsInChildren <Transform>(true);
            for (int i = 0; i < children.Length; i++)
            {
                Transform child    = children[i];
                string    fullName = child.name;
                string[]  tmpName  = fullName.Split('_');
                if (tmpName.Length > 1)
                {
                    Type type;
                    if (name_type.TryGetValue(tmpName[0], out type))
                    {
                        transformGroup.Add(child, type);
                    }
                }
            }

            //读取
            StreamReader streamReader = new StreamReader(UI_TEMPLATE_PATH, Encoding.UTF8);
            string       ClassText    = streamReader.ReadToEnd();

            streamReader.Close();

            //生成
            UIBase       uIBase       = GetComponent <UIBase>();
            string       uiBasePath   = StringPool.Format(Application.dataPath + "/Lemon/Scripts/UI/{0}/{1}_Generate.cs", uIBase.name, uIBase.name);
            StreamWriter streamWriter = new StreamWriter(uiBasePath, false, Encoding.UTF8);

            //添加自动化的变量
            StringBuilder stringBuilder = StringPool.GetStringBuilder();

            stringBuilder.Append("\n");
            Dictionary <Transform, Type> .Enumerator enumerator = transformGroup.GetEnumerator();
            while (enumerator.MoveNext())
            {
                string name = enumerator.Current.Key.name;
                Type   type = enumerator.Current.Value;
                stringBuilder.Append("        public " + type.Name + " " + name + "; ");
                stringBuilder.Append("\n");
            }

            ClassText = ClassText.Replace("UITemplate", uIBase.name);
            ClassText = ClassText.Replace(KEY_VARIABLE, KEY_VARIABLE + stringBuilder.ToString());

            //添加自动化的变量路径
            stringBuilder = StringPool.GetStringBuilder();
            stringBuilder.Append("\n");
            enumerator = transformGroup.GetEnumerator();
            while (enumerator.MoveNext())
            {
                Transform childTransform = enumerator.Current.Key;
                Type      type           = enumerator.Current.Value;
                stringBuilder.Append("            " + childTransform.name + " = " + "CacheTransform.Find(\"" + UtilityEditor.GetPath(childTransform, CacheTransform) + "\").GetComponent<" + type.Name + ">();\n");
            }

            ClassText = ClassText.Replace(KEY_PATH, KEY_PATH + stringBuilder.ToString());

            streamWriter.Write(ClassText);
            streamWriter.Close();

            UnityEditor.AssetDatabase.Refresh();
        }