void DrawIcon(Icon pIcon, string pPath)
    {
        EditorGUILayout.BeginHorizontal();
        if (pIcon.IconSprite != null)
        {
            GUILayout.Label(pIcon.IconSprite.texture, GUILayout.Width(80), GUILayout.Height(80));
        }

        GUILayout.Label(pIcon.Tag);

        if (GUILayout.Button("Select", GUILayout.Width(50)))
        {
            IconEditor.Init(ref pIcon);
        }

        if (GUILayout.Button("Delete", GUILayout.Width(50)))
        {
            Debug.Log(pPath + "/" + pIcon.name);
            System.IO.File.Delete(pPath + "/" + pIcon.name + ".asset");
            System.IO.File.Delete(pPath + "/" + pIcon.name + ".asset.meta");
            AssetDatabase.Refresh();
        }


        EditorGUILayout.EndHorizontal();
    }
Ejemplo n.º 2
0
    static void ShowWindow()
    {
        IconEditor window = GetWindow <IconEditor>("IconEditor");

        window.minSize = new Vector2(1280, 720);
        //2018版本这个方法不中用了 找不到了
        //Texture2D tex = EditorGUIUtility.FindTexture("GameObject Icon");
        loadIconMethodInfo  = typeof(EditorGUIUtility).GetMethod("LoadIcon", BindingFlags.Static | BindingFlags.NonPublic);
        window.titleContent = new GUIContent("InternalIcon", loadIconMethodInfo.Invoke(null, new object[] { "Image Icon" }) as Texture);
    }
Ejemplo n.º 3
0
    public static void Init(ref Icon pIcon)
    {
        IconEditor tIconEditor = GetWindow <IconEditor>();

        Selection.activeObject = pIcon;

        tIconEditor.minSize = new Vector2(450, 600);
        tIconEditor.maxSize = new Vector2(450, 600);

        tIconEditor.Show();
    }
Ejemplo n.º 4
0
    /// <summary>
    /// InspectorのGUIを更新
    /// </summary>
    public override void OnInspectorGUI()
    {
        //元のInspector部分を表示
        base.OnInspectorGUI();

        //targetを変換して対象を取得
        IconEditor iconEditor = target as IconEditor;

        //PrivateMethodを実行する用のボタン
        if (GUILayout.Button("SaveIcons"))
        {
            //SendMessageを使って実行
            iconEditor.SendMessage("SaveIcons", null, SendMessageOptions.DontRequireReceiver);
        }
    }
Ejemplo n.º 5
0
        private void treeViewResources_AfterSelect(object sender, TreeViewEventArgs e)
        {
            //  Get the editor host.
            var editorHost = tableLayoutPanel1.GetControlFromPosition(1, 1);

            //  Release any existing editor.
            if (currentEditor != null)
            {
                editorHost.Controls.Remove((Control)currentEditor);
                currentEditor.Release();
            }

            //  Create the appropriate control.
            var resource = e.Node?.Tag as Win32Resource;

            if (resource == null)
            {
                return;
            }

            if (resource.ResourceType.IsKnownResourceType(ResType.RT_BITMAP))
            {
                var bitmapEditor = new BitmapEditor {
                    Dock = DockStyle.Fill
                };
                currentEditor = bitmapEditor;
                var parent = tableLayoutPanel1.GetControlFromPosition(1, 1);
                parent.Controls.Add(bitmapEditor);
                bitmapEditor.Initialise(resource);
            }
            else if (resource.ResourceType.IsKnownResourceType(ResType.RT_ICON))
            {
                var iconEditor = new IconEditor {
                    Dock = DockStyle.Fill
                };
                currentEditor = iconEditor;
                var parent = tableLayoutPanel1.GetControlFromPosition(1, 1);
                parent.Controls.Add(iconEditor);
                iconEditor.Initialise(resource);
            }
        }
Ejemplo n.º 6
0
        /*
         * private void OnRefreshIcons()
         * {
         *  RaisePropertyChanged(() => InputIcons);
         *  //    InputIcons = null; // force refresh
         * }
         */
        private void OnEditIcons()
        {
            var ic = new IconEditor();

            ic.ShowDialog();
        }