blob: c6a7f651c8b75768dc8e0ba48b50c5db01364bc3 (
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
|
using System;
using UnityEngine;
public class UseButtonManager : MonoBehaviour
{
private static readonly Color DisabledColor = new Color(1f, 1f, 1f, 0.3f);
private static readonly Color EnabledColor = new Color(1f, 1f, 1f, 1f);
public SpriteRenderer UseButton;
public Sprite UseImage;
public Sprite SabotageImage;
public Sprite VentImage;
public Sprite AdminMapImage;
public Sprite SecurityImage;
public Sprite OptionsImage;
private IUsable currentTarget;
public void SetTarget(IUsable target)
{
this.currentTarget = target;
if (target != null)
{
if (target is Vent)
{
this.UseButton.sprite = this.VentImage;
}
else if (target is MapConsole)
{
this.UseButton.sprite = this.AdminMapImage;
}
else if (target is OptionsConsole)
{
this.UseButton.sprite = this.OptionsImage;
}
else if (target is SystemConsole)
{
SystemConsole systemConsole = (SystemConsole)target;
if (systemConsole.name.StartsWith("Surv"))
{
this.UseButton.sprite = this.SecurityImage;
}
else if (systemConsole.name.StartsWith("TaskAdd"))
{
this.UseButton.sprite = this.OptionsImage;
}
else
{
this.UseButton.sprite = this.UseImage;
}
}
else
{
this.UseButton.sprite = this.UseImage;
}
this.UseButton.SetCooldownNormalizedUvs();
this.UseButton.material.SetFloat("_Percent", target.PercentCool);
this.UseButton.color = UseButtonManager.EnabledColor;
return;
}
if (PlayerControl.LocalPlayer.Data.IsImpostor && PlayerControl.LocalPlayer.CanMove)
{
this.UseButton.sprite = this.SabotageImage;
this.UseButton.SetCooldownNormalizedUvs();
this.UseButton.color = UseButtonManager.EnabledColor;
return;
}
this.UseButton.sprite = this.UseImage;
this.UseButton.color = UseButtonManager.DisabledColor;
}
public void DoClick()
{
if (!base.isActiveAndEnabled)
{
return;
}
if (!PlayerControl.LocalPlayer)
{
return;
}
GameData.PlayerInfo data = PlayerControl.LocalPlayer.Data;
if (this.currentTarget != null)
{
PlayerControl.LocalPlayer.UseClosest();
return;
}
if (data != null && data.IsImpostor)
{
DestroyableSingleton<HudManager>.Instance.ShowMap(delegate(MapBehaviour m)
{
m.ShowInfectedMap();
});
}
}
internal void Refresh()
{
this.SetTarget(this.currentTarget);
}
}
|