WPF layout (#3346)

This commit is contained in:
Pieter-Jan Briers
2021-02-21 12:38:56 +01:00
committed by GitHub
parent 33d6975c25
commit b898443f28
121 changed files with 1420 additions and 2069 deletions

View File

@@ -69,7 +69,7 @@ namespace Content.Client.GameObjects.EntitySystems.DoAfter
var doAfterBar = new DoAfterBar
{
SizeFlagsVertical = SizeFlags.ShrinkCenter
VerticalAlignment = VAlignment.Center
};
_doAfterBars[message.ID] = doAfterBar;
@@ -82,7 +82,7 @@ namespace Content.Client.GameObjects.EntitySystems.DoAfter
{
Texture = StaticIoC.ResC.GetTexture("/Textures/Interface/Misc/progress_bar.rsi/icon.png"),
TextureScale = Vector2.One * DoAfterBar.DoAfterBarScale,
SizeFlagsVertical = SizeFlags.ShrinkCenter,
VerticalAlignment = VAlignment.Center,
},
doAfterBar

View File

@@ -90,10 +90,11 @@ namespace Content.Client.GameObjects.EntitySystems
hBox.AddChild(new Label
{
Text = entity.Name,
SizeFlagsHorizontal = Control.SizeFlags.FillExpand,
HorizontalExpand = true,
});
var size = Vector2.ComponentMax((minWidth, 0), panel.CombinedMinimumSize);
panel.Measure(Vector2.Infinity);
var size = Vector2.ComponentMax((minWidth, 0), panel.DesiredSize);
_examineTooltipOpen.Open(UIBox2.FromDimensions(popupPos, size));

View File

@@ -26,14 +26,14 @@ namespace Content.Client.GameObjects.EntitySystems.HealthOverlay
CritBar = new HealthOverlayBar
{
Visible = false,
SizeFlagsVertical = SizeFlags.ShrinkCenter,
VerticalAlignment = VAlignment.Center,
Color = Color.Red
};
HealthBar = new HealthOverlayBar
{
Visible = false,
SizeFlagsVertical = SizeFlags.ShrinkCenter,
VerticalAlignment = VAlignment.Center,
Color = Color.Green
};
@@ -45,7 +45,7 @@ namespace Content.Client.GameObjects.EntitySystems.HealthOverlay
{
Texture = StaticIoC.ResC.GetTexture("/Textures/Interface/Misc/health_bar.rsi/icon.png"),
TextureScale = Vector2.One * HealthOverlayBar.HealthBarScale,
SizeFlagsVertical = SizeFlags.ShrinkCenter
VerticalAlignment = VAlignment.Center,
},
CritBar,
HealthBar

View File

@@ -164,7 +164,7 @@ namespace Content.Client.GameObjects.EntitySystems
{
_currentEntityList.List.AddChild(new PanelContainer
{
CustomMinimumSize = (0, 2),
MinSize = (0, 2),
PanelOverride = new StyleBoxFlat {BackgroundColor = Color.FromHex("#333")}
});
}
@@ -176,7 +176,8 @@ namespace Content.Client.GameObjects.EntitySystems
_userInterfaceManager.ModalRoot.AddChild(_currentEntityList);
var size = _currentEntityList.List.CombinedMinimumSize;
_currentEntityList.List.Measure(Vector2.Infinity);
var size = _currentEntityList.List.DesiredSize;
var box = UIBox2.FromDimensions(_userInterfaceManager.MousePositionScaled, size);
_currentEntityList.Open(box);
@@ -284,7 +285,7 @@ namespace Content.Client.GameObjects.EntitySystems
{
vBox.AddChild(new PanelContainer
{
CustomMinimumSize = (0, 2),
MinSize = (0, 2),
PanelOverride = new StyleBoxFlat {BackgroundColor = Color.FromHex("#333")}
});
}
@@ -306,7 +307,7 @@ namespace Content.Client.GameObjects.EntitySystems
{
vBox.AddChild(new PanelContainer
{
CustomMinimumSize = (0, 2),
MinSize = (0, 2),
PanelOverride = new StyleBoxFlat {BackgroundColor = Color.FromHex("#333")}
});
}
@@ -449,11 +450,11 @@ namespace Content.Client.GameObjects.EntitySystems
{
text = $"{text} ({entity.Uid})";
}
control.AddChild(new MarginContainer
control.AddChild(new Label
{
MarginLeftOverride = 4,
MarginRightOverride = 4,
Children = {new Label {Text = text}}
Margin = new Thickness(4, 0),
Text = text
});
AddChild(control);
@@ -486,7 +487,8 @@ namespace Content.Client.GameObjects.EntitySystems
var func = args.Function;
var funcId = _master._inputManager.NetworkBindMap.KeyFunctionID(args.Function);
var message = new FullInputCmdMessage(_master._gameTiming.CurTick, _master._gameTiming.TickFraction, funcId, BoundKeyState.Down,
var message = new FullInputCmdMessage(_master._gameTiming.CurTick, _master._gameTiming.TickFraction,
funcId, BoundKeyState.Down,
_entity.Transform.Coordinates,
args.PointerLocation, _entity.Uid);
@@ -546,12 +548,12 @@ namespace Content.Client.GameObjects.EntitySystems
{
(_icon = new TextureRect
{
CustomMinimumSize = (32, 32),
MinSize = (32, 32),
Stretch = TextureRect.StretchMode.KeepCentered
}),
(_label = new Label()),
// Padding
new Control {CustomMinimumSize = (8, 0)}
new Control {MinSize = (8, 0)}
}
});
}
@@ -603,17 +605,17 @@ namespace Content.Client.GameObjects.EntitySystems
{
(_icon = new TextureRect
{
CustomMinimumSize = (32, 32),
MinSize = (32, 32),
Stretch = TextureRect.StretchMode.KeepCentered
}),
(_label = new Label
{
SizeFlagsHorizontal = SizeFlags.FillExpand
HorizontalExpand = true
}),
// Padding
new Control {CustomMinimumSize = (8, 0)},
new Control {MinSize = (8, 0)},
new TextureRect
{
@@ -662,7 +664,7 @@ namespace Content.Client.GameObjects.EntitySystems
{
popup.List.AddChild(new PanelContainer
{
CustomMinimumSize = (0, 2),
MinSize = (0, 2),
PanelOverride = new StyleBoxFlat {BackgroundColor = Color.FromHex("#333")}
});
}