Terraria 1.4.0.5 Source Code
This commit is contained in:
commit
05205f009e
1059 changed files with 563450 additions and 0 deletions
69
GameContent/Achievements/ProgressionEventCondition.cs
Normal file
69
GameContent/Achievements/ProgressionEventCondition.cs
Normal file
|
@ -0,0 +1,69 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.GameContent.Achievements.ProgressionEventCondition
|
||||
// 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 System.Collections.Generic;
|
||||
using Terraria.Achievements;
|
||||
|
||||
namespace Terraria.GameContent.Achievements
|
||||
{
|
||||
public class ProgressionEventCondition : AchievementCondition
|
||||
{
|
||||
private const string Identifier = "PROGRESSION_EVENT";
|
||||
private static Dictionary<int, List<ProgressionEventCondition>> _listeners = new Dictionary<int, List<ProgressionEventCondition>>();
|
||||
private static bool _isListenerHooked;
|
||||
private int[] _eventIDs;
|
||||
|
||||
private ProgressionEventCondition(int eventID)
|
||||
: base("PROGRESSION_EVENT_" + (object) eventID)
|
||||
{
|
||||
this._eventIDs = new int[1]{ eventID };
|
||||
ProgressionEventCondition.ListenForPickup(this);
|
||||
}
|
||||
|
||||
private ProgressionEventCondition(int[] eventIDs)
|
||||
: base("PROGRESSION_EVENT_" + (object) eventIDs[0])
|
||||
{
|
||||
this._eventIDs = eventIDs;
|
||||
ProgressionEventCondition.ListenForPickup(this);
|
||||
}
|
||||
|
||||
private static void ListenForPickup(ProgressionEventCondition condition)
|
||||
{
|
||||
if (!ProgressionEventCondition._isListenerHooked)
|
||||
{
|
||||
AchievementsHelper.OnProgressionEvent += new AchievementsHelper.ProgressionEventEvent(ProgressionEventCondition.ProgressionEventListener);
|
||||
ProgressionEventCondition._isListenerHooked = true;
|
||||
}
|
||||
for (int index = 0; index < condition._eventIDs.Length; ++index)
|
||||
{
|
||||
if (!ProgressionEventCondition._listeners.ContainsKey(condition._eventIDs[index]))
|
||||
ProgressionEventCondition._listeners[condition._eventIDs[index]] = new List<ProgressionEventCondition>();
|
||||
ProgressionEventCondition._listeners[condition._eventIDs[index]].Add(condition);
|
||||
}
|
||||
}
|
||||
|
||||
private static void ProgressionEventListener(int eventID)
|
||||
{
|
||||
if (!ProgressionEventCondition._listeners.ContainsKey(eventID))
|
||||
return;
|
||||
foreach (AchievementCondition achievementCondition in ProgressionEventCondition._listeners[eventID])
|
||||
achievementCondition.Complete();
|
||||
}
|
||||
|
||||
public static ProgressionEventCondition Create(params int[] eventIDs) => new ProgressionEventCondition(eventIDs);
|
||||
|
||||
public static ProgressionEventCondition Create(int eventID) => new ProgressionEventCondition(eventID);
|
||||
|
||||
public static ProgressionEventCondition[] CreateMany(
|
||||
params int[] eventIDs)
|
||||
{
|
||||
ProgressionEventCondition[] progressionEventConditionArray = new ProgressionEventCondition[eventIDs.Length];
|
||||
for (int index = 0; index < eventIDs.Length; ++index)
|
||||
progressionEventConditionArray[index] = new ProgressionEventCondition(eventIDs[index]);
|
||||
return progressionEventConditionArray;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue