示例#1
0
    static void Save()
    {
        EditorPrefs.SetString("NGUI Partial", mPartial);
        EditorPrefs.SetString("NGUI Font Name", mFontName);
        EditorPrefs.SetString("NGUI Atlas Name", mAtlasName);
        EditorPrefs.SetInt("NGUI Font Asset", (mFontData != null) ? mFontData.GetInstanceID() : -1);
        EditorPrefs.SetInt("NGUI Font Texture", (mFontTexture != null) ? mFontTexture.GetInstanceID() : -1);
        EditorPrefs.SetInt("NGUI Font", (mFont != null) ? mFont.GetInstanceID() : -1);
        EditorPrefs.SetInt("NGUI Atlas", (mAtlas != null) ? mAtlas.GetInstanceID() : -1);
        EditorPrefs.SetInt("NGUI Atlas Padding", mAtlasPadding);
        EditorPrefs.SetBool("NGUI Atlas Trimming", mAtlasTrimming);
        EditorPrefs.SetBool("NGUI Unity Packing", mUnityPacking);
        EditorPrefs.SetBool("NGUI Force Square Atlas", mForceSquare);
        EditorPrefs.SetInt("NGUI Pivot", (int)mPivot);
        EditorPrefs.SetInt("NGUI Layer", mLayer);
        EditorPrefs.SetInt("NGUI DynFont", (mDynFont != null) ? mDynFont.GetInstanceID() : -1);
        EditorPrefs.SetInt("NGUI DynFontSize", mDynFontSize);
        EditorPrefs.SetInt("NGUI DynFontStyle", (int)mDynFontStyle);

        SaveColor();
    }
示例#2
0
    /// <summary>
    /// Figures out the saveable filename for the texture of the specified atlas.
    /// </summary>

    static public string GetSaveableTexturePath(NGUIAtlas atlas)
    {
        // Path where the texture atlas will be saved
        string path = "";

        // If the atlas already has a texture, overwrite its texture
        if (atlas.texture != null)
        {
            path = AssetDatabase.GetAssetPath(atlas.texture.GetInstanceID());

            if (!string.IsNullOrEmpty(path))
            {
                int dot = path.LastIndexOf('.');
                return(path.Substring(0, dot) + ".png");
            }
        }

        // No texture to use -- figure out a name using the atlas
        path = AssetDatabase.GetAssetPath(atlas.GetInstanceID());
        path = string.IsNullOrEmpty(path) ? "Assets/" + atlas.name + ".png" : path.Replace(".prefab", ".png");
        return(path);
    }