117 lines
3.2 KiB
C#
117 lines
3.2 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using UnityEngine;
|
|
using static InterfaceManager;
|
|
|
|
public class GameManager : MonoBehaviour
|
|
{
|
|
#region ״̬
|
|
|
|
/// <summary>
|
|
/// 是否登录
|
|
/// </summary>
|
|
public static bool is_login = false;
|
|
|
|
private static string _current_scene;
|
|
/// <summary>
|
|
/// 当前运行的模型场景
|
|
/// </summary>
|
|
public static string current_scene { get { return _current_scene; } set { _current_scene = scene_name = value; } }
|
|
/// <summary>
|
|
/// 当前运行场景的时间
|
|
/// </summary>
|
|
public static string current_scene_time { get; set; }
|
|
|
|
private static MainMenuType _main_menu_type;
|
|
/// <summary>
|
|
/// 当前主菜单选项
|
|
/// </summary>
|
|
public static MainMenuType current_main_menu_type
|
|
{
|
|
get
|
|
{
|
|
return _main_menu_type;
|
|
}
|
|
set
|
|
{
|
|
_main_menu_type = value;
|
|
parttern_name = value.ToString();
|
|
Debug.Log("切换模式:" + _main_menu_type.ToString());
|
|
}
|
|
}
|
|
|
|
private static ComponentType _component_type;
|
|
/// <summary>
|
|
/// 当前组件类型
|
|
/// </summary>
|
|
public static ComponentType current_component_type { get { return _component_type; } set { _component_type = value; part_name = value.ToString(); } }
|
|
#endregion
|
|
|
|
public static GameManager Instance;
|
|
|
|
#region 场景信息
|
|
/// <summary>
|
|
/// 当前所有场景详情数据
|
|
/// </summary>
|
|
public static List<FreeSceneItem.SceneItemDetailData> scene_detail_datas = new List<FreeSceneItem.SceneItemDetailData>();
|
|
/// <summary>
|
|
/// 组件名称:[机器人、数字人、无人机]
|
|
/// </summary>
|
|
public static string part_name { get; private set; }
|
|
/// <summary>
|
|
/// 场景名称:[]
|
|
/// </summary>
|
|
public static string scene_name { get; private set; }
|
|
/// <summary>
|
|
/// 模式名称:[课程任务、案例、自由编程]
|
|
/// </summary>
|
|
public static string parttern_name { get; private set; }
|
|
#endregion
|
|
|
|
private void Awake()
|
|
{
|
|
if (Instance != null && Instance != this)
|
|
{
|
|
Destroy(gameObject);
|
|
return;
|
|
}
|
|
Instance = this;
|
|
}
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
DontDestroyOnLoad(gameObject);
|
|
Debug.Log("Game Init");
|
|
}
|
|
|
|
/// <summary>
|
|
/// 检查功能所需版本号是否满足
|
|
/// </summary>
|
|
/// <param name="_version"></param>
|
|
/// <returns></returns>
|
|
public static bool VersionCheck(string _version)
|
|
{
|
|
var local_version = Version.Split('.');
|
|
var check_version = _version.Split('.');
|
|
bool _check = true;
|
|
if (local_version.Length >= check_version.Length)
|
|
{
|
|
for (int i = 0; i < check_version.Length; i++)
|
|
{
|
|
if (int.Parse(check_version[i]) >= int.Parse(local_version[i]))
|
|
{
|
|
|
|
}
|
|
else
|
|
{
|
|
_check = false;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
else _check = false;
|
|
return _check;
|
|
}
|
|
}
|