blob: 0ed57a69ee6577638a3873ed5ddf9c0d0c063c6d (
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
|
using System;
using System.Collections;
using UnityEngine;
public class BanButton : MonoBehaviour
{
public BanMenu Parent { get; set; }
public TextRenderer NameText;
public SpriteRenderer Background;
public int TargetClientId;
public int numVotes;
public void Start()
{
this.Background.SetCooldownNormalizedUvs();
}
public void Select()
{
this.Background.color = new Color(1f, 1f, 1f, 1f);
this.Parent.Select(this.TargetClientId);
}
public void Unselect()
{
this.Background.color = new Color(0.3f, 0.3f, 0.3f, 0.5f);
}
public void SetVotes(int newVotes)
{
base.StopAllCoroutines();
base.StartCoroutine(this.CoSetVotes(this.numVotes, newVotes));
this.numVotes = newVotes;
}
private IEnumerator CoSetVotes(int oldNum, int newNum)
{
float num = (float)oldNum / 3f;
float end = (float)newNum / 3f;
for (float timer = 0f; timer < 0.2f; timer += Time.deltaTime)
{
this.Background.material.SetFloat("_Percent", Mathf.SmoothStep(end, end, timer / 0.2f));
yield return null;
}
this.Background.material.SetFloat("_Percent", end);
yield break;
}
}
|