-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathResourceCacheExtensions.cs
More file actions
47 lines (38 loc) · 1.34 KB
/
Copy pathResourceCacheExtensions.cs
File metadata and controls
47 lines (38 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
using Robust.Client.Graphics;
using Robust.Client.ResourceManagement;
using Robust.Shared.Utility;
namespace Content.AL.UIKit;
[PublicAPI]
public static class ResourceCacheExtensions
{
public static Texture GetTexture(this IResourceCache cache, ResPath path)
{
return cache.GetResource<TextureResource>(path);
}
public static Texture GetTexture(this IResourceCache cache, string path)
{
return GetTexture(cache, new ResPath(path));
}
public static Font GetFont(this IResourceCache cache, ResPath path, int size)
{
return new VectorFont(cache.GetResource<FontResource>(path), size);
}
public static Font GetFont(this IResourceCache cache, string path, int size)
{
return cache.GetFont(new ResPath(path), size);
}
public static Font GetFont(this IResourceCache cache, ResPath[] path, int size)
{
var fs = new Font[path.Length];
for (var i = 0; i < path.Length; i++)
fs[i] = new VectorFont(cache.GetResource<FontResource>(path[i]), size);
return new StackedFont(fs);
}
public static Font GetFont(this IResourceCache cache, string[] path, int size)
{
var rp = new ResPath[path.Length];
for (var i = 0; i < path.Length; i++)
rp[i] = new ResPath(path[i]);
return cache.GetFont(rp, size);
}
}