-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Added a warning view to display whenever the game is outdated or the system isn't connected to internet - Other things, I dunno
- Loading branch information
1 parent
20bec34
commit e5d1a11
Showing
4 changed files
with
116 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
using System.Text; | ||
using ComputerInterface.ViewLib; | ||
|
||
namespace ComputerInterface.Views | ||
{ | ||
internal class WarnView : ComputerView | ||
{ | ||
internal static WarnInfo _currentWarn; | ||
|
||
public override void OnShow(object[] args) | ||
{ | ||
base.OnShow(args); | ||
|
||
_currentWarn = (WarnInfo)args[0]; // No way I'm actually using these arguments | ||
Redraw(); | ||
} | ||
|
||
public void Redraw() | ||
{ | ||
StringBuilder str = new StringBuilder(); | ||
str.BeginColor("ffffff50").Append("== ").EndColor(); | ||
str.Append("Warning").BeginColor("ffffff50").Append(" ==").EndColor().AppendLines(2); | ||
|
||
switch (_currentWarn._warnType) | ||
{ | ||
case WarnType.General: | ||
str.AppendLine("Gorilla Tag has thrown a warning:").AppendLine(); | ||
str.Append(_currentWarn._warnParams[0]); | ||
break; | ||
case WarnType.Outdated: | ||
str.AppendLine("You aren't on the latest version of Gorilla Tag, please update your game to continue playing with others."); | ||
break; | ||
case WarnType.NoInternet: | ||
str.AppendLine("You aren't connected to an internet connection, please connect to a valid connection to continue playing with others."); | ||
break; | ||
case WarnType.TemporaryBan: | ||
str.AppendLine($"You have been temporarily banned. You will not be able to play with others until the ban expires."); | ||
str.Append("Reason: ").Append(_currentWarn._warnParams[0]).AppendLine(); | ||
str.Append("Hours remaining: ").Append(_currentWarn._warnParams[1]); | ||
break; | ||
case WarnType.PermanentBan: | ||
str.AppendLine($"You have been permanently banned."); | ||
str.Append("Reason: ").Append(_currentWarn._warnParams[0]); | ||
break; | ||
} | ||
|
||
Text = str.ToString(); | ||
} | ||
|
||
public override void OnKeyPressed(EKeyboardKey key) | ||
{ | ||
if (key != EKeyboardKey.Back) return; | ||
ReturnToMainMenu(); | ||
} | ||
} | ||
|
||
internal struct WarnInfo | ||
{ | ||
public WarnType _warnType; | ||
public object[] _warnParams; | ||
} | ||
|
||
internal enum WarnType | ||
{ | ||
General, | ||
Outdated, | ||
NoInternet, | ||
TemporaryBan, | ||
PermanentBan | ||
} | ||
} |