上海虹口龙之梦项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

59 lines
2.1 KiB

using Newtonsoft.Json;
using System.IO;
using UnityEngine;
public class GameManager : Singleton<GameManager>
{
// Start is called before the first frame update
public override void Initialize()
{
base.Initialize();
//AssetManager.Instance.Initialize();
UIManager.Instance.Initialize();
LoadConfig();
}
public static void SaveConfig()
{
ConfigWebGL webConfig = new ConfigWebGL() {ServerAddress = Config.ServerAddress, BucketName = Config.BucketName, AreaName = Config.AreaName, CompanyName = Config.CompanyName };
string json = JsonConvert.SerializeObject(webConfig, Formatting.Indented);
string path = Path.Combine(Application.streamingAssetsPath, "Config.json");
using (StreamWriter streamWriter = File.CreateText(path))
{
streamWriter.Write(json);
}
}
public static void LoadConfig()
{
string path = Path.Combine(Application.streamingAssetsPath, "Config.json");
UnityNetworkManager.Instance.Get(path, (b, json) =>
{
if (b)
{
Debug.Log("================================================================"+json);
}
else
{
ConfigWebGL webConfig = JsonConvert.DeserializeObject<ConfigWebGL>(json);
Config.ServerAddress = webConfig.ServerAddress;
Config.BucketName = webConfig.BucketName;
Config.AreaName = webConfig.AreaName;
Config.CompanyName = webConfig.CompanyName;
Config.LocationServer = webConfig.LocationServer;
Config.AlarmServer = webConfig.AlarmServer;
Config.PersonnelVideoUrl = webConfig.PersonnelVideoUrl;
Config.Tags = webConfig.Tags;
Config.Range = webConfig.Range;
Config.Interval = webConfig.Interval;
Config.AlarmServer = webConfig.AlarmServer;
Config.AlarmInterval = webConfig.AlarmInterval;
Debug.Log("ServerAddress" + Config.ServerAddress);
}
});
}
}