UIManagerTextEntry.cs
1.54 KB
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
using UnityEngine;
using UnityEngine.UI;
public class UIManagerTextEntry : UIManager {
public Button back;
public GameObject label;
public GameObject textEntry;
public Button translate;
protected override void rebuild(float scale)
{
// back
{
float dist = 132 * scale * 0.75F;
back.transform.localScale = new Vector3(scale, scale, 1);
back.transform.position = new Vector3(dist, Screen.height - dist);
}
float labelHeight = 187.5F * scale;
float labelDist = labelHeight * 0.75F;
// label
{
label.transform.localScale = new Vector3(scale, scale, 1);
label.transform.position = new Vector3(Screen.width / 2, Screen.height - labelDist, 0);
}
float translateHeight = 152 * scale;
// translate
{
translate.transform.localScale = new Vector3(scale, scale, 1);
translate.transform.localPosition = new Vector3(translate.transform.localPosition.x, - translateHeight, 0);
}
// textEntry
{
float labelBottom = labelDist + labelHeight - (33 * scale);
float margin = 80 * scale;
float barTop = 165 * scale;
float marginTop = labelBottom + margin;
float marginBottom = barTop + translateHeight + (translateHeight / 2) + margin;
float height = Screen.height - marginTop - marginBottom;
Vector2 size = textEntry.GetComponent<RectTransform>().sizeDelta;
textEntry.transform.position = new Vector3(textEntry.transform.position.x, Screen.height - marginTop - (height / 2), 0);
size.y = Screen.height - marginTop - marginBottom;
textEntry.GetComponent<RectTransform>().sizeDelta = size;
}
}
}