-
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathUISpriteData.cs
84 lines (64 loc) · 1.54 KB
/
UISpriteData.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
using System;
[Serializable]
public class UISpriteData
{
public string name = "Sprite";
public int x;
public int y;
public int width;
public int height;
public int borderLeft;
public int borderRight;
public int borderTop;
public int borderBottom;
public int paddingLeft;
public int paddingRight;
public int paddingTop;
public int paddingBottom;
public bool hasBorder => (borderLeft | borderRight | borderTop | borderBottom) != 0;
public bool hasPadding => (paddingLeft | paddingRight | paddingTop | paddingBottom) != 0;
public void SetRect(int x, int y, int width, int height)
{
this.x = x;
this.y = y;
this.width = width;
this.height = height;
}
public void SetPadding(int left, int bottom, int right, int top)
{
paddingLeft = left;
paddingBottom = bottom;
paddingRight = right;
paddingTop = top;
}
public void SetBorder(int left, int bottom, int right, int top)
{
borderLeft = left;
borderBottom = bottom;
borderRight = right;
borderTop = top;
}
public void CopyFrom(UISpriteData sd)
{
name = sd.name;
x = sd.x;
y = sd.y;
width = sd.width;
height = sd.height;
borderLeft = sd.borderLeft;
borderRight = sd.borderRight;
borderTop = sd.borderTop;
borderBottom = sd.borderBottom;
paddingLeft = sd.paddingLeft;
paddingRight = sd.paddingRight;
paddingTop = sd.paddingTop;
paddingBottom = sd.paddingBottom;
}
public void CopyBorderFrom(UISpriteData sd)
{
borderLeft = sd.borderLeft;
borderRight = sd.borderRight;
borderTop = sd.borderTop;
borderBottom = sd.borderBottom;
}
}