public void AssignAssetSettingsWindow(AssetSettingsWindow assetSettings)
 {
     this.assetSettings = assetSettings;
 }
コード例 #2
0
    //    void OnDestroy() {
    //        EditorApplication.update -= MyUpdate;
    //    }
    void Init()
    {
        singleton = this;

        GetAssetPaths();

        //Load asset configurations
        LoadConfigurations();

        //Create/Refresh configuration dropdown list
        RefreshConfigurationDropdownList();

        //If serialized configurationIndex is out of array bounds, correct it
        if(ConfigurationIndex < 0 || ConfigurationIndex >= configurations.Count)
            ConfigurationIndex = 0;

        this.minSize = new Vector2(300, 200);
        this.maxSize = new Vector2(1000, 800);

        //Create GUIStyles
        edgeBoxStyle = new GUIStyle(EditorGUIUtility.GetBuiltinSkin(EditorSkin.Inspector).box);
        edgeBoxStyle.normal.background = edgeBoxTexture;
        edgeBoxStyle.margin = new RectOffset(0,0,0,0);
        edgeBoxStyle.padding = new RectOffset(0,0,0,0);
        edgeBoxStyle.border = new RectOffset(0,0,0,0);

        prefixLabelStyle = new GUIStyle(GUIStyle.none);
        prefixLabelStyle.stretchWidth = false;
        prefixLabelStyle.border = new RectOffset(0,0,0,0);
        prefixLabelStyle.overflow = new RectOffset(0,0,0,0);
        prefixLabelStyle.fixedWidth = 5;

        addButtonStyle = new GUIStyle();
        addButtonStyle.normal.background = addTextureUp;
        addButtonStyle.active.background = addTextureDown;
        addButtonStyle.fixedWidth = addTextureUp.width;
        addButtonStyle.fixedHeight = addTextureUp.height;
        addButtonStyle.imagePosition = ImagePosition.ImageLeft;
        addButtonStyle.alignment = TextAnchor.MiddleLeft;
        addButtonStyle.clipping = TextClipping.Overflow;
        addButtonStyle.margin = new RectOffset(4,4,4,4);
        addButtonStyle.padding = new RectOffset(16,8,8,8);

        removeButtonStyle = new GUIStyle(addButtonStyle); //Inherit margin and fixedWidth/Height from addButtonStyle
        removeButtonStyle.normal.background = removeTextureUp;
        removeButtonStyle.active.background = removeTextureDown;

        editButtonStyle = new GUIStyle(addButtonStyle); //Inherit margin and fixedWidth/Height from addButtonStyle
        editButtonStyle.normal.background = editTexture;
        editButtonStyle.active.background = editTexture;

        cancelButtonStyle = new GUIStyle(addButtonStyle); //Inherit margin and fixedWidth/Height from addButtonStyle
        cancelButtonStyle.normal.background = cancelTextureUp;
        cancelButtonStyle.active.background = cancelTextureDown;

        //Make sure asset selection indices are valid
        if(currentConfiguration == null) {
            assetSelectionIndices.Clear();
        } else {
            for(int i = assetSelectionIndices.Count - 1; i >= 0; i++) {
                if(assetSelectionIndices[i] < 0 || assetSelectionIndices[i] >= currentConfiguration.assets.Count)
                    assetSelectionIndices.RemoveAt(i);
            }
        }
    }
