AirControl  1.3.0
Open Source, Modular, and Extensible Flight Simulator For Deep Learning Research
XChartsSettingsEditor.cs
1 /************************************************/
2 /* */
3 /* Copyright (c) 2018 - 2021 monitor1394 */
4 /* https://github.com/monitor1394 */
5 /* */
6 /************************************************/
7 
8 using System.Collections.Generic;
9 using UnityEditor;
10 using UnityEngine;
11 
12 namespace XCharts
13 {
14  [CustomEditor(typeof(XChartsSettings))]
15  public class XChartsSettingsEditor : Editor
16  {
17  internal class Styles
18  {
19  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.");
20  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/\"");
21  }
22  }
23 
24 #if UNITY_2018_3_OR_NEWER
25  class XChartsResourceImporterProvider : SettingsProvider
26  {
27  XChartsPackageResourceImporter m_ResourceImporter;
28 
29  public XChartsResourceImporterProvider()
30  : base("Project/XCharts", SettingsScope.Project)
31  {
32  }
33 
34  public override void OnGUI(string searchContext)
35  {
36  if (m_ResourceImporter == null)
37  m_ResourceImporter = new XChartsPackageResourceImporter();
38 
39  m_ResourceImporter.OnGUI();
40  }
41 
42  public override void OnDeactivate()
43  {
44  if (m_ResourceImporter != null)
45  m_ResourceImporter.OnDestroy();
46  }
47 
48  static UnityEngine.Object GetSettings()
49  {
50  return Resources.Load<XChartsSettings>("XChartsSettings");
51  }
52 
53  [SettingsProviderGroup]
54  static SettingsProvider[] CreateXChartsSettingsProvider()
55  {
56  var providers = new List<SettingsProvider> { new XChartsResourceImporterProvider() };
57 
58  if (GetSettings() != null)
59  {
60  var provider = new AssetSettingsProvider("Project/XCharts/Settings", GetSettings);
61  provider.PopulateSearchKeywordsFromGUIContentProperties<XChartsSettingsEditor.Styles>();
62  providers.Add(provider);
63  }
64 
65  return providers.ToArray();
66  }
67  }
68 #endif
69 }
XCharts
Definition: RewardChart.cs:14
XCharts.XChartsSettingsEditor
Definition: XChartsSettingsEditor.cs:15