Commit a89919da85a99539b2cc6a33697ba4d90a38e160
Exists in
master
and in
6 other branches
Merge
Showing
8 changed files
with
203 additions
and
203 deletions
Show diff stats
Assets/Region.cs
@@ -1,20 +0,0 @@ | @@ -1,20 +0,0 @@ | ||
1 | -using UnityEngine; | ||
2 | -using System.Collections; | ||
3 | - | ||
4 | -public class Region : MonoBehaviour { | ||
5 | - | ||
6 | - public GameObject checkmark; | ||
7 | - private string path = ""; | ||
8 | - | ||
9 | - public string Path | ||
10 | - { | ||
11 | - get { return this.path; } | ||
12 | - set { this.path = value; } | ||
13 | - } | ||
14 | - | ||
15 | - public void select(bool selected) | ||
16 | - { | ||
17 | - checkmark.SetActive(selected); | ||
18 | - } | ||
19 | - | ||
20 | -} |
Assets/Region.cs.meta
@@ -1,12 +0,0 @@ | @@ -1,12 +0,0 @@ | ||
1 | -fileFormatVersion: 2 | ||
2 | -guid: 473cc1c6d151a554589205d28b0701a7 | ||
3 | -timeCreated: 1475266564 | ||
4 | -licenseType: Free | ||
5 | -MonoImporter: | ||
6 | - serializedVersion: 2 | ||
7 | - defaultReferences: [] | ||
8 | - executionOrder: 0 | ||
9 | - icon: {instanceID: 0} | ||
10 | - userData: | ||
11 | - assetBundleName: | ||
12 | - assetBundleVariant: |
Assets/RegionSelector.cs
@@ -1,159 +0,0 @@ | @@ -1,159 +0,0 @@ | ||
1 | -using UnityEngine; | ||
2 | -using System.Collections; | ||
3 | -using System.Collections.Generic; | ||
4 | -using UnityEngine.UI; | ||
5 | -using UnityEngine.EventSystems; | ||
6 | - | ||
7 | -public class RegionSelector : MonoBehaviour { | ||
8 | - | ||
9 | - private readonly Dictionary<string, string> regions = new Dictionary<string, string> { | ||
10 | - | ||
11 | - { "Padrão Nacional", "" }, | ||
12 | - { "Acre", "AC/" }, | ||
13 | - { "Alagoas", "AL/" }, | ||
14 | - { "Amapá", "AP/" }, | ||
15 | - { "Amazonas", "AM/" }, | ||
16 | - { "Bahia", "BA/" }, | ||
17 | - { "Ceará", "CE/" }, | ||
18 | - { "Distrito Federal", "DF/" }, | ||
19 | - { "Espírito Santo", "ES/" }, | ||
20 | - { "Goiás", "GO/" }, | ||
21 | - { "Maranhão", "MA/" }, | ||
22 | - { "Mato Grosso", "MT/" }, | ||
23 | - { "Mato Grosso do Sul", "MS/" }, | ||
24 | - { "Minas Gerais", "MG/" }, | ||
25 | - { "Pará", "PA/" }, | ||
26 | - { "Paraíba", "PB/" }, | ||
27 | - { "Paraná", "PR/"}, | ||
28 | - { "Pernambuco", "PE/" }, | ||
29 | - { "Piauí", "PI/" }, | ||
30 | - { "Rio de Janeiro", "RJ/" }, | ||
31 | - { "Rio Grande do Norte", "RN/" }, | ||
32 | - { "Rio Grande do Sul", "RS/" }, | ||
33 | - { "Rondônia", "RO/" }, | ||
34 | - { "Roraima", "RR/" }, | ||
35 | - { "Santa Catarina", "SC/" }, | ||
36 | - { "São Paulo", "SP/" }, | ||
37 | - { "Sergipe", "SE/" }, | ||
38 | - { "Tocantins", "TO/" } | ||
39 | - | ||
40 | - }; | ||
41 | - | ||
42 | - public PlayerManager manager; | ||
43 | - public GameObject list; | ||
44 | - public GameObject SampleItem; | ||
45 | - public Text label; | ||
46 | - | ||
47 | - private Region activeItem = null; | ||
48 | - private Region selectedItem = null; | ||
49 | - | ||
50 | - void Start () | ||
51 | - { | ||
52 | - foreach (KeyValuePair<string, string> regionData in regions) | ||
53 | - { | ||
54 | - GameObject item = Instantiate(this.SampleItem) as GameObject; | ||
55 | - item.GetComponentInChildren<Text>().text = regionData.Key; | ||
56 | - item.transform.SetParent(this.list.transform); | ||
57 | - item.GetComponent<Button>().onClick.AddListener(delegate { | ||
58 | - selectItem(EventSystem.current.currentSelectedGameObject.GetComponent<Region>()); | ||
59 | - }); | ||
60 | - | ||
61 | - Region region = item.GetComponent<Region>(); | ||
62 | - region.Path = regionData.Value; | ||
63 | - | ||
64 | - if (this.activeItem == null) | ||
65 | - { | ||
66 | - this.activeItem = region; | ||
67 | - this.selectedItem = region; | ||
68 | - region.select(true); | ||
69 | - } | ||
70 | - } | ||
71 | - } | ||
72 | - | ||
73 | - private void selectItem(Region region) | ||
74 | - { | ||
75 | - this.selectedItem.select(false); | ||
76 | - this.selectedItem = region; | ||
77 | - this.selectedItem.select(true); | ||
78 | - } | ||
79 | - | ||
80 | - public void ReselectActiveItem() | ||
81 | - { | ||
82 | - selectItem(this.activeItem); | ||
83 | - } | ||
84 | - | ||
85 | - public void OnDone() | ||
86 | - { | ||
87 | - this.activeItem = this.selectedItem; | ||
88 | - this.manager.setRegion(this.activeItem.Path); | ||
89 | - this.manager.clearLoadedBundles(); | ||
90 | - | ||
91 | - if (selectedItem.Path == "") | ||
92 | - { | ||
93 | - this.label.text = "BR"; | ||
94 | - }else | ||
95 | - { | ||
96 | - this.label.text = selectedItem.Path.Replace('/', ' '); | ||
97 | - | ||
98 | - } | ||
99 | - } | ||
100 | - | ||
101 | -} | ||
102 | - | ||
103 | -/* | ||
104 | - | ||
105 | -void Start () | ||
106 | - { | ||
107 | - this.group = this.gameObject.GetComponent<ToggleGroup>(); | ||
108 | - | ||
109 | - foreach (KeyValuePair<string, string> region in regions) | ||
110 | - { | ||
111 | - GameObject item = Instantiate(this.sampleItem) as GameObject; | ||
112 | - item.GetComponentInChildren<Text>().text = region.Key; | ||
113 | - | ||
114 | - Toggle toggle = item.GetComponentInChildren<Toggle>(); | ||
115 | - toggle.group = this.group; | ||
116 | - toggles.Add(toggle); | ||
117 | - | ||
118 | - Debug.Log(region.Key + ": " + (region.Value.Length == 0) + " but " + toggle.isOn); | ||
119 | - | ||
120 | - if (region.Value.Length == 0) | ||
121 | - this.selected = toggle; | ||
122 | - | ||
123 | - item.transform.SetParent(this.list.transform); | ||
124 | - } | ||
125 | - | ||
126 | - foreach (Toggle toggle in this.toggles) | ||
127 | - { | ||
128 | - toggle.isOn = false; | ||
129 | - } | ||
130 | - | ||
131 | - this.selected.isOn = true; | ||
132 | - } | ||
133 | - | ||
134 | - void Update () | ||
135 | - { | ||
136 | - int i = 0; | ||
137 | - foreach (Toggle toggle in this.toggles) | ||
138 | - { | ||
139 | - Debug.Log("Toggle " + i++ + " : " + toggle.isOn); | ||
140 | - toggle.isOn = false; | ||
141 | - this.group.NotifyToggleOn(toggle); | ||
142 | - } | ||
143 | - } | ||
144 | - | ||
145 | - public void OnSelect() | ||
146 | - { | ||
147 | - if ( ! selected.isOn) { | ||
148 | - foreach (Toggle toggle in group.ActiveToggles()) | ||
149 | - { | ||
150 | - if (toggle.isOn) | ||
151 | - { | ||
152 | - this.selected = toggle; | ||
153 | - this.manager.setRegion(this.regions[toggle.GetComponent<Text>().text]); | ||
154 | - } | ||
155 | - } | ||
156 | - } | ||
157 | - } | ||
158 | - | ||
159 | -*/ |
Assets/RegionSelector.cs.meta
@@ -1,12 +0,0 @@ | @@ -1,12 +0,0 @@ | ||
1 | -fileFormatVersion: 2 | ||
2 | -guid: a6c642c03c1f758439485b2a6623738a | ||
3 | -timeCreated: 1475168432 | ||
4 | -licenseType: Free | ||
5 | -MonoImporter: | ||
6 | - serializedVersion: 2 | ||
7 | - defaultReferences: [] | ||
8 | - executionOrder: 0 | ||
9 | - icon: {instanceID: 0} | ||
10 | - userData: | ||
11 | - assetBundleName: | ||
12 | - assetBundleVariant: |
@@ -0,0 +1,20 @@ | @@ -0,0 +1,20 @@ | ||
1 | +using UnityEngine; | ||
2 | +using System.Collections; | ||
3 | + | ||
4 | +public class Region : MonoBehaviour { | ||
5 | + | ||
6 | + public GameObject checkmark; | ||
7 | + private string path = ""; | ||
8 | + | ||
9 | + public string Path | ||
10 | + { | ||
11 | + get { return this.path; } | ||
12 | + set { this.path = value; } | ||
13 | + } | ||
14 | + | ||
15 | + public void select(bool selected) | ||
16 | + { | ||
17 | + checkmark.SetActive(selected); | ||
18 | + } | ||
19 | + | ||
20 | +} |
@@ -0,0 +1,12 @@ | @@ -0,0 +1,12 @@ | ||
1 | +fileFormatVersion: 2 | ||
2 | +guid: 473cc1c6d151a554589205d28b0701a7 | ||
3 | +timeCreated: 1475266564 | ||
4 | +licenseType: Free | ||
5 | +MonoImporter: | ||
6 | + serializedVersion: 2 | ||
7 | + defaultReferences: [] | ||
8 | + executionOrder: 0 | ||
9 | + icon: {instanceID: 0} | ||
10 | + userData: | ||
11 | + assetBundleName: | ||
12 | + assetBundleVariant: |
@@ -0,0 +1,159 @@ | @@ -0,0 +1,159 @@ | ||
1 | +using UnityEngine; | ||
2 | +using System.Collections; | ||
3 | +using System.Collections.Generic; | ||
4 | +using UnityEngine.UI; | ||
5 | +using UnityEngine.EventSystems; | ||
6 | + | ||
7 | +public class RegionSelector : MonoBehaviour { | ||
8 | + | ||
9 | + private readonly Dictionary<string, string> regions = new Dictionary<string, string> { | ||
10 | + | ||
11 | + { "Padrão Nacional", "" }, | ||
12 | + { "Acre", "AC/" }, | ||
13 | + { "Alagoas", "AL/" }, | ||
14 | + { "Amapá", "AP/" }, | ||
15 | + { "Amazonas", "AM/" }, | ||
16 | + { "Bahia", "BA/" }, | ||
17 | + { "Ceará", "CE/" }, | ||
18 | + { "Distrito Federal", "DF/" }, | ||
19 | + { "Espírito Santo", "ES/" }, | ||
20 | + { "Goiás", "GO/" }, | ||
21 | + { "Maranhão", "MA/" }, | ||
22 | + { "Mato Grosso", "MT/" }, | ||
23 | + { "Mato Grosso do Sul", "MS/" }, | ||
24 | + { "Minas Gerais", "MG/" }, | ||
25 | + { "Pará", "PA/" }, | ||
26 | + { "Paraíba", "PB/" }, | ||
27 | + { "Paraná", "PR/"}, | ||
28 | + { "Pernambuco", "PE/" }, | ||
29 | + { "Piauí", "PI/" }, | ||
30 | + { "Rio de Janeiro", "RJ/" }, | ||
31 | + { "Rio Grande do Norte", "RN/" }, | ||
32 | + { "Rio Grande do Sul", "RS/" }, | ||
33 | + { "Rondônia", "RO/" }, | ||
34 | + { "Roraima", "RR/" }, | ||
35 | + { "Santa Catarina", "SC/" }, | ||
36 | + { "São Paulo", "SP/" }, | ||
37 | + { "Sergipe", "SE/" }, | ||
38 | + { "Tocantins", "TO/" } | ||
39 | + | ||
40 | + }; | ||
41 | + | ||
42 | + public PlayerManager manager; | ||
43 | + public GameObject list; | ||
44 | + public GameObject SampleItem; | ||
45 | + public Text label; | ||
46 | + | ||
47 | + private Region activeItem = null; | ||
48 | + private Region selectedItem = null; | ||
49 | + | ||
50 | + void Start () | ||
51 | + { | ||
52 | + foreach (KeyValuePair<string, string> regionData in regions) | ||
53 | + { | ||
54 | + GameObject item = Instantiate(this.SampleItem) as GameObject; | ||
55 | + item.GetComponentInChildren<Text>().text = regionData.Key; | ||
56 | + item.transform.SetParent(this.list.transform); | ||
57 | + item.GetComponent<Button>().onClick.AddListener(delegate { | ||
58 | + selectItem(EventSystem.current.currentSelectedGameObject.GetComponent<Region>()); | ||
59 | + }); | ||
60 | + | ||
61 | + Region region = item.GetComponent<Region>(); | ||
62 | + region.Path = regionData.Value; | ||
63 | + | ||
64 | + if (this.activeItem == null) | ||
65 | + { | ||
66 | + this.activeItem = region; | ||
67 | + this.selectedItem = region; | ||
68 | + region.select(true); | ||
69 | + } | ||
70 | + } | ||
71 | + } | ||
72 | + | ||
73 | + private void selectItem(Region region) | ||
74 | + { | ||
75 | + this.selectedItem.select(false); | ||
76 | + this.selectedItem = region; | ||
77 | + this.selectedItem.select(true); | ||
78 | + } | ||
79 | + | ||
80 | + public void ReselectActiveItem() | ||
81 | + { | ||
82 | + selectItem(this.activeItem); | ||
83 | + } | ||
84 | + | ||
85 | + public void OnDone() | ||
86 | + { | ||
87 | + this.activeItem = this.selectedItem; | ||
88 | + this.manager.setRegion(this.activeItem.Path); | ||
89 | + this.manager.clearLoadedBundles(); | ||
90 | + | ||
91 | + if (selectedItem.Path == "") | ||
92 | + { | ||
93 | + this.label.text = "BR"; | ||
94 | + }else | ||
95 | + { | ||
96 | + this.label.text = selectedItem.Path.Replace('/', ' '); | ||
97 | + | ||
98 | + } | ||
99 | + } | ||
100 | + | ||
101 | +} | ||
102 | + | ||
103 | +/* | ||
104 | + | ||
105 | +void Start () | ||
106 | + { | ||
107 | + this.group = this.gameObject.GetComponent<ToggleGroup>(); | ||
108 | + | ||
109 | + foreach (KeyValuePair<string, string> region in regions) | ||
110 | + { | ||
111 | + GameObject item = Instantiate(this.sampleItem) as GameObject; | ||
112 | + item.GetComponentInChildren<Text>().text = region.Key; | ||
113 | + | ||
114 | + Toggle toggle = item.GetComponentInChildren<Toggle>(); | ||
115 | + toggle.group = this.group; | ||
116 | + toggles.Add(toggle); | ||
117 | + | ||
118 | + Debug.Log(region.Key + ": " + (region.Value.Length == 0) + " but " + toggle.isOn); | ||
119 | + | ||
120 | + if (region.Value.Length == 0) | ||
121 | + this.selected = toggle; | ||
122 | + | ||
123 | + item.transform.SetParent(this.list.transform); | ||
124 | + } | ||
125 | + | ||
126 | + foreach (Toggle toggle in this.toggles) | ||
127 | + { | ||
128 | + toggle.isOn = false; | ||
129 | + } | ||
130 | + | ||
131 | + this.selected.isOn = true; | ||
132 | + } | ||
133 | + | ||
134 | + void Update () | ||
135 | + { | ||
136 | + int i = 0; | ||
137 | + foreach (Toggle toggle in this.toggles) | ||
138 | + { | ||
139 | + Debug.Log("Toggle " + i++ + " : " + toggle.isOn); | ||
140 | + toggle.isOn = false; | ||
141 | + this.group.NotifyToggleOn(toggle); | ||
142 | + } | ||
143 | + } | ||
144 | + | ||
145 | + public void OnSelect() | ||
146 | + { | ||
147 | + if ( ! selected.isOn) { | ||
148 | + foreach (Toggle toggle in group.ActiveToggles()) | ||
149 | + { | ||
150 | + if (toggle.isOn) | ||
151 | + { | ||
152 | + this.selected = toggle; | ||
153 | + this.manager.setRegion(this.regions[toggle.GetComponent<Text>().text]); | ||
154 | + } | ||
155 | + } | ||
156 | + } | ||
157 | + } | ||
158 | + | ||
159 | +*/ |
@@ -0,0 +1,12 @@ | @@ -0,0 +1,12 @@ | ||
1 | +fileFormatVersion: 2 | ||
2 | +guid: a6c642c03c1f758439485b2a6623738a | ||
3 | +timeCreated: 1475168432 | ||
4 | +licenseType: Free | ||
5 | +MonoImporter: | ||
6 | + serializedVersion: 2 | ||
7 | + defaultReferences: [] | ||
8 | + executionOrder: 0 | ||
9 | + icon: {instanceID: 0} | ||
10 | + userData: | ||
11 | + assetBundleName: | ||
12 | + assetBundleVariant: |