コード例 #3
0
//	void OnDestroy() {
//		EditorApplication.update -= MyUpdate;
//	}

    void Init()
    {
        singleton = this;

        GetAssetPaths();

        //Load asset configurations
        LoadConfigurations();

        //Create/Refresh configuration dropdown list
        RefreshConfigurationDropdownList();

        //If serialized configurationIndex is out of array bounds, correct it
        if (ConfigurationIndex < 0 || ConfigurationIndex >= configurations.Count)
        {
            ConfigurationIndex = 0;
        }

        this.minSize = new Vector2(300, 200);
        this.maxSize = new Vector2(1000, 800);

        //Create GUIStyles
        edgeBoxStyle = new GUIStyle(EditorGUIUtility.GetBuiltinSkin(EditorSkin.Inspector).box);
        edgeBoxStyle.normal.background = edgeBoxTexture;
        edgeBoxStyle.margin            = new RectOffset(0, 0, 0, 0);
        edgeBoxStyle.padding           = new RectOffset(0, 0, 0, 0);
        edgeBoxStyle.border            = new RectOffset(0, 0, 0, 0);

        prefixLabelStyle = new GUIStyle(GUIStyle.none);
        prefixLabelStyle.stretchWidth = false;
        prefixLabelStyle.border       = new RectOffset(0, 0, 0, 0);
        prefixLabelStyle.overflow     = new RectOffset(0, 0, 0, 0);
        prefixLabelStyle.fixedWidth   = 5;

        addButtonStyle = new GUIStyle();
        addButtonStyle.normal.background = addTextureUp;
        addButtonStyle.active.background = addTextureDown;
        addButtonStyle.fixedWidth        = addTextureUp.width;
        addButtonStyle.fixedHeight       = addTextureUp.height;
        addButtonStyle.imagePosition     = ImagePosition.ImageLeft;
        addButtonStyle.alignment         = TextAnchor.MiddleLeft;
        addButtonStyle.clipping          = TextClipping.Overflow;
        addButtonStyle.margin            = new RectOffset(4, 4, 4, 4);
        addButtonStyle.padding           = new RectOffset(16, 8, 8, 8);

        removeButtonStyle = new GUIStyle(addButtonStyle);         //Inherit margin and fixedWidth/Height from addButtonStyle
        removeButtonStyle.normal.background = removeTextureUp;
        removeButtonStyle.active.background = removeTextureDown;

        editButtonStyle = new GUIStyle(addButtonStyle);         //Inherit margin and fixedWidth/Height from addButtonStyle
        editButtonStyle.normal.background = editTexture;
        editButtonStyle.active.background = editTexture;

        cancelButtonStyle = new GUIStyle(addButtonStyle);         //Inherit margin and fixedWidth/Height from addButtonStyle
        cancelButtonStyle.normal.background = cancelTextureUp;
        cancelButtonStyle.active.background = cancelTextureDown;

        //Make sure asset selection indices are valid
        if (currentConfiguration == null)
        {
            assetSelectionIndices.Clear();
        }
        else
        {
            for (int i = assetSelectionIndices.Count - 1; i >= 0; i++)
            {
                if (assetSelectionIndices[i] < 0 || assetSelectionIndices[i] >= currentConfiguration.assets.Count)
                {
                    assetSelectionIndices.RemoveAt(i);
                }
            }
        }
    }
コード例 #4
0
 public static void InitWindow()
 {
     AssetSettingsWindow.GetWindow <AssetSettingsWindow>(false, "Asset Settings", true).Init();
 }
コード例 #5
0
 public void AssignAssetSettingsWindow(AssetSettingsWindow assetSettings)
 {
     this.assetSettings = assetSettings;
 }
