Esempio n. 1
0
        public static void SetPostion(string name, Rect position)
        {
            EditorWindowInfo info = FindInfo(name);

            if (info != null)
            {
                info.position = position;
            }
        }
Esempio n. 2
0
        public static void SetActive(string name, bool active)
        {
            EditorWindowInfo info = FindInfo(name);

            if (info != null)
            {
                info.isOpen = active;
            }
        }
Esempio n. 3
0
        public static EditorWindowInfo FindInfo(string name)
        {
            EditorWindowInfo Info = Windows.Find((info) => { return(info.searchName == name); });

            if (Info == null)
            {
                FreshInfoDic();
                Info = Windows.Find((info) => { return(info.searchName == name); });
                if (Info == null)
                {
                    return(null);
                }
                return(Info);
            }
            return(Info);
        }
        void DrawRemoveAnimationClipButton(int index)
        {
            const float deleteButtonWidth = 20;
            Color       defaultColor      = GUI.color;

            GUI.color = Color.gray;

            if (GUILayout.Button("-", GUILayout.Width(deleteButtonWidth)))
            {
                Undo.RecordObject(EditorWindowInfo.Selector.AnimationEvents, "Remove AnimationClipEvent");
                EditorWindowInfo.Selector.AnimationEvents.RemoveAt(index);
                EditorWindowInfo.Selector.AnimationClipEvents = null;
                EditorWindowInfo.StopAnimation();
            }

            GUI.color = defaultColor;
        }
Esempio n. 5
0
        private static void FileField(EditorWindowInfo info, LanguageTemplate lang)
        {
            var style = new GUIStyle(EditorStyles.label);

            using (new EditorGUILayout.HorizontalScope())
            {
                if (info.HasChanged)
                {
                    style.normal.textColor = Color.red;
                }
                else
                {
                    style.normal.textColor = Color.black;
                }
                EditorGUILayout.LabelField(info.Name, style);

                if (info.Applied)
                {
                    EditorGUILayout.LabelField(lang.applied);
                }

                // ファイルだけの移動はできなくてもよいので一時削除
                //if (GUILayout.Button("x"))
                //{
                //    folder.EditorWindowList.Remove(editorWindowInfo);
                //    editorWindowInfo.DestMenuItemPath = string.Empty;
                //}
            }

            if (info.HasChanged && !info.Applied)
            {
                using (new EditorGUI.IndentLevelScope())
                {
                    var pathStyle = new GUIStyle(GUI.skin.label)
                    {
                        wordWrap = true
                    };
                    EditorGUILayout.LabelField(info.Path, pathStyle);
                    EditorGUILayout.LabelField("→ " + info.DestMenuItemPath, pathStyle);
                }
            }
        }
        void DrawAnimationClipControlButton(int index, AnimationClipEvents animationClipEvents)
        {
            string buttonName   = "Don't have AnimationClip";
            Color  defaultColor = GUI.color;

            if (animationClipEvents.AnimationClip == null)
            {
                GUI.color = Color.red;
            }
            else if (EditorWindowInfo.Selector.AnimationClipEvents == animationClipEvents)
            {
                buttonName = animationClipEvents.AnimationClip.name;
                GUI.color  = Color.green;
            }
            else
            {
                buttonName = animationClipEvents.AnimationClip.name;
                GUI.color  = defaultColor;
            }

            if (GUILayout.Button(buttonName))
            {
                if (EditorWindowInfo.IsPlaying)
                {
                    if (animationClipEvents.AnimationClip != null)
                    {
                        EditorWindowInfo.StopAnimation();
                    }
                }
                else
                {
                    EditorWindowInfo.StopAnimation();
                }

                EditorWindowInfo.Selector.AnimationClipEvents = animationClipEvents;
            }

            GUI.color = defaultColor;
        }
Esempio n. 7
0
        public static Rect Postion(string name)
        {
            EditorWindowInfo info = FindInfo(name);

            return(info == null ? Rect.zero : info.position);
        }
Esempio n. 8
0
        public static bool IsActive(string name)
        {
            EditorWindowInfo info = FindInfo(name);

            return(info == null ? false : info.isOpen);
        }
Esempio n. 9
0
        public static EditorWindow Create(string name)
        {
            EditorWindowInfo info = FindInfo(name);

            return(info == null ? null : info.Create());
        }
Esempio n. 10
0
        public static EditorWindow[] FindAll(string name)
        {
            EditorWindowInfo info = FindInfo(name);

            return(info == null ? null : info.FindAll());
        }