Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
AchievementTracker.cs
Go to the documentation of this file.
2
4
5public abstract class AchievementTracker<T> : IAchievementTracker
6{
7 protected T _value;
8
9 protected T _maxValue;
10
11 protected string _name;
12
14
15 public T Value => _value;
16
17 public T MaxValue => _maxValue;
18
20 {
21 _type = type;
22 }
23
24 void IAchievementTracker.ReportAs(string name)
25 {
26 _name = name;
27 }
28
33
35 {
36 SetValue(default(T));
37 }
38
39 public void SetValue(T newValue, bool reportUpdate = true)
40 {
41 if (newValue.Equals(_value))
42 {
43 return;
44 }
45 _value = newValue;
46 if (reportUpdate)
47 {
49 if (_value.Equals(_maxValue))
50 {
51 OnComplete();
52 }
53 }
54 }
55
56 public abstract void ReportUpdate();
57
58 protected abstract void Load();
59
61 {
62 Load();
63 }
64
65 protected void OnComplete()
66 {
67 if (SocialAPI.Achievements != null)
68 {
69 SocialAPI.Achievements.StoreStats();
70 }
71 }
72}
void SetValue(T newValue, bool reportUpdate=true)
static Terraria.Social.Base.AchievementsSocialModule Achievements
Definition SocialAPI.cs:16