- add: More controls

This commit is contained in:
2024-02-17 19:03:07 +03:00
parent c3e8e64fb8
commit 6019195779
20 changed files with 808 additions and 4525 deletions

View File

@@ -46,9 +46,9 @@ public sealed class HoleSystem : SharedHoleSystem
}
}
private void UpdateVisual(Entity<SpriteComponent?,HumanoidAppearanceComponent?> owner, Entity<HoleComponent?> entity, bool clear = false)
private void UpdateVisual(Entity<SpriteComponent?,HumanoidAppearanceComponent?,HoleContainerComponent?> owner, Entity<HoleComponent?> entity, bool clear = false)
{
if(!Resolve(owner.Owner,ref owner.Comp1) || !Resolve(entity.Owner,ref entity.Comp))
if(!Resolve(owner.Owner,ref owner.Comp1, ref owner.Comp3) || !Resolve(entity.Owner,ref entity.Comp))
return;
var spriteComp = owner.Comp1;
@@ -59,8 +59,11 @@ public sealed class HoleSystem : SharedHoleSystem
if (string.IsNullOrEmpty(layer.RsiPath))
layer.RsiPath = holeComp.RsiPath;
if(Resolve(owner.Owner,ref owner.Comp2))
if (Resolve(owner.Owner, ref owner.Comp2))
{
layer.Color ??= owner.Comp2.SkinColor;
layer.Color.Value.WithAlpha(owner.Comp2.SkinColor.A);
}
var state = layer.State;
@@ -84,20 +87,35 @@ public sealed class HoleSystem : SharedHoleSystem
continue;
}
layer.State = state + prefix.Prefix;
if (clear)
{
spriteComp.LayerSetVisible(@enum,false);
}
else
{
Log.Debug(@enum.ToString());
var s = "";
if (prefix.HasForHuman && owner.Comp3.UseHumanGenitalLayers)
s = "_s";
var mainPrefix = prefix.Prefix;
if (holeComp.IsExcited && !string.IsNullOrEmpty(prefix.ExcitedPrefix))
mainPrefix = prefix.ExcitedPrefix;
layer.State = state + s + mainPrefix;
spriteComp.LayerSetData(@enum, layer);
spriteComp.LayerSetVisible(@enum,true);
layer.State = state;
}
layer.State = state;
}
}
}
public override void Exide(Entity<HoleComponent?> entity, bool value = true)
{
base.Exide(entity, value);
var netEntity = entity.Comp!.Parent;
if (netEntity != null)
UpdateVisual(GetEntity(netEntity.Value), entity);
}
}

View File

@@ -2,7 +2,10 @@
xmlns="https://spacestation14.io"
xmlns:humanoidProfileEditorExt="clr-namespace:Content.Client._Amour.HumanoidProfileEditorExt">
<BoxContainer Orientation="Vertical">
<Label Text="{Loc 'genitals-group'}"/>
<BoxContainer>
<Label Text="{Loc 'genitals-group'}"/>
<CheckBox Text="{Loc 'genitals-exide'}" Name="Exide"/>
</BoxContainer>
<BoxContainer Name="Container" Orientation="Vertical"></BoxContainer>
</BoxContainer>
</humanoidProfileEditorExt:GenitalBoxView>

View File

@@ -1,5 +1,6 @@
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
namespace Content.Client._Amour.HumanoidProfileEditorExt;
@@ -10,6 +11,7 @@ public sealed partial class GenitalBoxView : Control
public GenitalBoxView()
{
RobustXamlLoader.Load(this);
}
public void AddChild(Control control)
@@ -21,5 +23,10 @@ public sealed partial class GenitalBoxView : Control
{
Container.RemoveAllChildren();
}
public void OnExide(Action<BaseButton.ButtonEventArgs> action)
{
Exide.OnPressed += action;
}
}

View File

@@ -1,16 +1,31 @@
using System.Linq;
using Content.Client._Amour.Hole;
using Content.Client._Amour.HumanoidProfileEditorExt;
using Content.Shared._Amour.Hole;
using Robust.Client.UserInterface.Controls;
namespace Content.Client.Preferences.UI;
public sealed partial class HumanoidProfileEditor
{
private Dictionary<string, Genital> _genitals = new();
private HoleSystem _holeSystem = default!;
private void InitializeGenitals()
{
_holeSystem = _entMan.System<HoleSystem>();
GenitalBoxView.OnExide(OnExide);
}
private void OnExide(BaseButton.ButtonEventArgs obj)
{
if (_entMan.TryGetComponent<HoleContainerComponent>(_previewDummy, out var component))
{
foreach (var entity in component.Slot.ContainedEntities)
{
_holeSystem.Exide(entity);
}
}
}
private void UpdateGenitalsControls()