修改分数赋值模型逻辑:分数只得一次,对了得分,错了不得分,如果做到一半出去,就保留做对的分数,错误的步骤不会再次得分,重新进入软件再重新得分。

This commit is contained in:
李浩 2025-06-11 19:59:51 +08:00
parent ecbb453f5c
commit 7675674e93
7 changed files with 108 additions and 67 deletions

View File

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

View File

@ -135,6 +135,7 @@ namespace ZXK.LouDiXvMuNiu
} }
return scoreFinish; return scoreFinish;
} }
private HashSet<string> _wrongSteps = new HashSet<string>();
/// <summary> /// <summary>
/// 操作正确步骤后得分 /// 操作正确步骤后得分
/// </summary> /// </summary>
@ -142,8 +143,17 @@ namespace ZXK.LouDiXvMuNiu
/// <param name="smallStepName">三级任务名称</param> /// <param name="smallStepName">三级任务名称</param>
/// <param name="score">当前步骤可得分数</param> /// <param name="score">当前步骤可得分数</param>
/// <returns></returns> /// <returns></returns>
/// <param name="score">当前步骤获得的分数</param>
/// <returns></returns>
public float AddScore(string bigStepName, string smallStepName, float score) public float AddScore(string bigStepName, string smallStepName, float score)
{ {
string stepKey = bigStepName + "_" + smallStepName;
// 检查该步骤是否已经获得过分数或者是否是错误步骤
if (_examScore.ContainsKey(bigStepName) && _examScore[bigStepName].ContainsKey(smallStepName) || _wrongSteps.Contains(stepKey))
{
return _examScore.ContainsKey(bigStepName) && _examScore[bigStepName].ContainsKey(smallStepName) ? _examScore[bigStepName][smallStepName] : 0;
}
if (!_examScore.ContainsKey(bigStepName)) if (!_examScore.ContainsKey(bigStepName))
{ {
_examScore.Add(bigStepName, new Dictionary<string, float>()); _examScore.Add(bigStepName, new Dictionary<string, float>());
@ -154,16 +164,34 @@ namespace ZXK.LouDiXvMuNiu
} }
_examScore[bigStepName][smallStepName] += score; _examScore[bigStepName][smallStepName] += score;
if (scoreTime.ContainsKey(bigStepName + smallStepName) == false) if (scoreTime.ContainsKey(stepKey) == false)
{ {
scoreTime.Add(bigStepName + smallStepName, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); scoreTime.Add(stepKey, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
} }
else else
{ {
scoreTime[bigStepName + smallStepName] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); scoreTime[stepKey] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
} }
return _examScore[bigStepName][smallStepName]; return _examScore[bigStepName][smallStepName];
} }
/// <summary>
/// 标记步骤为错误步骤
/// </summary>
/// <param name="bigStepName">模块名称</param>
/// <param name="smallStepName">子步骤名称</param>
public void MarkStepAsWrong(string bigStepName, string smallStepName)
{
string stepKey = bigStepName + "_" + smallStepName;
_wrongSteps.Add(stepKey);
}
} }
} }

View File

@ -867,6 +867,9 @@ namespace ZXK.LouDiXvMuNiu
useBts.Clear(); useBts.Clear();
addScoreTemp = false; addScoreTemp = false;
PopUpMng.PopChoseErrorToast(_CurSceneStep.ExamEvvr, 2.0f, null); PopUpMng.PopChoseErrorToast(_CurSceneStep.ExamEvvr, 2.0f, null);
// 标记步骤为错误步骤
GameManager.Instance._DataNiuHandler.MarkStepAsWrong(_CurSceneStep.ModuleName, _CurSceneStep.ThreeTaskName);
} }
} }

View File

@ -124,7 +124,7 @@ namespace ZXK.LouDiXvMuNiu
case "TrainState": case "TrainState":
case "ExamState": case "ExamState":
PopUpMng.PopConBox("提示", "是否退出当前模块?", "是", "否", () => { PopUpMng.PopConBox("提示", "是否退出当前模块?", "是", "否", () => {
GameManager.Instance._DataNiuHandler._examScore.Clear(); // GameManager.Instance._DataNiuHandler._examScore.Clear();
GameManager.Instance._StateContext.SetState( GameManager.Instance._StateContext.SetState(
new ModelSelectState(GameManager.Instance._StateContext)); new ModelSelectState(GameManager.Instance._StateContext));
}); });

View File

