1234567891011121314151617181920212223242526272829303132 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- public class TimeManager : UpdateManager
- {
- public Text timetext;
- public string gxlj= "HH:mm:ss";
- public override void updateData()
- {
- base.updateData();
- DateTime now = DateTime.Now; // 获取当前本地时间
- string dateString = now.ToString("yyyy-MM-dd"); // 格式化日期部分
- string timeString = now.ToString(gxlj); // 格式化时间部分
- string dateTimeString = dateString + " " + timeString;
- // Debug.Log("dateTimeString==>" + dateTimeString);
- timetext.text = dateTimeString.ToString();
- }
- private void OnEnable() {
-
- if(gxlj=="HH:mm")
- {
- DataManager.Instance.getInfo((msg) => {
- timetext.transform.parent.gameObject.SetActive( msg.general_option.update_time_display_switch==1?true:false);
- });
- }
- }
- }
|