-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathHintUI.cs
More file actions
75 lines (68 loc) · 2.03 KB
/
HintUI.cs
File metadata and controls
75 lines (68 loc) · 2.03 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
using TMPro;
using UnityEngine;
using UnityEngine.UI;
namespace PocketCartPlus
{
public class HintUI : SemiUI
{
public TextMeshProUGUI Text = null!;
internal static HintUI instance = null!;
public string messagePrev = "prev";
public float messageTimer;
public Color textColor;
internal Transform normalParent = null!;
internal bool grabHint = false;
public override void Start()
{
base.Start();
Text = GetComponent<TextMeshProUGUI>();
if(Text == null)
{
Plugin.Log.LogError("NULL HINTER TEXT!!");
return;
}
instance = this;
Text.text = "";
normalParent = transform.parent;
showPosition.x = 0f;
showPosition.y = 0f;
textColor = new(0, 102, 0);
hidePosition.x = 0f;
hidePosition.y = -30f;
}
public void ShowInfo(string message, Color color, float fontSize)
{
if (messageTimer <= 0f)
{
messageTimer = 0.2f;
if (message != messagePrev)
{
Text.text = message;
SemiUISpringShakeY(20f, 10f, 0.3f);
SemiUISpringScale(0.4f, 5f, 0.2f);
textColor = color;
Text.fontSize = fontSize;
((Graphic)Text).color = textColor;
messagePrev = message;
}
}
}
public override void Update()
{
base.Update();
if (SemiFunc.RunIsShop())
return;
ItemInfoUI.instance.SemiUIScoot(new Vector2(0f, 8f));
if (messageTimer > 0f)
{
messageTimer -= Time.deltaTime;
}
else
{
((Graphic)Text).color = Color.white;
messagePrev = "prev";
Hide();
}
}
}
}