IOSBarResizer.cs
764 Bytes
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
using System;
using UnityEngine;
using UnityEngine.UI;
public class IOSBarResizer : MonoBehaviour {
protected void Start ()
{
HorizontalLayoutGroup barBottomLayout = gameObject.GetComponent<HorizontalLayoutGroup>();
if (Screen.dpi < 140)
{
barBottomLayout.spacing = 42;
}
// 240
else if (Screen.dpi < 280)
{
barBottomLayout.spacing = 72;
}
// 320
else if (Screen.dpi < 400)
{
barBottomLayout.spacing = 108;
}
// 480
else if (Screen.dpi < 500)
{
barBottomLayout.spacing = 158;
}
else
{
barBottomLayout.spacing = 108;
}
}
public void _set_(InputField inf) {
gameObject.GetComponent<HorizontalLayoutGroup>().spacing = Convert.ToInt32(inf.text);
Debug.Log("sp: " + Convert.ToInt32(inf.text));
}
}