mirror of
https://github.com/ppy/osu.git
synced 2025-02-21 22:12:53 +08:00
Remove StreamColour class and implement locally
This commit is contained in:
parent
0b076c9ca0
commit
dbc42fd59e
@ -1,43 +0,0 @@
|
|||||||
// 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 osu.Framework.Graphics.Colour;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using osuTK.Graphics;
|
|
||||||
|
|
||||||
namespace osu.Game.Graphics
|
|
||||||
{
|
|
||||||
public class StreamColour
|
|
||||||
{
|
|
||||||
public static readonly Color4 STABLE = new Color4(102, 204, 255, 255);
|
|
||||||
public static readonly Color4 STABLEFALLBACK = new Color4(34, 153, 187, 255);
|
|
||||||
public static readonly Color4 BETA = new Color4(255, 221, 85, 255);
|
|
||||||
public static readonly Color4 CUTTINGEDGE = new Color4(238, 170, 0, 255);
|
|
||||||
public static readonly Color4 LAZER = new Color4(237, 18, 33, 255);
|
|
||||||
public static readonly Color4 WEB = new Color4(136, 102, 238, 255);
|
|
||||||
|
|
||||||
private static readonly Dictionary<string, ColourInfo> colours = new Dictionary<string, ColourInfo>
|
|
||||||
{
|
|
||||||
{ "stable40", STABLE },
|
|
||||||
{ "Stable", STABLE },
|
|
||||||
{ "stable", STABLEFALLBACK },
|
|
||||||
{ "Stable Fallback", STABLEFALLBACK },
|
|
||||||
{ "beta40", BETA },
|
|
||||||
{ "Beta", BETA },
|
|
||||||
{ "cuttingedge", CUTTINGEDGE },
|
|
||||||
{ "Cutting Edge", CUTTINGEDGE },
|
|
||||||
{ "lazer", LAZER },
|
|
||||||
{ "Lazer", LAZER },
|
|
||||||
{ "web", WEB },
|
|
||||||
};
|
|
||||||
|
|
||||||
public static ColourInfo FromStreamName(string name)
|
|
||||||
{
|
|
||||||
if (!string.IsNullOrEmpty(name))
|
|
||||||
if (colours.TryGetValue(name, out ColourInfo colour))
|
|
||||||
return colour;
|
|
||||||
|
|
||||||
return new Color4(0, 0, 0, 255);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -3,6 +3,8 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using osu.Framework.Graphics.Colour;
|
||||||
|
using osuTK.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Online.API.Requests.Responses
|
namespace osu.Game.Online.API.Requests.Responses
|
||||||
{
|
{
|
||||||
@ -30,5 +32,35 @@ namespace osu.Game.Online.API.Requests.Responses
|
|||||||
|
|
||||||
return Id == other.Id;
|
return Id == other.Id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ColourInfo Colour
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
switch (Name)
|
||||||
|
{
|
||||||
|
case "stable40":
|
||||||
|
return new Color4(102, 204, 255, 255);
|
||||||
|
|
||||||
|
case "stable":
|
||||||
|
return new Color4(34, 153, 187, 255);
|
||||||
|
|
||||||
|
case "beta40":
|
||||||
|
return new Color4(255, 221, 85, 255);
|
||||||
|
|
||||||
|
case "cuttingedge":
|
||||||
|
return new Color4(238, 170, 0, 255);
|
||||||
|
|
||||||
|
case "lazer":
|
||||||
|
return new Color4(237, 18, 33, 255);
|
||||||
|
|
||||||
|
case "web":
|
||||||
|
return new Color4(136, 102, 238, 255);
|
||||||
|
|
||||||
|
default:
|
||||||
|
return new Color4(0, 0, 0, 255);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,7 @@ namespace osu.Game.Overlays.Changelog
|
|||||||
{
|
{
|
||||||
Text = build.DisplayVersion,
|
Text = build.DisplayVersion,
|
||||||
Font = OsuFont.GetFont(weight: FontWeight.Light, size: 24),
|
Font = OsuFont.GetFont(weight: FontWeight.Light, size: 24),
|
||||||
Colour = StreamColour.FromStreamName(build.UpdateStream.Name),
|
Colour = build.UpdateStream.Colour,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -156,7 +156,7 @@ namespace osu.Game.Overlays.Changelog
|
|||||||
{
|
{
|
||||||
Text = build.DisplayVersion,
|
Text = build.DisplayVersion,
|
||||||
Font = OsuFont.GetFont(weight: FontWeight.Light, size: 19),
|
Font = OsuFont.GetFont(weight: FontWeight.Light, size: 19),
|
||||||
Colour = StreamColour.FromStreamName(build.UpdateStream.Name),
|
Colour = build.UpdateStream.Colour,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -73,7 +73,7 @@ namespace osu.Game.Overlays.Changelog
|
|||||||
lineBadge = new LineBadge(false)
|
lineBadge = new LineBadge(false)
|
||||||
{
|
{
|
||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
Colour = StreamColour.FromStreamName(stream.Name),
|
Colour = stream.Colour,
|
||||||
UncollapsedSize = 4,
|
UncollapsedSize = 4,
|
||||||
CollapsedSize = 2,
|
CollapsedSize = 2,
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user