EnergyEfficiencyManagement/Assets/Zion/Scripts/Init.cs

71 lines
1.8 KiB
C#

using System;
using System.IO;
using UnityEngine;
public class Init : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
LoadInfo();
}
// Update is called once per frame
void Update()
{
}
void LoadInfo()
{
string tempStr;
string path = Application.streamingAssetsPath + "/info.ini";
Debug.Log(path);
if (File.Exists(path))
{
tempStr = File.ReadAllText(path); Debug.Log(tempStr);
string[] data = tempStr.Split(new char[] { '#' });
DateTime dt = DateTime.Parse(data[0]);
TimeSpan ts = DateTime.Now - dt;
Debug.Log(dt);
Debug.Log(DateTime.Now);
if (ts.Seconds > 60)
{
Debug.Log("超时");
Debug.Log(data[0]);
}
else
{
if (!data[1].Contains("local"))
{
string[] taskData = data[1].Split(new char[] { ',' });
// for (int i = 0; i < taskData.Length; i++)
// {
// Debug.Log("taskData" + i + ":" + taskData[i]);
// }
if (taskData[4].Equals("3"))
{
Debug.Log("考试模式");
GameManager.Instance.Init();
}
else if (taskData[4].Equals("1") || taskData[4].Equals("2"))
{
Debug.Log("学习模式");
GameManager.Instance.Init();
}
}
else
{
Debug.Log("单机模式");
GameManager.Instance.Init();
}
}
}
}
}