mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-15 11:40:52 +01:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f8cb1729a3 | ||
|
|
fd9d5c8aa8 | ||
|
|
4677296934 | ||
|
|
708f5dd376 | ||
|
|
4a06acda32 | ||
|
|
e7beb2032b | ||
|
|
c7bd75f800 |
@@ -1,4 +1,4 @@
|
||||
<Project>
|
||||
|
||||
<!-- This file automatically reset by Tools/version.py -->
|
||||
|
||||
<Project>
|
||||
<!-- This file automatically reset by Tools/version.py -->
|
||||
<PropertyGroup><Version>210.1.0</Version></PropertyGroup>
|
||||
</Project>
|
||||
|
||||
@@ -54,6 +54,24 @@ END TEMPLATE-->
|
||||
*None yet*
|
||||
|
||||
|
||||
## 210.1.0
|
||||
|
||||
### New features
|
||||
|
||||
* `NetUserId` implements `ISelfSerialize` so can be used in data fields.
|
||||
* `ButtonGroup.IsNoneSetAllowed` to allow a button group to have no buttons pressed by default.
|
||||
|
||||
|
||||
## 210.0.3
|
||||
|
||||
|
||||
## 210.0.2
|
||||
|
||||
### Bugfixes
|
||||
|
||||
* Revert changes to `TextureRect` too.
|
||||
|
||||
|
||||
## 210.0.1
|
||||
|
||||
### Bugfixes
|
||||
|
||||
@@ -114,7 +114,7 @@ internal sealed partial class MidiManager : IMidiManager
|
||||
"/usr/share/sounds/sf2/TimGM6mb.sf2",
|
||||
};
|
||||
|
||||
private const string WindowsSoundfont = @"C:\WINDOWS\system32\drivers\gm.dls";
|
||||
private static readonly string WindowsSoundfont = $@"{Environment.GetEnvironmentVariable("SystemRoot")}\system32\drivers\gm.dls";
|
||||
|
||||
private const string OsxSoundfont =
|
||||
"/System/Library/Components/CoreAudio.component/Contents/Resources/gs_instruments.dls";
|
||||
|
||||
@@ -53,8 +53,17 @@ namespace Robust.Client.UserInterface.Controls
|
||||
value.InternalButtons.Add(this);
|
||||
ToggleMode = true;
|
||||
|
||||
// Set us to pressed if we're the first button. Doesn't go through the setter to avoid setting off our own error check.
|
||||
_pressed = value.InternalButtons.Count == 1;
|
||||
if (value.IsNoneSetAllowed)
|
||||
{
|
||||
// Still UNPRESS if there's another pressed button, but don't PRESS it otherwise.
|
||||
if (value.Pressed != this)
|
||||
_pressed = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Set us to pressed if we're the first button. Doesn't go through the setter to avoid setting off our own error check.
|
||||
_pressed = value.InternalButtons.Count == 1;
|
||||
}
|
||||
DrawModeChanged();
|
||||
}
|
||||
}
|
||||
@@ -99,7 +108,7 @@ namespace Robust.Client.UserInterface.Controls
|
||||
return;
|
||||
}
|
||||
|
||||
if (!value && Group != null)
|
||||
if (!value && Group is { IsNoneSetAllowed: false })
|
||||
{
|
||||
throw new InvalidOperationException("Cannot directly unset a grouped button. Set another button in the group instead.");
|
||||
}
|
||||
@@ -444,6 +453,26 @@ namespace Robust.Client.UserInterface.Controls
|
||||
/// </remarks>
|
||||
public sealed class ButtonGroup
|
||||
{
|
||||
/// <summary>
|
||||
/// Whether it is legal for this button group to have no selected button.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// If true, it's legal for no button in the group to be active.
|
||||
/// This is then the initial state of a new group of buttons (no button is automatically selected),
|
||||
/// and it becomes legal to manually clear the active button through code.
|
||||
/// The user cannot manually unselect the active button regardless, only by selecting a difference button.
|
||||
/// </remarks>
|
||||
public bool IsNoneSetAllowed { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Create a new <see cref="ButtonGroup"/>
|
||||
/// </summary>
|
||||
/// <param name="isNoneSetAllowed">The value of <see cref="IsNoneSetAllowed"/> on the new button group.</param>
|
||||
public ButtonGroup(bool isNoneSetAllowed = false)
|
||||
{
|
||||
IsNoneSetAllowed = isNoneSetAllowed;
|
||||
}
|
||||
|
||||
internal readonly List<BaseButton> InternalButtons = new();
|
||||
public IReadOnlyList<BaseButton> Buttons => InternalButtons;
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ using Robust.Shared.Serialization;
|
||||
namespace Robust.Shared.Network
|
||||
{
|
||||
[Serializable, NetSerializable]
|
||||
public struct NetUserId : IEquatable<NetUserId>
|
||||
public struct NetUserId : IEquatable<NetUserId>, ISelfSerialize
|
||||
{
|
||||
public readonly Guid UserId;
|
||||
|
||||
@@ -32,5 +32,15 @@ namespace Robust.Shared.Network
|
||||
|
||||
public static implicit operator Guid(NetUserId id) => id.UserId;
|
||||
public static explicit operator NetUserId(Guid id) => new(id);
|
||||
|
||||
void ISelfSerialize.Deserialize(string value)
|
||||
{
|
||||
this = (NetUserId) Guid.Parse(value);
|
||||
}
|
||||
|
||||
string ISelfSerialize.Serialize()
|
||||
{
|
||||
return ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user