-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMapPrefScript.cs
More file actions
114 lines (101 loc) · 2.44 KB
/
Copy pathMapPrefScript.cs
File metadata and controls
114 lines (101 loc) · 2.44 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
using System;
using TMPro;
using UnityEngine;
public class MapPrefScript : MonoBehaviour
{
public GameObject mapPref;
public GameObject s1;
public GameObject s2;
public GameObject s3;
public GameObject s4;
public GameObject s5;
public TMP_Text name;
public TMP_Text distance;
public TMP_Text address;
public int stars;
public void OnEnable()
{
mapPref.SetActive(true);
CreatePref();
}
public void Close()
{
AppManager.Instance.mapPrefOnline = false;
Destroy(mapPref);
}
public void CreatePref()
{
var AM = AppManager.Instance;
if (AppManager.Instance.res.company.Count>0)
{
name.text = AM.name;
stars = AM.rating;
address.text = AM.address;
if (AM.distance < 1)
{
AM.distance *= 1000;
distance.text = Convert.ToString(AM.distance) + " m";
}
else
{
distance.text = Convert.ToString(AM.distance) + " km";
}
ChangeStars();
}
}
public void ChangeStars()
{
AllClose();
switch (stars)
{
case 1:
{ ChangeStar1(); break; }
case 2:
{ ChangeStar2(); break; }
case 3:
{ ChangeStar3(); break; }
case 4:
{ ChangeStar4(); break; }
case 5:
{ ChangeStar5(); break; }
}
}
public void AllClose()
{
s1.SetActive(false);
s2.SetActive(false);
s3.SetActive(false);
s4.SetActive(false);
s5.SetActive(false);
}
public void ChangeStar1()
{
s1.SetActive(true);
}
public void ChangeStar2()
{
s1.SetActive(true);
s2.SetActive(true);
}
public void ChangeStar3()
{
s1.SetActive(true);
s2.SetActive(true);
s3.SetActive(true);
}
public void ChangeStar4()
{
s1.SetActive(true);
s2.SetActive(true);
s3.SetActive(true);
s4.SetActive(true);
}
public void ChangeStar5()
{
s1.SetActive(true);
s2.SetActive(true);
s3.SetActive(true);
s4.SetActive(true);
s5.SetActive(true);
}
}