mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-17 05:27:38 +03:00
* - add: StyleSheetify * - add: APC style * - tweak: Select only APC now! * - fix: Window positioning * - fix: animations * - add: Fancy chat * - tweak: change some margin think * - fix: add assemblies of stylesheetify for packaging * - tweak: update StyleSheetify * - add: custom LauncherConnection * - tweak: change to paper * - tweak: Update StyleSheetify * - add: fancy lobby screen * - tweak: some beauty think in lobby screen * - add: new icons * - tweak: change icons * - tweak: //WWDP EDIT * - fix: disable style while testing * - fix: Channel Popup button style revert * - fix: test again * - tweak: Update StyleSheetify
174 lines
5.5 KiB
C#
174 lines
5.5 KiB
C#
using System.Numerics;
|
|
using Content.Client.Guidebook;
|
|
using Content.Client.Guidebook.Components;
|
|
using Content.Shared.Guidebook;
|
|
using Content.StyleSheetify.Client.Utils;
|
|
using Robust.Client.Animations;
|
|
using Robust.Client.AutoGenerated;
|
|
using Robust.Client.UserInterface.Controls;
|
|
using Robust.Client.UserInterface.CustomControls;
|
|
using Robust.Client.UserInterface.XAML;
|
|
using Robust.Shared.Animations;
|
|
using Robust.Shared.Prototypes;
|
|
|
|
namespace Content.Client.UserInterface.Controls
|
|
{
|
|
[GenerateTypedNameReferences]
|
|
[Virtual]
|
|
public partial class FancyWindow : BaseWindow
|
|
{
|
|
[Dependency] private readonly IEntitySystemManager _sysMan = default!;
|
|
private GuidebookSystem? _guidebookSystem;
|
|
private const int DRAG_MARGIN_SIZE = 7;
|
|
public const string StyleClassWindowHelpButton = "windowHelpButton";
|
|
|
|
private AnimationExtend<Vector2> OpenAnimation;
|
|
private AnimationExtend<float> FadeAnimation;
|
|
private AnimationExtend<float> UnfadeAnimation;
|
|
|
|
private static readonly float[] KeyFrames = [0f, 0.15f, 0.25f,];
|
|
|
|
public FancyWindow()
|
|
{
|
|
RobustXamlLoader.Load(this);
|
|
|
|
CloseButton.OnPressed += _ => Close();
|
|
HelpButton.OnPressed += _ => Help();
|
|
XamlChildren = ContentsContainer.Children;
|
|
|
|
// WWDP EDIT START
|
|
OpenAnimation = new(
|
|
RecenterWindow,
|
|
this,
|
|
AnimationInterpolationMode.Cubic,
|
|
new List<AnimationTrackProperty.KeyFrame>()
|
|
{
|
|
new(new Vector2(0.5f, 1.2f), KeyFrames[0]),
|
|
new(new Vector2(0.5f, 0.4f), KeyFrames[1]),
|
|
new(new Vector2(0.5f, 0.5f), KeyFrames[2])
|
|
}
|
|
);
|
|
|
|
FadeAnimation = new(
|
|
SetVisibility,
|
|
this,
|
|
AnimationInterpolationMode.Cubic,
|
|
new List<AnimationTrackProperty.KeyFrame>()
|
|
{
|
|
new(1f,KeyFrames[0]),
|
|
new(0f,KeyFrames[1]),
|
|
new(0f,KeyFrames[2])
|
|
}
|
|
);
|
|
|
|
UnfadeAnimation = new(
|
|
SetVisibility,
|
|
this,
|
|
AnimationInterpolationMode.Cubic,
|
|
new List<AnimationTrackProperty.KeyFrame>()
|
|
{
|
|
new(0f,KeyFrames[0]),
|
|
new(1f,KeyFrames[1]),
|
|
new(1f,KeyFrames[2])
|
|
}
|
|
);
|
|
}
|
|
|
|
// WWDP EDIT END
|
|
|
|
protected override void Opened()
|
|
{
|
|
base.Opened();
|
|
OpenAnimation.PlayAnimation(); // WWDP EDIT
|
|
UnfadeAnimation.PlayAnimation(); // WWDP EDIT
|
|
}
|
|
// WWDP EDIT START
|
|
// TODO: make FancyClose when not shitty timer appears
|
|
private void FancyClose()
|
|
{
|
|
var pos = (Position + DesiredSize / 2) / Parent!.Size;
|
|
|
|
new AnimationExtend<Vector2>(
|
|
RecenterWindow,
|
|
this,
|
|
AnimationInterpolationMode.Cubic,
|
|
new List<AnimationTrackProperty.KeyFrame>()
|
|
{
|
|
new(new Vector2(pos.X,pos.Y),KeyFrames[0]),
|
|
new(new Vector2(pos.X,0.4f),KeyFrames[1]),
|
|
new(new Vector2(pos.X,1.0f),KeyFrames[2])
|
|
}
|
|
).PlayAnimation();
|
|
FadeAnimation.PlayAnimation();
|
|
}
|
|
|
|
private void SetVisibility(float percent)
|
|
{
|
|
Modulate = new(1,1,1,Math.Clamp(percent,0,1));
|
|
}
|
|
// WWDP EDIT END
|
|
public string? Title
|
|
{
|
|
get => WindowTitle.Text;
|
|
set => WindowTitle.Text = value;
|
|
}
|
|
|
|
private List<ProtoId<GuideEntryPrototype>>? _helpGuidebookIds;
|
|
public List<ProtoId<GuideEntryPrototype>>? HelpGuidebookIds
|
|
{
|
|
get => _helpGuidebookIds;
|
|
set
|
|
{
|
|
_helpGuidebookIds = value;
|
|
HelpButton.Disabled = _helpGuidebookIds == null;
|
|
HelpButton.Visible = !HelpButton.Disabled;
|
|
}
|
|
}
|
|
// WWDP EDIT
|
|
public void AppendStyleClass(string styleClass)
|
|
{
|
|
WindowsHeadingBackground.StyleClasses.Add(styleClass);
|
|
WindowsPanelBackground.StyleClasses.Add(styleClass);
|
|
WindowTitle.StyleClasses.Add(styleClass);
|
|
CloseButton.StyleClasses.Add(styleClass);
|
|
HelpButton.StyleClasses.Add(styleClass);
|
|
}
|
|
|
|
public void Help()
|
|
{
|
|
if (HelpGuidebookIds is null)
|
|
return;
|
|
_guidebookSystem ??= _sysMan.GetEntitySystem<GuidebookSystem>();
|
|
_guidebookSystem.OpenHelp(HelpGuidebookIds);
|
|
}
|
|
|
|
protected override DragMode GetDragModeFor(Vector2 relativeMousePos)
|
|
{
|
|
var mode = DragMode.Move;
|
|
|
|
if (Resizable)
|
|
{
|
|
if (relativeMousePos.Y < DRAG_MARGIN_SIZE)
|
|
{
|
|
mode = DragMode.Top;
|
|
}
|
|
else if (relativeMousePos.Y > Size.Y - DRAG_MARGIN_SIZE)
|
|
{
|
|
mode = DragMode.Bottom;
|
|
}
|
|
|
|
if (relativeMousePos.X < DRAG_MARGIN_SIZE)
|
|
{
|
|
mode |= DragMode.Left;
|
|
}
|
|
else if (relativeMousePos.X > Size.X - DRAG_MARGIN_SIZE)
|
|
{
|
|
mode |= DragMode.Right;
|
|
}
|
|
}
|
|
|
|
return mode;
|
|
}
|
|
}
|
|
}
|