-
Notifications
You must be signed in to change notification settings - Fork 0
/
UIHelper.cs
44 lines (38 loc) · 1.46 KB
/
UIHelper.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
43
44
using ColossalFramework.UI;
using System;
using UnityEngine;
namespace WaterPipeUpgraderv2
{
public static class UIHelper
{
private static UIFont _font;
public static UIButton CreateButton(UIComponent parent)
{
UIButton local1 = parent.AddUIComponent<UIButton>();
local1.font = Font;
local1.textPadding = new RectOffset(0, 0, 4, 0);
local1.normalBgSprite = "ButtonMenu";
local1.disabledBgSprite = "ButtonMenuDisabled";
local1.hoveredBgSprite = "ButtonMenuHovered";
local1.focusedBgSprite = "ButtonMenu";
local1.pressedBgSprite = "ButtonMenuPressed";
local1.textColor = new Color32(0xff, 0xff, 0xff, 0xff);
local1.disabledTextColor = new Color32(7, 7, 7, 0xff);
local1.hoveredTextColor = new Color32(0xff, 0xff, 0xff, 0xff);
local1.focusedTextColor = new Color32(0xff, 0xff, 0xff, 0xff);
local1.pressedTextColor = new Color32(30, 30, 0x2c, 0xff);
return local1;
}
public static UIFont Font
{
get
{
if (_font == null)
{
_font = GameObject.Find("(Library) PublicTransportInfoViewPanel").GetComponent<PublicTransportInfoViewPanel>().Find<UILabel>("Label").font;
}
return _font;
}
}
}
}