using CommonAI.Zone.Instance; using CommonLang.Property; using System; using System.Collections.Generic; using System.Linq; using System.Text; using CommonAI.Zone.EventTrigger; namespace CommonAI.Zone.ZoneEditor.EventTrigger { [DescAttribute("刷新点 - 当前存活单位数量", "区域 - 刷新点")] public class SpawnTriggerAliveCount : IntegerValue { [DescAttribute("区域")] public FlagValue Region = new FlagValue.EditorRegion(); public override string ToString() { return string.Format("刷新点[{0}]当前怪物存活数量", Region); } public override Int32 GetValue(IEditorValueAdapter api, EventArguments args) { EventTriggerAdapter evtapi = api as EventTriggerAdapter; if (evtapi != null) { ZoneRegion region = Region.GetValue(api, args) as ZoneRegion; if (region != null) { int ret = 0; foreach (AbstractSpawnTrigger spawn in region.GetSpawnTriggers()) { ret += spawn.AliveCount; } return ret; } } return 0; } } [DescAttribute("刷新点 - 总共生成单位数量", "区域 - 刷新点")] public class SpawnTriggerTotalSpawnCount : IntegerValue { [DescAttribute("区域")] public FlagValue Region = new FlagValue.EditorRegion(); public override string ToString() { return string.Format("刷新点[{0}]当前怪物存活数量", Region); } public override Int32 GetValue(IEditorValueAdapter api, EventArguments args) { EventTriggerAdapter evtapi = api as EventTriggerAdapter; if (evtapi != null) { ZoneRegion region = Region.GetValue(api, args) as ZoneRegion; if (region != null) { int ret = 0; foreach (AbstractSpawnTrigger spawn in region.GetSpawnTriggers()) { ret += spawn.TotalSpawnCount; } return ret; } } return 0; } } [DescAttribute("刷新点 - 单次生成单位数量", "区域 - 刷新点")] public class SpawnTriggerOnceSpawnCount : IntegerValue { [DescAttribute("区域")] public FlagValue Region = new FlagValue.EditorRegion(); public override string ToString() { return string.Format("刷新点[{0}]单次生成单位数量", Region); } public override Int32 GetValue(IEditorValueAdapter api, EventArguments args) { EventTriggerAdapter evtapi = api as EventTriggerAdapter; if (evtapi != null) { ZoneRegion region = Region.GetValue(api, args) as ZoneRegion; if (region != null) { int ret = 0; foreach (AbstractSpawnTrigger spawn in region.GetSpawnTriggers()) { ret += spawn.OnceSpawnCount; } return ret; } } return 0; } } [DescAttribute("刷新点 - 总共生成单位上限", "区域 - 刷新点")] public class SpawnTriggerLimitedSpawnCount : IntegerValue { [DescAttribute("区域")] public FlagValue Region = new FlagValue.EditorRegion(); public override string ToString() { return string.Format("刷新点[{0}]总共生成单位上限", Region); } public override Int32 GetValue(IEditorValueAdapter api, EventArguments args) { EventTriggerAdapter evtapi = api as EventTriggerAdapter; if (evtapi != null) { ZoneRegion region = Region.GetValue(api, args) as ZoneRegion; if (region != null) { int ret = 0; foreach (AbstractSpawnTrigger spawn in region.GetSpawnTriggers()) { ret += spawn.LimitedSpawnCount; } return ret; } } return 0; } } [DescAttribute("刷新点 - 存活数量上限(不死完不刷新)", "区域 - 刷新点")] public class SpawnTriggerLimitedAliveCount : IntegerValue { [DescAttribute("区域")] public FlagValue Region = new FlagValue.EditorRegion(); public override string ToString() { return string.Format("刷新点[{0}]存活数量上限", Region); } public override Int32 GetValue(IEditorValueAdapter api, EventArguments args) { EventTriggerAdapter evtapi = api as EventTriggerAdapter; if (evtapi != null) { ZoneRegion region = Region.GetValue(api, args) as ZoneRegion; if (region != null) { int ret = 0; foreach (AbstractSpawnTrigger spawn in region.GetSpawnTriggers()) { ret += spawn.LimitedAliveCount; } return ret; } } return 0; } } [DescAttribute("刷新点 - 是否已完成刷新", "区域 - 刷新点")] public class SpawnTriggerIsSpawnOver : BooleanValue { [DescAttribute("区域")] public FlagValue Region = new FlagValue.EditorRegion(); public override string ToString() { return string.Format("刷新点[{0}]是否已完成刷新", Region); } public override bool GetValue(IEditorValueAdapter api, EventArguments args) { EventTriggerAdapter evtapi = api as EventTriggerAdapter; if (evtapi != null) { ZoneRegion region = Region.GetValue(api, args) as ZoneRegion; if (region != null) { foreach (AbstractSpawnTrigger spawn in region.GetSpawnTriggers()) { if (!spawn.IsSpawnOver) { return false; } } return true; } } return false; } } }