GameLaunch_Qiushi.cs 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. using UnityEngine.UI;
  6. public class GameLaunch_Qiushi : MonoBehaviour
  7. {
  8. /// <summary>
  9. /// 进度加载
  10. /// </summary>
  11. [SerializeField]
  12. private AsyncLoad_Qiushi m_asyncLoad;
  13. [Header("是否开启进度加载")]
  14. [SerializeField]
  15. private bool m_isOpenAsyncLoad;
  16. private void Start()
  17. {
  18. InitStartupData();
  19. }
  20. /// <summary>
  21. /// 操作类型
  22. /// </summary>
  23. private string m_OperationType;
  24. /// <summary>
  25. /// 初始化启动数据
  26. /// </summary>
  27. private void InitStartupData()
  28. {
  29. string[] args = Environment.GetCommandLineArgs();
  30. if (args.Length < 2)
  31. {
  32. return;
  33. }
  34. //模拟数据
  35. //string simulationData = "11111111111/10kV真空断路器及开关柜例行检修/练习/47.92.0.243:15156";
  36. //string[] tmpArgs = simulationData.Split('/');
  37. //截断
  38. string tmpArgsDecrypt = args[1].Decrypt("chivatech");
  39. string[] tmpArgs = tmpArgsDecrypt.Split('/');
  40. // 文件各种:手机号/课程名/模式/地址
  41. string tmpMode = tmpArgs[1];
  42. m_OperationType = tmpArgs[1];
  43. string tmpCourseName = tmpArgs[2];
  44. string tmpPhoneNumber = tmpArgs[4];
  45. string tmpAddress = tmpArgs[5];
  46. GrpcChannelContronller.Instance.StartClient(tmpAddress);
  47. GetInfoaboutSpecifiedUser(tmpPhoneNumber);
  48. SetOperationMode(tmpMode);
  49. GlobalConfig.m_SelectDevice = tmpCourseName;
  50. if (!string.IsNullOrEmpty(tmpCourseName))
  51. {
  52. m_asyncLoad.Init(tmpCourseName, m_isOpenAsyncLoad);
  53. }
  54. else
  55. {
  56. Debug.Log($"ERROR:请检查是否存在 {tmpCourseName} 课程");
  57. }
  58. }
  59. /// <summary>
  60. /// 获取指定用户信息
  61. /// </summary>
  62. /// <param name="_phoneNumber"></param>
  63. private void GetInfoaboutSpecifiedUser(string _phoneNumber)
  64. {
  65. UserProxy userProxy = DAL.Instance.Get<UserProxy>();
  66. SearchInfoResponse tmpResponse = GrpcChannelContronller.Instance.client.StudentInfoSearch(new SearchRequest()
  67. {
  68. PhoneNumber = _phoneNumber
  69. });
  70. if (tmpResponse.Result)
  71. {
  72. userProxy.userInfo.userName = tmpResponse.StudentInfos[0].Name;
  73. userProxy.userInfo.phoneNumber = _phoneNumber;
  74. }
  75. }
  76. /// <summary>
  77. /// 设置操作模式
  78. /// </summary>
  79. /// <param name="_mode"></param>
  80. private void SetOperationMode(string _mode)
  81. {
  82. switch (_mode)
  83. {
  84. case "Learn":
  85. GlobalData.m_CurrentOperationMode = OperationMode.Learn;
  86. break;
  87. case "Practice":
  88. GlobalData.m_CurrentOperationMode = OperationMode.Practice;
  89. break;
  90. case "Exam":
  91. GlobalData.m_CurrentOperationMode = OperationMode.Exam;
  92. break;
  93. }
  94. }
  95. }