Local Backend Auto registration, files and typo cleanup

This commit is contained in:
LubieKakao1212 2023-02-14 13:45:19 +01:00
parent 0270c50090
commit 1e6204e57e
6 changed files with 20 additions and 29 deletions

View File

@ -6,7 +6,10 @@ using UnityEngine;
namespace NEG.Utils.Achievments namespace NEG.Utils.Achievments
{ {
public static class Achievments /// <summary>
/// Static utility for achievment managment
/// </summary>
public static class Achievment
{ {
public static AchievmentManager Instance public static AchievmentManager Instance
{ {
@ -22,11 +25,15 @@ namespace NEG.Utils.Achievments
} }
} }
internal static string BackendLabel public static string BackendLabel
{ {
get => backendLabel; get => backendLabel;
set set
{ {
if(instance != null)
{
throw new ApplicationException("Achievments - Cannot set backend label, Managed already created");
}
if (backendLabel != null) if (backendLabel != null)
{ {
throw new ApplicationException("Multiple AchievmentBackends enabled, this is not allowed"); throw new ApplicationException("Multiple AchievmentBackends enabled, this is not allowed");

View File

@ -5,7 +5,7 @@ using UnityEngine;
namespace NEG.Utils.Achievments namespace NEG.Utils.Achievments
{ {
[CreateAssetMenu(menuName = "Achivments/BaseConfig")] [CreateAssetMenu(menuName = "Achievments/Config/BaseConfig")]
public class AchievmentManagerConfig : ScriptableObject, IAchivmentManagerConfig public class AchievmentManagerConfig : ScriptableObject, IAchivmentManagerConfig
{ {
[field: SerializeField] [field: SerializeField]

View File

@ -1,14 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace NEG.Utils.Achievments
{
using AchievmentTypes;
[CreateAssetMenu(menuName = "Achivments/Collection")]
public class AchivmentDefinitionCollection : ScriptableObject
{
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: ef37a873be859d042bda22dee624e429
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -8,14 +8,23 @@ using UnityEngine;
namespace NEG.Utils.Achievments namespace NEG.Utils.Achievments
{ {
[CreateAssetMenu(menuName = "Achievments/Config/Backend/Local")]
public class LoaclBackendConfig : ScriptableObject, IAchievmentBackendConfig public class LoaclBackendConfig : ScriptableObject, IAchievmentBackendConfig
{ {
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterAssembliesLoaded)]
private static void Init()
{
#if LOCAL_ACHIEVMENT_BACKEND
Achievments.BackendLabel = "LocalAchievments";
#endif
}
[SerializeField] [SerializeField]
private string saveLocation; private string saveLocation;
public IAchievmentBackend ConstructBackend() public IAchievmentBackend ConstructBackend()
{ {
return new LocalBackend(saveLocation);
} }
} }