@ -97,6 +97,9 @@ namespace ZXK.LouDiXvMuNiu
toolItemGeo.transform.Find("BeUseImg").gameObject.SetActive(true); toolItemGeo.transform.Find("BeUseImg").gameObject.SetActive(true);
toolItemGeo.transform.Find("BeUseImg/ChoseError").gameObject.SetActive(true); toolItemGeo.transform.Find("BeUseImg/ChoseError").gameObject.SetActive(true);
}); });
// 标记步骤为错误步骤
GameManager.Instance._DataNiuHandler.MarkStepAsWrong(curStep.ModuleName, curStep.ThreeTaskName);
} }
}); });
toolItemGeo.SetActive(true); toolItemGeo.SetActive(true);

View File

@ -79,7 +79,7 @@ PlayerSettings:
androidAutoRotationBehavior: 1 androidAutoRotationBehavior: 1
defaultIsNativeResolution: 1 defaultIsNativeResolution: 1
macRetinaSupport: 1 macRetinaSupport: 1
runInBackground: 0 runInBackground: 1
captureSingleScreen: 0 captureSingleScreen: 0
muteOtherAudioSources: 0 muteOtherAudioSources: 0
Prepare IOS For Recording: 0 Prepare IOS For Recording: 0
@ -137,7 +137,7 @@ PlayerSettings:
vulkanEnableLateAcquireNextImage: 0 vulkanEnableLateAcquireNextImage: 0
vulkanEnableCommandBufferRecycling: 1 vulkanEnableCommandBufferRecycling: 1
loadStoreDebugModeEnabled: 0 loadStoreDebugModeEnabled: 0
bundleVersion: 0.1.1 bundleVersion: 0.1.2
preloadedAssets: [] preloadedAssets: []
metroInputSource: 0 metroInputSource: 0
wsaTransparentSwapchain: 0 wsaTransparentSwapchain: 0

View File

