Tanoda
pb_GridLayoutGroup.cs
Go to the documentation of this file.
1
using
UnityEngine
;
2
using
UnityEngine
.
UI
;
3
using
System.Collections;
4
5
namespace
GILES.Interface
6
{
10
public
class
pb_GridLayoutGroup
: GridLayoutGroup,
pb_IOnResizeHandler
11
{
12
#if UNITY_WEBGL
13
private
Vector2 elementSize =
new
Vector2(93f, 93f);
14
#else
15
private
Vector2 elementSize =
new
Vector2(233f, 74f);
16
#endif
17
18
public
bool
maintainAspectRatio
=
true
;
19
20
protected
override
void
Start
()
21
{
22
base.Start();
23
24
OnResize
();
25
}
26
27
public
void
OnResize
()
28
{
29
float
width = (rectTransform.rect.width - spacing.x);
30
float
grid = elementSize.x + spacing.x;
31
32
if
(width <= grid)
33
return
;
34
35
Vector2 cell = Vector2.zero;
36
37
cell.x = elementSize.x + (width % grid) / (
float
)(((int)width) / ((int)grid));
38
39
if
(
maintainAspectRatio
)
40
cell.y = elementSize.y * (cell.x / elementSize.x);
41
42
cellSize = cell;
43
}
44
}
45
}
GILES.Interface.pb_GridLayoutGroup
Definition:
pb_GridLayoutGroup.cs:11
GILES.Interface.pb_GridLayoutGroup.Start
override void Start()
Definition:
pb_GridLayoutGroup.cs:20
GILES.Interface.pb_GridLayoutGroup.maintainAspectRatio
bool maintainAspectRatio
Definition:
pb_GridLayoutGroup.cs:18
GILES.Interface.pb_GridLayoutGroup.OnResize
void OnResize()
Definition:
pb_GridLayoutGroup.cs:27
GILES.Interface.pb_IOnResizeHandler
Definition:
pb_IOnResizeHandler.cs:9
GILES.Interface
Definition:
pb_AutoStageItemEditor.cs:9
UnityEngine.UI
Definition:
HSVPicker/UtilityScripts/BoxSlider.cs:7
UnityEngine
Definition:
HSVPicker/UtilityScripts/BoxSlider.cs:7
Source
Assets
GILES
Code
Classes
GUI
pb_GridLayoutGroup.cs
Generated by
1.9.3