This commit is contained in:
yzx 2024-06-14 13:03:55 +08:00
parent e26a60e951
commit bf8b5a9be1
11 changed files with 2625 additions and 121 deletions

File diff suppressed because one or more lines are too long

View File

@ -60,6 +60,7 @@ public class GameLauncher : MonoBehaviour
//工具包
MotionEngine.CreateModule<ToolsPackManager>();
//数据配置文件
MotionEngine.CreateModule<DataConfigManager>();

View File

@ -19606,8 +19606,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 1}
m_AnchorMax: {x: 0.5, y: 1}
m_AnchoredPosition: {x: 0, y: -50}
m_SizeDelta: {x: 1920, y: 94}
m_AnchoredPosition: {x: 0, y: -72}
m_SizeDelta: {x: 1920, y: 144}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &884140861
MonoBehaviour:
@ -26006,7 +26006,7 @@ GameObject:
- component: {fileID: 1290596211}
- component: {fileID: 1290596210}
m_Layer: 5
m_Name: Button (Legacy) (1)
m_Name: "\u4E34\u65F6\u7528\u7535"
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
@ -32173,6 +32173,8 @@ MonoBehaviour:
- {fileID: 588400109}
- {fileID: 1485260145}
- {fileID: 2018635915}
ui: {fileID: 1393670468}
processBt: {fileID: 1290596210}
PutBack: {fileID: 506401300}
--- !u!1 &1511629609
GameObject:

View File

@ -162,13 +162,13 @@ public class Screwdriver : MonoBehaviour
StartCoroutine(ScrewdriverBack());
ElectricWireBcr.enabled = true;
StartCoroutine(IEElectricWire());
Debug.Log("所有螺丝都已隐藏");
// Debug.Log("所有螺丝都已隐藏");
}
//集中器外壳上的封印和螺丝
if (AllHubOfHubs())
{
HubCoverObj.gameObject.transform.DOLocalMove(new Vector3(0, 0.0167f, -0.2387f),1);
Debug.Log("所有集线器盖子螺丝都已隐藏");
// Debug.Log("所有集线器盖子螺丝都已隐藏");
}
if (ConcentratorScrew())
{

View File

@ -13,8 +13,10 @@ namespace DefaultNamespace.ProcessMode
public HashSet<GameObject> ClickedObjects { get; private set; } // 已点击的对象集合
public int CurrentObjectIndex { get; set; } // 当前对象的点击索引,仅用于按顺序点击的情况
public bool FeedbackDisplayed { get; set; } // 是否已经显示过反馈
public string StepDescription { get; set; }
public ActionWithDescription(List<GameObject> targetObjects, Action action, string description, bool isSequential)
public ActionWithDescription(List<GameObject> targetObjects, Action action, string description, bool isSequential,string stepDescription)
{
TargetObjects = targetObjects ?? new List<GameObject>();
Action = action;
@ -23,10 +25,8 @@ namespace DefaultNamespace.ProcessMode
ClickedObjects = new HashSet<GameObject>(); // 初始化已点击的对象集合
CurrentObjectIndex = 0; // 初始化为第一个对象
FeedbackDisplayed = false; // 初始化反馈未显示
StepDescription = stepDescription;
}
}
}

View File

