//时间格式化 传入的毫秒publicstaticstringFormatTime(int seconds){float time = seconds /1000f;float h = Mathf.FloorToInt(time /3600f);float m = Mathf.FloorToInt(time /60f- h *60f);float all = time - m *60f- h *3600f;// float s = Mathf.FloorToInt(time - m * 60f - h * 3600f);//将秒和毫秒拿出来,这样不会让毫秒四舍五入string str=@"(?s)\d{1}[.]{1}\d{2}";Regex regex =newRegex(str);print("总秒数"+ regex.Match(all.ToString()).Value);string res = regex.Match(all.ToString()).Value;string sc = res.Split('.')[0];//秒string ms = res.Split('.')[1];//毫秒string result = h.ToString("00")+":"+ m.ToString("00")+":"+ sc.PadLeft(2,'0')+":"+ ms.PadLeft(2,'0');return result;}