mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-20 15:30:09 +00:00
3.0 - unitypackage
This commit is contained in:
62
Editor/Windows/XCSettingsEditor.cs
Normal file
62
Editor/Windows/XCSettingsEditor.cs
Normal file
@@ -0,0 +1,62 @@
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts.Editor
|
||||
{
|
||||
[CustomEditor(typeof(XCSettings))]
|
||||
public class XCSettingsEditor : UnityEditor.Editor
|
||||
{
|
||||
internal class Styles
|
||||
{
|
||||
public static readonly GUIContent defaultFontAssetLabel = new GUIContent("Default Font Asset", "The Font Asset that will be assigned by default to newly created text objects when no Font Asset is specified.");
|
||||
public static readonly GUIContent defaultFontAssetPathLabel = new GUIContent("Path: Resources/", "The relative path to a Resources folder where the Font Assets and Material Presets are located.\nExample \"Fonts & Materials/\"");
|
||||
}
|
||||
}
|
||||
|
||||
#if UNITY_2018_3_OR_NEWER
|
||||
class XCResourceImporterProvider : SettingsProvider
|
||||
{
|
||||
XCResourcesImporter m_ResourceImporter;
|
||||
|
||||
public XCResourceImporterProvider()
|
||||
: base("Project/XCharts", SettingsScope.Project)
|
||||
{
|
||||
}
|
||||
|
||||
public override void OnGUI(string searchContext)
|
||||
{
|
||||
if (m_ResourceImporter == null)
|
||||
m_ResourceImporter = new XCResourcesImporter();
|
||||
|
||||
m_ResourceImporter.OnGUI();
|
||||
}
|
||||
|
||||
public override void OnDeactivate()
|
||||
{
|
||||
if (m_ResourceImporter != null)
|
||||
m_ResourceImporter.OnDestroy();
|
||||
}
|
||||
|
||||
static UnityEngine.Object GetSettings()
|
||||
{
|
||||
return Resources.Load<XCSettings>("XCSettings");
|
||||
}
|
||||
|
||||
[SettingsProviderGroup]
|
||||
static SettingsProvider[] CreateXCSettingsProvider()
|
||||
{
|
||||
var providers = new List<SettingsProvider> { new XCResourceImporterProvider() };
|
||||
|
||||
if (GetSettings() != null)
|
||||
{
|
||||
var provider = new AssetSettingsProvider("Project/XCharts/Settings", GetSettings);
|
||||
provider.PopulateSearchKeywordsFromGUIContentProperties<XCSettingsEditor.Styles>();
|
||||
providers.Add(provider);
|
||||
}
|
||||
|
||||
return providers.ToArray();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
Reference in New Issue
Block a user