Commit 61f18b624c755b1425ec586b7e8064c7df4030d8
1 parent
26bfb6b8
Exists in
master
and in
9 other branches
Correção do loading
Showing
7 changed files
with
84 additions
and
36 deletions
Show diff stats
Assets/Scripts/UIManager.cs
... | ... | @@ -3,10 +3,10 @@ using UnityEngine.UI; |
3 | 3 | |
4 | 4 | public abstract class UIManager : MonoBehaviour { |
5 | 5 | |
6 | - protected float scale = 1F; | |
7 | - | |
8 | 6 | public virtual void Start () |
9 | 7 | { |
8 | + float scale; | |
9 | + | |
10 | 10 | if (Screen.dpi < 140) |
11 | 11 | scale = 0.22F; |
12 | 12 | |
... | ... | @@ -25,9 +25,9 @@ public abstract class UIManager : MonoBehaviour { |
25 | 25 | else |
26 | 26 | scale = 1F; |
27 | 27 | |
28 | - rebuild(); | |
28 | + rebuild(scale); | |
29 | 29 | } |
30 | 30 | |
31 | - protected abstract void rebuild(); | |
31 | + protected abstract void rebuild(float scale); | |
32 | 32 | |
33 | 33 | } | ... | ... |
Assets/Scripts/UIManagerInfo.cs
... | ... | @@ -10,44 +10,44 @@ public class UIManagerInfo : UIManager { |
10 | 10 | public Button tutorial; |
11 | 11 | public Image info; |
12 | 12 | |
13 | - protected override void rebuild() | |
13 | + protected override void rebuild(float scale) | |
14 | 14 | { |
15 | 15 | // bar |
16 | 16 | { |
17 | - bar.transform.localScale = new Vector3(base.scale, base.scale, 1); | |
18 | - bar.transform.position -= new Vector3(0, 165 * (1F - base.scale), 0); | |
17 | + bar.transform.localScale = new Vector3(scale, scale, 1); | |
18 | + bar.transform.position -= new Vector3(0, 165 * (1F - scale), 0); | |
19 | 19 | } |
20 | 20 | |
21 | 21 | // logo |
22 | 22 | { |
23 | - logo.transform.localScale = new Vector3(base.scale, base.scale, 1); | |
24 | - logo.transform.position -= new Vector3(0, -160 * (1F - base.scale), 0); | |
23 | + logo.transform.localScale = new Vector3(scale, scale, 1); | |
24 | + logo.transform.position -= new Vector3(0, -160 * (1F - scale), 0); | |
25 | 25 | } |
26 | 26 | |
27 | 27 | // back |
28 | 28 | { |
29 | - float dist = 100 * (1F - base.scale); | |
29 | + float dist = 100 * (1F - scale); | |
30 | 30 | |
31 | - back.transform.localScale = new Vector3(base.scale, base.scale, 1); | |
31 | + back.transform.localScale = new Vector3(scale, scale, 1); | |
32 | 32 | back.transform.position -= new Vector3(dist, -dist, 0); |
33 | 33 | } |
34 | 34 | |
35 | 35 | |
36 | 36 | { |
37 | - facebook.transform.localScale = new Vector3(base.scale, base.scale, 1); | |
38 | - facebook.transform.position -= new Vector3(0, 500 * (1F - base.scale), 0); | |
37 | + facebook.transform.localScale = new Vector3(scale, scale, 1); | |
38 | + facebook.transform.position -= new Vector3(0, 500 * (1F - scale), 0); | |
39 | 39 | } |
40 | 40 | |
41 | 41 | // tutorial |
42 | 42 | { |
43 | - tutorial.transform.localScale = new Vector3(base.scale, base.scale, 1); | |
44 | - tutorial.transform.position -= new Vector3(0, 900 * (1F - base.scale), 0); | |
43 | + tutorial.transform.localScale = new Vector3(scale, scale, 1); | |
44 | + tutorial.transform.position -= new Vector3(0, 900 * (1F - scale), 0); | |
45 | 45 | } |
46 | 46 | |
47 | 47 | // info |
48 | 48 | { |
49 | - info.transform.localScale = new Vector3(base.scale, base.scale, 1); | |
50 | - //info.transform.position -= new Vector3(0, 540 * (1F - base.scale), 0); | |
49 | + info.transform.localScale = new Vector3(scale, scale, 1); | |
50 | + //info.transform.position -= new Vector3(0, 540 * (1F - scale), 0); | |
51 | 51 | } |
52 | 52 | } |
53 | 53 | ... | ... |
... | ... | @@ -0,0 +1,36 @@ |
1 | +using UnityEngine; | |
2 | +using UnityEngine.UI; | |
3 | + | |
4 | +public class UIManagerLoading : UIManager { | |
5 | + | |
6 | + public Text text; | |
7 | + public Image image; | |
8 | + | |
9 | + protected override void rebuild(float scale) | |
10 | + { | |
11 | + float textHeight = Screen.height / 2; | |
12 | + | |
13 | + // text | |
14 | + { | |
15 | + text.fontSize = (int)( text.fontSize * scale ); | |
16 | + | |
17 | + Vector2 textSize = text.GetComponent<RectTransform>().sizeDelta; | |
18 | + textSize.y = textHeight; | |
19 | + text.GetComponent<RectTransform>().sizeDelta = textSize; | |
20 | + | |
21 | + Vector3 textPosition = text.transform.position; | |
22 | + textPosition.y = (3 * Screen.height) / 4; | |
23 | + text.transform.position = textPosition; | |
24 | + } | |
25 | + | |
26 | + // image | |
27 | + { | |
28 | + image.transform.localScale = new Vector3(scale, scale, 1); | |
29 | + | |
30 | + Vector3 imagePosition = image.transform.position; | |
31 | + imagePosition.y = textHeight - (90 * scale); | |
32 | + image.transform.position = imagePosition; | |
33 | + } | |
34 | + } | |
35 | + | |
36 | +} | ... | ... |
... | ... | @@ -0,0 +1,12 @@ |
1 | +fileFormatVersion: 2 | |
2 | +guid: 823c98ddc010736408f7ed99ec13991e | |
3 | +timeCreated: 1443546340 | |
4 | +licenseType: Pro | |
5 | +MonoImporter: | |
6 | + serializedVersion: 2 | |
7 | + defaultReferences: [] | |
8 | + executionOrder: 0 | |
9 | + icon: {instanceID: 0} | |
10 | + userData: | |
11 | + assetBundleName: | |
12 | + assetBundleVariant: | ... | ... |
Assets/Scripts/UIManagerMain.cs
... | ... | @@ -7,11 +7,11 @@ public class UIManagerMain : UIManager { |
7 | 7 | public GameObject container; |
8 | 8 | public Text text; |
9 | 9 | |
10 | - protected override void rebuild() | |
10 | + protected override void rebuild(float scale) | |
11 | 11 | { |
12 | - container.transform.localScale = new Vector3(base.scale, 1, 1); | |
13 | - bar.transform.localScale = new Vector3(1, base.scale, 1); | |
14 | - bar.transform.position -= new Vector3(0, 165 * (1F - base.scale), 0); | |
12 | + container.transform.localScale = new Vector3(scale, 1, 1); | |
13 | + bar.transform.localScale = new Vector3(1, scale, 1); | |
14 | + bar.transform.position -= new Vector3(0, 165 * (1F - scale), 0); | |
15 | 15 | } |
16 | 16 | |
17 | 17 | } | ... | ... |
Assets/Scripts/UIManagerTextEntry.cs
... | ... | @@ -8,22 +8,22 @@ public class UIManagerTextEntry : UIManager { |
8 | 8 | public GameObject textEntry; |
9 | 9 | public Button translate; |
10 | 10 | |
11 | - protected override void rebuild() | |
11 | + protected override void rebuild(float scale) | |
12 | 12 | { |
13 | 13 | // back |
14 | 14 | { |
15 | 15 | float dist = 132 * scale * 0.75F; |
16 | 16 | |
17 | - back.transform.localScale = new Vector3(base.scale, base.scale, 1); | |
17 | + back.transform.localScale = new Vector3(scale, scale, 1); | |
18 | 18 | back.transform.position = new Vector3(dist, Screen.height - dist); |
19 | 19 | } |
20 | 20 | |
21 | - float labelHeight = 187.5F * base.scale; | |
21 | + float labelHeight = 187.5F * scale; | |
22 | 22 | float labelDist = labelHeight * 0.75F; |
23 | 23 | |
24 | 24 | // label |
25 | 25 | { |
26 | - label.transform.localScale = new Vector3(base.scale, base.scale, 1); | |
26 | + label.transform.localScale = new Vector3(scale, scale, 1); | |
27 | 27 | label.transform.position = new Vector3(Screen.width / 2, Screen.height - labelDist, 0); |
28 | 28 | } |
29 | 29 | |
... | ... | @@ -31,14 +31,14 @@ public class UIManagerTextEntry : UIManager { |
31 | 31 | |
32 | 32 | // translate |
33 | 33 | { |
34 | - translate.transform.localScale = new Vector3(base.scale, base.scale, 1); | |
34 | + translate.transform.localScale = new Vector3(scale, scale, 1); | |
35 | 35 | translate.transform.localPosition = new Vector3(translate.transform.localPosition.x, - translateHeight, 0); |
36 | 36 | } |
37 | 37 | |
38 | 38 | // textEntry |
39 | 39 | { |
40 | 40 | float labelBottom = labelDist + labelHeight - (33 * scale); |
41 | - float margin = 80 * base.scale; | |
41 | + float margin = 80 * scale; | |
42 | 42 | float barTop = 165 * scale; |
43 | 43 | |
44 | 44 | float marginTop = labelBottom + margin; | ... | ... |
Assets/Scripts/UIManagerTutorial.cs
... | ... | @@ -9,20 +9,20 @@ public class UIManagerTutorial : UIManager { |
9 | 9 | public Button exit; |
10 | 10 | public RawImage text; |
11 | 11 | |
12 | - protected override void rebuild() | |
12 | + protected override void rebuild(float scale) | |
13 | 13 | { |
14 | - container.transform.localScale = new Vector3(base.scale, 1, 1); | |
15 | - next.transform.localScale = new Vector3(base.scale, 1, 1); | |
16 | - bar.transform.localScale = new Vector3(1, base.scale, 1); | |
14 | + container.transform.localScale = new Vector3(scale, 1, 1); | |
15 | + next.transform.localScale = new Vector3(scale, 1, 1); | |
16 | + bar.transform.localScale = new Vector3(1, scale, 1); | |
17 | 17 | |
18 | - bar.transform.position -= new Vector3(0, 165 * (1F - base.scale), 0); | |
19 | - next.transform.localPosition = new Vector3((Screen.width / 2) - (122.4F * base.scale), 0, 0); | |
18 | + bar.transform.position -= new Vector3(0, 165 * (1F - scale), 0); | |
19 | + next.transform.localPosition = new Vector3((Screen.width / 2) - (122.4F * scale), 0, 0); | |
20 | 20 | |
21 | - exit.transform.localScale = new Vector3(base.scale, base.scale, 1); | |
22 | - float dist = 116 * base.scale * 0.75F; | |
21 | + exit.transform.localScale = new Vector3(scale, scale, 1); | |
22 | + float dist = 116 * scale * 0.75F; | |
23 | 23 | exit.transform.position = new Vector3(Screen.width - dist, Screen.height - dist, 0); |
24 | 24 | |
25 | - text.transform.localScale = new Vector3(base.scale, base.scale, 1); | |
25 | + text.transform.localScale = new Vector3(scale, scale, 1); | |
26 | 26 | } |
27 | 27 | |
28 | 28 | } | ... | ... |