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
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using InnerNet;
using UnityEngine;
public class HudManager : DestroyableSingleton<HudManager>
{
public Coroutine ReactorFlash { get; set; }
public Coroutine OxyFlash { get; set; }
public MeetingHud MeetingPrefab;
public KillButtonManager KillButton;
public UseButtonManager UseButton;
public ReportButtonManager ReportButton;
public TextRenderer GameSettings;
public GameObject TaskStuff;
public ChatController Chat;
public DialogueBox Dialogue;
public TextRenderer TaskText;
public Transform TaskCompleteOverlay;
private float taskDirtyTimer;
public MeshRenderer ShadowQuad;
public SpriteRenderer FullScreen;
public SpriteRenderer MapButton;
public KillOverlay KillOverlay;
public IVirtualJoystick joystick;
public MonoBehaviour[] Joysticks;
public DiscussBehaviour discussEmblem;
public ShhhBehaviour shhhEmblem;
public IntroCutscene IntroPrefab;
public OptionsMenuBehaviour GameMenu;
public NotificationPopper Notifier;
public RoomTracker roomTracker;
public AudioClip SabotageSound;
public AudioClip TaskCompleteSound;
public AudioClip TaskUpdateSound;
private StringBuilder tasksString = new StringBuilder();
public void Start()
{
this.SetTouchType(SaveManager.TouchConfig);
}
public void ShowTaskComplete()
{
base.StartCoroutine(this.CoTaskComplete());
}
private IEnumerator CoTaskComplete()
{
if (Constants.ShouldPlaySfx())
{
SoundManager.Instance.PlaySound(this.TaskCompleteSound, false, 1f);
}
this.TaskCompleteOverlay.gameObject.SetActive(true);
yield return Effects.Slide2D(this.TaskCompleteOverlay, new Vector2(0f, -8f), Vector2.zero, 0.25f);
for (float time = 0f; time < 0.75f; time += Time.deltaTime)
{
yield return null;
}
yield return Effects.Slide2D(this.TaskCompleteOverlay, Vector2.zero, new Vector2(0f, 8f), 0.25f);
this.TaskCompleteOverlay.gameObject.SetActive(false);
yield break;
}
public void SetJoystickSize(float size)
{
if (this.joystick != null && this.joystick is VirtualJoystick)
{
VirtualJoystick virtualJoystick = (VirtualJoystick)this.joystick;
virtualJoystick.transform.localScale = new Vector3(size, size, 1f);
AspectPosition component = virtualJoystick.GetComponent<AspectPosition>();
float num = Mathf.Lerp(0.65f, 1.1f, FloatRange.ReverseLerp(size, 0.5f, 1.5f));
component.DistanceFromEdge = new Vector3(num, num, -10f);
component.AdjustPosition();
}
}
public void SetTouchType(int type)
{
if (this.joystick != null && !(this.joystick is KeyboardJoystick))
{
UnityEngine.Object.Destroy((this.joystick as MonoBehaviour).gameObject);
}
MonoBehaviour monoBehaviour = UnityEngine.Object.Instantiate<MonoBehaviour>(this.Joysticks[Mathf.Clamp(type + 1, 1, this.Joysticks.Length)]);
monoBehaviour.transform.SetParent(base.transform, false);
this.joystick = monoBehaviour.GetComponent<IVirtualJoystick>();
}
public void OpenMap()
{
this.ShowMap(delegate(MapBehaviour m)
{
m.ShowNormalMap();
});
}
public void ShowMap(Action<MapBehaviour> mapAction)
{
if (!ShipStatus.Instance)
{
return;
}
if (!MapBehaviour.Instance)
{
MapBehaviour.Instance = UnityEngine.Object.Instantiate<MapBehaviour>(ShipStatus.Instance.MapPrefab, base.transform);
MapBehaviour.Instance.gameObject.SetActive(false);
}
mapAction(MapBehaviour.Instance);
}
public void SetHudActive(bool isActive)
{
DestroyableSingleton<HudManager>.Instance.UseButton.gameObject.SetActive(isActive);
DestroyableSingleton<HudManager>.Instance.UseButton.Refresh();
DestroyableSingleton<HudManager>.Instance.ReportButton.gameObject.SetActive(isActive);
GameData.PlayerInfo data = PlayerControl.LocalPlayer.Data;
DestroyableSingleton<HudManager>.Instance.KillButton.gameObject.SetActive(isActive && data.IsImpostor && !data.IsDead);
DestroyableSingleton<HudManager>.Instance.TaskText.transform.parent.gameObject.SetActive(isActive);
}
public void FixedUpdate()
{
this.taskDirtyTimer += Time.fixedDeltaTime;
if (this.taskDirtyTimer > 0.25f)
{
this.taskDirtyTimer = 0f;
if (!PlayerControl.LocalPlayer)
{
this.TaskText.Text = string.Empty;
return;
}
GameData.PlayerInfo data = PlayerControl.LocalPlayer.Data;
if (data == null)
{
return;
}
bool isImpostor = data.IsImpostor;
this.tasksString.Clear();
if (PlayerControl.LocalPlayer.myTasks.Count == 0)
{
this.tasksString.Append("None");
}
else
{
for (int i = 0; i < PlayerControl.LocalPlayer.myTasks.Count; i++)
{
PlayerTask playerTask = PlayerControl.LocalPlayer.myTasks[i];
if (playerTask)
{
if (playerTask.TaskType == TaskTypes.FixComms && !isImpostor)
{
this.tasksString.Clear();
playerTask.AppendTaskText(this.tasksString);
break;
}
playerTask.AppendTaskText(this.tasksString);
}
}
this.tasksString.TrimEnd();
}
this.TaskText.Text = this.tasksString.ToString();
}
}
public IEnumerator ShowEmblem(bool shhh)
{
if (shhh)
{
this.shhhEmblem.gameObject.SetActive(true);
yield return this.shhhEmblem.PlayAnimation();
this.shhhEmblem.gameObject.SetActive(false);
}
else
{
this.discussEmblem.gameObject.SetActive(true);
yield return this.discussEmblem.PlayAnimation();
this.discussEmblem.gameObject.SetActive(false);
}
yield break;
}
public void StartReactorFlash()
{
if (this.ReactorFlash == null)
{
this.ReactorFlash = base.StartCoroutine(this.CoReactorFlash());
}
}
public void StartOxyFlash()
{
if (this.OxyFlash == null)
{
this.OxyFlash = base.StartCoroutine(this.CoReactorFlash());
}
}
public void ShowPopUp(string text)
{
this.Dialogue.Show(text);
}
public void StopReactorFlash()
{
if (this.ReactorFlash != null)
{
base.StopCoroutine(this.ReactorFlash);
this.FullScreen.enabled = false;
this.ReactorFlash = null;
}
}
public void StopOxyFlash()
{
if (this.OxyFlash != null)
{
base.StopCoroutine(this.OxyFlash);
this.FullScreen.enabled = false;
this.OxyFlash = null;
}
}
public IEnumerator CoFadeFullScreen(Color source, Color target, float duration = 0.2f)
{
if (this.FullScreen.enabled && this.FullScreen.color == target)
{
yield break;
}
this.FullScreen.enabled = true;
for (float t = 0f; t < duration; t += Time.deltaTime)
{
this.FullScreen.color = Color.Lerp(source, target, t / duration);
yield return null;
}
this.FullScreen.color = target;
if (target.a < 0.05f)
{
this.FullScreen.enabled = false;
}
yield break;
}
private IEnumerator CoReactorFlash()
{
WaitForSeconds wait = new WaitForSeconds(1f);
this.FullScreen.color = new Color(1f, 0f, 0f, 0.37254903f);
for (;;)
{
this.FullScreen.enabled = !this.FullScreen.enabled;
SoundManager.Instance.PlaySound(this.SabotageSound, false, 1f);
yield return wait;
}
yield break;
}
public IEnumerator CoShowIntro(List<PlayerControl> yourTeam)
{
DestroyableSingleton<HudManager>.Instance.FullScreen.transform.localPosition = new Vector3(0f, 0f, -250f);
yield return DestroyableSingleton<HudManager>.Instance.ShowEmblem(true);
IntroCutscene introCutscene = UnityEngine.Object.Instantiate<IntroCutscene>(this.IntroPrefab, base.transform);
yield return introCutscene.CoBegin(yourTeam, PlayerControl.LocalPlayer.Data.IsImpostor);
PlayerControl.LocalPlayer.SetKillTimer(10f);
((SabotageSystemType)ShipStatus.Instance.Systems[SystemTypes.Sabotage]).ForceSabTime(10f);
yield return this.CoFadeFullScreen(Color.black, Color.clear, 0.2f);
DestroyableSingleton<HudManager>.Instance.FullScreen.transform.localPosition = new Vector3(0f, 0f, -500f);
yield break;
}
public void OpenMeetingRoom(PlayerControl reporter)
{
if (MeetingHud.Instance)
{
return;
}
Debug.Log("Opening meeting room: " + reporter);
ShipStatus.Instance.RepairSystem(SystemTypes.Reactor, PlayerControl.LocalPlayer, 16);
ShipStatus.Instance.RepairSystem(SystemTypes.LifeSupp, PlayerControl.LocalPlayer, 16);
MeetingHud.Instance = UnityEngine.Object.Instantiate<MeetingHud>(this.MeetingPrefab);
MeetingHud.Instance.ServerStart(reporter.PlayerId);
AmongUsClient.Instance.Spawn(MeetingHud.Instance, -2, SpawnFlags.None);
}
}
|