This commit is contained in:
parent
830011f6d8
commit
398de6d359
|
|
@ -495,13 +495,13 @@ RectTransform:
|
|||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 87833960}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
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:
|
||||
- {fileID: 1065894754}
|
||||
m_Father: {fileID: 587418715}
|
||||
m_Father: {fileID: 935789805}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0.5}
|
||||
m_AnchorMax: {x: 0, y: 0.5}
|
||||
|
|
@ -2206,6 +2206,7 @@ GameObject:
|
|||
- component: {fileID: 505215071}
|
||||
- component: {fileID: 505215072}
|
||||
- component: {fileID: 505215073}
|
||||
- component: {fileID: 505215074}
|
||||
m_Layer: 0
|
||||
m_Name: APP
|
||||
m_TagString: Untagged
|
||||
|
|
@ -2286,6 +2287,18 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: 0d3b1a9715a34aa8ab0530af2056aaf9, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!114 &505215074
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 505215068}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 0234ae9c682a4828aa916e415ad8b21d, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1001 &520819557
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -2338,9 +2351,39 @@ PrefabInstance:
|
|||
propertyPath: m_Name
|
||||
value: APP (1)
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8119939561368072965, guid: fa12b84946083d14cb4447029910be28, type: 3}
|
||||
propertyPath: m_UiScaleMode
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8119939561368072965, guid: fa12b84946083d14cb4447029910be28, type: 3}
|
||||
propertyPath: m_ReferenceResolution.x
|
||||
value: 1920
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8119939561368072965, guid: fa12b84946083d14cb4447029910be28, type: 3}
|
||||
propertyPath: m_ReferenceResolution.y
|
||||
value: 1080
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects: []
|
||||
m_AddedGameObjects:
|
||||
- targetCorrespondingSourceObject: {fileID: 178020885541006542, guid: fa12b84946083d14cb4447029910be28, type: 3}
|
||||
insertIndex: 0
|
||||
addedObject: {fileID: 87833961}
|
||||
- targetCorrespondingSourceObject: {fileID: 178020885541006542, guid: fa12b84946083d14cb4447029910be28, type: 3}
|
||||
insertIndex: 1
|
||||
addedObject: {fileID: 1576153055}
|
||||
- targetCorrespondingSourceObject: {fileID: 178020885541006542, guid: fa12b84946083d14cb4447029910be28, type: 3}
|
||||
insertIndex: 2
|
||||
addedObject: {fileID: 1225655159}
|
||||
- targetCorrespondingSourceObject: {fileID: 178020885541006542, guid: fa12b84946083d14cb4447029910be28, type: 3}
|
||||
insertIndex: 3
|
||||
addedObject: {fileID: 912751626}
|
||||
- targetCorrespondingSourceObject: {fileID: 178020885541006542, guid: fa12b84946083d14cb4447029910be28, type: 3}
|
||||
insertIndex: 4
|
||||
addedObject: {fileID: 1245220569}
|
||||
- targetCorrespondingSourceObject: {fileID: 178020885541006542, guid: fa12b84946083d14cb4447029910be28, type: 3}
|
||||
insertIndex: -1
|
||||
addedObject: {fileID: 1818293524}
|
||||
m_AddedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: fa12b84946083d14cb4447029910be28, type: 3}
|
||||
--- !u!1 &533770564
|
||||
|
|
@ -2754,10 +2797,10 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_UiScaleMode: 0
|
||||
m_UiScaleMode: 1
|
||||
m_ReferencePixelsPerUnit: 100
|
||||
m_ScaleFactor: 1
|
||||
m_ReferenceResolution: {x: 800, y: 600}
|
||||
m_ReferenceResolution: {x: 1920, y: 1080}
|
||||
m_ScreenMatchMode: 0
|
||||
m_MatchWidthOrHeight: 0
|
||||
m_PhysicalUnit: 3
|
||||
|
|
@ -2802,13 +2845,7 @@ RectTransform:
|
|||
m_Children:
|
||||
- {fileID: 1976332301}
|
||||
- {fileID: 1992983540}
|
||||
- {fileID: 1245220569}
|
||||
- {fileID: 1058744479}
|
||||
- {fileID: 912751626}
|
||||
- {fileID: 1225655159}
|
||||
- {fileID: 1576153055}
|
||||
- {fileID: 87833961}
|
||||
- {fileID: 1818293524}
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
|
|
@ -3480,10 +3517,10 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_UiScaleMode: 0
|
||||
m_UiScaleMode: 1
|
||||
m_ReferencePixelsPerUnit: 100
|
||||
m_ScaleFactor: 1
|
||||
m_ReferenceResolution: {x: 800, y: 600}
|
||||
m_ReferenceResolution: {x: 1920, y: 1080}
|
||||
m_ScreenMatchMode: 0
|
||||
m_MatchWidthOrHeight: 0
|
||||
m_PhysicalUnit: 3
|
||||
|
|
@ -3509,7 +3546,7 @@ Canvas:
|
|||
m_OverridePixelPerfect: 0
|
||||
m_SortingBucketNormalizedSize: 0
|
||||
m_VertexColorAlwaysGammaSpace: 0
|
||||
m_AdditionalShaderChannelsFlag: 0
|
||||
m_AdditionalShaderChannelsFlag: 25
|
||||
m_UpdateRectTransformForStandalone: 0
|
||||
m_SortingLayerID: 0
|
||||
m_SortingOrder: 2
|
||||
|
|
@ -3694,17 +3731,17 @@ RectTransform:
|
|||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 912751625}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
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:
|
||||
- {fileID: 2028748281}
|
||||
m_Father: {fileID: 587418715}
|
||||
m_Father: {fileID: 935789805}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0.5}
|
||||
m_AnchorMax: {x: 0, y: 0.5}
|
||||
m_AnchoredPosition: {x: 56.00006, y: 81.1}
|
||||
m_AnchoredPosition: {x: 56.000122, y: 81.1}
|
||||
m_SizeDelta: {x: 100, y: 100}
|
||||
m_Pivot: {x: 0.000000018626451, y: 0.5}
|
||||
--- !u!114 &912751627
|
||||
|
|
@ -3816,6 +3853,11 @@ MonoBehaviour:
|
|||
defaultSprite: {fileID: 21300000, guid: a2d870f027267fe42aa868fcbc136c61, type: 3}
|
||||
clickSprite: {fileID: 21300000, guid: c972974cdc2b155409446a750757b1b4, type: 3}
|
||||
clickGameSprite: {fileID: 2028748280}
|
||||
--- !u!224 &935789805 stripped
|
||||
RectTransform:
|
||||
m_CorrespondingSourceObject: {fileID: 178020885541006542, guid: fa12b84946083d14cb4447029910be28, type: 3}
|
||||
m_PrefabInstance: {fileID: 520819557}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!1 &936063428
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -4811,13 +4853,13 @@ RectTransform:
|
|||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1225655158}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
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:
|
||||
- {fileID: 1342808445}
|
||||
m_Father: {fileID: 587418715}
|
||||
m_Father: {fileID: 935789805}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0.5}
|
||||
m_AnchorMax: {x: 0, y: 0.5}
|
||||
|
|
@ -4956,7 +4998,7 @@ RectTransform:
|
|||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1245220568}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
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
|
||||
|
|
@ -4964,7 +5006,7 @@ RectTransform:
|
|||
- {fileID: 764280861}
|
||||
- {fileID: 121167659}
|
||||
- {fileID: 1714064126}
|
||||
m_Father: {fileID: 587418715}
|
||||
m_Father: {fileID: 935789805}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
|
|
@ -6442,13 +6484,13 @@ RectTransform:
|
|||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1576153054}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
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:
|
||||
- {fileID: 719798634}
|
||||
m_Father: {fileID: 587418715}
|
||||
m_Father: {fileID: 935789805}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0.5}
|
||||
m_AnchorMax: {x: 0, y: 0.5}
|
||||
|
|
@ -7682,7 +7724,7 @@ PrefabInstance:
|
|||
serializedVersion: 2
|
||||
m_Modification:
|
||||
serializedVersion: 3
|
||||
m_TransformParent: {fileID: 587418715}
|
||||
m_TransformParent: {fileID: 935789805}
|
||||
m_Modifications:
|
||||
- target: {fileID: 1122751253276967949, guid: 62e20368ea041df4bb96b1e042cacd31, type: 3}
|
||||
propertyPath: m_Name
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using HighlightPlus;
|
||||
using MotionFramework;
|
||||
using UnityEngine;
|
||||
|
|
@ -79,8 +80,14 @@ namespace DefaultNamespace.ProcessMode
|
|||
else
|
||||
{
|
||||
// 不按顺序点击的逻辑
|
||||
if (currentAction.TargetObjects.Contains(clickedObject))
|
||||
if (currentAction.TargetObjects.Any(obj => obj.name == clickedObject.name))
|
||||
{
|
||||
if (currentAction.ClickedObjects.Any(obj => obj.name == clickedObject.name))
|
||||
{
|
||||
Debug.Log($"错误点击:{clickedObject.name}。这个物体已经点击过。");
|
||||
return; // 如果物体已经点击过,不继续处理
|
||||
}
|
||||
|
||||
if (!currentAction.ClickedObjects.Contains(clickedObject))
|
||||
{
|
||||
Debug.Log($"正确点击了:{clickedObject.name}");
|
||||
|
|
@ -128,7 +135,7 @@ namespace DefaultNamespace.ProcessMode
|
|||
currentAction.CurrentObjectIndex = 0; // 重置当前动作对象索引
|
||||
currentAction.ClickedObjects.Clear(); // 重置已点击对象集合
|
||||
currentAction.FeedbackDisplayed = false; // 重置反馈显示标志
|
||||
|
||||
|
||||
if (currentActionIndex >= step.Actions.Count)
|
||||
{
|
||||
Debug.Log("所有动作完成!");
|
||||
|
|
@ -141,7 +148,11 @@ namespace DefaultNamespace.ProcessMode
|
|||
}
|
||||
else
|
||||
{
|
||||
OnCompleteEvent();
|
||||
if (MotionEngine.GetModule<ToolsPackManager>().GetToolsPackScene() == ToolsPackScene.其他)
|
||||
{
|
||||
OnCompleteEvent();
|
||||
}
|
||||
|
||||
Debug.Log("全部完成了!!!!");
|
||||
}
|
||||
}
|
||||
|
|
@ -151,7 +162,7 @@ namespace DefaultNamespace.ProcessMode
|
|||
PrepareNextStep(currentMode, step.Actions[currentActionIndex]); // 传递下一个动作对象
|
||||
}
|
||||
}
|
||||
|
||||
// Start is called before the first frame update
|
||||
|
||||
/// <summary>
|
||||
/// 根据当前模式显示相应的动作反馈
|
||||
|
|
@ -261,13 +272,14 @@ namespace DefaultNamespace.ProcessMode
|
|||
{
|
||||
// 添加高亮效果的逻辑
|
||||
GameObject.Find(nextObject.name).GetComponent<HighlightEffect>().highlighted = true;
|
||||
|
||||
|
||||
Debug.Log($"高亮显示:{nextObject.name}");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置当前模式
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -1,131 +0,0 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using DefaultNamespace.Dto;
|
||||
using DG.Tweening;
|
||||
using MotionFramework;
|
||||
using Newtonsoft.Json;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DefaultNamespace.ProcessMode
|
||||
{
|
||||
public class ProcessLauncher : MonoBehaviour
|
||||
{
|
||||
private AnimationProcessManager processManager;
|
||||
|
||||
|
||||
private IEnumerator Start()
|
||||
{
|
||||
processManager = MotionEngine.GetModule<AnimationProcessManager>();
|
||||
|
||||
|
||||
yield return new WaitForSeconds(1);
|
||||
|
||||
processManager.AddProcess("Teaching");
|
||||
|
||||
string json = System.IO.File.ReadAllText(Application.streamingAssetsPath + "/DataConfig/StepData.json");
|
||||
StepsContainer stepsContainer = JsonConvert.DeserializeObject<StepsContainer>(json);
|
||||
|
||||
|
||||
foreach (var stepData in stepsContainer.Steps)
|
||||
{
|
||||
List<ActionWithDescription> actions = new List<ActionWithDescription>();
|
||||
|
||||
foreach (var actionData in stepData.Actions)
|
||||
{
|
||||
List<GameObject> targetObjects = new List<GameObject>();
|
||||
foreach (var objectName in actionData.TargetObjects)
|
||||
{
|
||||
GameObject obj = GameObject.Find(objectName);
|
||||
if (obj != null)
|
||||
{
|
||||
targetObjects.Add(obj);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError($"Object not found: {objectName}");
|
||||
}
|
||||
}
|
||||
|
||||
Action action = () => { };
|
||||
actions.Add(new ActionWithDescription(targetObjects, action, actionData.Description, actionData.IsSequential));
|
||||
}
|
||||
|
||||
AnimationStep step = new AnimationStep(stepData.StepDescription, stepData.Score, actions);
|
||||
processManager.AddStepToProcess("Teaching", step);
|
||||
}
|
||||
|
||||
InitializeFirstStep();
|
||||
|
||||
}
|
||||
|
||||
private void InitializeFirstStep()
|
||||
{
|
||||
ProcessMode initialMode = ProcessMode.Teaching; // 假设初始模式是教学模式
|
||||
MotionEngine.GetModule<AnimationProcessManager>().SetCurrentMode(initialMode);
|
||||
|
||||
if (MotionEngine.GetModule<AnimationProcessManager>().CurrentProcess.Steps.Count > 0)
|
||||
{
|
||||
AnimationStep firstStep = MotionEngine.GetModule<AnimationProcessManager>().CurrentProcess.Steps[0];
|
||||
if (firstStep.Actions.Count > 0)
|
||||
{
|
||||
MotionEngine.GetModule<AnimationProcessManager>().PrepareNextStep(initialMode, firstStep.Actions[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// private List<ActionWithDescription> CreateStepActions()
|
||||
// {
|
||||
// List<ActionWithDescription> actions = new List<ActionWithDescription>();
|
||||
//
|
||||
// GameObject obj1 = GameObject.Find("变电箱_门");
|
||||
// GameObject 插座 = GameObject.Find("插座");
|
||||
// Action action1 = () => { };
|
||||
// Action action2 = () => { };
|
||||
//
|
||||
// actions.Add(new ActionWithDescription(new List<GameObject>() { obj1,插座 }, action1, $"步骤 {1} 的动作描述"));
|
||||
// actions.Add(new ActionWithDescription(new List<GameObject>() { 插座,obj1}, action1, $"步骤 {2} 的动作描述"));
|
||||
//
|
||||
// return actions;
|
||||
// }
|
||||
//
|
||||
// private List<ActionWithDescription> CreateStepActions1()
|
||||
// {
|
||||
// List<ActionWithDescription> actions = new List<ActionWithDescription>();
|
||||
//
|
||||
// GameObject obj1 = GameObject.Find("变电箱_门");
|
||||
// GameObject 插座 = GameObject.Find("插座");
|
||||
// Action action1 = () => { };
|
||||
//
|
||||
// actions.Add(new ActionWithDescription(new List<GameObject>() { obj1 }, action1, $"步骤 {1} 的动作描述"));
|
||||
// actions.Add(new ActionWithDescription(new List<GameObject>() { 插座 }, action1, $"步骤 {2} 的动作描述"));
|
||||
//
|
||||
// return actions;
|
||||
// }
|
||||
|
||||
// private void Update()
|
||||
// {
|
||||
// if (Input.GetMouseButtonDown(0))
|
||||
// {
|
||||
// // 假设您有方法来检测点击对象
|
||||
// GameObject clickedObject = DetectClickedObject();
|
||||
// if (clickedObject != null)
|
||||
// {
|
||||
// processManager.HandleClick(clickedObject);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private GameObject DetectClickedObject()
|
||||
// {
|
||||
// Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
|
||||
// RaycastHit hit;
|
||||
// if (Physics.Raycast(ray, out hit))
|
||||
// {
|
||||
// return hit.collider.gameObject;
|
||||
// }
|
||||
//
|
||||
// return null;
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using DefaultNamespace.Dto;
|
||||
using DG.Tweening;
|
||||
using MotionFramework;
|
||||
using Newtonsoft.Json;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DefaultNamespace.ProcessMode
|
||||
{
|
||||
[ScriptDescription("现场场景的流程启动器")]
|
||||
public class SceneProcessLauncher : MonoBehaviour
|
||||
{
|
||||
private AnimationProcessManager processManager;
|
||||
|
||||
|
||||
private IEnumerator Start()
|
||||
{
|
||||
yield return new WaitForSeconds(1);
|
||||
processManager = MotionEngine.GetModule<AnimationProcessManager>();
|
||||
|
||||
processManager.AddProcess("Training");
|
||||
|
||||
string json = System.IO.File.ReadAllText(Application.streamingAssetsPath + "/DataConfig/SceneStepData.json");
|
||||
StepsContainer stepsContainer = JsonConvert.DeserializeObject<StepsContainer>(json);
|
||||
|
||||
foreach (var stepData in stepsContainer.Steps)
|
||||
{
|
||||
List<ActionWithDescription> actions = new List<ActionWithDescription>();
|
||||
|
||||
foreach (var actionData in stepData.Actions)
|
||||
{
|
||||
List<GameObject> targetObjects = new List<GameObject>();
|
||||
foreach (var objectName in actionData.TargetObjects)
|
||||
{
|
||||
GameObject obj = GameObject.Find(objectName);
|
||||
if (obj != null)
|
||||
{
|
||||
targetObjects.Add(obj);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError($"Object not found: {objectName}");
|
||||
}
|
||||
}
|
||||
|
||||
Action action = () => { };
|
||||
actions.Add(new ActionWithDescription(targetObjects, action, actionData.Description, actionData.IsSequential));
|
||||
}
|
||||
|
||||
AnimationStep step = new AnimationStep(stepData.StepDescription, stepData.Score, actions);
|
||||
processManager.AddStepToProcess("Training", step);
|
||||
}
|
||||
|
||||
InitializeFirstStep();
|
||||
|
||||
}
|
||||
|
||||
private void InitializeFirstStep()
|
||||
{
|
||||
ProcessMode initialMode = ProcessMode.Training; // 假设初始模式是教学模式
|
||||
MotionEngine.GetModule<AnimationProcessManager>().SetCurrentMode(initialMode);
|
||||
|
||||
if (MotionEngine.GetModule<AnimationProcessManager>().CurrentProcess.Steps.Count > 0)
|
||||
{
|
||||
AnimationStep firstStep = MotionEngine.GetModule<AnimationProcessManager>().CurrentProcess.Steps[0];
|
||||
if (firstStep.Actions.Count > 0)
|
||||
{
|
||||
MotionEngine.GetModule<AnimationProcessManager>().PrepareNextStep(initialMode, firstStep.Actions[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using DefaultNamespace;
|
||||
using DefaultNamespace.ProcessMode;
|
||||
using HighlightPlus;
|
||||
using MotionFramework;
|
||||
using UnityEngine;
|
||||
|
|
@ -16,12 +17,18 @@ namespace ToolsPack
|
|||
private HighlightEffect _highlight;
|
||||
private int index;
|
||||
[SerializeField] private ModelTypeEnum _modelTypeEnum;
|
||||
[SerializeField] private ToolsPackScene _toolsPackScene;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_highlight = this.GetComponent<HighlightEffect>();
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
_toolsPackScene = MotionEngine.GetModule<ToolsPackManager>().GetToolsPackScene();
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
_highlight.highlighted = false;
|
||||
|
|
@ -29,8 +36,15 @@ namespace ToolsPack
|
|||
|
||||
private void OnMouseDown()
|
||||
{
|
||||
MotionEngine.GetModule<ToolsPackManager>().AddToolsPack(this.name, this.gameObject);
|
||||
if (_toolsPackScene == ToolsPackScene.工具间)
|
||||
{
|
||||
MotionEngine.GetModule<AnimationProcessManager>().HandleClick(this.gameObject);
|
||||
MotionEngine.GetModule<ToolsPackManager>().AddToolsPack(this.name, this.gameObject);
|
||||
|
||||
}
|
||||
this.gameObject.SetActive(false);
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void OnMouseEnter()
|
||||
|
|
|
|||
|
|
@ -0,0 +1,79 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using DefaultNamespace.Dto;
|
||||
using DefaultNamespace.ProcessMode;
|
||||
using MotionFramework;
|
||||
using Newtonsoft.Json;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ToolsPack
|
||||
{
|
||||
|
||||
|
||||
[ScriptDescription("工具间场景的流程启动器")]
|
||||
public class ToolsSceneProcessLauncher : MonoBehaviour
|
||||
{
|
||||
private AnimationProcessManager processManager;
|
||||
|
||||
|
||||
private IEnumerator Start()
|
||||
{
|
||||
yield return new WaitForSeconds(1);
|
||||
processManager = MotionEngine.GetModule<AnimationProcessManager>();
|
||||
|
||||
processManager.AddProcess("Training");
|
||||
|
||||
string json = System.IO.File.ReadAllText(Application.streamingAssetsPath + "/DataConfig/ToolsSceneStepData.json");
|
||||
StepsContainer stepsContainer = JsonConvert.DeserializeObject<StepsContainer>(json);
|
||||
|
||||
|
||||
foreach (var stepData in stepsContainer.Steps)
|
||||
{
|
||||
List<ActionWithDescription> actions = new List<ActionWithDescription>();
|
||||
|
||||
foreach (var actionData in stepData.Actions)
|
||||
{
|
||||
List<GameObject> targetObjects = new List<GameObject>();
|
||||
foreach (var objectName in actionData.TargetObjects)
|
||||
{
|
||||
GameObject obj = GameObject.Find(objectName);
|
||||
if (obj != null)
|
||||
{
|
||||
targetObjects.Add(obj);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError($"Object not found: {objectName}");
|
||||
}
|
||||
}
|
||||
|
||||
Action action = () => { };
|
||||
actions.Add(new ActionWithDescription(targetObjects, action, actionData.Description, actionData.IsSequential));
|
||||
}
|
||||
|
||||
AnimationStep step = new AnimationStep(stepData.StepDescription, stepData.Score, actions);
|
||||
processManager.AddStepToProcess("Training", step);
|
||||
}
|
||||
|
||||
InitializeFirstStep();
|
||||
|
||||
}
|
||||
|
||||
private void InitializeFirstStep()
|
||||
{
|
||||
ProcessMode initialMode = ProcessMode.Training; // 假设初始模式是教学模式
|
||||
MotionEngine.GetModule<AnimationProcessManager>().SetCurrentMode(initialMode);
|
||||
|
||||
if (MotionEngine.GetModule<AnimationProcessManager>().CurrentProcess.Steps.Count > 0)
|
||||
{
|
||||
AnimationStep firstStep = MotionEngine.GetModule<AnimationProcessManager>().CurrentProcess.Steps[0];
|
||||
if (firstStep.Actions.Count > 0)
|
||||
{
|
||||
MotionEngine.GetModule<AnimationProcessManager>().PrepareNextStep(initialMode, firstStep.Actions[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 0234ae9c682a4828aa916e415ad8b21d
|
||||
timeCreated: 1718269320
|
||||
|
|
@ -9,8 +9,9 @@ namespace DefaultNamespace
|
|||
[ScriptDescription("工具间的选择类,除了工具间场景,其他场景应选择:其他,为了背包里的UI不显示X")]
|
||||
public class ToolsPackSceneManager : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private ToolsPackScene toolsPackScene;
|
||||
private void Start()
|
||||
[SerializeField] private ToolsPackScene toolsPackScene;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
MotionEngine.GetModule<ToolsPackManager>().SetToolsPackScene(toolsPackScene);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,20 @@
|
|||
{
|
||||
"steps": [
|
||||
|
||||
{
|
||||
"stepDescription": "前往现场",
|
||||
"score": 0,
|
||||
"actions": [
|
||||
{
|
||||
"description": "前往现场",
|
||||
"score": 0,
|
||||
"isSequential": true,
|
||||
"targetObjects": [
|
||||
"Man_stand"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"stepDescription": "步骤 1 描述",
|
||||
"score": 0,
|
||||
|
|
@ -200,6 +215,6 @@
|
|||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: d81c44f672f82c1459eb8be7cce474c4
|
||||
guid: c903293fea9015444815f60be6003cc6
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
{
|
||||
"steps": [
|
||||
{
|
||||
"stepDescription": "填写工作票",
|
||||
"score": 0,
|
||||
"actions": [
|
||||
{
|
||||
"description": "填写工作票",
|
||||
"score": 0,
|
||||
"isSequential": true,
|
||||
"targetObjects": [
|
||||
"工作单"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"stepDescription": "领取工器具及仪器设备",
|
||||
"score": 0,
|
||||
"actions": [
|
||||
{
|
||||
"description": "领取工器具及仪器设备",
|
||||
"score": 0,
|
||||
"isSequential": false,
|
||||
"targetObjects": [
|
||||
"螺丝刀",
|
||||
"剥线钳",
|
||||
"绝缘胶带",
|
||||
"验电笔",
|
||||
"盒装封印",
|
||||
"安全帽",
|
||||
"纱布手套",
|
||||
"工作服",
|
||||
"l型集中器"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: ed8f789182d8af3479574d6b5b8b196a
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Loading…
Reference in New Issue