equal
deleted
inserted
replaced
1 using System; |
1 using System; |
2 using System.Collections.Generic; |
2 using System.Collections.Generic; |
3 using System.Linq; |
3 using System.Linq; |
4 using System.Text; |
4 using System.Text; |
5 using FingersDance.Control.Player; |
5 using FingersDance.Control.Player; |
6 using FingersDance.Actions; |
|
7 |
6 |
8 namespace FingersDance.ActionFactory |
7 namespace FingersDance.ActionFactory |
9 { |
8 { |
10 public class ActionFactory |
9 public class ActionFactory |
11 { |
10 { |
12 private Dictionary<String, Type> actionDict = new Dictionary<string, Type>(); |
11 private static ActionGenerator _Factory; |
13 |
12 |
14 public ActionFactory() |
13 public ActionFactory() |
|
14 { } |
|
15 |
|
16 public ActionGenerator GetGenerator() |
15 { |
17 { |
16 actionDict.Add("ActionPlayMedia", typeof(FingersDance.Actions.ActionPlayMedia)); |
18 if (_Factory == null) |
17 actionDict.Add("ActionShowMessage", typeof(FingersDance.Actions.ActionShowMessage)); |
19 { |
18 actionDict.Add("ActionOpenMedia", typeof(FingersDance.Actions.ActionOpenMedia)); |
20 _Factory = new ActionGenerator(); |
19 actionDict.Add("ActionStopMedia", typeof(FingersDance.Actions.ActionStopMedia)); |
21 } |
20 } |
22 return _Factory; |
21 |
|
22 public ActionBase GetAction(string T, object Args) |
|
23 { |
|
24 return (ActionBase)Activator.CreateInstance(actionDict[T]); |
|
25 } |
23 } |
26 } |
24 } |
27 } |
25 } |