修改模式
This commit is contained in:
parent
ebeccad778
commit
4366914e60
|
|
@ -5,7 +5,7 @@ using UnityEngine;
|
|||
public class ScriptDescriptionEditor : Editor
|
||||
{
|
||||
private GUIStyle descriptionStyle;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -21,6 +21,9 @@ public class ScriptDescriptionEditor : Editor
|
|||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private Texture2D MakeTex(int width, int height, Color col)
|
||||
{
|
||||
Color[] pix = new Color[width * height];
|
||||
|
|
|
|||
|
|
@ -0,0 +1,42 @@
|
|||
namespace DefaultNamespace.Dto
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
public class EnergyList
|
||||
{
|
||||
[JsonProperty("keywork")]
|
||||
public string KeyWork { get; set; }
|
||||
|
||||
[JsonProperty("valuework")]
|
||||
public double ValueWork { get; set; }
|
||||
}
|
||||
|
||||
public class Work
|
||||
{
|
||||
[JsonProperty("work")]
|
||||
public string WorkType { get; set; }
|
||||
|
||||
[JsonProperty("worklist")]
|
||||
public List<EnergyList> WorkList { get; set; }
|
||||
}
|
||||
|
||||
public class SceneInformation
|
||||
{
|
||||
[JsonProperty("scenename")]
|
||||
public string SceneName { get; set; }
|
||||
|
||||
[JsonProperty("questbooks")]
|
||||
public string QuestBooks { get; set; }
|
||||
|
||||
[JsonProperty("userinformation")]
|
||||
public string UserInformation { get; set; }
|
||||
|
||||
[JsonProperty("energyinformation")]
|
||||
public string EnergyInformation { get; set; }
|
||||
|
||||
[JsonProperty("energylist")]
|
||||
public List<Work> EnergyList { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 205e3a1f124e4862b02125ff75e82284
|
||||
timeCreated: 1718760217
|
||||
|
|
@ -12,10 +12,9 @@ public class MessageManager : MonoBehaviour
|
|||
public TMP_Text text;
|
||||
void Start()
|
||||
{
|
||||
|
||||
MotionEngine.GetModule<AnimationProcessManager>().OnSendMessagePrompt += SendMessagePrompt;
|
||||
}
|
||||
|
||||
|
||||
private void SendMessagePrompt(string message)
|
||||
{
|
||||
text.text = message;
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ namespace DefaultNamespace.ProcessMode
|
|||
/// 全部流程结束调用方法
|
||||
/// </summary>
|
||||
public event CompleteEventHandler OnCompleteEvent;
|
||||
|
||||
public event UIEventHandler OnUIEvent;
|
||||
public event SendMessagePrompt OnSendMessagePrompt;
|
||||
|
||||
|
|
@ -80,10 +81,10 @@ namespace DefaultNamespace.ProcessMode
|
|||
currentAction.TargetObjects[currentAction.CurrentObjectIndex] == clickedObject)
|
||||
{
|
||||
Debug.Log($"正确点击了:{clickedObject}");
|
||||
|
||||
HandleModeFeedback(currentMode, currentAction); // 处理模式特定的反馈
|
||||
currentAction.CurrentObjectIndex++; // 正确点击,递增对象索引
|
||||
currentAction.ClickedObjects.Add(clickedObject); // 添加到已点击对象集合
|
||||
HandleModeFeedback(currentMode, currentAction); // 处理模式特定的反馈
|
||||
|
||||
if (currentAction.CurrentObjectIndex >= currentAction.TargetObjects.Count)
|
||||
{
|
||||
CompleteAction(step, currentAction); // 完成当前动作
|
||||
|
|
@ -160,8 +161,14 @@ namespace DefaultNamespace.ProcessMode
|
|||
currentStepIndex++;
|
||||
if (currentStepIndex < processes[currentMode.ToString()].Steps.Count)
|
||||
{
|
||||
var nextStep = processes[currentMode.ToString()].Steps[currentStepIndex];
|
||||
HandleModeFeedback(currentMode, nextStep.Actions[0]); // 准备下一个步骤
|
||||
// if (currentMode == ProcessMode.Practice)
|
||||
// {
|
||||
// var nextStep = processes[currentMode.ToString()].Steps[currentStepIndex];
|
||||
// HandleModeFeedback(currentMode, nextStep.Actions[0]); // 准备下一个步骤
|
||||
// }
|
||||
|
||||
var nextStep = processes[currentMode.ToString()].Steps[currentStepIndex];
|
||||
HandleModeFeedback(currentMode, nextStep.Actions[0]); // 准备下一个步骤
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -179,21 +186,16 @@ namespace DefaultNamespace.ProcessMode
|
|||
HandleModeFeedback(currentMode, step.Actions[currentActionIndex]); // 传递下一个动作对象
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 判断是否为最后一个动作
|
||||
/// 判断是否为targetObjects中的最后一个物体
|
||||
/// </summary>
|
||||
/// <param name="action">当前的动作</param>
|
||||
/// <returns>是否为最后一个动作</returns>
|
||||
private bool IsLastAction(ActionWithDescription action)
|
||||
/// <returns>是否为targetObjects中的最后一个物体</returns>
|
||||
private bool IsLastTargetObject(ActionWithDescription action)
|
||||
{
|
||||
if (currentStepIndex == processes[currentMode.ToString()].Steps.Count - 1 &&
|
||||
currentActionIndex == processes[currentMode.ToString()].Steps[currentStepIndex].Actions.Count - 1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return action.CurrentObjectIndex == action.TargetObjects.Count - 1;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -230,18 +232,18 @@ namespace DefaultNamespace.ProcessMode
|
|||
case ProcessMode.Practice:
|
||||
if (stepOrAction is ActionWithDescription practiceAction)
|
||||
{
|
||||
if (IsLastAction(practiceAction))
|
||||
if (IsLastTargetObject(practiceAction))
|
||||
{
|
||||
ShowPracticeStep(practiceAction.Description); // 只显示当前步骤
|
||||
ShowPracticeStep(practiceAction); // 只显示当前步骤
|
||||
}
|
||||
}
|
||||
else if (stepOrAction is AnimationStep practiceStep)
|
||||
{
|
||||
if (practiceStep.Actions.Count > 0)
|
||||
{
|
||||
if (IsLastAction(practiceStep.Actions[0]))
|
||||
if (IsLastTargetObject(practiceStep.Actions[0]))
|
||||
{
|
||||
ShowPracticeStep(practiceStep.Actions[0].Description); // 只显示当前步骤
|
||||
ShowPracticeStep(practiceStep.Actions[0]); // 只显示当前步骤
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -326,7 +328,6 @@ namespace DefaultNamespace.ProcessMode
|
|||
currentActionIndex = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void ShowPracticeStep(object nextStepOrAction)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,25 +1,26 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using DefaultNamespace.Dto;
|
||||
using DefaultNamespace.ProcessMode;
|
||||
using DG.Tweening;
|
||||
using MotionFramework;
|
||||
using Newtonsoft.Json;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class test1 : MonoBehaviour
|
||||
{
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
this.GetComponent<Button>().onClick.AddListener(delegate
|
||||
{
|
||||
MotionEngine.GetModule<AnimationProcessManager>().HandleClick(this.gameObject.name);
|
||||
});
|
||||
string json =
|
||||
@"{""scenename"":""场景名称"",""questbooks"":""本次训练任务默认停电作业,现场集中器损坏,需要查看情况,并处理。"",""userinformation"":""用户基本信息"",""energyinformation"":""现场电能表信息内容"",""energylist"":[{""work"":""正向有功"",""worklist"":[{""keywork"":""总"",""valuework"":630732.86},{""keywork"":""尖"",""valuework"":0},{""keywork"":""峰"",""valuework"":600227.02},{""keywork"":""平"",""valuework"":0},{""keywork"":""谷"",""valuework"":30505.84}]},{""work"":""正向无功"",""worklist"":[{""keywork"":""总"",""valuework"":90704.72},{""keywork"":""尖"",""valuework"":0},{""keywork"":""峰"",""valuework"":82394.39},{""keywork"":""平"",""valuework"":0},{""keywork"":""谷"",""valuework"":8310.33}]},{""work"":""反向有功"",""worklist"":[{""keywork"":""总"",""valuework"":0},{""keywork"":""尖"",""valuework"":0},{""keywork"":""峰"",""valuework"":0},{""keywork"":""平"",""valuework"":0},{""keywork"":""谷"",""valuework"":0}]},{""work"":""反向无功"",""worklist"":[{""keywork"":""总"",""valuework"":18385.2},{""keywork"":""尖"",""valuework"":0},{""keywork"":""峰"",""valuework"":13222.55},{""keywork"":""平"",""valuework"":0},{""keywork"":""谷"",""valuework"":5162.65}]}]}";
|
||||
SceneInformation sceneInfo = JsonConvert.DeserializeObject<SceneInformation>(json);
|
||||
Debug.Log("Scene Name: " + sceneInfo.SceneName);
|
||||
}
|
||||
|
||||
private void HandleStringEvent(string message)
|
||||
{
|
||||
Debug.Log("Received message: " + message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1 +1 @@
|
|||
2024-06-14 15:04:12#'sxfz://;lyht,2,18,userId,username,token,90;/'|
|
||||
2024-06-14 15:04:12#'sxfz://;lyht,0,18,userId,username,token,90;/'|
|
||||
Loading…
Reference in New Issue