diff --git a/Content.Client/Chat/ChatBox.cs b/Content.Client/Chat/ChatBox.cs index 3ad087d1ae..87bbebba1b 100644 --- a/Content.Client/Chat/ChatBox.cs +++ b/Content.Client/Chat/ChatBox.cs @@ -43,6 +43,7 @@ namespace Content.Client.Chat AnchorLeft = 1.0f; AnchorRight = 1.0f;*/ + MouseFilter = MouseFilterMode.Stop; var outerVBox = new VBoxContainer(); diff --git a/Content.Client/Chat/ChatManager.cs b/Content.Client/Chat/ChatManager.cs index e0ee549fbd..a2a3e04ae7 100644 --- a/Content.Client/Chat/ChatManager.cs +++ b/Content.Client/Chat/ChatManager.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using Content.Client.Interfaces.Chat; using Content.Shared.Chat; using Robust.Client.Console; @@ -81,10 +81,7 @@ namespace Content.Client.Chat { _netManager.RegisterNetMessage(MsgChatMessage.NAME, _onChatMessage); - _speechBubbleRoot = new LayoutContainer - { - MouseFilter = Control.MouseFilterMode.Ignore - }; + _speechBubbleRoot = new LayoutContainer(); LayoutContainer.SetAnchorPreset(_speechBubbleRoot, LayoutContainer.LayoutPreset.Wide); _userInterfaceManager.StateRoot.AddChild(_speechBubbleRoot); _speechBubbleRoot.SetPositionFirst(); diff --git a/Content.Client/Chat/SpeechBubble.cs b/Content.Client/Chat/SpeechBubble.cs index 01453c12f0..2766ab1b0b 100644 --- a/Content.Client/Chat/SpeechBubble.cs +++ b/Content.Client/Chat/SpeechBubble.cs @@ -1,4 +1,4 @@ -using Content.Client.Interfaces.Chat; +using Content.Client.Interfaces.Chat; using Robust.Client.Interfaces.Graphics.ClientEye; using Robust.Client.UserInterface; using Robust.Client.UserInterface.Controls; @@ -44,14 +44,12 @@ namespace Content.Client.Chat _senderEntity = senderEntity; _eyeManager = eyeManager; - MouseFilter = MouseFilterMode.Ignore; // Use text clipping so new messages don't overlap old ones being pushed up. RectClipContent = true; var label = new RichTextLabel { MaxWidth = 256, - MouseFilter = MouseFilterMode.Ignore }; label.SetMessage(text); @@ -59,7 +57,6 @@ namespace Content.Client.Chat { StyleClasses = { "tooltipBox" }, Children = { label }, - MouseFilter = MouseFilterMode.Ignore, ModulateSelfOverride = Color.White.WithAlpha(0.75f) }; diff --git a/Content.Client/GameObjects/Components/Doors/AirlockVisualizer2D.cs b/Content.Client/GameObjects/Components/Doors/AirlockVisualizer2D.cs index 03f0af16c5..04597fc3f9 100644 --- a/Content.Client/GameObjects/Components/Doors/AirlockVisualizer2D.cs +++ b/Content.Client/GameObjects/Components/Doors/AirlockVisualizer2D.cs @@ -120,7 +120,6 @@ namespace Content.Client.GameObjects.Components.Doors { animPlayer.Play(OpenAnimation, AnimationKey); } - break; case DoorVisualState.Open: sprite.LayerSetState(DoorVisualLayers.Base, "open"); diff --git a/Content.Client/GameObjects/Components/Power/AutolatheVisualizer2D.cs b/Content.Client/GameObjects/Components/Power/AutolatheVisualizer2D.cs new file mode 100644 index 0000000000..6ad061678b --- /dev/null +++ b/Content.Client/GameObjects/Components/Power/AutolatheVisualizer2D.cs @@ -0,0 +1,107 @@ +using System; +using Content.Shared.GameObjects.Components.Power; +using Robust.Client.Animations; +using Robust.Client.GameObjects; +using Robust.Client.GameObjects.Components.Animations; +using Robust.Client.Interfaces.GameObjects.Components; +using Robust.Shared.Interfaces.GameObjects; +using YamlDotNet.RepresentationModel; + +namespace Content.Client.GameObjects.Components.Power +{ + public class AutolatheVisualizer2D : AppearanceVisualizer + { + private const string AnimationKey = "autolathe_animation"; + + private Animation _buildingAnimation; + private Animation _insertingMetalAnimation; + private Animation _insertingGlassAnimation; + + public override void LoadData(YamlMappingNode node) + { + base.LoadData(node); + + _buildingAnimation = PopulateAnimation("autolathe_building", "autolathe_building_unlit", 0.5f); + _insertingMetalAnimation = PopulateAnimation("autolathe_inserting_metal_plate", "autolathe_inserting_unlit", 0.9f); + _insertingGlassAnimation = PopulateAnimation("autolathe_inserting_glass_plate", "autolathe_inserting_unlit", 0.9f); + } + + private Animation PopulateAnimation(string sprite, string spriteUnlit, float length) + { + var animation = new Animation {Length = TimeSpan.FromSeconds(length)}; + + var flick = new AnimationTrackSpriteFlick(); + animation.AnimationTracks.Add(flick); + flick.LayerKey = AutolatheVisualLayers.Base; + flick.KeyFrames.Add(new AnimationTrackSpriteFlick.KeyFrame(sprite, 0f)); + + var flickUnlit = new AnimationTrackSpriteFlick(); + animation.AnimationTracks.Add(flickUnlit); + flickUnlit.LayerKey = AutolatheVisualLayers.BaseUnlit; + flickUnlit.KeyFrames.Add(new AnimationTrackSpriteFlick.KeyFrame(spriteUnlit, 0f)); + + return animation; + } + + public override void InitializeEntity(IEntity entity) + { + if (!entity.HasComponent()) + { + entity.AddComponent(); + } + } + + public override void OnChangeData(AppearanceComponent component) + { + base.OnChangeData(component); + + var sprite = component.Owner.GetComponent(); + var animPlayer = component.Owner.GetComponent(); + if (!component.TryGetData(PowerDeviceVisuals.VisualState, out LatheVisualState state)) + { + state = LatheVisualState.Idle; + } + + switch (state) + { + case LatheVisualState.Idle: + if (animPlayer.HasRunningAnimation(AnimationKey)) + { + animPlayer.Stop(AnimationKey); + } + + sprite.LayerSetState(AutolatheVisualLayers.Base, "autolathe"); + sprite.LayerSetState(AutolatheVisualLayers.BaseUnlit, "autolathe_unlit"); + break; + case LatheVisualState.Producing: + if (!animPlayer.HasRunningAnimation(AnimationKey)) + { + animPlayer.Play(_buildingAnimation, AnimationKey); + } + break; + case LatheVisualState.InsertingMetal: + if (!animPlayer.HasRunningAnimation(AnimationKey)) + { + animPlayer.Play(_insertingMetalAnimation, AnimationKey); + } + break; + case LatheVisualState.InsertingGlass: + if (!animPlayer.HasRunningAnimation(AnimationKey)) + { + animPlayer.Play(_insertingGlassAnimation, AnimationKey); + } + break; + default: + throw new ArgumentOutOfRangeException(); + } + + var glowingPartsVisible = !(component.TryGetData(PowerDeviceVisuals.Powered, out bool powered) && !powered); + sprite.LayerSetVisible(AutolatheVisualLayers.BaseUnlit, glowingPartsVisible); + } + public enum AutolatheVisualLayers + { + Base, + BaseUnlit + } + } +} diff --git a/Content.Client/GameObjects/Components/Power/ProtolatheVisualizer2D.cs b/Content.Client/GameObjects/Components/Power/ProtolatheVisualizer2D.cs new file mode 100644 index 0000000000..4547c1668c --- /dev/null +++ b/Content.Client/GameObjects/Components/Power/ProtolatheVisualizer2D.cs @@ -0,0 +1,104 @@ +using System; +using Content.Shared.GameObjects.Components.Power; +using Robust.Client.Animations; +using Robust.Client.GameObjects; +using Robust.Client.GameObjects.Components.Animations; +using Robust.Client.Interfaces.GameObjects.Components; +using Robust.Shared.Interfaces.GameObjects; +using YamlDotNet.RepresentationModel; + +namespace Content.Client.GameObjects.Components.Power +{ + public class ProtolatheVisualizer2D : AppearanceVisualizer + { + private const string AnimationKey = "protolathe_animation"; + + private Animation _buildingAnimation; + private Animation _insertingMetalAnimation; + private Animation _insertingGlassAnimation; + + public override void LoadData(YamlMappingNode node) + { + base.LoadData(node); + + _buildingAnimation = PopulateAnimation("protolathe_building", 0.9f); + _insertingMetalAnimation = PopulateAnimation("protolathe_metal", 0.9f); + _insertingGlassAnimation = PopulateAnimation("protolathe_glass", 0.9f); + } + + private Animation PopulateAnimation(string sprite, float length) + { + var animation = new Animation {Length = TimeSpan.FromSeconds(length)}; + + var flick = new AnimationTrackSpriteFlick(); + animation.AnimationTracks.Add(flick); + flick.LayerKey = ProtolatheVisualLayers.AnimationLayer; + flick.KeyFrames.Add(new AnimationTrackSpriteFlick.KeyFrame(sprite, 0f)); + + return animation; + } + + public override void InitializeEntity(IEntity entity) + { + if (!entity.HasComponent()) + { + entity.AddComponent(); + } + } + + public override void OnChangeData(AppearanceComponent component) + { + base.OnChangeData(component); + + var sprite = component.Owner.GetComponent(); + var animPlayer = component.Owner.GetComponent(); + if (!component.TryGetData(PowerDeviceVisuals.VisualState, out LatheVisualState state)) + { + state = LatheVisualState.Idle; + } + sprite.LayerSetVisible(ProtolatheVisualLayers.AnimationLayer, true); + switch (state) + { + case LatheVisualState.Idle: + if (animPlayer.HasRunningAnimation(AnimationKey)) + { + animPlayer.Stop(AnimationKey); + } + + sprite.LayerSetState(ProtolatheVisualLayers.Base, "protolathe"); + sprite.LayerSetState(ProtolatheVisualLayers.BaseUnlit, "protolathe_unlit"); + sprite.LayerSetVisible(ProtolatheVisualLayers.AnimationLayer, false); + break; + case LatheVisualState.Producing: + if (!animPlayer.HasRunningAnimation(AnimationKey)) + { + animPlayer.Play(_buildingAnimation, AnimationKey); + } + break; + case LatheVisualState.InsertingMetal: + if (!animPlayer.HasRunningAnimation(AnimationKey)) + { + animPlayer.Play(_insertingMetalAnimation, AnimationKey); + } + break; + case LatheVisualState.InsertingGlass: + if (!animPlayer.HasRunningAnimation(AnimationKey)) + { + animPlayer.Play(_insertingGlassAnimation, AnimationKey); + } + break; + default: + throw new ArgumentOutOfRangeException(); + } + + var glowingPartsVisible = !(component.TryGetData(PowerDeviceVisuals.Powered, out bool powered) && !powered); + sprite.LayerSetVisible(ProtolatheVisualLayers.BaseUnlit, glowingPartsVisible); + } + public enum ProtolatheVisualLayers + { + Base, + BaseUnlit, + AnimationLayer + } + } +} diff --git a/Content.Client/GameObjects/Components/Storage/ClientStorageComponent.cs b/Content.Client/GameObjects/Components/Storage/ClientStorageComponent.cs index a1491a0a7a..f66c6c7751 100644 --- a/Content.Client/GameObjects/Components/Storage/ClientStorageComponent.cs +++ b/Content.Client/GameObjects/Components/Storage/ClientStorageComponent.cs @@ -242,23 +242,22 @@ namespace Content.Client.GameObjects.Components.Storage }; AddChild(ActualButton); - var hBoxContainer = new HBoxContainer {MouseFilter = MouseFilterMode.Ignore}; + var hBoxContainer = new HBoxContainer(); EntitySpriteView = new SpriteView { - CustomMinimumSize = new Vector2(32.0f, 32.0f), MouseFilter = MouseFilterMode.Ignore + CustomMinimumSize = new Vector2(32.0f, 32.0f) }; EntityName = new Label { SizeFlagsVertical = SizeFlags.ShrinkCenter, Text = "Backpack", - MouseFilter = MouseFilterMode.Ignore }; hBoxContainer.AddChild(EntitySpriteView); hBoxContainer.AddChild(EntityName); EntityControl = new Control { - SizeFlagsHorizontal = SizeFlags.FillExpand, MouseFilter = MouseFilterMode.Ignore + SizeFlagsHorizontal = SizeFlags.FillExpand }; EntitySize = new Label { diff --git a/Content.Client/GameObjects/EntitySystems/VerbSystem.cs b/Content.Client/GameObjects/EntitySystems/VerbSystem.cs index 832ea53501..c88bf50150 100644 --- a/Content.Client/GameObjects/EntitySystems/VerbSystem.cs +++ b/Content.Client/GameObjects/EntitySystems/VerbSystem.cs @@ -121,7 +121,7 @@ namespace Content.Client.GameObjects.EntitySystems DebugTools.AssertNotNull(_currentPopup); - var buttons = new List