1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/Server/Slions/Ear/Event.cs Fri Jul 22 18:19:49 2016 +0200
1.3 @@ -0,0 +1,42 @@
1.4 +//
1.5 +
1.6 +
1.7 +using System;
1.8 +using System.Collections.Generic;
1.9 +using System.Runtime.Serialization;
1.10 +
1.11 +namespace Slions.Ear
1.12 +{
1.13 + [DataContract]
1.14 + abstract class MEvent
1.15 + {
1.16 + [DataMember]
1.17 + public string Name { get; protected set; }
1.18 +
1.19 + [DataMember]
1.20 + public string Description { get; protected set; }
1.21 +
1.22 + public abstract void Trigger();
1.23 + };
1.24 +
1.25 + [DataContract]
1.26 + abstract class Event : MEvent
1.27 + {
1.28 + List<Action> iActions;
1.29 +
1.30 + protected Event()
1.31 + {
1.32 + iActions = new List<Action>();
1.33 + }
1.34 +
1.35 + public override void Trigger()
1.36 + {
1.37 + Console.WriteLine("Event '" + Name + "' triggered.");
1.38 + foreach (Action action in iActions)
1.39 + {
1.40 + action.Execute();
1.41 + }
1.42 + }
1.43 + }
1.44 +
1.45 +}
1.46 \ No newline at end of file