using System; using Cysharp.Threading.Tasks; using Script.AppImpl; using Script.battle; using UnityEngine; using UnityEngine.UI; namespace Script { public class UIMain : MonoBehaviour { public Text frameLabel; private void Awake() { DontDestroyOnLoad(this.gameObject); } //重置 public void OnClickReset() { GBattleModeManager.Instance.Open(GBattleMode.Default).Forget(); } private void Update() { float f = 1.23456789f; for (int i = 10 - 1; i >= 0; i--) { // 进行一些基本的浮点数运算 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()}"; } } }