This commit is contained in:
huqibin 2024-09-23 09:50:42 +08:00
parent 49df979e55
commit fb623f632b
18 changed files with 736 additions and 82 deletions

View File

@ -59,13 +59,6 @@ public class GameLauncher : MonoBehaviour
//¼ÓÔØÏûÏ¢¿ò
MotionEngine.CreateModule<MessageManager>();
//教学模式显示箭头和提示框
if (MotionEngine.GetModule<DataConfigManager>().GetProcessMode() != ProcessMode.Assessment)
{
this.GetComponent<IndicatorArrowComponent>().Init();
}
//ÐÞ¸Äģʽ
MotionEngine.GetModule<DataConfigManager>().SetProcessMode(MotionEngine.GetModule<InfoDataManager>().GetParsedData().SceneModel);
@ -77,6 +70,12 @@ public class GameLauncher : MonoBehaviour
//³õʼ»¯²½ÖèÁ÷³Ì
MotionEngine.GetModule<AnimationProcessManager>().InitializeFirstStep();
//教学模式显示箭头和提示框
if (MotionEngine.GetModule<DataConfigManager>().GetProcessMode() != ProcessMode.Assessment)//HQB 0920
{
this.GetComponent<IndicatorArrowComponent>().Init();
}
}

View File

@ -20,10 +20,11 @@ namespace MotionFramework.Scripts.Runtime.Engine.Engine.Network.WebRequest
/// <param name="onProgress"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public async UniTask<string> GetTextAsync(string url, Action<float> onProgress = null, CancellationToken cancellationToken = default)
public async UniTask<string> GetTextAsync(string url, string token, Action<float> onProgress = null, CancellationToken cancellationToken = default)
{
using (UnityWebRequest request = UnityWebRequest.Get(url))
{
request.SetRequestHeader("auth_token", token);
await SendRequestWithProgress(request, onProgress, cancellationToken);
if (request.result == UnityWebRequest.Result.ConnectionError || request.result == UnityWebRequest.Result.ProtocolError)
{
@ -238,15 +239,16 @@ namespace MotionFramework.Scripts.Runtime.Engine.Engine.Network.WebRequest
/// <param name="onProgress"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public async UniTask<string> PostJsonAsync(string url, string jsonData, Action<float> onProgress = null, CancellationToken cancellationToken = default)
public async UniTask<string> PostJsonAsync(string url, string token, string jsonData, Action<float> onProgress = null, CancellationToken cancellationToken = default)
{
Debug.Log("Ìá½»ÊÔ¾í:" + url);
using (UnityWebRequest request = new UnityWebRequest(url, UnityWebRequest.kHttpVerbPOST))
{
byte[] bodyRaw = System.Text.Encoding.UTF8.GetBytes(jsonData);
request.uploadHandler = new UploadHandlerRaw(bodyRaw);
request.downloadHandler = new DownloadHandlerBuffer();
request.SetRequestHeader("Content-Type", "application/json");
request.SetRequestHeader("auth_token", token);//HQB
await SendRequestWithProgress(request, onProgress, cancellationToken);
if (request.result == UnityWebRequest.Result.ConnectionError || request.result == UnityWebRequest.Result.ProtocolError)
{

View File

@ -2322,6 +2322,10 @@ PrefabInstance:
propertyPath: m_Enabled
value: 1
objectReference: {fileID: 0}
- target: {fileID: 5901248756884239939, guid: fa12b84946083d14cb4447029910be28, type: 3}
propertyPath: practiceTime
value:
objectReference: {fileID: 1127559886}
- target: {fileID: 5913175448180373515, guid: fa12b84946083d14cb4447029910be28, type: 3}
propertyPath: m_Sprite
value:
@ -2484,7 +2488,23 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 7027834050634466508, guid: fa12b84946083d14cb4447029910be28, type: 3}
propertyPath: m_text
value: "\u5F20\u4E09\u4E09"
value: "\u5180\u5EFA\u6C11"
objectReference: {fileID: 0}
- target: {fileID: 7027834050634466508, guid: fa12b84946083d14cb4447029910be28, type: 3}
propertyPath: m_fontAsset
value:
objectReference: {fileID: 11400000, guid: 01096d19d4ab6f14eab3c8bf2b08f541, type: 2}
- target: {fileID: 7027834050634466508, guid: fa12b84946083d14cb4447029910be28, type: 3}
propertyPath: m_fontStyle
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7027834050634466508, guid: fa12b84946083d14cb4447029910be28, type: 3}
propertyPath: m_sharedMaterial
value:
objectReference: {fileID: 3830445454110675045, guid: 01096d19d4ab6f14eab3c8bf2b08f541, type: 2}
- target: {fileID: 7027834050634466508, guid: fa12b84946083d14cb4447029910be28, type: 3}
propertyPath: m_hasFontAssetChanged
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7111662294929120867, guid: fa12b84946083d14cb4447029910be28, type: 3}
propertyPath: m_Sprite
@ -2696,6 +2716,9 @@ PrefabInstance:
- targetCorrespondingSourceObject: {fileID: 3872295731099453067, guid: fa12b84946083d14cb4447029910be28, type: 3}
insertIndex: -1
addedObject: {fileID: 1382749199}
- targetCorrespondingSourceObject: {fileID: 8040459939376544360, guid: fa12b84946083d14cb4447029910be28, type: 3}
insertIndex: 4
addedObject: {fileID: 1127559885}
- targetCorrespondingSourceObject: {fileID: 5439446738207451450, guid: fa12b84946083d14cb4447029910be28, type: 3}
insertIndex: -1
addedObject: {fileID: 501902162}
@ -2708,7 +2731,7 @@ PrefabInstance:
addedObject: {fileID: 1847624254}
- targetCorrespondingSourceObject: {fileID: 5694174020841979734, guid: fa12b84946083d14cb4447029910be28, type: 3}
insertIndex: -1
addedObject: {fileID: 1175298433}
addedObject: {fileID: 1175298439}
- targetCorrespondingSourceObject: {fileID: 7261749442720430534, guid: fa12b84946083d14cb4447029910be28, type: 3}
insertIndex: -1
addedObject: {fileID: 191666369}
@ -12295,6 +12318,140 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1123086041}
m_CullTransparentMesh: 1
--- !u!1 &1127559884
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1127559885}
- component: {fileID: 1127559887}
- component: {fileID: 1127559886}
m_Layer: 0
m_Name: "\u7EC3\u4E60\u4F7F\u7528\u65F6\u95F4"
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1127559885
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1127559884}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1950461391}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 6.6477003, y: -39.599976}
m_SizeDelta: {x: 255.4846, y: 30.2964}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1127559886
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1127559884}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text:
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 45138b4de74eb5a4b829ae598c8cb358, type: 2}
m_sharedMaterial: {fileID: 3942548801962692333, guid: 45138b4de74eb5a4b829ae598c8cb358, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4288237841
m_fontColor: {r: 0.06666667, g: 0.31764707, b: 0.6, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_StyleSheet: {fileID: 0}
m_TextStyleHashCode: -1183493901
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 16
m_fontSizeBase: 16
m_fontWeight: 400
m_enableAutoSizing: 0
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 1
m_HorizontalAlignment: 1
m_VerticalAlignment: 512
m_textAlignment: 65535
m_characterSpacing: 0
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_enableWordWrapping: 1
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_linkedTextComponent: {fileID: 0}
parentLinkedComponent: {fileID: 0}
m_enableKerning: 1
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
m_parseCtrlCharacters: 1
m_isOrthographic: 1
m_isCullingEnabled: 0
m_horizontalMapping: 0
m_verticalMapping: 0
m_uvLineOffset: 0
m_geometrySortingOrder: 0
m_IsTextObjectScaleStatic: 0
m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 0, w: 0}
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!222 &1127559887
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1127559884}
m_CullTransparentMesh: 1
--- !u!1 &1134550762
GameObject:
m_ObjectHideFlags: 0
@ -12762,7 +12919,7 @@ GameObject:
m_CorrespondingSourceObject: {fileID: 5694174020841979734, guid: fa12b84946083d14cb4447029910be28, type: 3}
m_PrefabInstance: {fileID: 191666367}
m_PrefabAsset: {fileID: 0}
--- !u!114 &1175298433
--- !u!114 &1175298439
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
@ -23436,6 +23593,11 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1942579444}
m_CullTransparentMesh: 1
--- !u!224 &1950461391 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 8040459939376544360, guid: fa12b84946083d14cb4447029910be28, type: 3}
m_PrefabInstance: {fileID: 191666367}
m_PrefabAsset: {fileID: 0}
--- !u!1 &1953000207
GameObject:
m_ObjectHideFlags: 0

