Add files via upload
This commit is contained in:
parent
7164a48df0
commit
a276679d6e
19 changed files with 2252 additions and 0 deletions
51
Achievements/AchievementCondition.cs
Normal file
51
Achievements/AchievementCondition.cs
Normal file
|
@ -0,0 +1,51 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Achievements.AchievementCondition
|
||||
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
|
||||
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
|
||||
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace Terraria.Achievements
|
||||
{
|
||||
[JsonObject]
|
||||
public abstract class AchievementCondition
|
||||
{
|
||||
public readonly string Name;
|
||||
protected IAchievementTracker _tracker;
|
||||
[JsonProperty("Completed")]
|
||||
private bool _isCompleted;
|
||||
|
||||
public event AchievementCondition.AchievementUpdate OnComplete;
|
||||
|
||||
public bool IsCompleted => this._isCompleted;
|
||||
|
||||
protected AchievementCondition(string name) => this.Name = name;
|
||||
|
||||
public virtual void Load(JObject state) => this._isCompleted = JToken.op_Explicit(state["Completed"]);
|
||||
|
||||
public virtual void Clear() => this._isCompleted = false;
|
||||
|
||||
public virtual void Complete()
|
||||
{
|
||||
if (this._isCompleted)
|
||||
return;
|
||||
this._isCompleted = true;
|
||||
if (this.OnComplete == null)
|
||||
return;
|
||||
this.OnComplete(this);
|
||||
}
|
||||
|
||||
protected virtual IAchievementTracker CreateAchievementTracker() => (IAchievementTracker) null;
|
||||
|
||||
public IAchievementTracker GetAchievementTracker()
|
||||
{
|
||||
if (this._tracker == null)
|
||||
this._tracker = this.CreateAchievementTracker();
|
||||
return this._tracker;
|
||||
}
|
||||
|
||||
public delegate void AchievementUpdate(AchievementCondition condition);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue