Make symbol pieces relative sized.

This commit is contained in:
smoogipooo 2017-08-03 15:57:45 +09:30
parent 09c0e18a04
commit 74e9449a75
3 changed files with 38 additions and 11 deletions

View File

@ -11,17 +11,26 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces
/// <summary>
/// The symbol used for centre hit pieces.
/// </summary>
public class CentreHitSymbolPiece : CircularContainer
public class CentreHitSymbolPiece : Container
{
public CentreHitSymbolPiece()
{
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
Size = new Vector2(CirclePiece.SYMBOL_INNER_SIZE);
Masking = true;
RelativeSizeAxes = Axes.Both;
Size = new Vector2(CirclePiece.SYMBOL_SIZE);
Padding = new MarginPadding(CirclePiece.SYMBOL_BORDER);
Children = new[] { new Box { RelativeSizeAxes = Axes.Both } };
Children = new[]
{
new CircularContainer
{
RelativeSizeAxes = Axes.Both,
Masking = true,
Children = new[] { new Box { RelativeSizeAxes = Axes.Both } }
}
};
}
}
}

View File

@ -22,9 +22,8 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces
/// </summary>
public class CirclePiece : TaikoPiece
{
public const float SYMBOL_SIZE = 36;
public const float SYMBOL_SIZE = 0.35f;
public const float SYMBOL_BORDER = 8;
public const float SYMBOL_INNER_SIZE = SYMBOL_SIZE - 2 * SYMBOL_BORDER;
private const double pre_beat_transition_time = 80;
/// <summary>

View File

@ -1,7 +1,10 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using OpenTK;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics;
namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces
@ -9,18 +12,34 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces
/// <summary>
/// The symbol used for swell pieces.
/// </summary>
public class SwellSymbolPiece : TextAwesome
public class SwellSymbolPiece : Container
{
private readonly TextAwesome symbol;
public SwellSymbolPiece()
{
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
TextSize = CirclePiece.SYMBOL_INNER_SIZE;
RelativeSizeAxes = Axes.Both;
Size = new Vector2(CirclePiece.SYMBOL_SIZE);
Padding = new MarginPadding(CirclePiece.SYMBOL_BORDER);
Icon = FontAwesome.fa_asterisk;
UseFullGlyphHeight = true;
Shadow = false;
Children = new[]
{
symbol = new TextAwesome
{
Icon = FontAwesome.fa_asterisk,
UseFullGlyphHeight = true,
Shadow = false
}
};
}
protected override void Update()
{
base.Update();
symbol.TextSize = Math.Min(ChildSize.X, ChildSize.Y);
}
}
}