View File

@ -17588,6 +17588,7 @@ GameObject:
- component: {fileID: 877326145}
- component: {fileID: 877326144}
- component: {fileID: 877326143}
- component: {fileID: 877326147}
m_Layer: 5
m_Name: Canvas (2)
m_TagString: Untagged
@ -17678,6 +17679,18 @@ RectTransform:
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &877326147
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 877326142}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4255571b6392ba843a3d004027992244, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &881447936
GameObject:
m_ObjectHideFlags: 0
@ -17703,14 +17716,14 @@ RectTransform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 881447936}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalRotation: {x: -0.04180079, y: 0.21903005, z: 0.0076662716, w: 0.97479224}
m_LocalPosition: {x: 0, y: 0, z: -860.5}
m_LocalScale: {x: 0.071971, y: 0.071971, z: 0.071971}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 593568343}
m_Father: {fileID: 314679705}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_LocalEulerAnglesHint: {x: -4.868, y: 25.336, z: -0.194}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 26.3, y: 7.68}
@ -35309,7 +35322,7 @@ PrefabInstance:
m_Modifications:
- target: {fileID: -8679921383154817045, guid: fe4c1814d44af964c94c33808b704426, type: 3}
propertyPath: m_LocalPosition.x
value: 304.15
value: 306.99
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: fe4c1814d44af964c94c33808b704426, type: 3}
propertyPath: m_LocalPosition.y
@ -35317,11 +35330,11 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: fe4c1814d44af964c94c33808b704426, type: 3}
propertyPath: m_LocalPosition.z
value: 168.04
value: 164.18
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: fe4c1814d44af964c94c33808b704426, type: 3}
propertyPath: m_LocalRotation.w
value: 0
value: 0.7071068
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: fe4c1814d44af964c94c33808b704426, type: 3}
propertyPath: m_LocalRotation.x
@ -35329,7 +35342,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: fe4c1814d44af964c94c33808b704426, type: 3}
propertyPath: m_LocalRotation.y
value: 1
value: 0.7071068
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: fe4c1814d44af964c94c33808b704426, type: 3}
propertyPath: m_LocalRotation.z
@ -35341,7 +35354,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: fe4c1814d44af964c94c33808b704426, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 180
value: 90
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: fe4c1814d44af964c94c33808b704426, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
@ -35501,7 +35514,7 @@ Transform:
m_GameObject: {fileID: 1810323351}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 303.59, y: 1.14, z: 163.544}
m_LocalPosition: {x: 305.61, y: 1.14, z: 163.544}
m_LocalScale: {x: 4.2154512, y: 1.9946195, z: 3.9705188}
m_ConstrainProportionsScale: 0
m_Children: []
@ -35573,7 +35586,7 @@ BoxCollider:
m_ProvidesContacts: 0
m_Enabled: 1
serializedVersion: 3
m_Size: {x: 0.9429537, y: 0.27271962, z: 1.4630866}
m_Size: {x: 1.68, y: 0.27271962, z: 1.4630866}
m_Center: {x: 0.0028089092, y: -0.36363685, z: 0.23154095}
--- !u!23 &1810323356
MeshRenderer:

