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