mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 08:20:00 +09:00
Add the ability to add settings to skinnable elements
This commit is contained in:
@ -1,8 +1,11 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using Humanizer;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Screens.Play.HUD;
|
||||
using osu.Game.Skinning;
|
||||
using osuTK;
|
||||
@ -59,8 +62,18 @@ namespace osu.Game.Extensions
|
||||
component.Origin = info.Origin;
|
||||
|
||||
if (component is ISkinnableDrawable skinnable)
|
||||
{
|
||||
skinnable.UsesFixedAnchor = info.UsesFixedAnchor;
|
||||
|
||||
foreach (var (_, property) in component.GetSettingsSourceProperties())
|
||||
{
|
||||
if (!info.Settings.TryGetValue(property.Name.Underscore(), out object settingValue))
|
||||
continue;
|
||||
|
||||
skinnable.CopyAdjustedSetting((IBindable)property.GetValue(component), settingValue);
|
||||
}
|
||||
}
|
||||
|
||||
if (component is Container container)
|
||||
{
|
||||
foreach (var child in info.Children)
|
||||
|
Reference in New Issue
Block a user