-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReviewPrefScript.cs
More file actions
114 lines (102 loc) · 2.84 KB
/
Copy pathReviewPrefScript.cs
File metadata and controls
114 lines (102 loc) · 2.84 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 TMPro;
using UnityEngine;
using UnityEngine.UI;
public class ReviewPrefScript : MonoBehaviour
{
public RawImage avatar;
public TMP_Text review;
public TMP_Text name;
public GameObject[] starss;
public int stars;
public Reviews rev;
public async void CreatePref(Reviews reviews)
{
if (rev==null)
await new WaitForSeconds(.01f);
rev = reviews;
name.text = reviews.review_user_name;
review.text = reviews.text;
Stars(reviews);
}
public async void CreatePref2(Reviews reviews)
{
if (rev == null)
await new WaitForSeconds(.01f);
rev = reviews;
name.text = reviews.review_user_name;
review.text = reviews.review_text;
Stars2(reviews);
}
public void Open()
{
var AM = AppManager.Instance;
foreach (var dish in AM.res.dish)
{
if (dish.id == rev.review_id)
{
AM.currentDish = dish;
AM.SwitchScreen(4);
}
}
}
//async Task<Texture> LoadImg(string endpoint)
//{
// using (UnityWebRequest request = UnityWebRequestTexture.GetTexture(endpoint))
// {
// await request.SendWebRequest();
// var texture = DownloadHandlerTexture.GetContent(request);
// return texture;
// }
//}
public void Stars2(Reviews reviews)
{
if (reviews.review_rating == "1")
{ stars = 1; Star1(); }
if (reviews.review_rating == "2")
{ stars = 2; Star2(); }
if (reviews.review_rating == "3")
{ stars = 3; Star3(); }
if (reviews.review_rating == "4")
{ stars = 4; Star4(); }
if (reviews.review_rating == "5")
{ stars = 5; Star5(); }
}
public void Stars(Reviews reviews)
{
if (reviews.rating == "1")
{ stars = 1; Star1(); }
if (reviews.rating == "2")
{ stars = 2; Star2(); }
if (reviews.rating == "3")
{ stars = 3; Star3(); }
if (reviews.rating == "4")
{ stars = 4; Star4(); }
if (reviews.rating == "5")
{ stars = 5; Star5(); }
}
public void Star1()
{
for (int i = 0; i < stars; i++)
starss[i].SetActive(true);
}
public void Star2()
{
for (int i = 0; i < stars; i++)
starss[i].SetActive(true);
}
public void Star3()
{
for (int i = 0; i < stars; i++)
starss[i].SetActive(true);
}
public void Star4()
{
for (int i = 0; i < stars; i++)
starss[i].SetActive(true);
}
public void Star5()
{
for (int i = 0; i < stars; i++)
starss[i].SetActive(true);
}
}