53 lines
1.5 KiB
C#
Raw Normal View History

using Assets.Scenes.Ride.Scripts;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
namespace Assets.Scripts.Scenes
{
public abstract class BaseScene: MonoBehaviour
{
protected virtual void Awake()
{
Debug.Log("base scene awake");
Application.logMessageReceived += Application_logMessageReceived;
}
private void Application_logMessageReceived(string condition, string stackTrace, LogType type)
{
//Debug.Log("application log");
if (type == LogType.Error || type == LogType.Exception)
{
string log = $"time:{ System.DateTime.Now.ToString() }\r\n";
log += $"type:{ type }\r\n";
log += $"msg:{ condition }\r\n";
log += $"stack trace:{ stackTrace }\r\n";
System.IO.File.AppendAllText($"{PFConstants.LogFolder}\\{ System.DateTime.Now.ToString("yyyy-MM-dd") }.txt", log);
//Debug.Log(PFConstants.LogFolder);
}
}
private void OnApplicationQuit()
{
MapUDPService.Dispose();
App.MainDeviceAdapter.Dispose();
}
2021-09-13 18:21:43 +08:00
private void OnApplicationPause(bool focus)
{
if (focus)
{
Debug.Log("我休眠了");
}
else
{
UIManager.InitNow();//重置当前时间
}
}
}
}