2025-09-03 19:59:22 +08:00
|
|
|
using System;
|
2025-10-10 14:08:23 +08:00
|
|
|
using Data;
|
|
|
|
|
using Managers;
|
2025-09-19 08:26:54 +08:00
|
|
|
using Prefab;
|
2025-09-03 19:59:22 +08:00
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
namespace UI
|
|
|
|
|
{
|
2025-10-10 14:08:23 +08:00
|
|
|
public class AttackModeUI : MonoBehaviour
|
2025-09-03 19:59:22 +08:00
|
|
|
{
|
|
|
|
|
public UIImageAnimator icon;
|
|
|
|
|
|
2025-10-10 14:08:23 +08:00
|
|
|
public int CurrentIndex { get; private set; }
|
|
|
|
|
public RobotLogicDef[] robotLogic;
|
|
|
|
|
|
|
|
|
|
public RobotLogicDef CurrentLogic => robotLogic?[CurrentIndex];
|
|
|
|
|
|
2025-09-03 19:59:22 +08:00
|
|
|
private void Start()
|
|
|
|
|
{
|
2025-10-10 14:08:23 +08:00
|
|
|
robotLogic=Program.Instance.CurrentCharacter?.robotLogic;
|
|
|
|
|
if (robotLogic == null || robotLogic.Length == 0)
|
|
|
|
|
{
|
|
|
|
|
robotLogic= Array.Empty<RobotLogicDef>();
|
|
|
|
|
icon.gameObject.SetActive(false);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
UpdateUI();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void UpdateUI()
|
|
|
|
|
{
|
|
|
|
|
if (CurrentLogic == null)
|
|
|
|
|
return;
|
|
|
|
|
icon.SetSprites(PackagesImageManager.Instance.GetSprites(new[]
|
|
|
|
|
{
|
|
|
|
|
CurrentLogic.icon
|
|
|
|
|
}));
|
|
|
|
|
Program.Instance.CurrentRobotLogic = CurrentLogic;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void OnSwitch()
|
|
|
|
|
{
|
|
|
|
|
if (robotLogic.Length == 0)
|
|
|
|
|
return;
|
|
|
|
|
CurrentIndex += 1;
|
|
|
|
|
CurrentIndex %= robotLogic.Length;
|
|
|
|
|
UpdateUI();
|
2025-09-03 19:59:22 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|