Merge branch 'master' into xamlui
This commit is contained in:
@@ -19,7 +19,7 @@ namespace Content.Client.GameObjects.Components.Body.Surgery
|
||||
|
||||
public SurgeryWindow()
|
||||
{
|
||||
Title = Loc.GetString("Select surgery target...");
|
||||
Title = Loc.GetString("Surgery");
|
||||
RectClipContent = true;
|
||||
|
||||
var vSplitContainer = new VBoxContainer
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Content.Shared.GameObjects.Components.Buckle;
|
||||
using Content.Shared.GameObjects.Components.Buckle;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
@@ -27,6 +27,8 @@ namespace Content.Client.GameObjects.Components.Buckle
|
||||
}
|
||||
|
||||
_buckled = buckle.Buckled;
|
||||
LastEntityBuckledTo = buckle.LastEntityBuckledTo;
|
||||
DontCollide = buckle.DontCollide;
|
||||
|
||||
if (!Owner.TryGetComponent(out SpriteComponent ownerSprite))
|
||||
{
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace Content.Client.GameObjects.Components
|
||||
|
||||
var localPos = Owner.Transform.InvWorldMatrix.Transform(worldPos);
|
||||
|
||||
var worldRotation = Owner.Transform.WorldRotation;
|
||||
var worldRotation = new Angle(Owner.Transform.WorldRotation - sprite.Rotation);
|
||||
if (sprite.Directional)
|
||||
{
|
||||
localPos = new Angle(worldRotation).RotateVec(localPos);
|
||||
|
||||
@@ -52,6 +52,8 @@ namespace Content.Client.GameObjects.Components.Instruments
|
||||
|
||||
private bool _allowProgramChange;
|
||||
|
||||
private bool _respectMidiLimits;
|
||||
|
||||
/// <summary>
|
||||
/// A queue of MidiEvents to be sent to the server.
|
||||
/// </summary>
|
||||
@@ -239,6 +241,7 @@ namespace Content.Client.GameObjects.Components.Instruments
|
||||
serializer.DataField(ref _instrumentBank, "bank", (byte) 0);
|
||||
serializer.DataField(ref _allowPercussion, "allowPercussion", false);
|
||||
serializer.DataField(ref _allowProgramChange, "allowProgramChange", false);
|
||||
serializer.DataField(ref _respectMidiLimits, "respectMidiLimits", true);
|
||||
}
|
||||
|
||||
public override void HandleNetworkMessage(ComponentMessage message, INetChannel channel, ICommonSession? session = null)
|
||||
@@ -429,7 +432,9 @@ namespace Content.Client.GameObjects.Components.Instruments
|
||||
|
||||
if (_midiEventBuffer.Count == 0) return;
|
||||
|
||||
var max = Math.Min(_instrumentSystem.MaxMidiEventsPerBatch, _instrumentSystem.MaxMidiEventsPerSecond - _sentWithinASec);
|
||||
var max = _respectMidiLimits ?
|
||||
Math.Min(_instrumentSystem.MaxMidiEventsPerBatch, _instrumentSystem.MaxMidiEventsPerSecond - _sentWithinASec)
|
||||
: _midiEventBuffer.Count;
|
||||
|
||||
if (max <= 0)
|
||||
{
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace Content.Client.GameObjects.Components.Items
|
||||
return Hands.FirstOrDefault(hand => hand.Name == name);
|
||||
}
|
||||
|
||||
private bool TryHand(string name, [MaybeNullWhen(false)] out Hand hand)
|
||||
private bool TryHand(string name, [NotNullWhen(true)] out Hand? hand)
|
||||
{
|
||||
return (hand = GetHand(name)) != null;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Content.Client
|
||||
namespace Content.Client
|
||||
{
|
||||
public static class IgnoredComponents
|
||||
{
|
||||
@@ -225,7 +225,10 @@
|
||||
"MachineFrame",
|
||||
"MachineBoard",
|
||||
"ChemicalAmmo",
|
||||
"BiologicalSurgeryData"
|
||||
"BiologicalSurgeryData",
|
||||
"CargoTelepad",
|
||||
"TraitorDeathMatchRedemption",
|
||||
"GlassBeaker"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,7 +109,8 @@ namespace Content.Client.UserInterface.Cargo
|
||||
var buttons = new HBoxContainer();
|
||||
CallShuttleButton = new Button()
|
||||
{
|
||||
Text = Loc.GetString("Call Shuttle"),
|
||||
//Text = Loc.GetString("Call Shuttle"),
|
||||
Text = Loc.GetString("Activate Telepad"), //Shuttle code pending
|
||||
TextAlign = Label.AlignMode.Center,
|
||||
SizeFlagsHorizontal = SizeFlags.FillExpand
|
||||
};
|
||||
|
||||
@@ -43,8 +43,11 @@ namespace Content.Client.UserInterface
|
||||
private readonly Button _sexClassifiedButton;
|
||||
private readonly HairStylePicker _hairPicker;
|
||||
private readonly FacialHairStylePicker _facialHairPicker;
|
||||
|
||||
private readonly List<JobPrioritySelector> _jobPriorities;
|
||||
private readonly OptionButton _preferenceUnavailableButton;
|
||||
private readonly Dictionary<string, VBoxContainer> _jobCategories;
|
||||
|
||||
private readonly List<AntagPreferenceSelector> _antagPreferences;
|
||||
|
||||
private readonly IEntity _previewDummy;
|
||||
@@ -313,31 +316,79 @@ namespace Content.Client.UserInterface
|
||||
};
|
||||
|
||||
_jobPriorities = new List<JobPrioritySelector>();
|
||||
_jobCategories = new Dictionary<string, VBoxContainer>();
|
||||
|
||||
var firstCategory = true;
|
||||
|
||||
foreach (var job in prototypeManager.EnumeratePrototypes<JobPrototype>().OrderBy(j => j.Name))
|
||||
{
|
||||
var selector = new JobPrioritySelector(job);
|
||||
jobList.AddChild(selector);
|
||||
_jobPriorities.Add(selector);
|
||||
|
||||
selector.PriorityChanged += priority =>
|
||||
foreach (var department in job.Departments)
|
||||
{
|
||||
Profile = Profile.WithJobPriority(job.ID, priority);
|
||||
IsDirty = true;
|
||||
|
||||
if (priority == JobPriority.High)
|
||||
if (!_jobCategories.TryGetValue(department, out var category))
|
||||
{
|
||||
// Lower any other high priorities to medium.
|
||||
category = new VBoxContainer
|
||||
{
|
||||
Name = department,
|
||||
ToolTip = Loc.GetString("Jobs in the {0} department", department)
|
||||
};
|
||||
|
||||
if (firstCategory)
|
||||
{
|
||||
firstCategory = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
category.AddChild(new Control
|
||||
{
|
||||
CustomMinimumSize = new Vector2(0, 23),
|
||||
});
|
||||
}
|
||||
|
||||
category.AddChild(new PanelContainer
|
||||
{
|
||||
PanelOverride = new StyleBoxFlat {BackgroundColor = Color.FromHex("#464966")},
|
||||
Children =
|
||||
{
|
||||
new Label
|
||||
{
|
||||
Text = Loc.GetString("{0} jobs", department)
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
_jobCategories[department] = category;
|
||||
jobList.AddChild(category);
|
||||
}
|
||||
|
||||
var selector = new JobPrioritySelector(job);
|
||||
category.AddChild(selector);
|
||||
_jobPriorities.Add(selector);
|
||||
|
||||
selector.PriorityChanged += priority =>
|
||||
{
|
||||
Profile = Profile.WithJobPriority(job.ID, priority);
|
||||
IsDirty = true;
|
||||
|
||||
foreach (var jobSelector in _jobPriorities)
|
||||
{
|
||||
if (jobSelector != selector && jobSelector.Priority == JobPriority.High)
|
||||
// Sync other selectors with the same job in case of multiple department jobs
|
||||
if (jobSelector.Job == selector.Job)
|
||||
{
|
||||
jobSelector.Priority = JobPriority.Medium;
|
||||
Profile = Profile.WithJobPriority(jobSelector.Job.ID, JobPriority.Medium);
|
||||
jobSelector.Priority = priority;
|
||||
}
|
||||
|
||||
// Lower any other high priorities to medium.
|
||||
if (priority == JobPriority.High)
|
||||
{
|
||||
if (jobSelector.Job != selector.Job && jobSelector.Priority == JobPriority.High)
|
||||
{
|
||||
jobSelector.Priority = JobPriority.Medium;
|
||||
Profile = Profile.WithJobPriority(jobSelector.Job.ID, JobPriority.Medium);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -452,7 +503,7 @@ namespace Content.Client.UserInterface
|
||||
SizeFlagsHorizontal = SizeFlags.FillExpand,
|
||||
};
|
||||
hbox.AddChild(vBox);
|
||||
|
||||
|
||||
#region Preview
|
||||
|
||||
_previewDummy = entityManager.SpawnEntity("HumanMob_Dummy", MapCoordinates.Nullspace);
|
||||
@@ -495,7 +546,7 @@ namespace Content.Client.UserInterface
|
||||
box.AddChild(_previewSpriteSide);
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
if (preferencesManager.ServerDataLoaded)
|
||||
|
||||
@@ -4,6 +4,8 @@ using System.Linq;
|
||||
using Content.Client.Interfaces;
|
||||
using Content.Shared.Roles;
|
||||
using Robust.Client.Console;
|
||||
using Robust.Client.Graphics.Drawing;
|
||||
using Robust.Client.UserInterface;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Client.UserInterface.CustomControls;
|
||||
using Robust.Client.Utility;
|
||||
@@ -27,6 +29,7 @@ namespace Content.Client.UserInterface
|
||||
public event Action<string> SelectedId;
|
||||
|
||||
private readonly Dictionary<string, JobButton> _jobButtons = new();
|
||||
private readonly Dictionary<string, VBoxContainer> _jobCategories = new();
|
||||
|
||||
public LateJoinGui()
|
||||
{
|
||||
@@ -37,65 +40,108 @@ namespace Content.Client.UserInterface
|
||||
var jobList = new VBoxContainer();
|
||||
var vBox = new VBoxContainer
|
||||
{
|
||||
Children =
|
||||
Children =
|
||||
{
|
||||
new ScrollContainer
|
||||
{
|
||||
new ScrollContainer
|
||||
SizeFlagsVertical = SizeFlags.FillExpand,
|
||||
Children =
|
||||
{
|
||||
SizeFlagsVertical = SizeFlags.FillExpand,
|
||||
Children =
|
||||
{
|
||||
jobList
|
||||
}
|
||||
jobList
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
Contents.AddChild(vBox);
|
||||
|
||||
var firstCategory = true;
|
||||
|
||||
foreach (var job in _prototypeManager.EnumeratePrototypes<JobPrototype>().OrderBy(j => j.Name))
|
||||
{
|
||||
var jobButton = new JobButton
|
||||
foreach (var department in job.Departments)
|
||||
{
|
||||
JobId = job.ID
|
||||
};
|
||||
if (!_jobCategories.TryGetValue(department, out var category))
|
||||
{
|
||||
category = new VBoxContainer
|
||||
{
|
||||
Name = department,
|
||||
ToolTip = Loc.GetString("Jobs in the {0} department", department)
|
||||
};
|
||||
|
||||
var jobSelector = new HBoxContainer
|
||||
{
|
||||
SizeFlagsHorizontal = SizeFlags.FillExpand
|
||||
};
|
||||
if (firstCategory)
|
||||
{
|
||||
firstCategory = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
category.AddChild(new Control
|
||||
{
|
||||
CustomMinimumSize = new Vector2(0, 23),
|
||||
});
|
||||
}
|
||||
|
||||
var icon = new TextureRect
|
||||
{
|
||||
TextureScale = (2, 2),
|
||||
Stretch = TextureRect.StretchMode.KeepCentered
|
||||
};
|
||||
category.AddChild(new PanelContainer
|
||||
{
|
||||
PanelOverride = new StyleBoxFlat {BackgroundColor = Color.FromHex("#464966")},
|
||||
Children =
|
||||
{
|
||||
new Label
|
||||
{
|
||||
Text = Loc.GetString("{0} jobs", department)
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (job.Icon != null)
|
||||
{
|
||||
var specifier = new SpriteSpecifier.Rsi(new ResourcePath("/Textures/Interface/Misc/job_icons.rsi"), job.Icon);
|
||||
icon.Texture = specifier.Frame0();
|
||||
_jobCategories[department] = category;
|
||||
jobList.AddChild(category);
|
||||
}
|
||||
|
||||
var jobButton = new JobButton
|
||||
{
|
||||
JobId = job.ID
|
||||
};
|
||||
|
||||
var jobSelector = new HBoxContainer
|
||||
{
|
||||
SizeFlagsHorizontal = SizeFlags.FillExpand
|
||||
};
|
||||
|
||||
var icon = new TextureRect
|
||||
{
|
||||
TextureScale = (2, 2),
|
||||
Stretch = TextureRect.StretchMode.KeepCentered
|
||||
};
|
||||
|
||||
if (job.Icon != null)
|
||||
{
|
||||
var specifier = new SpriteSpecifier.Rsi(new ResourcePath("/Textures/Interface/Misc/job_icons.rsi"), job.Icon);
|
||||
icon.Texture = specifier.Frame0();
|
||||
}
|
||||
|
||||
jobSelector.AddChild(icon);
|
||||
|
||||
var jobLabel = new Label
|
||||
{
|
||||
Text = job.Name
|
||||
};
|
||||
|
||||
jobSelector.AddChild(jobLabel);
|
||||
jobButton.AddChild(jobSelector);
|
||||
category.AddChild(jobButton);
|
||||
|
||||
jobButton.OnPressed += _ =>
|
||||
{
|
||||
SelectedId?.Invoke(jobButton.JobId);
|
||||
};
|
||||
|
||||
if (!_gameTicker.JobsAvailable.Contains(job.ID))
|
||||
{
|
||||
jobButton.Disabled = true;
|
||||
}
|
||||
|
||||
_jobButtons[job.ID] = jobButton;
|
||||
}
|
||||
jobSelector.AddChild(icon);
|
||||
|
||||
var jobLabel = new Label
|
||||
{
|
||||
Text = job.Name
|
||||
};
|
||||
|
||||
jobSelector.AddChild(jobLabel);
|
||||
|
||||
jobButton.AddChild(jobSelector);
|
||||
jobList.AddChild(jobButton);
|
||||
jobButton.OnPressed += args =>
|
||||
{
|
||||
SelectedId?.Invoke(jobButton.JobId);
|
||||
};
|
||||
|
||||
if (!_gameTicker.JobsAvailable.Contains(job.ID))
|
||||
{
|
||||
jobButton.Disabled = true;
|
||||
}
|
||||
|
||||
_jobButtons[job.ID] = jobButton;
|
||||
}
|
||||
|
||||
SelectedId += jobId =>
|
||||
@@ -108,11 +154,6 @@ namespace Content.Client.UserInterface
|
||||
_gameTicker.LobbyJobsAvailableUpdated += JobsAvailableUpdated;
|
||||
}
|
||||
|
||||
public string ReturnId()
|
||||
{
|
||||
return SelectedId.ToString();
|
||||
}
|
||||
|
||||
private void JobsAvailableUpdated(IReadOnlyList<string> jobs)
|
||||
{
|
||||
foreach (var (id, button) in _jobButtons)
|
||||
@@ -129,6 +170,7 @@ namespace Content.Client.UserInterface
|
||||
{
|
||||
_gameTicker.LobbyJobsAvailableUpdated -= JobsAvailableUpdated;
|
||||
_jobButtons.Clear();
|
||||
_jobCategories.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user