This commit is contained in:
陈向学 2024-04-09 13:45:36 +08:00
parent dd61a24e0a
commit dea356073e
3 changed files with 39 additions and 5 deletions

View File

@ -55,10 +55,20 @@ public class LoginPanel :XUIPanel
Fixed(); Fixed();
}); });
if (PlayerPrefs.HasKey("Õ˺Å"))
//加载试卷
if (MyManage.instance.startMode != null && MyManage.instance.startMode.teachplanId>0)
{ {
accountInput.text = PlayerPrefs.GetString("Õ˺Å"); //参数启动
accountInput.text = "admin" + MyManage.instance.startMode.teachplanId;
accountInput.interactable = false;
} }
else
{
//无参启动
accountInput.interactable = true;
}
accountInput.ActivateInputField(); accountInput.ActivateInputField();
ClickModify(); ClickModify();
version.text = ScenesRecorder.instance.version; version.text = ScenesRecorder.instance.version;

View File

@ -10,6 +10,8 @@ using SGUnitySDK.Services.HTTP;
using SGUnitySDK.Utils; using SGUnitySDK.Utils;
using System; using System;
using RuralPower; using RuralPower;
using static UnityEditor.PlayerSettings;
using System.Linq;
public class MyManage : MonoBehaviour public class MyManage : MonoBehaviour
{ {
@ -26,13 +28,20 @@ public class MyManage : MonoBehaviour
/// ģʽ /// ģʽ
/// </summary> /// </summary>
public PlayModeEnum playModeEnum; public PlayModeEnum playModeEnum;
/// <summary>
/// 启动参数
/// </summary>
List<string> infos;
private void Awake() private void Awake()
{ {
instance = this; instance = this;
infos = Environment.GetCommandLineArgs().ToList();
//³õʼ»¯ //³õʼ»¯
#if UNITY_EDITOR #if UNITY_EDITOR
SGStartParamsService.GetInstance().setMode("eyJtb2RlIjo1LCJwbGFuTG9jYWxQYXRoIjoiRDpcXFVzZXJGaWxlc1xc5Yac55S156ue6LWb5a+55o6lXFzmoYjkvoszLnppcCIsInByYWN0aXNlSWQiOiIxIiwic3R1VXNlcklkIjoiMzk4IiwiYXBwSWQiOiI2OCIsImV4YW1JZCI6Ii0xIiwidGVhY2hwbGFuSWQiOiIzIiwiY291cnNlSWQiOiItMSJ9"); SGStartParamsService.GetInstance().setMode("eyJtb2RlIjo1LCJwbGFuTG9jYWxQYXRoIjoiRDpcXFVzZXJGaWxlc1xc5Yac55S156ue6LWb5a+55o6lXFzmoYjkvoszLnppcCIsInByYWN0aXNlSWQiOiI1NyIsInN0dVVzZXJJZCI6IjM4NyIsImFwcElkIjoiNTUiLCJleGFtSWQiOiItMSIsInRlYWNocGxhbklkIjoiMyIsImNvdXJzZUlkIjoiLTEifQ==");
SGStartParamsService.GetInstance().setToken("b745dbae-7744-4bd3-ac52-c22ae974f7e5"); SGStartParamsService.GetInstance().setToken("74c05c8d-3915-4bb7-a1b2-1d643ad5d145");
#endif #endif
SGUConfig config = new SGUConfig(); SGUConfig config = new SGUConfig();
SGUSdk.GetInstance().InitSDK(config); SGUSdk.GetInstance().InitSDK(config);
@ -96,6 +105,7 @@ public class MyManage : MonoBehaviour
RuralPowerAPI ruralPowerAPI = new RuralPowerAPI(); RuralPowerAPI ruralPowerAPI = new RuralPowerAPI();
var tmps=ruralPowerAPI.GetAnswer(ScenesRecorder.user.ExamId, ScenesRecorder.user.user_id, startMode.teachplanId); var tmps=ruralPowerAPI.GetAnswer(ScenesRecorder.user.ExamId, ScenesRecorder.user.user_id, startMode.teachplanId);
Debug.Log("µ±Ç°´ð°¸====================="); Debug.Log("µ±Ç°´ð°¸=====================");
Debug.Log(JsonConvert.SerializeObject(DataBase.achievement_list));
foreach (var tmp in tmps) foreach (var tmp in tmps)
{ {
Debug.Log(JsonConvert.SerializeObject(tmp)); Debug.Log(JsonConvert.SerializeObject(tmp));
@ -104,6 +114,19 @@ public class MyManage : MonoBehaviour
} }
#endif #endif
} }
private void OnGUI()
{
if (infos != null && infos.Count > 0)
{
GUILayout.Label("启动参数:");
for (int i = 0; i < infos.Count; i++)
{
GUILayout.Label(infos[i]);
}
}
}
/// <summary> /// <summary>
/// ¿ªÊ¼Á·Ï° /// ¿ªÊ¼Á·Ï°
/// </summary> /// </summary>
@ -208,7 +231,8 @@ public class MyManage : MonoBehaviour
{ {
RuralPowerAPI ruralPowerAPI = new RuralPowerAPI(); RuralPowerAPI ruralPowerAPI = new RuralPowerAPI();
var answers = ruralPowerAPI.GetAnswer(ScenesRecorder.user.ExamId, ScenesRecorder.user.user_id, startMode.teachplanId); var answers = ruralPowerAPI.GetAnswer(ScenesRecorder.user.ExamId, ScenesRecorder.user.user_id, startMode.teachplanId);
Debug.Log("结束练习:");
Debug.Log(JsonConvert.SerializeObject(answers));
HttpExamService getPractiseInfo = new HttpExamService(); HttpExamService getPractiseInfo = new HttpExamService();
ResponObject responObject = getPractiseInfo.UploadAnswer(startMode.examId, userData.id, answers); ResponObject responObject = getPractiseInfo.UploadAnswer(startMode.examId, userData.id, answers);
if (responObject.code == "0") if (responObject.code == "0")