This commit is contained in:
yzx 2024-06-12 13:22:53 +08:00
parent 5ad1d14b3d
commit 7d6745dd3e
7 changed files with 129 additions and 4 deletions

View File

@ -47,6 +47,7 @@
<ItemGroup>
<Compile Include="Assets\taoruiqi\Script\ElectricCheckPen.cs" />
<Compile Include="Assets\Scripts\ProcessMode\ProcessMode.cs" />
<Compile Include="Assets\Scripts\Dto\StepData.cs" />
<Compile Include="Assets\Scripts\ToolsPack\ToolsPackWindowManager.cs" />
<Compile Include="Assets\Standard Assets 1\Utility\FOVKick.cs" />
<Compile Include="Assets\HighlightPlus\Scripts\HighlightEffectOccluderManager.cs" />
@ -215,6 +216,7 @@
<None Include="Assets\TextMesh Pro\Shaders\TMP_Bitmap-Custom-Atlas.shader" />
<None Include="Assets\TextMesh Pro\Shaders\TMP_SDF.shader" />
<None Include="Assets\TextMesh Pro\Shaders\TMP_SDF-Mobile SSD.shader" />
<None Include="Assets\StreamingAssets\DataConfig\StepData.json" />
<None Include="Assets\TextMesh Pro\Resources\LineBreaking Leading Characters.txt" />
<None Include="Assets\HighlightPlus\Resources\HighlightPlus\HighlightAddDepthClip.shader" />
<None Include="Assets\TextMesh Pro\Shaders\TMPro_Properties.cginc" />

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: e8fccbddd2724242ac0ddbe6842b4e62
timeCreated: 1718169397

View File

@ -0,0 +1,23 @@
using System.Collections.Generic;
namespace DefaultNamespace.Dto
{
public class ActionData
{
public string Description { get; set; }
public int Score { get; set; }
public List<string> TargetObjects { get; set; }
}
public class StepData
{
public string StepDescription { get; set; }
public int Score { get; set; }
public List<ActionData> Actions { get; set; }
}
public class StepsContainer
{
public List<StepData> Steps { get; set; }
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: bd785483722c49d1ab4f549d9467d59b
timeCreated: 1718169406

View File

@ -1,8 +1,10 @@
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
@ -19,12 +21,51 @@ namespace DefaultNamespace.ProcessMode
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);
List<ActionWithDescription> actions = CreateStepActions();
AnimationStep step = new AnimationStep($"描述步骤", 100, actions);
processManager.AddStepToProcess("Teaching", step);
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 = () => { Debug.Log(actionData.Description); };
actions.Add(new ActionWithDescription(targetObjects, action, actionData.Description));
}
AnimationStep step = new AnimationStep(stepData.StepDescription, stepData.Score, actions);
processManager.AddStepToProcess("Teaching", step);
}
//
// processManager.AddProcess("Teaching");
//
// List<ActionWithDescription> actions = CreateStepActions();
// AnimationStep step = new AnimationStep($"描述步骤", 100, actions);
// processManager.AddStepToProcess("Teaching", step);
// List<ActionWithDescription> actions1 = CreateStepActions1();

View File

@ -0,0 +1,46 @@
{
"steps": [
{
"stepDescription": "步骤 1 描述",
"score": 100,
"actions": [
{
"description": "动作 1 的描述",
"score": 50,
"targetObjects": [
"变电箱_门",
"插座"
]
},
{
"description": "动作 2 的描述",
"score": 50,
"targetObjects": [
"插座",
"变电箱_门"
]
}
]
},
{
"stepDescription": "步骤 2 描述",
"score": 100,
"actions": [
{
"description": "动作 1 的描述",
"score": 50,
"targetObjects": [
"插座"
]
},
{
"description": "动作 2 的描述",
"score": 50,
"targetObjects": [
"变电箱_门"
]
}
]
}
]
}

View File

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