using System;
using System.Collections.Generic;
using System.Text;
using CommonLang.Property;
using CommonAI.Zone.ZoneEditor;
using CommonAI.Zone.Instance;
using CommonAI.Zone.Attributes;
using CommonAI.Zone.EventTrigger;

namespace CommonAI.Zone.ZoneEditor.EventTrigger
{


    [DescAttribute("触发器将执行", "触发器事件")]
    public class EventBeginInvoke : AbstractTrigger
    {
        [SceneEventIDAttribute]
        [DescAttribute("触发事件名字")]
        public string EventName;

        public override string ToString()
        {
            return string.Format("{0}将执行", EventName);
        }
        public override void Listen(EventTriggerAdapter api, EventArguments args)
        {
            EventTriggerAdapter trigger = api.Group.GetEditEvent(EventName);
            if (trigger != null)
            {
                //trigger.OnActionBegin += api.onEventActionBegin;
                api.listen_EventActionBegin(args, trigger);
            }
        }
    }
    [DescAttribute("触发器已执行", "触发器事件")]
    public class EventEndInvoke : AbstractTrigger
    {
        [SceneEventIDAttribute]
        [DescAttribute("触发事件名字")]
        public string EventName;

        public override string ToString()
        {
            return string.Format("{0}已执行", EventName);
        }
        public override void Listen(EventTriggerAdapter api, EventArguments args)
        {
            EventTriggerAdapter trigger = api.Group.GetEditEvent(EventName);
            if (trigger != null)
            {
                //trigger.OnActionEnd += api.onEventActionEnd;
                api.listen_EventActionEnd(args, trigger);
            }
        }
    }

	[DescAttribute("触发器被激活", "触发器事件")]
	public class EventActiveInvoke : AbstractTrigger
	{
		[SceneEventIDAttribute]
		[DescAttribute("触发事件名字")]
		public string EventName;

		public override string ToString()
		{
			return string.Format("{0}被激活", EventName);
		}
		public override void Listen(EventTriggerAdapter api, EventArguments args)
		{
			EventTriggerAdapter trigger = api.Group.GetEditEvent(EventName);
			if (trigger != null)
			{
				api.listen_EventActionActive(args, trigger);
			}
		}
	}

}