64 lines
1.3 KiB
C#
64 lines
1.3 KiB
C#
using System;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
|
|
// Token: 0x020000A8 RID: 168
|
|
public class FPS : MonoBehaviour
|
|
{
|
|
// Token: 0x06000F8B RID: 3979 RVA: 0x0012CE7C File Offset: 0x0012B07C
|
|
private void Start()
|
|
{
|
|
if (Records.x.showFPS && (Records.x.editor || Records.x.secrets))
|
|
{
|
|
base.gameObject.SetActive(true);
|
|
}
|
|
else
|
|
{
|
|
base.gameObject.SetActive(false);
|
|
}
|
|
this.timeleft = this.updateInterval;
|
|
}
|
|
|
|
// Token: 0x06000F8C RID: 3980 RVA: 0x0012CED4 File Offset: 0x0012B0D4
|
|
private void Update()
|
|
{
|
|
if (!Records.x.dialogue)
|
|
{
|
|
this.timeleft -= Time.unscaledDeltaTime;
|
|
this.accum += 1f / Time.unscaledDeltaTime;
|
|
this.frames++;
|
|
if ((double)this.timeleft <= 0.0)
|
|
{
|
|
int num = Mathf.RoundToInt(this.accum / (float)this.frames);
|
|
this.label.text = num.ToString();
|
|
this.timeleft = this.updateInterval;
|
|
this.accum = 0f;
|
|
this.frames = 0;
|
|
return;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
this.label.text = "";
|
|
}
|
|
}
|
|
|
|
// Token: 0x040019A1 RID: 6561
|
|
public float updateInterval = 0.1f;
|
|
|
|
// Token: 0x040019A2 RID: 6562
|
|
private float accum;
|
|
|
|
// Token: 0x040019A3 RID: 6563
|
|
private int frames;
|
|
|
|
// Token: 0x040019A4 RID: 6564
|
|
private float timeleft;
|
|
|
|
// Token: 0x040019A5 RID: 6565
|
|
private string format;
|
|
|
|
// Token: 0x040019A6 RID: 6566
|
|
public TextMeshProUGUI label;
|
|
}
|