blob: 6feeed5bad6cfc1c94ea3e5ce130e72a44886672 (
plain)
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
|
using System;
using InnerNet;
public class DisconnectPopup : DestroyableSingleton<DisconnectPopup>
{
public TextRenderer TextArea;
public void Start()
{
if (DestroyableSingleton<DisconnectPopup>.Instance == this)
{
this.Show();
}
}
public void Show()
{
base.gameObject.SetActive(true);
this.DoShow();
}
private void DoShow()
{
if (DestroyableSingleton<WaitForHostPopup>.InstanceExists)
{
DestroyableSingleton<WaitForHostPopup>.Instance.Hide();
}
if (!AmongUsClient.Instance)
{
base.gameObject.SetActive(false);
return;
}
string text = InnerNetClient.IntToGameName(AmongUsClient.Instance.GameId);
string str = (text != null) ? (" from " + text) : " from the room";
DisconnectReasons lastDisconnectReason = AmongUsClient.Instance.LastDisconnectReason;
switch (lastDisconnectReason)
{
case DisconnectReasons.ExitGame:
case DisconnectReasons.Destroy:
base.gameObject.SetActive(false);
break;
case DisconnectReasons.GameFull:
this.TextArea.Text = "The game you tried to join is full.\r\n\r\nCheck with the host to see if you can join next round.";
return;
case DisconnectReasons.GameStarted:
this.TextArea.Text = "The game you tried to join already started.\r\n\r\nCheck with the host to see if you can join next round.";
return;
case DisconnectReasons.GameNotFound:
case DisconnectReasons.IncorrectGame:
this.TextArea.Text = "Could not find the game you're looking for.";
return;
case (DisconnectReasons)4:
case (DisconnectReasons)9:
case (DisconnectReasons)10:
case (DisconnectReasons)11:
case (DisconnectReasons)12:
case (DisconnectReasons)13:
case (DisconnectReasons)14:
case (DisconnectReasons)15:
break;
case DisconnectReasons.IncorrectVersion:
this.TextArea.Text = "You are running an older version of the game.\r\n\r\nPlease update to play with others.";
return;
case DisconnectReasons.Banned:
this.TextArea.Text = "You were banned" + str + ".\r\n\r\nYou cannot rejoin that room.";
return;
case DisconnectReasons.Kicked:
this.TextArea.Text = "You were kicked" + str + ".\r\n\r\nYou can rejoin if the room hasn't started.";
return;
case DisconnectReasons.Custom:
this.TextArea.Text = (AmongUsClient.Instance.LastCustomDisconnect ?? "An unknown error disconnected you from the server.");
return;
case DisconnectReasons.Error:
if (AmongUsClient.Instance.GameMode == GameModes.OnlineGame)
{
this.TextArea.Text = "You disconnected from the server.\r\nIf this happens often, check your network strength.\r\nThis may also be a server issue.";
return;
}
this.TextArea.Text = "You disconnected from the host.\r\n\r\nIf this happens often, check your WiFi strength.";
return;
case DisconnectReasons.ServerRequest:
this.TextArea.Text = "The server stopped this game. Possibly due to inactivity.";
return;
case DisconnectReasons.ServerFull:
this.TextArea.Text = "The Among Us servers are overloaded.\r\n\r\nSorry! Please try again later!";
return;
default:
if (lastDisconnectReason == DisconnectReasons.IntentionalLeaving)
{
this.TextArea.Text = string.Format("You may not join another game for another {0} minutes after intentionally disconnecting.", StatsManager.Instance.BanMinutesLeft);
return;
}
if (lastDisconnectReason != DisconnectReasons.FocusLost)
{
return;
}
this.TextArea.Text = "You were disconnected because Among Us was suspended by another app.";
return;
}
}
public void ShowCustom(string message)
{
base.gameObject.SetActive(true);
this.TextArea.Text = message;
}
public void Close()
{
base.gameObject.SetActive(false);
}
}
|