NLDClient-yudde/ProjectNLD/Assets/Code/Scripts/Gameplay/Condition/Conditions/ConditionLevelPass.cs

33 lines
826 B
C#
Raw Normal View History

2023-11-03 14:46:27 +08:00
using System.Collections.Generic;
2023-11-01 13:33:20 +08:00
using Framework;
using Gameplay.Level;
using Framework.Condition;
/// <summary>
/// 关卡是否通关
/// </summary>
public class ConditionLevelPass : ICondition
{
public EventManager.EventName SignalName => EventManager.EventName.LevelInfoChanged;
2023-11-03 14:46:27 +08:00
public bool Check(List<float> args)
2023-11-01 13:33:20 +08:00
{
2024-09-05 13:41:39 +08:00
int id = (int)args[0];
2023-11-01 13:33:20 +08:00
2024-09-05 13:41:39 +08:00
if (!LevelManager.Instance.TryGetLevelInfoByID(id, out LevelInfo levelInfo))
return false;
return levelInfo.IsPass;
2023-11-01 13:33:20 +08:00
}
2024-04-15 17:59:58 +08:00
public string[] GetArgLocalizations(List<float> args)
{
2024-09-13 14:22:11 +08:00
int id = (int)args[0];
2024-09-18 14:25:33 +08:00
if (LevelManager.Instance.TryGetLevelInfoByID(id, out LevelInfo levelInfo))
return new string[1] { levelInfo.Name };
else
return new string[1] { id.ToString() };
2024-04-15 17:59:58 +08:00
}
2023-11-01 13:33:20 +08:00
}