Skip to content

Commit

Permalink
Added icon to settings file.
Browse files Browse the repository at this point in the history
  • Loading branch information
h-sigma committed Feb 10, 2021
1 parent d2bc0c8 commit fbd9a13
Show file tree
Hide file tree
Showing 3 changed files with 141 additions and 1 deletion.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
128 changes: 128 additions & 0 deletions PvCustomizer/Editor/Resources/Icons/logo_small.png.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 13 additions & 1 deletion PvCustomizer/Editor/Scripts/PvCustomizerSettings.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using Akaal.Editor.Utils;
using UnityEditor;
using UnityEngine;

Expand All @@ -12,13 +13,17 @@ public class PvCustomizerSettings : ScriptableObject, ISerializationCallbackRece

public const string PackageName = "com.akaal.pvcustomizer";

public const string k_MyCustomSettingsPath = ResourcesFolder + "PvCustomizerSettings.asset";
private const string AssetFileName = "PvCustomizerSettings.asset";
private const string ResourcesFolder = "Assets/Plugins/PvCustomizer/Editor/Resources/";
public const string k_MyCustomSettingsPath = ResourcesFolder + AssetFileName;

#endregion

#region Serializable

[SerializeField, PvIcon, HideInInspector]
private Sprite assetIcon;

[SerializeField]
private float tintAmount = 0.5f;

Expand Down Expand Up @@ -89,6 +94,8 @@ internal static PvCustomizerSettings GetOrCreateSettings()
if (_settings == null)
{
_settings = CreateInstance<PvCustomizerSettings>();
_settings.assetIcon = Resource.Load<Sprite>("Icons/logo_small.png");
LoadDefaultRules(_settings);
if (!Directory.Exists(ResourcesFolder)) Directory.CreateDirectory(ResourcesFolder);
AssetDatabase.CreateAsset(_settings, k_MyCustomSettingsPath);
AssetDatabase.SaveAssets();
Expand All @@ -98,6 +105,11 @@ internal static PvCustomizerSettings GetOrCreateSettings()
return _settings;
}

private static void LoadDefaultRules(PvCustomizerSettings settings)
{
//todo
}

internal static SerializedObject GetSerializedSettings()
{
return new SerializedObject(GetOrCreateSettings());
Expand Down

0 comments on commit fbd9a13

Please sign in to comment.