using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class GameLaunch : MonoBehaviour { /// /// 进度加载 /// [SerializeField] private AsyncLoad m_asyncLoad; [Header("是否开启进度加载")] [SerializeField] private bool m_isOpenAsyncLoad; private void Start() { InitStartupData(); } /// /// 初始化启动数据 /// private void InitStartupData() { string[] args = Environment.GetCommandLineArgs(); if (args.Length < 2) { return; } //模拟数据 //string simulationData = "11111111111/10kV真空断路器及开关柜例行检修/练习/47.92.0.243:15156"; //string[] tmpArgs = simulationData.Split('/'); //截断 string[] tmpArgs = args[1].Split('/'); // 文件各种:手机号/课程名/模式/地址 string tmpPhoneNumber = tmpArgs[0]; string tmpCourseName = tmpArgs[1]; string tmpMode = tmpArgs[2]; if (tmpArgs.Length > 3) { string tmpAddress = tmpArgs[3]; GrpcChannelContronller.Instance.StartClient(tmpAddress); GetInfoaboutSpecifiedUser(tmpPhoneNumber); } SetOperationMode(tmpMode); GlobalConfig.m_SelectDevice = tmpCourseName; if (!string.IsNullOrEmpty(tmpCourseName)) { m_asyncLoad.Init(tmpCourseName, m_isOpenAsyncLoad); } else { Debug.Log($"ERROR:请检查是否存在 {tmpCourseName} 课程"); } } /// /// 获取指定用户信息 /// /// private void GetInfoaboutSpecifiedUser(string _phoneNumber) { UserProxy userProxy = DAL.Instance.Get(); SearchInfoResponse tmpResponse = GrpcChannelContronller.Instance.client.StudentInfoSearch(new SearchRequest() { PhoneNumber = _phoneNumber }); if (tmpResponse.Result) { userProxy.userInfo.userName = tmpResponse.StudentInfos[0].Name; userProxy.userInfo.phoneNumber = _phoneNumber; } } /// /// 设置操作模式 /// /// private void SetOperationMode(string _mode) { switch (_mode) { case "学习": GlobalData.m_CurrentOperationMode = OperationMode.Learn; break; case "练习": GlobalData.m_CurrentOperationMode = OperationMode.Practice; break; case "考核": GlobalData.m_CurrentOperationMode = OperationMode.Exam; break; } } }