64 lines
2.1 KiB
C#
64 lines
2.1 KiB
C#
using UnityEngine;
|
|
using AibisDream.FixSystem;
|
|
using System;
|
|
|
|
namespace AibisDream
|
|
{
|
|
public class BlockPuzzlePanel : MonoBehaviour, ILineView
|
|
{
|
|
[Header("组件索引")]
|
|
[SerializeField] private UniversalScreen logScreen;
|
|
[SerializeField] private UniversalScreen blockPuzzleScreen;
|
|
[SerializeField] private BlockPuzzlePart blockPuzzlePart;
|
|
|
|
public event Action OnSubmit;
|
|
|
|
// ---------------------- 维修部分 ----------------------
|
|
public BlockPuzzlePart Panel => blockPuzzlePart;
|
|
|
|
public void ShowShapeInScreen(BlockShapeInfo shape)
|
|
{
|
|
logScreen.gameObject.SetActive(false);
|
|
blockPuzzleScreen.gameObject.SetActive(true);
|
|
|
|
// 在屏幕上显示对应信息
|
|
blockPuzzleScreen.SetImage("设备缩略图", shape.GetButtonImage());
|
|
|
|
blockPuzzleScreen.SetText("设备名称", shape.shapeName);
|
|
blockPuzzleScreen.SetText("设备描述", shape.shapeDescription);
|
|
|
|
blockPuzzleScreen.SetText("PWR", shape.paramValue.power.ToString());
|
|
blockPuzzleScreen.SetText("NOISE", shape.paramValue.noise.ToString());
|
|
blockPuzzleScreen.SetText("HEAT", shape.paramValue.heat.ToString());
|
|
|
|
// TODO: 设备状态后面实现
|
|
}
|
|
|
|
// ---------------------- 对话功能 ----------------------
|
|
|
|
public void RunLine(LineSyncToken syncToken)
|
|
{
|
|
// 对话时显示Log面板,隐藏BlockPuzzle面板
|
|
logScreen.gameObject.SetActive(true);
|
|
blockPuzzleScreen.gameObject.SetActive(false);
|
|
|
|
logScreen.RunLine(syncToken);
|
|
}
|
|
|
|
// -------------------------- 生命周期 --------------------------
|
|
|
|
private void OnEnable()
|
|
{
|
|
DialogUIManager.Instance.RegisterScreenView(DialogViewType.Log, this);
|
|
|
|
blockPuzzlePart.LockButton.onClick.AddListener(() => OnSubmit?.Invoke());
|
|
}
|
|
|
|
private void OnDisable()
|
|
{
|
|
DialogUIManager.Instance.UnRegisterScreenView(DialogViewType.Log);
|
|
|
|
blockPuzzlePart.LockButton.onClick.RemoveAllListeners();
|
|
}
|
|
}
|
|
} |