blob: b19b0be8b7a2cdbcc3920b46a2a712bb9d480c69 (
plain)
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
|
using MoreMountains.Feedbacks;
using UnityEngine;
public class TFUISliderDragArea : ThronefallUIElement
{
public TFUISlider target;
public Color dragColor;
public MMF_Player onStartDrag;
public MMF_Player onEndDrag;
private Color defaultColor;
private bool colorInitialized;
private bool delayedDisable;
private bool inDrag;
private float afterDragCounter;
public override bool dragable => true;
protected override void OnApply()
{
}
private void Update()
{
if (!delayedDisable || inDrag)
{
return;
}
afterDragCounter += Time.unscaledDeltaTime;
if (afterDragCounter > 0.35f)
{
delayedDisable = false;
target.knob.SetActive(value: false);
if ((bool)target.tooltip)
{
target.tooltip.SetActive(value: false);
}
}
}
protected override void OnClear()
{
if (!inDrag)
{
target.knob.SetActive(value: false);
if ((bool)target.tooltip)
{
target.tooltip.SetActive(value: false);
}
}
else
{
delayedDisable = true;
afterDragCounter = 0f;
}
}
protected override void OnFocus()
{
delayedDisable = false;
target.knob.SetActive(value: true);
if ((bool)target.tooltip)
{
target.tooltip.SetActive(value: true);
}
}
protected override void OnFocusAndSelect()
{
}
protected override void OnHardStateSet(SelectionState selectionState)
{
}
protected override void OnSelect()
{
}
public override void OnDragStart()
{
inDrag = true;
onStartDrag.PlayFeedbacks();
if (!colorInitialized)
{
InitColor();
}
target.fillImg.color = dragColor;
target.knobImg.color = dragColor;
}
public override void OnDrag(Vector2 mousePosition)
{
target.SetValueByScreenPoint(mousePosition);
}
public override void OnDragEnd()
{
onEndDrag.PlayFeedbacks();
target.fillImg.color = defaultColor;
target.knobImg.color = defaultColor;
inDrag = false;
}
private void InitColor()
{
defaultColor = target.fillImg.color;
colorInitialized = true;
}
private void OnEnable()
{
if (!colorInitialized)
{
InitColor();
}
target.fillImg.color = defaultColor;
inDrag = false;
}
}
|