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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
|
using System;
using System.Collections;
using System.Text;
using PowerTools;
using UnityEngine;
public class UploadDataGame : Minigame
{
public SpriteAnim LeftFolder;
public SpriteAnim RightFolder;
public AnimationClip FolderOpen;
public AnimationClip FolderClose;
public SpriteRenderer Runner;
public HorizontalGauge Gauge;
public TextRenderer PercentText;
public TextRenderer EstimatedText;
public TextRenderer SourceText;
public TextRenderer TargetText;
public SpriteRenderer Button;
public Sprite DownloadImage;
public GameObject Status;
public GameObject Tower;
private int count;
private float timer;
public const float RandomChunks = 5f;
public const float ConstantTime = 3f;
private bool running = true;
public override void Begin(PlayerTask task)
{
PlayerControl.LocalPlayer.SetPlayerMaterialColors(this.Runner);
base.Begin(task);
if (this.MyNormTask.taskStep == 0)
{
this.Button.sprite = this.DownloadImage;
this.Tower.SetActive(false);
this.SourceText.Text = this.MyTask.StartAt.ToString();
this.TargetText.Text = "My Tablet";
return;
}
this.SourceText.Text = "My Tablet";
this.TargetText.Text = "Headquarters";
}
public void Click()
{
base.StartCoroutine(this.Transition());
}
private IEnumerator Transition()
{
this.Button.gameObject.SetActive(false);
this.Status.SetActive(true);
float target = this.Gauge.transform.localScale.x;
for (float t = 0f; t < 0.15f; t += Time.deltaTime)
{
this.Gauge.transform.localScale = new Vector3(t / 0.15f * target, 1f, 1f);
yield return null;
}
base.StartCoroutine(this.PulseText());
base.StartCoroutine(this.DoRun());
base.StartCoroutine(this.DoText());
base.StartCoroutine(this.DoPercent());
yield break;
}
private IEnumerator PulseText()
{
MeshRenderer rend2 = this.PercentText.GetComponent<MeshRenderer>();
MeshRenderer rend1 = this.EstimatedText.GetComponent<MeshRenderer>();
Color gray = new Color(0.3f, 0.3f, 0.3f, 1f);
while (this.running)
{
yield return new WaitForLerp(0.4f, delegate(float t)
{
Color value = Color.Lerp(Color.black, gray, t);
rend2.material.SetColor("_OutlineColor", value);
rend1.material.SetColor("_OutlineColor", value);
});
yield return new WaitForLerp(0.4f, delegate(float t)
{
Color value = Color.Lerp(gray, Color.black, t);
rend2.material.SetColor("_OutlineColor", value);
rend1.material.SetColor("_OutlineColor", value);
});
}
rend2.material.SetColor("_OutlineColor", Color.black);
rend1.material.SetColor("_OutlineColor", Color.black);
yield break;
}
private IEnumerator DoPercent()
{
while (this.running)
{
float num = (float)this.count / 5f * 0.7f + this.timer / 3f * 0.3f;
if (num >= 1f)
{
this.running = false;
}
num = Mathf.Clamp(num, 0f, 1f);
this.Gauge.Value = num;
this.PercentText.Text = Mathf.RoundToInt(num * 100f) + "%";
yield return null;
}
yield break;
}
private IEnumerator DoText()
{
StringBuilder txt = new StringBuilder("Estimated Time: ");
int baselen = txt.Length;
int max = 604800;
this.count = 0;
while ((float)this.count < 5f)
{
txt.Length = baselen;
int num = IntRange.Next(max / 6, max);
int num2 = num / 86400;
if (num2 > 0)
{
txt.Append(num2 + "d ");
}
int num3 = num / 3600 % 24;
if (num3 > 0)
{
txt.Append(num3 + "hr ");
}
int num4 = num / 60 % 60;
if (num4 > 0)
{
txt.Append(num4 + "m ");
}
int num5 = num % 60;
if (num5 > 0)
{
txt.Append(num5 + "s");
}
this.EstimatedText.Text = txt.ToString();
max /= 4;
yield return new WaitForSeconds(FloatRange.Next(0.6f, 1.2f));
this.count++;
}
this.timer = 0f;
while (this.timer < 3f)
{
txt.Length = baselen;
int num6 = Mathf.RoundToInt(3f - this.timer);
txt.Append(num6 + "s");
this.EstimatedText.Text = txt.ToString();
yield return null;
this.timer += Time.deltaTime;
}
yield break;
}
private IEnumerator DoRun()
{
while (this.running)
{
UploadDataGame.<>c__DisplayClass25_0 CS$<>8__locals1 = new UploadDataGame.<>c__DisplayClass25_0();
CS$<>8__locals1.<>4__this = this;
this.LeftFolder.Play(this.FolderOpen, 1f);
CS$<>8__locals1.pos = this.Runner.transform.localPosition;
yield return new WaitForLerp(1.125f, delegate(float t)
{
CS$<>8__locals1.pos.x = Mathf.Lerp(-1.25f, 0.5625f, t);
CS$<>8__locals1.<>4__this.Runner.transform.localPosition = CS$<>8__locals1.pos;
});
this.LeftFolder.Play(this.FolderClose, 1f);
this.RightFolder.Play(this.FolderOpen, 1f);
yield return new WaitForLerp(1.375f, delegate(float t)
{
CS$<>8__locals1.pos.x = Mathf.Lerp(0.5625f, 1.25f, t);
CS$<>8__locals1.<>4__this.Runner.transform.localPosition = CS$<>8__locals1.pos;
});
yield return new WaitForAnimationFinish(this.RightFolder, this.FolderClose);
CS$<>8__locals1 = null;
}
this.EstimatedText.Text = "Complete";
this.MyNormTask.NextStep();
base.StartCoroutine(base.CoStartClose(0.75f));
yield break;
}
}
|