Пример #1
0
        public static GraphEditorWindow Init()
        {
            editor = GetWindow <GraphEditorWindow>(typeof(SceneView));
            Texture2D icon = EditorUtils.FindAssetByName <Texture2D>("title_content");

            editor.titleContent   = new GUIContent("FastPlay", icon);
            editor.wantsMouseMove = true;
            return(editor);
        }
Пример #2
0
            public Styles()
            {
                border = FPSkin.border;
                header = FPSkin.header;

                if (EditorGUIUtility.isProSkin)
                {
                    background = EditorUtils.FindAssetByName <Texture2D>("background_dark");
                }
                else
                {
                    background = EditorUtils.FindAssetByName <Texture2D>("background_light");
                }
            }
Пример #3
0
        private void OnEnable()
        {
            styles  = new Styles();
            is_open = true;
            editor  = this;

            Undo.undoRedoPerformed   += UndoRedoPerformed;
            EditorApplication.update += Update;
            EditorApplication.playModeStateChanged += OnStateChange;

            anim = new List <Texture2D>();
            for (int id = 0; id < 21; id++)
            {
                anim.Add(EditorUtils.FindAssetByName <Texture2D>(string.Format("anim_{0}", id)));
            }
            OnSelectionChange();
        }
Пример #4
0
 public static void UpdateSkin()
 {
     m_skin = EditorUtils.FindAssetByName <GUISkin>(EditorGUIUtility.isProSkin ? "FPDarkSkin" : "FPLightSkin");
 }
Пример #5
0
        public static Texture GetTypeIcon(Type type, bool return_default_icon = true)
        {
            if (type == null)
            {
                if (return_default_icon)
                {
                    return(icons[typeof(Nullable)] = EditorUtils.FindAssetByName <Texture>("http_status_not_found"));
                }
                return(null);
            }
            Texture t;

            if (icons.TryGetValue(type, out t))
            {
                return(t);
            }
            string path;

            if (paths.TryGetValue(type, out path))
            {
                return(icons[type] = EditorUtils.FindAssetByName <Texture>(path));
            }
            IconAttribute icon_flag = type.GetAttribute <IconAttribute>(false);

            if (icon_flag != null)
            {
                return(icons[type] = icon_flag.GetIcon());
            }
            else if (typeof(UnityObject).IsAssignableFrom(type))
            {
                return(icons[type] = EditorGUIUtility.ObjectContent(null, type).image);
            }
            else if (type.IsSubclassOf(typeof(EventNode)))
            {
                return(icons[type] = GetTypeIcon(typeof(EventNode), return_default_icon));
            }
            else
            {
                Type base_type = type;
                while (!base_type.IsGenericType)
                {
                    if (base_type.BaseType == null)
                    {
                        break;
                    }
                    base_type = base_type.BaseType;
                }
                if (base_type.IsGenericType)
                {
                    t = GetTypeIcon(base_type.GetGenericArguments()[0], false);
                    if (t != null)
                    {
                        return(icons[type] = t);
                    }
                }
            }
            if (return_default_icon)
            {
                return(icons[type] = EditorUtils.FindAssetByName <Texture>("http_status_not_found"));
            }
            else
            {
                return(null);
            }
        }