diff --git a/Achievments/AchievmentManager.cs b/Achievments/AchievmentManager.cs
index 7ae0dd2..38b46f0 100644
--- a/Achievments/AchievmentManager.cs
+++ b/Achievments/AchievmentManager.cs
@@ -176,9 +176,9 @@ namespace NEG.Utils.Achievments
///
///
/// throws an if there is no achievment under id or an if achievment under id is of a different type
- public void SetToggleAchivment(string id)
+ public bool SetToggleAchivment(string id)
{
- ManipulateAchievment(id, (achievment) => achievment.CompletionState = true);
+ return ManipulateAchievment(id, (achievment) => achievment.CompletionState = true);
}
///
@@ -198,9 +198,9 @@ namespace NEG.Utils.Achievments
///
///
/// throws an if there is no achievment under id or an if achievment under id is of a different type
- public void SetIntProgress(string id, int progress)
+ public bool SetIntProgress(string id, int progress)
{
- ManipulateAchievment(id, (achievment) => achievment.CurrentProgress = progress);
+ return ManipulateAchievment(id, (achievment) => achievment.CurrentProgress = progress);
}
///
@@ -208,9 +208,9 @@ namespace NEG.Utils.Achievments
///
///
/// throws an if there is no achievment under id or an if achievment under id is of a different type
- public void ChangeIntProgress(string id, int delta)
+ public bool ChangeIntProgress(string id, int delta)
{
- ManipulateAchievment(id, (achievment) => achievment.CurrentProgress += delta);
+ return ManipulateAchievment(id, (achievment) => achievment.CurrentProgress += delta);
}
///
@@ -230,9 +230,9 @@ namespace NEG.Utils.Achievments
///
///
/// throws an if there is no achievment under id or an if achievment under id is of a different type
- public void SetFloatProgress(string id, float progress)
+ public bool SetFloatProgress(string id, float progress)
{
- ManipulateAchievment(id, (achievment) => achievment.CurrentProgress = progress);
+ return ManipulateAchievment(id, (achievment) => achievment.CurrentProgress = progress);
}
///
@@ -240,9 +240,9 @@ namespace NEG.Utils.Achievments
///
///
/// throws an if there is no achievment under id or an if achievment under id is of a different type
- public void ChangeFloatProgress(string id, float delta)
+ public bool ChangeFloatProgress(string id, float delta)
{
- ManipulateAchievment(id, (achievment) => achievment.CurrentProgress += delta);
+ return ManipulateAchievment(id, (achievment) => achievment.CurrentProgress += delta);
}
///
@@ -290,7 +290,7 @@ namespace NEG.Utils.Achievments
{
if (data is not T convetred)
{
- throw new AchievmentTypeException($"Attempting to perform an operation on an invalid achievment type. Expected {typeof(T)} got {data.GetType()}", data.Achivment.Id, typeof(T), data.GetType());
+ throw new AchievmentTypeException($"Attempting to perform an operation on an invalid achievment type. Expected {typeof(T)} got {data.GetType()}", data.Achievment.Id, typeof(T), data.GetType());
}
return convetred;
}
@@ -301,18 +301,20 @@ namespace NEG.Utils.Achievments
///
///
/// Action to perform on the achievment
- private void ManipulateAchievment(string id, Action manipulation) where T : AchievmentData
+ private bool ManipulateAchievment(string id, Action manipulation) where T : AchievmentData
{
var data = GetAchievmentForId(id);
if (CheckNotCompleted(data))
{
- return;
+ return true;
}
manipulation(data);
SendUpdateCallbacks(data);
+
+ return data.IsCompleted;
}
///
@@ -324,7 +326,7 @@ namespace NEG.Utils.Achievments
{
if (data.IsCompleted)
{
- Debug.LogWarning($"Achievment already completed: {data.Achivment.Id}");
+ Debug.LogWarning($"Achievment already completed: {data.Achievment.Id}");
}
return data.IsCompleted;
}
diff --git a/Achievments/AchivmentManagerConfig.cs b/Achievments/AchievmentManagerConfig.cs
similarity index 88%
rename from Achievments/AchivmentManagerConfig.cs
rename to Achievments/AchievmentManagerConfig.cs
index 4815d84..b6584f4 100644
--- a/Achievments/AchivmentManagerConfig.cs
+++ b/Achievments/AchievmentManagerConfig.cs
@@ -5,7 +5,7 @@ using UnityEngine;
namespace NEG.Utils.Achievments
{
[CreateAssetMenu(menuName = "Achivments/BaseConfig")]
- public class AchivmentManagerConfig : ScriptableObject, IAchivmentManagerConfig
+ public class AchievmentManagerConfig : ScriptableObject, IAchivmentManagerConfig
{
public const string DefaultAchivmentsCollectionLabel = "Achivments";
diff --git a/Achievments/AchivmentManagerConfig.cs.meta b/Achievments/AchievmentManagerConfig.cs.meta
similarity index 100%
rename from Achievments/AchivmentManagerConfig.cs.meta
rename to Achievments/AchievmentManagerConfig.cs.meta
diff --git a/Achievments/AchievmentTypes/AchievmentData.cs b/Achievments/AchievmentTypes/AchievmentData.cs
index 86a154d..9407979 100644
--- a/Achievments/AchievmentTypes/AchievmentData.cs
+++ b/Achievments/AchievmentTypes/AchievmentData.cs
@@ -9,13 +9,13 @@ namespace NEG.Utils.Achievments.AchievmentTypes
{
public abstract class AchievmentData
{
- public AchievmentDefinition Achivment { get; private set; }
+ public AchievmentDefinition Achievment { get; private set; }
public abstract bool IsCompleted { get; }
public AchievmentData(AchievmentDefinition achivment)
{
- Achivment = achivment;
+ Achievment = achivment;
}
}
}
\ No newline at end of file
diff --git a/Achievments/AchievmentTypes/FloatAchievmentData.cs b/Achievments/AchievmentTypes/FloatAchievmentData.cs
index 27a43ed..9b76dbe 100644
--- a/Achievments/AchievmentTypes/FloatAchievmentData.cs
+++ b/Achievments/AchievmentTypes/FloatAchievmentData.cs
@@ -23,7 +23,7 @@ namespace NEG.Utils.Achievments.AchievmentTypes
public float ProgressLeft => Def.ProgressRequired - CurrentProgress;
- private FloatAchievmentDefinition Def => (FloatAchievmentDefinition)Achivment;
+ private FloatAchievmentDefinition Def => (FloatAchievmentDefinition)Achievment;
private float currentProgress;
diff --git a/Achievments/AchievmentTypes/IntAchievmentData.cs b/Achievments/AchievmentTypes/IntAchievmentData.cs
index 94e900a..e9e13f5 100644
--- a/Achievments/AchievmentTypes/IntAchievmentData.cs
+++ b/Achievments/AchievmentTypes/IntAchievmentData.cs
@@ -24,7 +24,7 @@ namespace NEG.Utils.Achievments.AchievmentTypes
public int ProgressLeft => Def.ProgressRequired - CurrentProgress;
- private IntAchievmentDefinition Def => (IntAchievmentDefinition)Achivment;
+ private IntAchievmentDefinition Def => (IntAchievmentDefinition)Achievment;
private int currentProgress;
diff --git a/Achievments/Achievments.cs b/Achievments/Achievments.cs
new file mode 100644
index 0000000..fcaa854
--- /dev/null
+++ b/Achievments/Achievments.cs
@@ -0,0 +1,22 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+namespace NEG.Utils.Achievments
+{
+ public static class Achievments
+ {
+ public static AchievmentManager Instance
+ {
+ get
+ {
+ if (instance == null)
+ {
+ instance =
+ }
+ }
+ }
+ private static AchievmentManager instance;
+
+ }
+}
\ No newline at end of file
diff --git a/Achievments/Achievments.cs.meta b/Achievments/Achievments.cs.meta
new file mode 100644
index 0000000..d293cde
--- /dev/null
+++ b/Achievments/Achievments.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 696bafd4c06b0a8458f008103441ea7f
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Achievments/TODO.txt b/Achievments/TODO.txt
new file mode 100644
index 0000000..bf02039
--- /dev/null
+++ b/Achievments/TODO.txt
@@ -0,0 +1,5 @@
+Static Achievments class
+Implement Storage again
+Fix typos
+Merge AchievmentCollection with AchievmentManagerConfig
+Static backend constructors
\ No newline at end of file
diff --git a/Achievments/TODO.txt.meta b/Achievments/TODO.txt.meta
new file mode 100644
index 0000000..df317ce
--- /dev/null
+++ b/Achievments/TODO.txt.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 94e4aa3c6dc078c4db6a47949655f8a5
+TextScriptImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Achievments/Tests/ConfigTests.cs b/Achievments/Tests/ConfigTests.cs
index 832b657..9a995f2 100644
--- a/Achievments/Tests/ConfigTests.cs
+++ b/Achievments/Tests/ConfigTests.cs
@@ -325,7 +325,7 @@ namespace NEG.Utils.Achievments.Tests
public void AchievmentCompleted(AchievmentData achievment)
{
LastTypeSet = achievment.GetType();
- LastIdSet = achievment.Achivment.Id;
+ LastIdSet = achievment.Achievment.Id;
}
public void AchievmentStateChanged(AchievmentData achievment)