上传文件至 Common

This commit is contained in:
2025-10-13 18:18:47 +08:00
parent 535e955faf
commit 566c6190ff
25 changed files with 1487 additions and 0 deletions

28
Common/ShowFPS.cs Normal file
View File

@@ -0,0 +1,28 @@
using UnityEngine;
namespace SinmaiAssist.Common;
public class ShowFPS
{
private static string fpsText = "FPS: ";
private static float deltaTime = 0.0f;
public static void OnGUI()
{
Update();
GUIStyle style = new GUIStyle();
style.fontSize = 24;
style.normal.textColor = Color.black;
style.alignment = TextAnchor.UpperLeft;
UnityEngine.GUI.Label(new Rect(10 + 2, 10 + 2, 500, 30), fpsText, style);
style.normal.textColor = Color.white;
UnityEngine.GUI.Label(new Rect(10, 10, 500, 30), fpsText, style);
}
private static void Update()
{
deltaTime += (Time.deltaTime - deltaTime) * 0.1f;
float fps = 1.0f / deltaTime;
fpsText = $"FPS: {Mathf.Ceil(fps)}";
}
}