-
Notifications
You must be signed in to change notification settings - Fork 369
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'Merge-master-1/10' of https://github.com/DebugOk/Delta-…
…v-rebase into Try-to-fix-the-mess-Colin-made
- Loading branch information
Showing
440 changed files
with
10,868 additions
and
10,624 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 was deleted.
Oops, something went wrong.
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
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,59 @@ | ||
using System.Threading; | ||
using Content.Client.Stylesheets; | ||
using Robust.Client.UserInterface.Controls; | ||
using Timer = Robust.Shared.Timing.Timer; | ||
|
||
namespace Content.Client.Administration.UI; | ||
|
||
public static class AdminUIHelpers | ||
{ | ||
private static void ResetButton(Button button, ConfirmationData data) | ||
{ | ||
data.Cancellation.Cancel(); | ||
button.ModulateSelfOverride = null; | ||
button.Text = data.OriginalText; | ||
} | ||
|
||
public static bool RemoveConfirm(Button button, Dictionary<Button, ConfirmationData> confirmations) | ||
{ | ||
if (confirmations.Remove(button, out var data)) | ||
{ | ||
ResetButton(button, data); | ||
return true; | ||
} | ||
|
||
return false; | ||
} | ||
|
||
public static void RemoveAllConfirms(Dictionary<Button, ConfirmationData> confirmations) | ||
{ | ||
foreach (var (button, confirmation) in confirmations) | ||
{ | ||
ResetButton(button, confirmation); | ||
} | ||
|
||
confirmations.Clear(); | ||
} | ||
|
||
public static bool TryConfirm(Button button, Dictionary<Button, ConfirmationData> confirmations) | ||
{ | ||
if (RemoveConfirm(button, confirmations)) | ||
return true; | ||
|
||
var data = new ConfirmationData(new CancellationTokenSource(), button.Text); | ||
confirmations[button] = data; | ||
|
||
Timer.Spawn(TimeSpan.FromSeconds(5), () => | ||
{ | ||
confirmations.Remove(button); | ||
button.ModulateSelfOverride = null; | ||
button.Text = data.OriginalText; | ||
}, data.Cancellation.Token); | ||
|
||
button.ModulateSelfOverride = StyleNano.ButtonColorCautionDefault; | ||
button.Text = Loc.GetString("admin-player-actions-confirm"); | ||
return false; | ||
} | ||
} | ||
|
||
public readonly record struct ConfirmationData(CancellationTokenSource Cancellation, string? OriginalText); |
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
Oops, something went wrong.