@ -21,10 +21,14 @@ namespace DefaultNamespace.ProcessMode
public AnimationProcess CurrentProcess => processes[currentMode.ToString()];
public delegate void CompleteEventHandler();
public delegate void UIEventHandler();
public delegate void SendMessagePrompt(string message);
// 定义一个事件,使用委托类型
public event CompleteEventHandler OnCompleteEvent;
public event UIEventHandler OnUIEvent;
public event SendMessagePrompt OnSendMessagePrompt;
public void AddProcess(string type)
@ -153,6 +157,12 @@ namespace DefaultNamespace.ProcessMode
{
var nextStep = processes[currentMode.ToString()].Steps[currentStepIndex];
PrepareNextStep(currentMode, nextStep.Actions[0]); // 准备下一个步骤
if (nextStep.Actions[0].StepDescription == "临时用电")
{
Debug.Log("临时用电临时用电临时用电临时用电临时用电临时用电临时用电临时用电临时用电临时用电");
OnUIEvent();
}
}
else
{
@ -168,6 +178,12 @@ namespace DefaultNamespace.ProcessMode
{
Debug.Log("开始下一个动作!");
PrepareNextStep(currentMode, step.Actions[currentActionIndex]); // 传递下一个动作对象
if (step.Actions[currentActionIndex].StepDescription == "临时用电")
{
Debug.Log("临时用电临时用电临时用电临时用电临时用电临时用电临时用电临时用电临时用电临时用电");
OnUIEvent();
}
}
}
// Start is called before the first frame update
@ -214,14 +230,14 @@ namespace DefaultNamespace.ProcessMode
if (nextStepOrAction is ActionWithDescription action)
{
Debug.Log($"培训模式:{action.Description}");
OnSendMessagePrompt("提示:"+action.Description);
OnSendMessagePrompt("提示:" + action.Description);
}
else if (nextStepOrAction is AnimationStep step)
{
if (step.Actions.Count > 0)
{
Debug.Log($"培训模式:{step.Actions[0].Description}");
OnSendMessagePrompt("提示:"+step.Actions[0].Description);
OnSendMessagePrompt("提示:" + step.Actions[0].Description);
}
}

View File

@ -54,7 +54,7 @@ namespace DefaultNamespace.ProcessMode
}
Action action = () => { };
actions.Add(new ActionWithDescription(targetObjects, action, actionData.Description, actionData.IsSequential));
actions.Add(new ActionWithDescription(targetObjects, action, actionData.Description, actionData.IsSequential,stepData.StepDescription));
}
AnimationStep step = new AnimationStep(stepData.StepDescription, stepData.Score, actions);

View File

@ -56,7 +56,7 @@ namespace ToolsPack
}
Action action = () => { };
actions.Add(new ActionWithDescription(targetObjects, action, actionData.Description, actionData.IsSequential));
actions.Add(new ActionWithDescription(targetObjects, action, actionData.Description, actionData.IsSequential,stepData.StepDescription));
}
AnimationStep step = new AnimationStep(stepData.StepDescription, stepData.Score, actions);

View File

@ -15,6 +15,20 @@
}
]
},
{
"stepDescription": "临时用电",
"score": 0,
"actions": [
{
"description": "安装完成后UI出现申请测试点击临时用电测试申请确认后进行通电调试。",
"score": 0,
"isSequential": false,
"targetObjects": [
"临时用电"
]
}
]
},
{
"stepDescription": "验电",
"score": 0,
@ -282,7 +296,7 @@
"score": 0,
"isSequential": false,
"targetObjects": [
"柜门卡栓",
"柜门卡栓"
]
}
]

View File

@ -92,7 +92,7 @@ public class concentrator : MonoBehaviour
{
isPlayAni = false;
StartCoroutine(TapeBack());
Debug.Log("所有螺丝都显示");
// Debug.Log("所有螺丝都显示");
}
}

View File

@ -1,6 +1,7 @@
using MotionFramework;
using System.Collections;
using System.Collections.Generic;
using DefaultNamespace.ProcessMode;
using UnityEngine;
using UnityEngine.UI;
@ -11,6 +12,8 @@ public class DisplayKnapsackObjects : MonoBehaviour
{
public GameObject[] Tool;
public GameObject ui;
public Button processBt;
/// <summary>
/// ·Å»Ø±³°ü°´Å¥
/// </summary>
@ -20,6 +23,9 @@ public class DisplayKnapsackObjects : MonoBehaviour
void Start()
{
MotionEngine.GetModule<ToolsPackManager>().OnStringEvent += HandleStringEvent;
MotionEngine.GetModule<AnimationProcessManager>().OnUIEvent += UIEvent;
PutBack.onClick.AddListener(() => {
if (Tool[0].activeInHierarchy)
{
@ -51,7 +57,16 @@ public class DisplayKnapsackObjects : MonoBehaviour
Tool[6].gameObject.SetActive(false);
}
});
processBt.onClick.AddListener(delegate
{
MotionEngine.GetModule<AnimationProcessManager>().HandleClick(processBt.gameObject);
ui.SetActive(false);
});
}
private void UIEvent()
{
ui.SetActive(true);
}