-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathBadge.cs
70 lines (56 loc) · 1.53 KB
/
Badge.cs
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 Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ScreepsAPI_NET
{
public class Badge
{
/// <summary>
/// The type number of the badge
/// </summary>
public int Type { get; set; }
/// <summary>
/// The first color of the badge
/// </summary>
public int Color1 { get; set; }
/// <summary>
/// The second color of the badge
/// </summary>
public int Color2 { get; set; }
/// <summary>
/// The thrid color of the badge
/// </summary>
public int Color3 { get; set; }
/// <summary>
/// ??????
/// </summary>
public int Param { get; set; }
/// <summary>
/// Is the badge flipped
/// </summary>
public bool Flip { get; set; }
public Badge()
{
}
public static Badge Parse(JObject obj)
{
try
{
Badge badge = new Badge();
badge.Type = obj.GetValue<int>("type");
badge.Color1 = obj.GetValue<int>("color1");
badge.Color2 = obj.GetValue<int>("color2");
badge.Color3 = obj.GetValue<int>("color3");
badge.Param = obj.GetValue<int>("param");
badge.Flip = obj.GetValue<bool>("flip");
return badge;
}
catch
{
}
return null;
}
}
}