summaryrefslogtreecommitdiff
path: root/Client/Assembly-CSharp/HatManager.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Client/Assembly-CSharp/HatManager.cs')
-rw-r--r--Client/Assembly-CSharp/HatManager.cs89
1 files changed, 89 insertions, 0 deletions
diff --git a/Client/Assembly-CSharp/HatManager.cs b/Client/Assembly-CSharp/HatManager.cs
new file mode 100644
index 0000000..4c57c44
--- /dev/null
+++ b/Client/Assembly-CSharp/HatManager.cs
@@ -0,0 +1,89 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using UnityEngine;
+
+public class HatManager : DestroyableSingleton<HatManager>
+{
+ public HatBehaviour NoneHat;
+
+ public List<PetBehaviour> AllPets = new List<PetBehaviour>();
+
+ public List<HatBehaviour> AllHats = new List<HatBehaviour>();
+
+ public List<SkinData> AllSkins = new List<SkinData>();
+
+ internal PetBehaviour GetPetById(uint petId)
+ {
+ if ((ulong)petId >= (ulong)((long)this.AllPets.Count))
+ {
+ return this.AllPets[0];
+ }
+ return this.AllPets[(int)petId];
+ }
+
+ public uint GetIdFromPet(PetBehaviour pet)
+ {
+ return (uint)this.AllPets.FindIndex((PetBehaviour p) => p.idleClip == pet.idleClip);
+ }
+
+ public PetBehaviour[] GetUnlockedPets()
+ {
+ return (from h in this.AllPets
+ where h.Free || SaveManager.GetPurchase(h.ProductId)
+ select h).ToArray<PetBehaviour>();
+ }
+
+ public HatBehaviour GetHatById(uint hatId)
+ {
+ if ((ulong)hatId >= (ulong)((long)this.AllHats.Count))
+ {
+ return this.NoneHat;
+ }
+ return this.AllHats[(int)hatId];
+ }
+
+ public HatBehaviour[] GetUnlockedHats()
+ {
+ return (from h in this.AllHats
+ where h.LimitedMonth == 0 || SaveManager.GetPurchase(h.ProductId)
+ select h into o
+ orderby o.Order descending, o.name
+ select o).ToArray<HatBehaviour>();
+ }
+
+ public uint GetIdFromHat(HatBehaviour hat)
+ {
+ return (uint)this.AllHats.IndexOf(hat);
+ }
+
+ public SkinData[] GetUnlockedSkins()
+ {
+ return (from o in this.AllSkins
+ orderby o.Order descending, o.name
+ select o).ToArray<SkinData>();
+ }
+
+ public uint GetIdFromSkin(SkinData skin)
+ {
+ return (uint)this.AllSkins.IndexOf(skin);
+ }
+
+ internal SkinData GetSkinById(uint skinId)
+ {
+ if ((ulong)skinId >= (ulong)((long)this.AllSkins.Count))
+ {
+ return this.AllSkins[0];
+ }
+ return this.AllSkins[(int)skinId];
+ }
+
+ internal void SetSkin(SpriteRenderer skinRend, uint skinId)
+ {
+ SkinData skinById = this.GetSkinById(skinId);
+ if (skinById)
+ {
+ skinRend.sprite = skinById.IdleFrame;
+ }
+ }
+}