SharpLibEar/Event.cs
author StephaneLenclud
Wed, 27 Jul 2016 17:09:10 +0200
changeset 224 471cb4c8a09a
parent 210 83dd86e73448
child 229 7c631055b94b
permissions -rw-r--r--
Make sure action edit combo box for enums is long enough.
     1 //
     2 
     3 
     4 using System;
     5 using System.Collections.Generic;
     6 using System.Runtime.Serialization;
     7 
     8 namespace SharpLib.Ear
     9 {
    10     [DataContract]
    11     public abstract class MEvent
    12     {
    13         public string Name { get; protected set; }
    14         public string Description { get; protected set; }
    15 
    16         public abstract void Trigger();
    17     };
    18 
    19     [DataContract]
    20     public abstract class Event : MEvent
    21     {
    22         [DataMember]
    23         public List<Action> Actions = new List<Action>();
    24 
    25         protected Event()
    26         {
    27            
    28         }
    29 
    30         public override void Trigger()
    31         {
    32             Console.WriteLine("Event '" + Name + "' triggered.");
    33             foreach (Action action in Actions)
    34             {
    35                 action.Execute();
    36             }
    37         }
    38     }
    39 
    40 }