@ -26,7 +26,7 @@ MonoBehaviour:
m_MinSize: {x: 400, y: 100} m_MinSize: {x: 400, y: 100}
m_MaxSize: {x: 32384, y: 16192} m_MaxSize: {x: 32384, y: 16192}
vertical: 0 vertical: 0
controlID: 8713 controlID: 1085
--- !u!114 &2 --- !u!114 &2
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 52 m_ObjectHideFlags: 52
@ -49,9 +49,9 @@ MonoBehaviour:
m_Pos: m_Pos:
serializedVersion: 2 serializedVersion: 2
x: 0 x: 0
y: 287 y: 475
width: 753 width: 712
height: 712 height: 524
m_SerializedDataModeController: m_SerializedDataModeController:
m_DataMode: 0 m_DataMode: 0
m_PreferredDataMode: 0 m_PreferredDataMode: 0
@ -104,10 +104,10 @@ MonoBehaviour:
serializedVersion: 2 serializedVersion: 2
x: 0 x: 0
y: 21 y: 21
width: 753 width: 712
height: 691 height: 503
m_Scale: {x: 0.3921875, y: 0.3921875} m_Scale: {x: 0.37083334, y: 0.37083337}
m_Translation: {x: 376.5, y: 345.5} m_Translation: {x: 356, y: 251.50002}
m_MarginLeft: 0 m_MarginLeft: 0
m_MarginRight: 0 m_MarginRight: 0
m_MarginTop: 0 m_MarginTop: 0
@ -115,12 +115,12 @@ MonoBehaviour:
m_LastShownAreaInsideMargins: m_LastShownAreaInsideMargins:
serializedVersion: 2 serializedVersion: 2
x: -960 x: -960
y: -880.9562 y: -678.2022
width: 1920 width: 1920
height: 1761.9124 height: 1356.4044
m_MinimalGUI: 1 m_MinimalGUI: 1
m_defaultScale: 0.3921875 m_defaultScale: 0.37083334
m_LastWindowPixelSize: {x: 753, y: 712} m_LastWindowPixelSize: {x: 712, y: 524}
m_ClearInEditMode: 1 m_ClearInEditMode: 1
m_NoCameraWarning: 1 m_NoCameraWarning: 1
m_LowResolutionForAspectRatios: 00000000000000000000 m_LowResolutionForAspectRatios: 00000000000000000000
@ -145,12 +145,12 @@ MonoBehaviour:
serializedVersion: 2 serializedVersion: 2
x: 0 x: 0
y: 0 y: 0
width: 754 width: 713
height: 947 height: 947
m_MinSize: {x: 100, y: 100} m_MinSize: {x: 100, y: 100}
m_MaxSize: {x: 8096, y: 16192} m_MaxSize: {x: 8096, y: 16192}
vertical: 1 vertical: 1
controlID: 8714 controlID: 1086
--- !u!114 &4 --- !u!114 &4
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 52 m_ObjectHideFlags: 52
@ -168,8 +168,8 @@ MonoBehaviour:
serializedVersion: 2 serializedVersion: 2
x: 0 x: 0
y: 0 y: 0
width: 754 width: 713
height: 214 height: 402
m_MinSize: {x: 200, y: 200} m_MinSize: {x: 200, y: 200}
m_MaxSize: {x: 4000, y: 4000} m_MaxSize: {x: 4000, y: 4000}
m_ActualView: {fileID: 5} m_ActualView: {fileID: 5}
@ -201,8 +201,8 @@ MonoBehaviour:
serializedVersion: 2 serializedVersion: 2
x: 0 x: 0
y: 73 y: 73
width: 753 width: 712
height: 193 height: 381
m_SerializedDataModeController: m_SerializedDataModeController:
m_DataMode: 0 m_DataMode: 0
m_PreferredDataMode: 0 m_PreferredDataMode: 0
@ -561,9 +561,9 @@ MonoBehaviour:
m_PlayAudio: 0 m_PlayAudio: 0
m_AudioPlay: 0 m_AudioPlay: 0
m_Position: m_Position:
m_Target: {x: 1439, y: 307, z: 0} m_Target: {x: 0.9102906, y: 0.028324064, z: 0.020564094}
speed: 2 speed: 2
m_Value: {x: 1439, y: 307, z: 0} m_Value: {x: 0.9102906, y: 0.028324064, z: 0.020564094}
m_RenderMode: 0 m_RenderMode: 0
m_CameraMode: m_CameraMode:
drawMode: 0 drawMode: 0
@ -613,9 +613,9 @@ MonoBehaviour:
speed: 2 speed: 2
m_Value: {x: 0, y: 0, z: 0, w: 1} m_Value: {x: 0, y: 0, z: 0, w: 1}
m_Size: m_Size:
m_Target: 312.9015 m_Target: 7.9435906
speed: 2 speed: 2
m_Value: 312.9015 m_Value: 7.9435906
m_Ortho: m_Ortho:
m_Target: 1 m_Target: 1
speed: 2 speed: 2
@ -729,11 +729,11 @@ MonoBehaviour:
m_Position: m_Position:
serializedVersion: 2 serializedVersion: 2
x: 0 x: 0
y: 214 y: 402
width: 754 width: 713
height: 733 height: 545
m_MinSize: {x: 100, y: 100} m_MinSize: {x: 101, y: 121}
m_MaxSize: {x: 4000, y: 4000} m_MaxSize: {x: 4001, y: 4021}
m_ActualView: {fileID: 2} m_ActualView: {fileID: 2}
m_Panes: m_Panes:
- {fileID: 2} - {fileID: 2}
@ -754,12 +754,12 @@ MonoBehaviour:
m_Children: [] m_Children: []
m_Position: m_Position:
serializedVersion: 2 serializedVersion: 2
x: 754 x: 713
y: 0 y: 0
width: 564 width: 266
height: 947 height: 947
m_MinSize: {x: 200, y: 200} m_MinSize: {x: 202, y: 221}
m_MaxSize: {x: 4000, y: 4000} m_MaxSize: {x: 4002, y: 4021}
m_ActualView: {fileID: 9} m_ActualView: {fileID: 9}
m_Panes: m_Panes:
- {fileID: 9} - {fileID: 9}
@ -787,9 +787,9 @@ MonoBehaviour:
m_Tooltip: m_Tooltip:
m_Pos: m_Pos:
serializedVersion: 2 serializedVersion: 2
x: 754 x: 713
y: 73 y: 73
width: 562 width: 264
height: 926 height: 926
m_SerializedDataModeController: m_SerializedDataModeController:
m_DataMode: 0 m_DataMode: 0
@ -804,9 +804,9 @@ MonoBehaviour:
m_SceneHierarchy: m_SceneHierarchy:
m_TreeViewState: m_TreeViewState:
scrollPos: {x: 0, y: 0} scrollPos: {x: 0, y: 0}
m_SelectedIDs: m_SelectedIDs: f6290000
m_LastClickedID: 0 m_LastClickedID: 0
m_ExpandedIDs: fe12d2ffe0ebd2ff5a2bd4ff8e64d4ff9464d4fff296d4fff866d6ffd896dfffdab8dfff5220edff2c21edff6081edffa681edff0c44f7ff46adf7fffec6f7ff02c7f7ff2efbfffff4ffffff007b00001c7b0000227b0000367b00003c7b0000467b0000906d0100b86d010092750100e47501003a420200564202005c420200704202007642020080420200924c0300dc4c0300c05303006c540300be540300c4600300b46703008a740300527d0300541304002e1b0400801b040058310400083f0400 m_ExpandedIDs: 22fbffff
m_RenameOverlay: m_RenameOverlay:
m_UserAcceptedRename: 0 m_UserAcceptedRename: 0
m_Name: m_Name:
@ -851,9 +851,9 @@ MonoBehaviour:
m_Tooltip: m_Tooltip:
m_Pos: m_Pos:
serializedVersion: 2 serializedVersion: 2
x: 754 x: 1111
y: 73 y: 73
width: 562 width: 223
height: 926 height: 926
m_SerializedDataModeController: m_SerializedDataModeController:
m_DataMode: 0 m_DataMode: 0
@ -880,9 +880,9 @@ MonoBehaviour:
m_Children: [] m_Children: []
m_Position: m_Position:
serializedVersion: 2 serializedVersion: 2
x: 1318 x: 979
y: 0 y: 0
width: 238 width: 330
height: 947 height: 947
m_MinSize: {x: 232, y: 271} m_MinSize: {x: 232, y: 271}
m_MaxSize: {x: 10002, y: 10021} m_MaxSize: {x: 10002, y: 10021}
@ -912,9 +912,9 @@ MonoBehaviour:
m_Tooltip: m_Tooltip:
m_Pos: m_Pos:
serializedVersion: 2 serializedVersion: 2
x: 1318 x: 979
y: 73 y: 73
width: 236 width: 328
height: 926 height: 926
m_SerializedDataModeController: m_SerializedDataModeController:
m_DataMode: 0 m_DataMode: 0
@ -927,7 +927,7 @@ MonoBehaviour:
m_SaveData: [] m_SaveData: []
m_OverlaysVisible: 1 m_OverlaysVisible: 1
m_SearchFilter: m_SearchFilter:
m_NameFilter: m_NameFilter: Sele
m_ClassNames: [] m_ClassNames: []
m_AssetLabels: [] m_AssetLabels: []
m_AssetBundleNames: [] m_AssetBundleNames: []
@ -937,9 +937,9 @@ MonoBehaviour:
m_SkipHidden: 0 m_SkipHidden: 0
m_SearchArea: 1 m_SearchArea: 1
m_Folders: m_Folders:
- Assets/_Scripts/Application/States - Assets/_Scripts
m_Globs: [] m_Globs: []
m_OriginalText: m_OriginalText: Sele
m_ImportLogFlags: 0 m_ImportLogFlags: 0
m_FilterByTypeIntersection: 0 m_FilterByTypeIntersection: 0
m_ViewMode: 0 m_ViewMode: 0
@ -953,7 +953,7 @@ MonoBehaviour:
scrollPos: {x: 0, y: 0} scrollPos: {x: 0, y: 0}
m_SelectedIDs: 10690000 m_SelectedIDs: 10690000
m_LastClickedID: 26896 m_LastClickedID: 26896
m_ExpandedIDs: ffffffff000000009a7b00009c7b00009e7b0000a07b0000a27b0000a47b0000a67b0000a87b0000aa7b0000ac7b0000ae7b0000b07b0000b27b0000b47b0000b67b0000b87b0000ba7b0000bc7b0000be7b0000c07b0000c27b0000c47b0000c67b0000c87b0000ca7b0000cc7b0000ce7b0000d07b0000d27b0000d47b0000d67b0000d87b0000da7b0000dc7b0000de7b0000e07b0000e27b0000e47b0000ee7e0000f07e0000087f0000f4490100fa490100 m_ExpandedIDs: ffffffff00000000a27b0000a47b0000a67b0000a87b0000aa7b0000ac7b0000ae7b0000b07b0000b27b0000b47b0000b67b0000b87b0000ba7b0000bc7b0000be7b0000c07b0000c27b0000c47b0000c67b0000c87b0000ca7b0000cc7b0000ce7b0000d07b0000d27b0000d47b0000d67b0000d87b0000da7b0000dc7b0000de7b0000e07b0000e27b0000e47b0000e67b0000e87b0000ea7b0000ec7b0000ee7b0000f07b0000f27b0000f47b0000f67b0000f87b0000fa7b0000fc7b0000fe7b0000007c0000027c0000047c0000067c0000087c00000a7c0000167f000020820000
m_RenameOverlay: m_RenameOverlay:
m_UserAcceptedRename: 0 m_UserAcceptedRename: 0
m_Name: m_Name:
@ -978,10 +978,10 @@ MonoBehaviour:
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_ResourceFile: m_ResourceFile:
m_AssetTreeState: m_AssetTreeState:
scrollPos: {x: 0, y: 564} scrollPos: {x: 0, y: 0}
m_SelectedIDs: m_SelectedIDs: f6290000
m_LastClickedID: 0 m_LastClickedID: 10742
m_ExpandedIDs: ffffffff000000009a7b00009c7b00009e7b0000a07b0000a27b0000a47b0000a67b0000a87b0000aa7b0000ac7b0000ae7b0000b07b0000b27b0000b47b0000b67b0000b87b0000ba7b0000bc7b0000be7b0000c07b0000c27b0000c47b0000c67b0000c87b0000ca7b0000cc7b0000ce7b0000d07b0000d27b0000d47b0000d67b0000d87b0000da7b0000dc7b0000de7b0000e07b0000e27b0000e47b0000ee7e0000f07e0000007f0000087f0000f4490100fa490100fc490100fe49010024280400 m_ExpandedIDs: ffffffff00000000a27b0000a47b0000a67b0000a87b0000aa7b0000ac7b0000ae7b0000b07b0000b27b0000b47b0000b67b0000b87b0000ba7b0000bc7b0000be7b0000c07b0000c27b0000c47b0000c67b0000c87b0000ca7b0000cc7b0000ce7b0000d07b0000d27b0000d47b0000d67b0000d87b0000da7b0000dc7b0000de7b0000e07b0000e27b0000e47b0000e67b0000e87b0000ea7b0000ec7b0000ee7b0000f07b0000f27b0000f47b0000f67b0000f87b0000fa7b0000fc7b0000fe7b0000007c0000027c0000047c0000067c0000087c00000a7c0000167f000020820000
m_RenameOverlay: m_RenameOverlay:
m_UserAcceptedRename: 0 m_UserAcceptedRename: 0
m_Name: m_Name:
@ -1006,24 +1006,24 @@ MonoBehaviour:
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_ResourceFile: m_ResourceFile:
m_ListAreaState: m_ListAreaState:
m_SelectedInstanceIDs: m_SelectedInstanceIDs: f6290000
m_LastClickedInstanceID: 0 m_LastClickedInstanceID: 10742
m_HadKeyboardFocusLastEvent: 1 m_HadKeyboardFocusLastEvent: 1
m_ExpandedInstanceIDs: f46c0000 m_ExpandedInstanceIDs: f46c0000
m_RenameOverlay: m_RenameOverlay:
m_UserAcceptedRename: 0 m_UserAcceptedRename: 0
m_Name: NiuSceneMng m_Name:
m_OriginalName: NiuSceneMng m_OriginalName:
m_EditFieldRect: m_EditFieldRect:
serializedVersion: 2 serializedVersion: 2
x: 0 x: 0
y: 0 y: 0
width: 0 width: 0
height: 0 height: 0
m_UserData: 3096 m_UserData: 0
m_IsWaitingForDelay: 0 m_IsWaitingForDelay: 0
m_IsRenaming: 0 m_IsRenaming: 0
m_OriginalEventType: 0 m_OriginalEventType: 11
m_IsRenamingFilename: 1 m_IsRenamingFilename: 1
m_ClientGUIView: {fileID: 11} m_ClientGUIView: {fileID: 11}
m_CreateAssetUtility: m_CreateAssetUtility:
@ -1052,12 +1052,12 @@ MonoBehaviour:
m_Children: [] m_Children: []
m_Position: m_Position:
serializedVersion: 2 serializedVersion: 2
x: 1556 x: 1309
y: 0 y: 0
width: 364 width: 611
height: 947 height: 947
m_MinSize: {x: 275, y: 50} m_MinSize: {x: 276, y: 71}
m_MaxSize: {x: 4000, y: 4000} m_MaxSize: {x: 4001, y: 4021}
m_ActualView: {fileID: 14} m_ActualView: {fileID: 14}
m_Panes: m_Panes:
- {fileID: 14} - {fileID: 14}
@ -1084,9 +1084,9 @@ MonoBehaviour:
m_Tooltip: m_Tooltip:
m_Pos: m_Pos:
serializedVersion: 2 serializedVersion: 2
x: 1556 x: 1309
y: 73 y: 73
width: 363 width: 610
height: 926 height: 926
m_SerializedDataModeController: m_SerializedDataModeController:
m_DataMode: 0 m_DataMode: 0