84 lines
2.4 KiB
C#
84 lines
2.4 KiB
C#
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
namespace DefaultNamespace.ProcessMode
|
|
{
|
|
public class ProcessUIManager
|
|
{
|
|
public Text trainingTextBox; // 培训模式的文本框
|
|
public Text practiceTextBox; // 练习模式的文本框
|
|
public GameObject highlightObject; // 高亮对象,用于教学模式
|
|
|
|
public AnimationProcessManager processManager; // 流程管理器实例
|
|
|
|
private void Start()
|
|
{
|
|
processManager = new AnimationProcessManager(this); // 传递UIManager实例
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
if (Input.GetMouseButtonDown(0))
|
|
{
|
|
GameObject clickedObject = DetectClickedObject();
|
|
if (clickedObject != null)
|
|
{
|
|
processManager.HandleClick(clickedObject);
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 检测点击的对象
|
|
/// </summary>
|
|
/// <returns>点击的对象</returns>
|
|
private GameObject DetectClickedObject()
|
|
{
|
|
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
|
|
RaycastHit hit;
|
|
if (Physics.Raycast(ray, out hit))
|
|
{
|
|
return hit.collider.gameObject;
|
|
}
|
|
return null;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 显示培训步骤信息
|
|
/// </summary>
|
|
/// <param name="step">当前步骤</param>
|
|
public void ShowTrainingStep(AnimationStep step)
|
|
{
|
|
if (trainingTextBox != null)
|
|
{
|
|
trainingTextBox.text = step.Description;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 显示练习步骤信息
|
|
/// </summary>
|
|
/// <param name="step">当前步骤</param>
|
|
public void ShowPracticeStep(AnimationStep step)
|
|
{
|
|
if (practiceTextBox != null)
|
|
{
|
|
practiceTextBox.text = step.Description;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 高亮显示下一个需要点击的地方(教学模式)
|
|
/// </summary>
|
|
/// <param name="step">当前步骤</param>
|
|
public void HighlightNextStep(AnimationStep step)
|
|
{
|
|
if (highlightObject != null)
|
|
{
|
|
highlightObject.SetActive(true);
|
|
// 假设你有一个方法来定位高亮对象
|
|
// highlightObject.transform.position = ...;
|
|
}
|
|
}
|
|
}
|
|
} |