1.1 --- a/SharpLibEar/Object.cs Wed Aug 31 17:28:30 2016 +0200
1.2 +++ b/SharpLibEar/Object.cs Wed Aug 31 20:20:32 2016 +0200
1.3 @@ -19,6 +19,22 @@
1.4 {
1.5 private bool iConstructed = false;
1.6
1.7 + [DataMember]
1.8 + public List<Object> Objects = new List<Object>();
1.9 +
1.10 + /// <summary>
1.11 + /// </summary>
1.12 + [DataMember]
1.13 + [AttributeObjectProperty
1.14 + (
1.15 + Id = "Object.Name",
1.16 + Name = "Name",
1.17 + Description = "Given object name."
1.18 + )
1.19 + ]
1.20 + public string Name { get; set; } = "";
1.21 +
1.22 +
1.23 protected Object()
1.24 {
1.25 Construct();
1.26 @@ -29,11 +45,18 @@
1.27 /// </summary>
1.28 public void Construct()
1.29 {
1.30 + //Construct ourselves first
1.31 if (!iConstructed)
1.32 {
1.33 DoConstruct();
1.34 iConstructed = true;
1.35 }
1.36 +
1.37 + //Then construct our children
1.38 + foreach (Object o in Objects)
1.39 + {
1.40 + o.Construct();
1.41 + }
1.42 }
1.43
1.44 /// <summary>
1.45 @@ -41,10 +64,19 @@
1.46 /// </summary>
1.47 protected virtual void DoConstruct()
1.48 {
1.49 + //Make sure our name is not null
1.50 + if (Name == null)
1.51 + {
1.52 + Name = "";
1.53 + }
1.54
1.55 + // Makes sure our objects are not null
1.56 + if (Objects == null)
1.57 + {
1.58 + Objects = new List<Object>();
1.59 + }
1.60 }
1.61
1.62 -
1.63 public enum State
1.64 {
1.65 Rest=0,