// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved. using System; using FlaxEditor.Content.Create; using FlaxEditor.Content.Settings; namespace FlaxEditor.Content { /// /// Content proxy for json settings assets (e.g or ). /// /// public sealed class SettingsProxy : JsonAssetProxy { private readonly Type _type; /// /// Initializes a new instance of the class. /// /// The settings asset type (must be subclass of SettingsBase type). public SettingsProxy(Type type) { _type = type; TypeName = type.FullName; } /// public override string Name => "Settings"; //public override string Name { get; } = CustomEditors.CustomEditorsUtil.GetPropertyNameUI(_type.Name); /// public override bool CanCreate(ContentFolder targetLocation) { // Use proxy only for GameSettings for creating if (_type != typeof(GameSettings)) return false; return targetLocation.CanHaveAssets; } /// public override void Create(string outputPath, object arg) { Editor.Instance.ContentImporting.Create(new SettingsCreateEntry(outputPath)); } /// public override bool IsProxyFor() { return typeof(T) == _type; } /// public override string TypeName { get; } } }