ok final actions fixes fr this time (#21683)

This commit is contained in:
Nemanja
2023-11-16 00:12:47 -05:00
committed by GitHub
parent ca8d53b4e5
commit de5319737e
4 changed files with 19 additions and 8 deletions

View File

@@ -16,10 +16,12 @@
<controls:RecordedSplitContainer Name="ScreenContainer" HorizontalExpand="True" VerticalExpand="True" SplitWidth="0" StretchDirection="TopLeft">
<LayoutContainer Name="ViewportContainer" HorizontalExpand="True" VerticalExpand="True">
<controls:MainViewport Name="MainViewport"/>
<BoxContainer Name="VoteMenu" Access="Public" Orientation="Vertical"/>
<widgets:GhostGui Name="Ghost" Access="Protected" />
<hotbar:HotbarGui Name="Hotbar" Access="Protected" />
<actions:ActionsBar Name="Actions" Access="Protected" />
<BoxContainer Name="TopLeftContainer" Orientation="Vertical">
<actions:ActionsBar Name="Actions" Access="Protected" />
<BoxContainer Name="VoteMenu" Access="Public" Orientation="Vertical"/>
</BoxContainer>
<alerts:AlertsUI Name="Alerts" Access="Protected" />
</LayoutContainer>
<PanelContainer HorizontalExpand="True" MinWidth="300">

View File

@@ -18,8 +18,7 @@ public sealed partial class SeparatedChatGameScreen : InGameScreen
SetAnchorPreset(ScreenContainer, LayoutPreset.Wide);
SetAnchorPreset(ViewportContainer, LayoutPreset.Wide);
SetAnchorPreset(MainViewport, LayoutPreset.Wide);
SetAnchorAndMarginPreset(VoteMenu, LayoutPreset.TopLeft, margin: 10);
SetAnchorAndMarginPreset(Actions, LayoutPreset.TopLeft, margin: 10);
SetAnchorAndMarginPreset(TopLeftContainer, LayoutPreset.TopLeft, margin: 10);
SetAnchorAndMarginPreset(Ghost, LayoutPreset.BottomWide, margin: 80);
SetAnchorAndMarginPreset(Hotbar, LayoutPreset.BottomWide, margin: 5);
SetAnchorAndMarginPreset(Alerts, LayoutPreset.CenterRight, margin: 10);

View File

@@ -752,6 +752,12 @@ public sealed class ActionUIController : UIController, IOnStateChanged<GameplayS
public void RegisterActionContainer(ActionButtonContainer container)
{
if (_container != null)
{
_container.ActionPressed -= OnActionPressed;
_container.ActionUnpressed -= OnActionUnpressed;
}
_container = container;
_container.ActionPressed += OnActionPressed;
_container.ActionUnpressed += OnActionUnpressed;

View File

@@ -283,13 +283,15 @@ public sealed class ActionButton : Control, IEntityControl
public void UpdateBackground()
{
if (_action == null)
_controller ??= UserInterfaceManager.GetUIController<ActionUIController>();
if (_action != null ||
_controller.IsDragging && GetPositionInParent() == Parent?.ChildCount - 1)
{
Button.Texture = null;
Button.Texture = _buttonBackgroundTexture;
}
else
{
Button.Texture = _buttonBackgroundTexture;
Button.Texture = null;
}
}
@@ -326,6 +328,8 @@ public sealed class ActionButton : Control, IEntityControl
{
base.FrameUpdate(args);
UpdateBackground();
Cooldown.Visible = _action != null && _action.Cooldown != null;
if (_action == null)
return;
@@ -397,7 +401,7 @@ public sealed class ActionButton : Control, IEntityControl
// it's only depress-able if it's usable, so if we're depressed
// show the depressed style
if (_depressed)
if (_depressed && !_beingHovered)
{
HighlightRect.Visible = false;
SetOnlyStylePseudoClass(ContainerButton.StylePseudoClassPressed);