using System;
using System.Collections.Generic;
using System.Text;
using UnityEngine;
using UnityEngine.SceneManagement;
using System.Linq;
using System.Collections;
using DataModel.Model;
using System.Net.Sockets;
using System.Threading;
using System.Net;
using LitJson;
using TMPro;
using System.IO;
using UnityEngine.Networking;
using UnityEngine.UI;
public class LoadManage : MonoBehaviour
{
public static LoadManage Instance;
///
/// 系统模式
///
public SystemMode systemMode;
///
/// 本人账户信息
///
[HideInInspector]
public User me;
///
/// 当前训练 (进房间前赋值)
///
[HideInInspector]
public practice currentPractice=null;
///
/// 当前科目
///
[HideInInspector]
public practicesubject currentPracticeSubejct=null;
///
/// 当前岗位
///
[HideInInspector]
public practiceseat currentPracticeSeat=null;
///
/// 当前步骤
///
[HideInInspector]
public practicesubjectstep currentPracticeSubjectStep=null;
///
/// 本人在训练中所有岗位信息
///
[HideInInspector]
public List myPracticeSeat=new List();
///
/// 训练科目 (进房间前赋值)
///
[HideInInspector]
public List psubjects;
///
/// 训练步骤
///
[HideInInspector]
public List psteps;
///
/// 训练岗位
///
[HideInInspector]
public List pseats;
///
/// 音量大小
///
[DisplayOnly]
public float SourceLiangValue;
///
/// 音效大小
///
[DisplayOnly]
public float SourceXiaoValue;
[HideInInspector]
public string MyId;
///
/// 房间域 "1room"
///
[DisplayOnly]
public string currentRoomArea;
///
/// 同步Id
///
[DisplayOnly]
public int SyncId;
///
/// 训练状态
///
public static ProgramState programState = ProgramState.结束;
///
/// 是否暂停
///
public static bool isPause;
///
/// 与RoomServer通信
///
[DisplayOnly]
public MyNetMQClient RSclient;
#region UDP
[HideInInspector]
public UdpClient udpClient;
bool udpRun;
int refreshTime = 0;
#endregion
List tmps;
public static string IP = "";
public InputField interfanceInput;
public GameObject inputCanvas;
///
/// 人员
///
public static List persons = new List();
private void Awake()
{
Instance = this;
DontDestroyOnLoad(gameObject);
//启动(测试用) HQB20250917
//udpClient = new UdpClient(8889);
//udpRun = true;
//Thread thread = new Thread(UdpRecive);
//thread.IsBackground = true;
//thread.Start();
//if (PlayerPrefs.HasKey("接口服务IP"))
//{
// interfanceInput.text = PlayerPrefs.GetString("接口服务IP","");
//}
//IP = interfanceInput.text;
//StartCoroutine(CallGet("http://" + IP + "/3DConfig/MainSetting.txt"));
SceneManager.LoadScene("LoginSencePC");
#if UNITY_EDITOR
UnityEngine.Debug.unityLogger.logEnabled = true;
#else
UnityEngine.Debug.unityLogger.logEnabled = false;
#endif
}
///
/// 获取IP配置
///
///
///
public IEnumerator CallGet(string url)
{
UnityWebRequest request = UnityWebRequest.Get(url);
yield return request.SendWebRequest();
if (request.isDone)
{
if (request.isHttpError || request.isNetworkError)
{
MessagePanel.ShowMessage("接口异常+isHttpError" + request.isHttpError + ",isNetworkError" + request.isNetworkError, GameObject.FindObjectOfType