blob: 4c57c44b2f7fbd10b66eefb340173b1421773076 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
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;
}
}
}
|