using System.Collections.Generic;
using Framework;
using Gameplay.Level;
using Framework.Condition;
///
/// 关卡星级是否满足
///
public class ConditionLevelStar : ICondition
{
public EventManager.EventName SignalName => EventManager.EventName.LevelInfoChanged;
public bool Check(List args)
{
if (args.Count < 2)
throw new ConditionException($"{nameof(ConditionLevelStar)}条件(关卡星级是否满足),需要两个参数,当前只有{args.Count}个参数,参数1:关卡id,参数2:星级数量");
int id = (int)args[0];
int star = (int)args[1];
if (!LevelManager.Instance.TryGetLevelInfoByID(id, out LevelInfo levelInfo))
return false;
return levelInfo.Score >= star;
}
public string[] GetArgLocalizations(List args)
{
if (args.Count < 2)
throw new ConditionException($"{nameof(ConditionLevelStar)}条件(关卡星级是否满足),需要两个参数,当前只有{args.Count}个参数,参数1:关卡id,参数2:星级数量");
return new string[2] { ((int)args[0]).ToString(), ((int)args[1]).ToString() };
}
}