View File

@ -5,13 +5,16 @@ using UnityEngine;
public class APIs
{
/// <summary>
/// 虚拟仿真考试提交分数
/// </summary>
public static string SimulationScore = PlayerPrefs.GetString("IP")+ "/member/pro/score/simulationScore";
#if UNITY_EDITOR
public static string SimulationScore = PlayerPrefs.GetString("IP") + "/member/pro/score/simulationScore";
public static string queryByExamId = PlayerPrefs.GetString("IP") + "/member/proSimulationExamination/queryById?id=";
#else
public static string SimulationScore = PlayerPrefs.GetString("IP")+ "/pro/score/simulationScore";
public static string queryByExamId = PlayerPrefs.GetString("IP") + "/proSimulationExamination/queryById?id=";
#endif
}

View File

@ -20,8 +20,9 @@ public class CountdownTimer : MonoBehaviour
}
private async UniTaskVoid StartCountdown()
{
for (int i = countdownTime; i >= 0; i--)
{
int i = countdownTime;
for (; i >= 0; i--)
{
countdownText.text = $"<size={numberFontSize}>{i}</size><size={suffixFontSize}>s</size>";
countdownImage.fillAmount = (float)i / countdownTime;
@ -31,11 +32,17 @@ public class CountdownTimer : MonoBehaviour
countdownText.text = $"<size={numberFontSize}>0</size><size={suffixFontSize}>s</size>";
countdownImage.fillAmount = 0;
if (i <= 0)
{
//倒计时结束退出程序
Application.Quit();
}
}
// #if !UNITY_EDITOR
//
// #else
// Application.Quit();
// #endif
// #if !UNITY_EDITOR
//
// #else
// Application.Quit();
// #endif
}

View File

@ -0,0 +1,23 @@
using DefaultNamespace;
using DefaultNamespace.ProcessMode;
using MotionFramework;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TeachingGotoScene : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
if (MotionEngine.GetModule<DataConfigManager>().GetProcessMode() == ProcessMode.Teaching ||
MotionEngine.GetModule<DataConfigManager>().GetProcessMode() == ProcessMode.Training)//HQB
MotionEngine.GetModule<AnimationProcessManager>().HandleClick("ǰÍùÏÖ³¡");
}
// Update is called once per frame
void Update()
{
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4255571b6392ba843a3d004027992244
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -31,7 +31,8 @@ public class IndicatorArrowComponent : MonoBehaviour
teachingModePrompt.SetActive(true);
MotionEngine.GetModule<AnimationProcessManager>().OnTeachingPromptsObjects += TeachingPromptsObjects;
if (MotionEngine.GetModule<DataConfigManager>().GetProcessMode() == ProcessMode.Teaching)//LY除了教学模式都弹出提示
if (MotionEngine.GetModule<DataConfigManager>().GetProcessMode() == ProcessMode.Teaching
|| MotionEngine.GetModule<DataConfigManager>().GetProcessMode() == ProcessMode.Training)//LY除了教学模式都弹出提示
{
MotionEngine.GetModule<AnimationProcessManager>().OnStepProcessDescriptionMessage += OnSendMessagePrompt;
}

View File

@ -71,7 +71,7 @@ public class InfoDataManager : ModuleSingleton<InfoDataManager>, IModule
_parsedData.SceneModel = int.Parse(dataElements[1]);
_parsedData.ExamId = int.Parse(dataElements[2]);
_parsedData.UserId = dataElements[3];
_parsedData.Username = dataElements[4];
_parsedData.Username = WWW.UnEscapeURL(dataElements[4], System.Text.Encoding.UTF8);
_parsedData.Token = dataElements[5];
_parsedData.UserTime = int.Parse(dataElements[6]);
_parsedData.ClassId = int.Parse(dataElements[7]);

View File

@ -1,7 +1,11 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Runtime.Remoting.Metadata.W3cXsd2001;
using System.Security.Cryptography;
using System.Security.Policy;
using System.Threading.Tasks;
using Cysharp.Threading.Tasks;
using DefaultNamespace.Dto;
@ -10,7 +14,9 @@ using MotionFramework;
using MotionFramework.Scripts.Runtime.Engine.Engine.Network.WebRequest;
using Newtonsoft.Json;
using Unity.VisualScripting;
using Unity.VisualScripting.Antlr3.Runtime;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.UI;
using Type = System.Type;
@ -65,6 +71,14 @@ namespace DefaultNamespace.ProcessMode
/// </summary>
public event StepProcessDescriptionMessage OnStepProcessDescriptionMessage;
/// <summary>
/// HQB 更新token
/// </summary>
/// <param name="type"></param>
public Coroutine updateTokenCor;
public float updateTime = 270.0f;
public float updateTimeIter = 270.0f;
// /// <summary>
// /// 教学模式提示
// /// </summary>
@ -546,6 +560,7 @@ namespace DefaultNamespace.ProcessMode
float sco = step.Score / step.Actions[0].TargetObjects.Count;
Debug.Log("每个物体的分数--->" + sco);
float zong = step.Score - sco * value.Count;
if (zong < 0) zong = 0;//HQB步骤分最低扣到0
totalScore += zong;
Debug.Log("扣的分数--->" + (step.Score - sco * value.Count));
Debug.Log($"步骤 {stepIndex + 1} 错误点击的物体: {string.Join(", ", value)}");
@ -577,6 +592,7 @@ namespace DefaultNamespace.ProcessMode
_submitScoreSteps.Add(sub);
}
if (totalScore < 0)totalScore = 0;//HQB防止掉到0以下
Debug.Log($"总分: {totalScore}");
return (int)totalScore;
}
@ -587,8 +603,17 @@ namespace DefaultNamespace.ProcessMode
_incorrectClicksPerStep = new Dictionary<int, List<string>>();
}
public void OnUpdate()
public async void OnUpdate()
{
updateTimeIter -= Time.deltaTime;
if (updateTimeIter <= 0.0f)
{
//HQB 更新token
Debug.Log("更新token");
int kaoID = MotionEngine.GetModule<InfoDataManager>().GetParsedData().ExamId;
string re = await MotionEngine.GetModule<WebRequestManager>().GetTextAsync(APIs.queryByExamId + kaoID, MotionEngine.GetModule<InfoDataManager>().GetParsedData().Token, null);
updateTimeIter = updateTime;
}
//Debug.Log("==>当前得分:" + CalculateTotalScore());
}
@ -604,13 +629,15 @@ namespace DefaultNamespace.ProcessMode
{
try
{
Debug.Log("网络初始化");
int kaoID = MotionEngine.GetModule<InfoDataManager>().GetParsedData().ExamId;
Debug.Log(APIs.queryByExamId + kaoID);
Debug.Log("网络地址为:" + APIs.queryByExamId + kaoID);
string json = await MotionEngine.GetModule<WebRequestManager>().GetTextAsync(APIs.queryByExamId + kaoID, null);
string json = await MotionEngine.GetModule<WebRequestManager>().GetTextAsync(APIs.queryByExamId + kaoID, MotionEngine.GetModule<InfoDataManager>().GetParsedData().Token, null);
Debug.Log("获取得考试题目---->" + json);
Debug.Log("Token" + MotionEngine.GetModule<InfoDataManager>().GetParsedData().Token + " 获取得考试题目---->" + json);
SceneStepData _sceneStepData = JsonConvert.DeserializeObject<SceneStepData>(json);

View File

@ -19,9 +19,13 @@ public class UserInfoComponent : MonoBehaviour
public TMP_Text processDescribe;
public TMP_Text processMessage;
public TMP_Text gameTime;
public TMP_Text practiceTime; //HQB练习使用时间
private int practiceUsedTime = 0;
private bool startPracticeTime = false;
public GameObject SubmitBt;
private int totalSubmitTime = 120;
public void Init()
{
@ -29,6 +33,11 @@ public class UserInfoComponent : MonoBehaviour
}
public void OnDisable()
{
MotionEngine.GetModule<AnimationProcessManager>().OnStepProcessMessage -= SendMessagePrompt;
}
private void Start()
{
@ -48,6 +57,7 @@ public class UserInfoComponent : MonoBehaviour
ParsedData parsedData = MotionEngine.GetModule<InfoDataManager>().GetParsedData();
ProcessMode pm = MotionEngine.GetModule<DataConfigManager>().GetProcessMode();
gameTime.gameObject.SetActive(false);
practiceTime.gameObject.SetActive(false);//HQB
processMessage.gameObject.SetActive(true);
SubmitBt.SetActive(true);
switch (pm)
@ -56,10 +66,12 @@ public class UserInfoComponent : MonoBehaviour
processDescribe.text = "模式:教学实训"; SubmitBt.SetActive(false);
break;
case ProcessMode.Training:
processDescribe.text = "模式:培训实训";
processDescribe.text = "模式:培训实训"; SubmitBt.SetActive(false);//HQB0920
break;
case ProcessMode.Practice:
processDescribe.text = "模式:练习实训";
processMessage.gameObject.SetActive(false);
practiceTime.gameObject.SetActive(true);//HQB
break;
case ProcessMode.Assessment:
processDescribe.text = "模式:考核模式";
@ -75,9 +87,31 @@ public class UserInfoComponent : MonoBehaviour
username.text = parsedData.Username;
int totalTime = parsedData.UserTime * 60;
await Countdown(totalTime);
if (MotionEngine.GetModule<DataConfigManager>().GetProcessMode() == ProcessMode.Practice)
await CountPracticeTime();
else if (MotionEngine.GetModule<DataConfigManager>().GetProcessMode() == ProcessMode.Assessment)
await Countdown(totalTime);
}
private async UniTask CountPracticeTime()
{
practiceUsedTime = 0;
startPracticeTime = true;
while (startPracticeTime)
{
practiceUsedTime++;
int minutes = practiceUsedTime / 60;
int seconds = practiceUsedTime % 60;
string formattedMinutes = minutes < 10 ? "0" + minutes.ToString() : minutes.ToString();
string formattedSeconds = seconds < 10 ? "0" + seconds.ToString() : seconds.ToString();
practiceTime.text = $"已用时间:{formattedMinutes}:{formattedSeconds}";
await UniTask.Delay(TimeSpan.FromSeconds(1));
}
}
private async UniTask Countdown(int totalTime)
{
while (totalTime > 5395)
@ -85,6 +119,7 @@ public class UserInfoComponent : MonoBehaviour
totalTime--;
int minutes = totalTime / 60;
int seconds = totalTime % 60;
totalSubmitTime = totalTime;
string formattedMinutes = minutes < 10 ? "0" + minutes.ToString() : minutes.ToString();
string formattedSeconds = seconds < 10 ? "0" + seconds.ToString() : seconds.ToString();
@ -98,6 +133,7 @@ public class UserInfoComponent : MonoBehaviour
public async void Submit()
{
startPracticeTime = false;
ParsedData parsedData = MotionEngine.GetModule<InfoDataManager>().GetParsedData();
@ -109,14 +145,19 @@ public class UserInfoComponent : MonoBehaviour
sub.userId = parsedData.UserId;
sub.examId = parsedData.ExamId;
sub.classId = parsedData.ClassId;
sub.useTime = parsedData.UserTime.ToString();
sub.useTime = (parsedData.UserTime * 60 - totalSubmitTime).ToString(); //parsedData.UserTime.ToString();//用时不对
sub.examClassId = parsedData.ExamClassId.ToString();
sub.stepList = MotionEngine.GetModule<AnimationProcessManager>().GetSubmitScoreStepList();
string js = JsonConvert.SerializeObject(sub);
Debug.Log(js);
string json = await MotionEngine.GetModule<WebRequestManager>().PostJsonAsync(APIs.SimulationScore, js, (ste) => { });
Debug.Log("交卷" + js);
string json = await MotionEngine.GetModule<WebRequestManager>().PostJsonAsync(APIs.SimulationScore, MotionEngine.GetModule<InfoDataManager>().GetParsedData().Token, js, (ste) => { });
if (json == null)
{
MotionEngine.GetModule<MessageManager>().OpenMessageWindow("分数上传失败", MessageTypeEnum.Error);
}
Debug.Log(json);
}
}

View File

@ -0,0 +1,287 @@
{
"steps": [
{
"stepDescription": "填写工作票",
"score": 10,
"actions": [
{
"description": "选择",
"score": 10,
"isUI": false,
"isSequential": true,
"targetObjects": [
"工作单"
]
}
]
},
{
"stepDescription": "领取工器具及仪器设备",
"score": 20,
"actions": [
{
"description": "领取",
"score": 20,
"isUI": false,
"isSequential": false,
"targetObjects": [
"螺丝刀",
"剥线钳",
"绝缘胶带",
"验电笔",
"盒装封印",
"安全帽",
"纱布手套",
"工作服",
"l型集中器",
"梯子",
"工作证"
]
}
]
},
{
"stepDescription": "佩戴装备检视",
"score": 5,
"actions": [
{
"description": "佩戴装备前往",
"score": 5,
"isUI": false,
"isSequential": false,
"targetObjects": [
"梳妆镜"
]
}
]
},
{
"stepDescription": "前往现场",
"score": 10,
"actions": [
{
"description": "前往现场后需要与客户沟通",
"score": 10,
"isUI": false,
"isSequential": true,
"targetObjects": [
"客户"
]
}
]
},
{
"stepDescription": "验电",
"score": 10,
"actions": [
{
"description": "验电笔验电",
"score": 10,
"isUI": false,
"isSequential": true,
"targetObjects": [
"插座",
"箱体",
"插座"
]
}
]
},
{
"stepDescription": "柜门封印",
"score": 0,
"actions": [
{
"description": "剥线钳打开",
"score": 0,
"isUI": false,
"isSequential": true,
"targetObjects": [
"柜门_封印"
]
}
]
},
{
"stepDescription": "更换集中器",
"score": 4,
"actions": [
{
"description": "打开接线盒,调整拨片",
"score": 4,
"isUI": false,
"isSequential": false,
"targetObjects": [
"接线盒_封印R",
"接线盒_封印L",
"盖_固定螺丝_Rup",
"固定螺丝_Ldown",
"接线盒纵向滑块004",
"接线盒横向上滑块003",
"接线盒纵向滑块003",
"接线盒横向上滑块001",
"接线盒纵向滑块002",
"接线盒横向上滑块002",
"接线盒纵向滑块001"
]
}
]
},
{
"stepDescription": "更换集中器",
"score": 4,
"actions": [
{
"description": "打开集中器盒子",
"score": 4,
"isUI": false,
"isSequential": false,
"targetObjects": [
"集中器_封印R",
"集中器_封印_L",
"壳固定螺丝_R",
"壳固定螺丝_L"
]
}
]
},
{
"stepDescription": "更换集中器",
"score": 4,
"actions": [
{
"description": "螺丝刀扭开",
"score": 4,
"isUI": false,
"isSequential": false,
"targetObjects": [
"JZQ_螺丝001",
"JZQ_螺丝0011",
"JZQ_螺丝002",
"JZQ_螺丝0022",
"JZQ_螺丝003",
"JZQ_螺丝0033",
"JZQ_螺丝004",
"JZQ_螺丝0044",
"JZQ_螺丝006",
"JZQ_螺丝005"
]
}
]
},
{
"stepDescription": "更换集中器",
"score": 4,
"actions": [
{
"description": "绝缘胶带绑",
"score": 4,
"isUI": false,
"isSequential": true,
"targetObjects": [
"pCylinder170"
]
}
]
},
{
"stepDescription": "更换集中器",
"score": 4,
"actions": [
{
"description": "螺丝刀扭开",
"score": 4,
"isUI": false,
"isSequential": false,
"targetObjects": [
"固定螺丝_Rdown",
"集电器固定螺丝_Ldown"
]
}
]
},
{
"stepDescription": "更换集中器",
"score": 4,
"actions": [
{
"description": "更换",
"score": 4,
"isUI": false,
"isSequential": false,
"targetObjects": [
"新的集中器碰撞"
]
}
]
},
{
"stepDescription": "更换集中器",
"score": 4,
"actions": [
{
"description": "螺丝刀上",
"score": 4,
"isUI": false,
"isSequential": false,
"targetObjects": [
"JZQ_螺丝1",
"JZQ_螺丝2",
"JZQ_螺丝3",
"JZQ_螺丝4",
"JZQ_螺丝6",
"JZQ_螺丝7"
]
}
]
},
{
"stepDescription": "临时用电",
"score": 10,
"actions": [
{
"description": "打开",
"score": 10,
"isUI": true,
"isSequential": false,
"targetObjects": [
"临时用电"
]
}
]
},
{
"stepDescription": "加装封印",
"score": 0,
"actions": [
{
"description": "盖上盒盖",
"score": 0,
"isUI": false,
"isSequential": false,
"targetObjects": [
"盖_透明外壳"
]
}
]
},
{
"stepDescription": "加装封印",
"score": 7,
"actions": [
{
"description": "加装封印",
"score": 7,
"isUI": false,
"isSequential": false,
"targetObjects": [
"透明盖子封印碰撞R",
"透明盖子封印碰撞L",
"变电箱_门",
"柜门卡栓"
]
}
]
}
]
}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: c903293fea9015444815f60be6003cc6
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -6,7 +6,7 @@
"actions": [
{
"description": "选择",
"score": 10,
"score": 0,
"isUI": false,
"isSequential": true,
"targetObjects": [
@ -21,7 +21,7 @@
"actions": [
{
"description": "领取",
"score": 20,
"score": 30,
"isUI": false,
"isSequential": false,
"targetObjects": [
@ -46,7 +46,7 @@
"actions": [
{
"description": "佩戴装备前往",
"score": 5,
"score": 0,
"isUI": false,
"isSequential": false,
"targetObjects": [
@ -57,11 +57,26 @@
},
{
"stepDescription": "前往现场",
"score": 10,
"score": 5,
"actions": [
{
"description": "前往现场后需要与客户沟通",
"score": 10,
"description": "点击按钮 ",
"score": 0,
"isUI": true,
"isSequential": false,
"targetObjects": [
"前往现场"
]
}
]
},
{
"stepDescription": "前往现场",
"score": 5,
"actions": [
{
"description": "前往",
"score": 0,
"isUI": false,
"isSequential": true,
"targetObjects": [
@ -76,7 +91,7 @@
"actions": [
{
"description": "验电笔验电",
"score": 10,
"score": 0,
"isUI": false,
"isSequential": true,
"targetObjects": [
@ -89,7 +104,7 @@
},
{
"stepDescription": "柜门封印",
"score": 0,
"score": 3.11,
"actions": [
{
"description": "剥线钳打开",
@ -104,18 +119,46 @@
},
{
"stepDescription": "更换集中器",
"score": 4,
"score": 3.11,
"actions": [
{
"description": "打开接线盒,调整拨片",
"score": 4,
"description": "剥线钳更换",
"score": 0,
"isUI": false,
"isSequential": false,
"targetObjects": [
"接线盒_封印R",
"接线盒_封印L",
"接线盒_封印L"
]
}
]
},
{
"stepDescription": "更换集中器",
"score": 3.11,
"actions": [
{
"description": "螺丝刀扭开",
"score": 0,
"isUI": false,
"isSequential": false,
"targetObjects": [
"盖_固定螺丝_Rup",
"固定螺丝_Ldown",
"固定螺丝_Ldown"
]
}
]
},
{
"stepDescription": "更换集中器",
"score": 3.11,
"actions": [
{
"description": "滑动",
"score": 0,
"isUI": false,
"isSequential": true,
"targetObjects": [
"接线盒纵向滑块004",
"接线盒横向上滑块003",
"接线盒纵向滑块003",
@ -129,11 +172,11 @@
},
{
"stepDescription": "更换集中器",
"score": 4,
"score": 3.11,
"actions": [
{
"description": "打开集中器盒子",
"score": 4,
"description": "螺丝刀扭开",
"score": 0,
"isUI": false,
"isSequential": false,
"targetObjects": [
@ -147,11 +190,11 @@
},
{
"stepDescription": "更换集中器",
"score": 4,
"score": 3.11,
"actions": [
{
"description": "螺丝刀扭开",
"score": 4,
"score": 0,
"isUI": false,
"isSequential": false,
"targetObjects": [
@ -171,11 +214,11 @@
},
{
"stepDescription": "更换集中器",
"score": 4,
"score": 3.11,
"actions": [
{
"description": "绝缘胶带绑",
"score": 4,
"score": 0,
"isUI": false,
"isSequential": true,
"targetObjects": [
@ -186,11 +229,11 @@
},
{
"stepDescription": "更换集中器",
"score": 4,
"score": 3.11,
"actions": [
{
"description": "螺丝刀扭开",
"score": 4,
"score": 0,
"isUI": false,
"isSequential": false,
"targetObjects": [
@ -202,11 +245,11 @@
},
{
"stepDescription": "更换集中器",
"score": 4,
"score": 3.11,
"actions": [
{
"description": "更换",
"score": 4,
"score": 0,
"isUI": false,
"isSequential": false,
"targetObjects": [
@ -217,11 +260,11 @@
},
{
"stepDescription": "更换集中器",
"score": 4,
"score": 3.12,
"actions": [
{
"description": "螺丝刀上",
"score": 4,
"score": 0,
"isUI": false,
"isSequential": false,
"targetObjects": [
@ -237,11 +280,11 @@
},
{
"stepDescription": "临时用电",
"score": 10,
"score": 5,
"actions": [
{
"description": "打开",
"score": 10,
"score": 0,
"isUI": true,
"isSequential": false,
"targetObjects": [
@ -252,10 +295,10 @@
},
{
"stepDescription": "加装封印",
"score": 0,
"score": 1.4,
"actions": [
{
"description": "盖上盒盖",
"description": "加装封印",
"score": 0,
"isUI": false,
"isSequential": false,
@ -267,17 +310,45 @@
},
{
"stepDescription": "加装封印",
"score": 7,
"score": 1.4,
"actions": [
{
"description": "加装封印",
"score": 7,
"score": 0,
"isUI": false,
"isSequential": false,
"targetObjects": [
"透明盖子封印碰撞R",
"透明盖子封印碰撞L",
"变电箱_门",
"透明盖子封印碰撞L"
]
}
]
},
{
"stepDescription": "加装封印",
"score": 1.4,
"actions": [
{
"description": "加装封印",
"score": 0,
"isUI": false,
"isSequential": false,
"targetObjects": [
"变电箱_门"
]
}
]
},
{
"stepDescription": "加装封印",
"score": 1.4,
"actions": [
{
"description": "加装封印",
"score": 0,
"isUI": false,
"isSequential": false,
"targetObjects": [
"柜门卡栓"
]
}

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: c903293fea9015444815f60be6003cc6
guid: 8165da38a652cba47b1d10c759031e38
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1 +1 @@
2024-07-19 16:52:07#'ydcj://;cb,1,47,cf9d56cd0e8545389b0ff134d4f846b4,username1,token,90,-1,688,http://172.16.1.128:9206;'|
2024-07-19 16:52:07#'ydcj://;cb,3,47,cf9d56cd0e8545389b0ff134d4f846b4,%E6%9D%8E%E4%BA%AC%E6%98%8C,token,90,-1,688,http://172.16.1.128:9206;'|

View File

@ -16,7 +16,7 @@ public class CompleteOverComponent : MonoBehaviour
void Start()
{
MotionEngine.GetModule<AnimationProcessManager>().HandleClick("前往现场");
//MotionEngine.GetModule<AnimationProcessManager>().HandleClick("前往现场");//HQB
MotionEngine.GetModule<AnimationProcessManager>().OnCompleteEvent += CompleteEvent;
}