70 lines
1.7 KiB
C#
70 lines
1.7 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
namespace Superlazy
|
|
{
|
|
[DefaultExecutionOrder(-1001)]
|
|
public class SLUnity : MonoBehaviour
|
|
{
|
|
public string loaderID = "SLWindowsLoader"; // "SLUnityDataLoader"
|
|
public string systemID = "SLSystem";
|
|
public string mainManager = "";
|
|
|
|
public string[] managers = { };
|
|
|
|
public SLGame game;
|
|
|
|
private void Awake()
|
|
{
|
|
SLOption.Init();
|
|
|
|
InitSLSystem();
|
|
InitSLGame();
|
|
InitSLTag();
|
|
}
|
|
|
|
private void InitSLSystem()
|
|
{
|
|
var loader = SLSystemUtility.CreateInstance<SLDataLoader>(loaderID);
|
|
var system = SLSystemUtility.CreateInstance<SLSystem>(systemID);
|
|
system.Init(loader, DateTime.UtcNow);
|
|
loader.Load();
|
|
|
|
SLLog.Info("InitSLSystem");
|
|
}
|
|
|
|
private void InitSLGame()
|
|
{
|
|
game = new SLGame(managers, mainManager);
|
|
|
|
SLLog.Info("InitSLGame");
|
|
}
|
|
|
|
private void InitSLTag()
|
|
{
|
|
var formats = new List<SLTag>();
|
|
formats.CreateInstanceList();
|
|
SLTag.Init(formats);
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
game.Update();
|
|
}
|
|
|
|
private void OnApplicationFocus(bool focus)
|
|
{
|
|
if (focus == false) SLOption.Save();
|
|
if (SLGame.Session["Option"]["Volume"]["MuteInBackground"])
|
|
{
|
|
AudioListener.volume = focus ? 1 : 0;
|
|
}
|
|
}
|
|
|
|
private void OnApplicationPause(bool pause)
|
|
{
|
|
if (pause == true) SLOption.Save();
|
|
}
|
|
}
|
|
} |