more typo fixes
This commit is contained in:
parent
bf79b07ea4
commit
36840271af
@ -176,9 +176,9 @@ namespace NEG.Utils.Achievments
|
||||
/// </summary>
|
||||
/// <seealso cref="ToggleAchievmentDefinition"/>
|
||||
/// <remarks>throws an <see cref="AchievmentException"/> if there is no achievment under id or an <see cref="AchievmentTypeException"/> if achievment under id is of a different type</remarks>
|
||||
public void SetToggleAchivment(string id)
|
||||
public bool SetToggleAchivment(string id)
|
||||
{
|
||||
ManipulateAchievment<ToggleAchievmentData>(id, (achievment) => achievment.CompletionState = true);
|
||||
return ManipulateAchievment<ToggleAchievmentData>(id, (achievment) => achievment.CompletionState = true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -198,9 +198,9 @@ namespace NEG.Utils.Achievments
|
||||
/// </summary>
|
||||
/// <seealso cref="IntAchievmentDefinition"/>
|
||||
/// <remarks>throws an <see cref="AchievmentException"/> if there is no achievment under id or an <see cref="AchievmentTypeException"/> if achievment under id is of a different type</remarks>
|
||||
public void SetIntProgress(string id, int progress)
|
||||
public bool SetIntProgress(string id, int progress)
|
||||
{
|
||||
ManipulateAchievment<IntAchievmentData>(id, (achievment) => achievment.CurrentProgress = progress);
|
||||
return ManipulateAchievment<IntAchievmentData>(id, (achievment) => achievment.CurrentProgress = progress);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -208,9 +208,9 @@ namespace NEG.Utils.Achievments
|
||||
/// </summary>
|
||||
/// <seealso cref="IntAchievmentDefinition"/>
|
||||
/// <remarks>throws an <see cref="AchievmentException"/> if there is no achievment under id or an <see cref="AchievmentTypeException"/> if achievment under id is of a different type</remarks>
|
||||
public void ChangeIntProgress(string id, int delta)
|
||||
public bool ChangeIntProgress(string id, int delta)
|
||||
{
|
||||
ManipulateAchievment<IntAchievmentData>(id, (achievment) => achievment.CurrentProgress += delta);
|
||||
return ManipulateAchievment<IntAchievmentData>(id, (achievment) => achievment.CurrentProgress += delta);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -230,9 +230,9 @@ namespace NEG.Utils.Achievments
|
||||
/// </summary>
|
||||
/// <seealso cref="FloatAchievmentDefinition"/>
|
||||
/// <remarks>throws an <see cref="AchievmentException"/> if there is no achievment under id or an <see cref="AchievmentTypeException"/> if achievment under id is of a different type</remarks>
|
||||
public void SetFloatProgress(string id, float progress)
|
||||
public bool SetFloatProgress(string id, float progress)
|
||||
{
|
||||
ManipulateAchievment<FloatAchievmentData>(id, (achievment) => achievment.CurrentProgress = progress);
|
||||
return ManipulateAchievment<FloatAchievmentData>(id, (achievment) => achievment.CurrentProgress = progress);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -240,9 +240,9 @@ namespace NEG.Utils.Achievments
|
||||
/// </summary>
|
||||
/// <seealso cref="FloatAchievmentDefinition"/>
|
||||
/// <remarks>throws an <see cref="AchievmentException"/> if there is no achievment under id or an <see cref="AchievmentTypeException"/> if achievment under id is of a different type</remarks>
|
||||
public void ChangeFloatProgress(string id, float delta)
|
||||
public bool ChangeFloatProgress(string id, float delta)
|
||||
{
|
||||
ManipulateAchievment<FloatAchievmentData>(id, (achievment) => achievment.CurrentProgress += delta);
|
||||
return ManipulateAchievment<FloatAchievmentData>(id, (achievment) => achievment.CurrentProgress += delta);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -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
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="manipulation">Action to perform on the achievment</param>
|
||||
private void ManipulateAchievment<T>(string id, Action<T> manipulation) where T : AchievmentData
|
||||
private bool ManipulateAchievment<T>(string id, Action<T> manipulation) where T : AchievmentData
|
||||
{
|
||||
var data = GetAchievmentForId<T>(id);
|
||||
|
||||
if (CheckNotCompleted(data))
|
||||
{
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
manipulation(data);
|
||||
|
||||
SendUpdateCallbacks(data);
|
||||
|
||||
return data.IsCompleted;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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";
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
22
Achievments/Achievments.cs
Normal file
22
Achievments/Achievments.cs
Normal file
@ -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;
|
||||
|
||||
}
|
||||
}
|
||||
11
Achievments/Achievments.cs.meta
Normal file
11
Achievments/Achievments.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 696bafd4c06b0a8458f008103441ea7f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
5
Achievments/TODO.txt
Normal file
5
Achievments/TODO.txt
Normal file
@ -0,0 +1,5 @@
|
||||
Static Achievments class
|
||||
Implement Storage again
|
||||
Fix typos
|
||||
Merge AchievmentCollection with AchievmentManagerConfig
|
||||
Static backend constructors
|
||||
7
Achievments/TODO.txt.meta
Normal file
7
Achievments/TODO.txt.meta
Normal file
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 94e4aa3c6dc078c4db6a47949655f8a5
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -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)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user