mirror of
https://github.com/ppy/osu
synced 2024-12-12 09:58:22 +00:00
Refactor update stream colour mapping code
This commit is contained in:
parent
b448fd1b8b
commit
0bd9f68cbd
@ -2,6 +2,7 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
using osu.Framework.Graphics.Colour;
|
||||
using osuTK.Graphics;
|
||||
@ -27,34 +28,16 @@ namespace osu.Game.Online.API.Requests.Responses
|
||||
|
||||
public bool Equals(APIUpdateStream other) => Id == other?.Id;
|
||||
|
||||
public ColourInfo Colour
|
||||
internal static readonly Dictionary<string, Color4> KNOWN_STREAMS = new Dictionary<string, Color4>
|
||||
{
|
||||
get
|
||||
{
|
||||
switch (Name)
|
||||
{
|
||||
case "stable40":
|
||||
return new Color4(102, 204, 255, 255);
|
||||
["stable40"] = new Color4(102, 204, 255, 255),
|
||||
["stable"] = new Color4(34, 153, 187, 255),
|
||||
["beta40"] = new Color4(255, 221, 85, 255),
|
||||
["cuttingedge"] = new Color4(238, 170, 0, 255),
|
||||
[OsuGameBase.CLIENT_STREAM_NAME] = new Color4(237, 18, 33, 255),
|
||||
["web"] = new Color4(136, 102, 238, 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 OsuGameBase.CLIENT_STREAM_NAME:
|
||||
return new Color4(237, 18, 33, 255);
|
||||
|
||||
case "web":
|
||||
return new Color4(136, 102, 238, 255);
|
||||
|
||||
default:
|
||||
return new Color4(0, 0, 0, 255);
|
||||
}
|
||||
}
|
||||
}
|
||||
public ColourInfo Colour => KNOWN_STREAMS.TryGetValue(Name, out var colour) ? colour : new Color4(0, 0, 0, 255);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user