using System.Collections; using System.Collections.Generic; using UnityEngine; public class TimeUtil { //格式化,最终得出分和秒 public static string GetTimeStr(float time, bool ceil = true) { int seconds = ceil ? Mathf.CeilToInt(time) : Mathf.FloorToInt(time); string str = ""; int m = seconds / 60; if (m < 10) { str += 0; } str += m; str += " : "; int s = seconds % 60; if (s < 10) { str += 0; } str += s; return str; } }