Nextrek
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
//----------------------------------------------
// NGUI: Next-Gen UI kit
// Copyright © 2011-2013 Tasharen Entertainment
//----------------------------------------------
using UnityEngine;
using System.Collections.Generic;
using System;
[System.Serializable]
public class UISpriteData
{
public string name = "Sprite";
public int x = 0;
public int y = 0;
public int width = 0;
public int height = 0;
public int borderLeft = 0;
public int borderRight = 0;
public int borderTop = 0;
public int borderBottom = 0;
public int paddingLeft = 0;
public int paddingRight = 0;
public int paddingTop = 0;
public int paddingBottom = 0;
//bool rotated = false;
/// <summary>
/// Whether the sprite has a border.
/// </summary>
public bool hasBorder { get { return (borderLeft | borderRight | borderTop | borderBottom) != 0; } }
/// <summary>
/// Whether the sprite has been offset via padding.
/// </summary>
public bool hasPadding { get { return (paddingLeft | paddingRight | paddingTop | paddingBottom) != 0; } }
/// <summary>
/// Convenience function -- set the X, Y, width, and height.
/// </summary>
public void SetRect (int x, int y, int width, int height)
{
this.x = x;
this.y = y;
this.width = width;
this.height = height;
}
/// <summary>
/// Convenience function -- set the sprite's padding.
/// </summary>
public void SetPadding (int left, int bottom, int right, int top)
{
paddingLeft = left;
paddingBottom = bottom;
paddingRight = right;
paddingTop = top;
}
/// <summary>
/// Convenience function -- set the sprite's border.
/// </summary>
public void SetBorder (int left, int bottom, int right, int top)
{
borderLeft = left;
borderBottom = bottom;
borderRight = right;
borderTop = top;
}
/// <summary>
/// Copy all values of the specified sprite data.
/// </summary>
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;
}
/// <summary>
/// Copy the border information from the specified sprite.
/// </summary>
public void CopyBorderFrom (UISpriteData sd)
{
borderLeft = sd.borderLeft;
borderRight = sd.borderRight;
borderTop = sd.borderTop;
borderBottom = sd.borderBottom;
}
}
|
Revision |
Author |
Commited |
Message |
83
|
FMMortaroli
|
Tue 13 May, 2014 11:32:51 +0000 |
|