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