BarResizer.cs
970 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
46
47
48
49
50
51
52
53
using System;
using UnityEngine;
using UnityEngine.UI;
public class BarResizer : MonoBehaviour {
public HorizontalLayoutGroup barBottomLayout;
public GameObject microButton;
protected void Start ()
{
#if UNITY_IOS
this.microButton.SetActive(false);
if (Screen.width < 400)
this.barBottomLayout.spacing = 8;
// 240
else if (Screen.width < 500)
this.barBottomLayout.spacing = 106;
// 320
else if (Screen.width < 620)
this.barBottomLayout.spacing = 132;
// 480
else if (Screen.width < 840)
this.barBottomLayout.spacing = 180;
else
this.barBottomLayout.spacing = 210;
#else
if (Screen.dpi < 140)
this.barBottomLayout.spacing = 48;
// 240
else if (Screen.dpi < 280)
this.barBottomLayout.spacing = 74;
// 320
else if (Screen.dpi < 400)
this.barBottomLayout.spacing = 108;
// 480
else if (Screen.dpi < 500)
this.barBottomLayout.spacing = 158;
else
this.barBottomLayout.spacing = 108;
#endif
}
}