From 0d3126dd664c7757a445ae0746e226300dd501f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=82=BA=E4=BB=80=E9=BA=BC?= Date: Thu, 6 Dec 2018 15:43:01 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=84=E5=A5=BD=E5=85=B6=E4=B8=AD=E5=85=A9?= =?UTF-8?q?=E5=80=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Graphics/Eggs/GameBoy/GameBoyContainer.cs | 60 ++++++++++++++----- .../Graphics/Eggs/GameBoy/GameBoySpeaker.cs | 14 ++++- 2 files changed, 57 insertions(+), 17 deletions(-) diff --git a/osu.GameBoy/Graphics/Eggs/GameBoy/GameBoyContainer.cs b/osu.GameBoy/Graphics/Eggs/GameBoy/GameBoyContainer.cs index 96a316d..de213f6 100644 --- a/osu.GameBoy/Graphics/Eggs/GameBoy/GameBoyContainer.cs +++ b/osu.GameBoy/Graphics/Eggs/GameBoy/GameBoyContainer.cs @@ -27,6 +27,13 @@ public class GameBoyContainer : Container private StreamedExternalMemory _currentExternalMemory; + private readonly Box backgroundBox; + private readonly Box backgroundLine1; + private readonly Box backgroundLine2; + private readonly Box backgroundLine3; + private readonly GameBoySpeaker gameBoySpeaker; + private readonly Box phoneBox; + private readonly GameBoyScreen _displayScreen; private readonly GameBoyPowerLed _powerLed; @@ -45,9 +52,19 @@ public class GameBoyContainer : Container #region UI - protected virtual Color4 BackgroundColor => new Color4(181, 181, 178, 255); + protected virtual Color4 BackgroundColor { set => backgroundBox.Colour = value; } - protected virtual Color4 BackgroundLineColor => new Color4(158, 159, 155, 255); + protected virtual Color4 BackgroundLineColor + { + set + { + backgroundLine1.Colour = value; + backgroundLine2.Colour = value; + backgroundLine3.Colour = value; + gameBoySpeaker.SperkeColour = value; + phoneBox.Colour = value; + } + } protected virtual Color4 DisplayBackgroundColor => new Color4(82, 82, 94, 255); @@ -114,7 +131,27 @@ public class GameBoyContainer : Container public GameBoyContainer() { //Colors - + BackgroundColor = new Color4(181, 181, 178, 255); + BackgroundLineColor = new Color4(158, 159, 155, 255); + DisplayBackgroundColor = new Color4(82, 82, 94, 255); + DisplayScreenColor = DisplayScreenColor1;//Screen off color + DisplayScreenColor0 = new Color4(224, 248, 208, 255); + DisplayScreenColor1 = new Color4(136, 192, 112, 255); + DisplayScreenColor2 = new Color4(52, 104, 86, 255); + DisplayScreenColor3 = new Color4(8, 24, 32, 255); + DisplayTextColor = Color4.White; + Banner1Color = new Color4(110, 19, 79, 255); + Banner2Color = new Color4(5, 2, 80, 255); + LedOffColor = new Color4(38, 17, 22, 255); + LedOnColor = new Color4(204, 68, 79, 255); + TextColor = new Color4(13, 24, 124, 255); + DPadButtonBackgroundColor = new Color4(10, 12, 24, 255); + DPadButtonColor = new Color4(10, 12, 24, 255); + DPadButtonPressedColor = new Color4(34, 41, 83, 255); + ABButtonColor = new Color4(154, 31, 85, 255); + ABButtonPressedColor = new Color4(109, 22, 62, 255); + OptionButtonColor = new Color4(112, 111, 119, 255); + OptionButtonPressedColor = new Color4(78, 77, 81, 255); //Keys UpKey = Key.Up; @@ -143,32 +180,28 @@ public GameBoyContainer() RelativeSizeAxes = Axes.Both, Children = new Drawable[] { - new Box + backgroundBox = new Box { Name = "Background", - Colour = BackgroundColor, RelativeSizeAxes = Axes.Both }, - new Box + backgroundLine1 = new Box { Name = "Center line", - Colour = BackgroundLineColor, RelativeSizeAxes = Axes.X, Height = 3, Y = 20 }, - new Box + backgroundLine2 = new Box { Name = "Left line", - Colour = BackgroundLineColor, Width = 3, Height = 20, X = 20, }, - new Box + backgroundLine3 = new Box { Name = "Right line", - Colour = BackgroundLineColor, Width = 3, Height = 20, Anchor = Anchor.TopRight, @@ -210,7 +243,7 @@ public GameBoyContainer() }, } }, - new GameBoySpeaker(BackgroundLineColor,5) + gameBoySpeaker = new GameBoySpeaker(5) { Name = "Speaker", Width = 100, @@ -222,10 +255,9 @@ public GameBoyContainer() Y = -60, Rotation = -30 }, - new Box + phoneBox = new Box { Name = "Phones", - Colour = BackgroundLineColor, Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, Width = 30, diff --git a/osu.GameBoy/Graphics/Eggs/GameBoy/GameBoySpeaker.cs b/osu.GameBoy/Graphics/Eggs/GameBoy/GameBoySpeaker.cs index 9e0019a..f22ae32 100644 --- a/osu.GameBoy/Graphics/Eggs/GameBoy/GameBoySpeaker.cs +++ b/osu.GameBoy/Graphics/Eggs/GameBoy/GameBoySpeaker.cs @@ -1,4 +1,5 @@ -using osu.Framework.Graphics.Containers; +using osu.Framework.Extensions.IEnumerableExtensions; +using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osuTK.Graphics; @@ -6,17 +7,24 @@ namespace osu.Framework.Graphics.Eggs.GameBoy { public sealed class GameBoySpeaker : FillFlowContainer { - public GameBoySpeaker(Color4 speakerColor, float speakerWidth) + public GameBoySpeaker(float speakerWidth) { for (int i = 0; i < 6; i++) { Add(new Box { - Colour = speakerColor, Width = speakerWidth, RelativeSizeAxes = Axes.Y, }); } } + + public Color4 SperkeColour + { + set + { + Children.ForEach(x => x.Colour = value); + } + } } }