45 lines
1.3 KiB
C#
Raw Normal View History

2024-01-30 19:22:27 +08:00
using System;
2024-01-29 19:07:52 +08:00
using Cysharp.Threading.Tasks;
2024-01-30 19:22:27 +08:00
using Script.AppImpl;
2024-01-29 19:07:52 +08:00
using Script.battle;
2024-01-26 19:15:07 +08:00
using UnityEngine;
2024-01-30 19:22:27 +08:00
using UnityEngine.UI;
2024-01-26 19:15:07 +08:00
namespace Script
{
public class UIMain : MonoBehaviour
{
2024-01-30 19:22:27 +08:00
public Text frameLabel;
2024-01-29 19:07:52 +08:00
2024-01-30 19:22:27 +08:00
private void Awake()
{
DontDestroyOnLoad(this.gameObject);
}
2024-01-29 19:07:52 +08:00
//重置
public void OnClickReset()
{
GBattleModeManager.Instance.Open(GBattleMode.Default).Forget();
}
2024-01-30 19:22:27 +08:00
private void Update()
{
float f = 1.23456789f;
2024-01-31 06:12:18 +08:00
for (int i = 1000 - 1; i >= 0; i--)
2024-01-30 19:22:27 +08:00
{
// 进行一些基本的浮点数运算
f = f + f;
f = f - (f / 2);
f = f * (f / 2);
f = f / (f / 2);
f = (float)Math.Sqrt(f);
f = Math.Abs(f);
f = (float)Math.Log(f);
f = (float)Math.Log10(f);
f = (float)Math.Exp(f);
}
this.frameLabel.text = $"浮点数计算: {f} 服务器帧数: {App.Sync.NServerFrame} 本地运行帧 {App.Sync.NLocalFrame} 本地已执行帧 {App.Sync.NLocalRunFrame} 是否正在请求{App.Sync.IsRequestServerData} FPS:{1f/Time.deltaTime} this.DyTime():{App.Sync.DyTime()}";
}
2024-01-26 19:15:07 +08:00
}
}