-
Notifications
You must be signed in to change notification settings - Fork 6
/
UIUtil.cs
42 lines (35 loc) · 1.17 KB
/
UIUtil.cs
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
using ColossalFramework.UI;
using System.Collections.Generic;
using UnityEngine;
namespace CS_EmploymentDetailsExtender
{
/**
* UIUtil source code from Skylines-ExtendedPublicTransport
* https://github.com/justacid/Skylines-ExtendedPublicTransport/tree/master/ExtendedPublicTransportUI
**/
public static class UIUtil
{
public static List<UIComponent> FindUIComponents(string searchString)
{
var uics = new List<UIComponent>();
var components = UnityEngine.Object.FindObjectsOfType<UIComponent>();
foreach (var uic in components)
{
if (!uic.name.Contains(searchString))
continue;
uics.Add(uic);
}
return uics;
}
public static UIComponent FindUIComponent(string searchString)
{
var components = UnityEngine.Object.FindObjectsOfType<UIComponent>();
foreach (var uic in components)
{
if (uic.name == searchString)
return uic;
}
return null;
}
}
}