feat(NumberSlot): 实现密码槽的显示
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using Script.Gameplay.Connect;
|
||||
@@ -7,24 +8,33 @@ namespace Script.Gameplay.Facility
|
||||
// 号码枚举类型
|
||||
public enum NumberType
|
||||
{
|
||||
Zero,
|
||||
One,
|
||||
Two,
|
||||
Three,
|
||||
Four,
|
||||
Five,
|
||||
// Six,
|
||||
// Seven,
|
||||
// Eight,
|
||||
// Nine
|
||||
Circle,
|
||||
Cloud,
|
||||
Flower,
|
||||
Leaf,
|
||||
Wave,
|
||||
}
|
||||
|
||||
// 号码槽
|
||||
public class NumberSlotController : BaseFacilityController
|
||||
{
|
||||
[Header("号码槽设置")]
|
||||
[SerializeField] private NumberType currentNumber = NumberType.Zero;
|
||||
[SerializeField] private NumberType correctNumber = NumberType.One;
|
||||
[SerializeField] private NumberType currentNumber = NumberType.Circle;
|
||||
[SerializeField] private NumberType correctNumber = NumberType.Cloud;
|
||||
[Header("图标")]
|
||||
[SerializeField] private GameObject CircleIcon;
|
||||
[SerializeField] private GameObject CloudIcon;
|
||||
[SerializeField] private GameObject FlowerIcon;
|
||||
[SerializeField] private GameObject LeafIcon;
|
||||
[SerializeField] private GameObject WaveIcon;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
// 初始化图标显示
|
||||
UpdateIconDisplay();
|
||||
// 检查初始号码并发送信号
|
||||
CheckNumberAndSendSignal();
|
||||
}
|
||||
|
||||
// 接收信号
|
||||
public override void OnSignalReceived(bool active, GameObject sender)
|
||||
@@ -41,6 +51,38 @@ namespace Script.Gameplay.Facility
|
||||
{
|
||||
currentNumber = (NumberType)(((int)currentNumber + 1) % System.Enum.GetValues(typeof(NumberType)).Length);
|
||||
CheckNumberAndSendSignal();
|
||||
// 更新图标显示
|
||||
UpdateIconDisplay();
|
||||
}
|
||||
|
||||
private void UpdateIconDisplay()
|
||||
{
|
||||
// 隐藏所有图标
|
||||
CircleIcon.SetActive(false);
|
||||
CloudIcon.SetActive(false);
|
||||
FlowerIcon.SetActive(false);
|
||||
LeafIcon.SetActive(false);
|
||||
WaveIcon.SetActive(false);
|
||||
|
||||
// 根据当前号码显示对应图标
|
||||
switch (currentNumber)
|
||||
{
|
||||
case NumberType.Circle:
|
||||
CircleIcon.SetActive(true);
|
||||
break;
|
||||
case NumberType.Cloud:
|
||||
CloudIcon.SetActive(true);
|
||||
break;
|
||||
case NumberType.Flower:
|
||||
FlowerIcon.SetActive(true);
|
||||
break;
|
||||
case NumberType.Leaf:
|
||||
LeafIcon.SetActive(true);
|
||||
break;
|
||||
case NumberType.Wave:
|
||||
WaveIcon.SetActive(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 检查号码并发信号
|
||||
|
||||
Reference in New Issue
Block a user