This commit is contained in:
2026-04-25 23:37:10 +02:00
commit 19d6bd934a
476 changed files with 9198 additions and 0 deletions
@@ -0,0 +1,21 @@
using System;
using System.Text.RegularExpressions;
namespace RPGCoreCommon.Settings
{
[AttributeUsage(AttributeTargets.Class)]
public class CustomSettingsAttribute : Attribute
{
internal string path { private set; get; }
/// <summary>
/// Optionally attached to class that extends <see cref="CustomSettingsSO"/>.<br/>
/// All paths in project should be unique otherwise different name will be generated.
/// </summary>
/// <param name="path">custom path and name with "/" as delimiter.</param>
public CustomSettingsAttribute(string path)
{
this.path = new Regex("/+").Replace(path, "/").Trim('/');
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: f707df1d72104aee928f9c94d1bdaf78
timeCreated: 1759151290
@@ -0,0 +1,13 @@
using System;
using UnityEngine;
namespace RPGCoreCommon.Settings
{
/// <summary>
/// Extend this to create new type of settings. These will be automatically added to settings editor window.
/// </summary>
[Serializable]
public abstract class CustomSettingsSO : ScriptableObject
{
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: a0846fc0c7874dd182f4dd9f83a06acf
timeCreated: 1759059292
@@ -0,0 +1,8 @@
using System.Runtime.CompilerServices;
[assembly: InternalsVisibleTo("RPGCoreCommon.Settings.Editor")]
namespace RPGCoreCommon.Settings
{
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 6a05ba05117242eca64be63d17123d74
timeCreated: 1759063680
@@ -0,0 +1,10 @@
using System.Collections.Generic;
using UnityEngine;
namespace RPGCoreCommon.Settings
{
internal class MainSettingsSO : CustomSettingsSO
{
[SerializeReference] internal List<CustomSettingsSO> settings;
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: e1b15ea3617b447290121c2f34009f42
timeCreated: 1759059460
@@ -0,0 +1,14 @@
{
"name": "RPGCoreCommon.Settings",
"rootNamespace": "RPGCoreCommon.Settings",
"references": [],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 42d6bbb0c4c8403d800c75cd28a1feef
timeCreated: 1759058936
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: f81c1b5e2a3146898d759c18b6a9ffa0
timeCreated: 1759058859
@@ -0,0 +1,21 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: e1b15ea3617b447290121c2f34009f42, type: 3}
m_Name: MainSettings
m_EditorClassIdentifier:
settings:
- {fileID: 11400000, guid: 6dbd2048bd875ca42bf5e2ccd3282671, type: 2}
- {fileID: 11400000, guid: 4bc4327b80b188146b7b4df067d792b0, type: 2}
- {fileID: 11400000, guid: f583031a590e02f4da97ee00f6d56be7, type: 2}
- {fileID: 11400000, guid: f96c774b23415ae46a33cd04b1eeb0f7, type: 2}
- {fileID: 11400000, guid: f1565c1ea85209c46b34b5066482be4b, type: 2}
- {fileID: 11400000, guid: 9df758ff4bf9af948aa6ad53f610288b, type: 2}
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 0a07eaaeda7416b4f8c78d79c5f9fb8c
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,16 @@
using System.Linq;
using UnityEngine;
namespace RPGCoreCommon.Settings
{
public static class SettingsManager
{
private static MainSettingsSO _mainSettings;
public static T Get<T>() where T : CustomSettingsSO
{
_mainSettings ??= Resources.Load<MainSettingsSO>("MainSettings");
return _mainSettings.settings.FirstOrDefault(settings => settings is T) as T;
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 9233d376eb8d441c8557a2489d3f39cd
timeCreated: 1759058999