コード例 #6
0
//	void OnDestroy() {
//		EditorApplication.update -= MyUpdate;
//	}

    void Init()
    {
        singleton = this;

//		EditorApplication.update += MyUpdate;

        //Load asset configurations
        LoadConfigurations();

        //Create/Refresh configuration dropdown list
        RefreshConfigurationDropdownList();

        //If serialized configurationIndex is out of array bounds, correct it
        if (ConfigurationIndex < 0 || ConfigurationIndex >= configurations.Count)
        {
            ConfigurationIndex = 0;
        }

        this.minSize = new Vector2(300, 200);
        this.maxSize = new Vector2(1000, 800);

        //find texture references
        string path = null;
        int    index;

        foreach (string assetPath in AssetDatabase.GetAllAssetPaths())
        {
            index = assetPath.IndexOf("MultiPlatformToolSuite");
            if (index >= 0)
            {
                path = assetPath.Substring(0, index);
                break;
            }
        }
        string editorPath = path + "MultiPlatformToolSuite" + Path.DirectorySeparatorChar + "Editor" + Path.DirectorySeparatorChar;

        path = editorPath + "Textures" + Path.DirectorySeparatorChar;

        //AssetSettingsWindow
        scriptAsset       = AssetDatabase.LoadAssetAtPath(editorPath + "AssetSettings" + Path.DirectorySeparatorChar + "AssetSettings.xml", typeof(Object));
        addTextureUp      = (Texture2D)AssetDatabase.LoadAssetAtPath(path + "editorAddButtonUp.tga", typeof(Texture2D));
        addTextureDown    = (Texture2D)AssetDatabase.LoadAssetAtPath(path + "editorAddButtonDown.tga", typeof(Texture2D));
        removeTextureUp   = (Texture2D)AssetDatabase.LoadAssetAtPath(path + "editorRemoveButtonUp.tga", typeof(Texture2D));
        removeTextureDown = (Texture2D)AssetDatabase.LoadAssetAtPath(path + "editorRemoveButtonDown.tga", typeof(Texture2D));
        editTexture       = (Texture2D)AssetDatabase.LoadAssetAtPath(path + "editButton.tga", typeof(Texture2D));
        cancelTextureUp   = (Texture2D)AssetDatabase.LoadAssetAtPath(path + "cancelButtonUp.tga", typeof(Texture2D));
        cancelTextureDown = (Texture2D)AssetDatabase.LoadAssetAtPath(path + "cancelButtonDown.tga", typeof(Texture2D));
        edgeBoxTexture    = (Texture2D)AssetDatabase.LoadAssetAtPath(path + "edgeBoxTexture.tga", typeof(Texture2D));
        selectionTexture  = (Texture2D)AssetDatabase.LoadAssetAtPath(path + "selectionTexture.tga", typeof(Texture2D));

        //Create GUIStyles
        edgeBoxStyle = new GUIStyle(EditorGUIUtility.GetBuiltinSkin(EditorSkin.Inspector).box);
        edgeBoxStyle.normal.background = edgeBoxTexture;
        edgeBoxStyle.margin            = new RectOffset(0, 0, 0, 0);
        edgeBoxStyle.padding           = new RectOffset(0, 0, 0, 0);
        edgeBoxStyle.border            = new RectOffset(0, 0, 0, 0);

        prefixLabelStyle = new GUIStyle(GUIStyle.none);
        prefixLabelStyle.stretchWidth = false;
        prefixLabelStyle.border       = new RectOffset(0, 0, 0, 0);
        prefixLabelStyle.overflow     = new RectOffset(0, 0, 0, 0);
        prefixLabelStyle.fixedWidth   = 5;

        addButtonStyle = new GUIStyle();
        addButtonStyle.normal.background = addTextureUp;
        addButtonStyle.active.background = addTextureDown;
        addButtonStyle.fixedWidth        = addTextureUp.width;
        addButtonStyle.fixedHeight       = addTextureUp.height;
        addButtonStyle.imagePosition     = ImagePosition.ImageLeft;
        addButtonStyle.alignment         = TextAnchor.MiddleLeft;
        addButtonStyle.clipping          = TextClipping.Overflow;
        addButtonStyle.margin            = new RectOffset(4, 4, 4, 4);
        addButtonStyle.padding           = new RectOffset(16, 8, 8, 8);

        removeButtonStyle = new GUIStyle(addButtonStyle);         //Inherit margin and fixedWidth/Height from addButtonStyle
        removeButtonStyle.normal.background = removeTextureUp;
        removeButtonStyle.active.background = removeTextureDown;

        editButtonStyle = new GUIStyle(addButtonStyle);         //Inherit margin and fixedWidth/Height from addButtonStyle
        editButtonStyle.normal.background = editTexture;
        editButtonStyle.active.background = editTexture;

        cancelButtonStyle = new GUIStyle(addButtonStyle);         //Inherit margin and fixedWidth/Height from addButtonStyle
        cancelButtonStyle.normal.background = cancelTextureUp;
        cancelButtonStyle.active.background = cancelTextureDown;

        //Make sure asset selection indices are valid
        if (currentConfiguration == null)
        {
            assetSelectionIndices.Clear();
        }
        else
        {
            for (int i = assetSelectionIndices.Count - 1; i >= 0; i++)
            {
                if (assetSelectionIndices[i] < 0 || assetSelectionIndices[i] >= currentConfiguration.assets.Count)
                {
                    assetSelectionIndices.RemoveAt(i);
                }
            }
        }
    }