-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIDyePlayer.cs
More file actions
70 lines (64 loc) · 2.59 KB
/
IDyePlayer.cs
File metadata and controls
70 lines (64 loc) · 2.59 KB
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
using System.Collections.Generic;
using Terraria;
using Terraria.ModLoader;
using System.Linq;
using Terraria.ModLoader.IO;
using Terraria.ID;
namespace IDye
{
public class IDyePlayer : ModPlayer
{
// experimental; none of this is final
public Microsoft.Xna.Framework.Color[] iDyePrimaryColors;
public Microsoft.Xna.Framework.Color[] iDyeSecondaryColors;
public float[] iDyeSaturation;
public string[] iDyePasses;
public bool[] iDyeUseImage;
public int[] iDyeItemID;
public override void Initialize()
{
iDyePrimaryColors = new Microsoft.Xna.Framework.Color[32];
iDyeSecondaryColors = new Microsoft.Xna.Framework.Color[32];
iDyeSaturation = new float[32];
iDyePasses = new string[32];
iDyeUseImage = new bool[32];
iDyeItemID = new int[32];
for (int i = 0; i < 32; i++)
{
iDyePrimaryColors[i] = new Microsoft.Xna.Framework.Color(0f, 0f, 0f);
iDyeSecondaryColors[i] = new Microsoft.Xna.Framework.Color(0f, 0f, 0f);
iDyeSaturation[i] = 0f;
iDyePasses[i] = "ArmorColored";
iDyeUseImage[i] = false;
iDyeItemID[i] = ItemID.RedDye;
}
}
public override void SaveData(TagCompound tag)
{
tag["IDyePrimaryColors"] = iDyePrimaryColors;
tag["IDyeSecondaryColors"] = iDyeSecondaryColors;
tag["IDyeSaturation"] = iDyeSaturation.ToList();
tag["IDyePasses"] = iDyePasses.ToList();
tag["IDyeUseImage"] = iDyeUseImage.ToList();
tag["IDyeItemID"] = iDyeItemID.ToList();
}
public override void LoadData(TagCompound tag)
{
iDyePrimaryColors = tag.Get<Microsoft.Xna.Framework.Color[]>("IDyePrimaryColors");
iDyeSecondaryColors = tag.Get<Microsoft.Xna.Framework.Color[]>("IDyeSecondaryColors");
iDyeSaturation = tag.Get<List<float>>("IDyeSaturation").ToArray();
iDyePasses = tag.Get<List<string>>("IDyePasses").ToArray();
iDyeUseImage = tag.Get<List<bool>>("IDyeUseImage").ToArray();
iDyeItemID = tag.Get<List<int>>("IDyeItemID").ToArray();
}
public override void Unload()
{
iDyePrimaryColors = null;
iDyeSecondaryColors = null;
iDyeSaturation = null;
iDyePasses = null;
iDyeUseImage = null;
iDyeItemID = null;
}
}
}