private PersistentObject _LoadPersistentObject(XmlElement PropertyElement) { PersistentObject Result = null; if (PropertyElement.InnerText.Trim().Length > 0) { var Identifier = _LoadObjectReference(PropertyElement); Result = _GameLoader.GetPersistentObject(Identifier); if (Result == null) { var ObjectElement = _GameLoader.GetObjectElement(Identifier); Result = Activator.CreateInstance(_AssertElementAndGetType(ObjectElement)) as PersistentObject; if (Result == null) { throw new FormatException(); } _GameLoader.AddPersistentObject(Identifier, Result); var LoadObjectStore = new LoadObjectStore(_GameLoader, ObjectElement); Result.Load(LoadObjectStore); } } return(Result); }
public void Load(Game Game) { try { var ButtonOfficeElement = _Document.DocumentElement; if (ButtonOfficeElement == null) { throw new FormatException(); } if (ButtonOfficeElement.Attributes["version"] == null) { throw new FormatException(); } if (ButtonOfficeElement.Attributes["version"].Value != Data.SaveGameFileVersion) { throw new FormatException($"The save game file version is \"{ButtonOfficeElement.Attributes["version"].Value}\" but should be \"{Data.SaveGameFileVersion}\"."); } var GameElement = ButtonOfficeElement.SelectSingleNode($"//button-office/object[@type='{typeof(Game).AssemblyQualifiedName}']") as XmlElement; var ObjectStore = new LoadObjectStore(this, GameElement); Game.Load(ObjectStore); } catch (FormatException Exception) { throw new GameLoadException(Exception); } }
public override void Load(LoadObjectStore ObjectStore) { // read these at first, so we can initialize the free space and minimum/maximum per floor _HighestFloor = ObjectStore.LoadInt32Property("highest-floor"); _LeftBorder = ObjectStore.LoadInt32Property("left-border"); _LowestFloor = ObjectStore.LoadInt32Property("lowest-floor"); _RightBorder = ObjectStore.LoadInt32Property("right-border"); _InitializeFreeSpaceAndMinimumMaximum(); foreach (var BrokenThing in ObjectStore.LoadObjects("broken-things")) { _BrokenThings.Add(BrokenThing); } foreach (var Building in ObjectStore.LoadBuildings("buildings")) { _AddBuilding(Building); } _CatStock = ObjectStore.LoadUInt32Property("cat-stock"); _Cents = ObjectStore.LoadUInt64Property("cents"); _Minutes = ObjectStore.LoadDoubleProperty("minutes"); _NextCatAtNumberOfEmployees = ObjectStore.LoadUInt32Property("next-cat-at-number-of-employees"); foreach (var Person in ObjectStore.LoadPersons("persons")) { _AddPerson(Person); } }
public Object LoadProperty(String PropertyName) { var PropertyElement = _GetPropertyElement(_Element, PropertyName); var Result = Activator.CreateInstance(_AssertElementAndGetType(PropertyElement)); if (Result is IPersistable) { var ObjectStore = new LoadObjectStore(_GameLoader, PropertyElement); (Result as IPersistable).Load(ObjectStore); } else if (Result is ObjectReference) { var Identifier = _LoadObjectReference(PropertyElement); Result = _GameLoader.GetPersistentObject(Identifier); if (Result == null) { var ObjectElement = _GameLoader.GetObjectElement(Identifier); Result = Activator.CreateInstance(_AssertElementAndGetType(ObjectElement)); if (Result == null) { throw new FormatException(); } _GameLoader.AddPersistentObject(Identifier, Result as PersistentObject); var ObjectStore = new LoadObjectStore(_GameLoader, ObjectElement); (Result as PersistentObject).Load(ObjectStore); } } return(Result); }
public override void Load(LoadObjectStore ObjectStore) { base.Load(ObjectStore); foreach (var Desk in ObjectStore.LoadDesks("cleaning-targets")) { _CleaningTargets.Enqueue(Desk); } }
public override void Load(LoadObjectStore ObjectStore) { base.Load(ObjectStore); _Computer = ObjectStore.LoadComputerProperty("computer"); _Janitor = ObjectStore.LoadJanitorProperty("janitor"); _Office = ObjectStore.LoadOfficeProperty("office"); _Person = ObjectStore.LoadPersonProperty("person"); _Rectangle = ObjectStore.LoadRectangleProperty("rectangle"); _TrashLevel = ObjectStore.LoadDoubleProperty("trash-level"); }
public override void Load(LoadObjectStore ObjectStore) { base.Load(ObjectStore); _Bottom = ObjectStore.LoadDoubleProperty("bottom"); _Height = ObjectStore.LoadDoubleProperty("height"); _Left = ObjectStore.LoadDoubleProperty("left"); _MinutesUntilBroken = ObjectStore.LoadDoubleProperty("minutes-until-broken"); _Office = ObjectStore.LoadOfficeProperty("office"); _Width = ObjectStore.LoadDoubleProperty("width"); }
public override void Load(LoadObjectStore ObjectStore) { base.Load(ObjectStore); _BackgroundColor = ObjectStore.LoadColorProperty("background-color"); _BorderColor = ObjectStore.LoadColorProperty("border-color"); _Floor = ObjectStore.LoadDoubleProperty("floor"); _Height = ObjectStore.LoadDoubleProperty("height"); _Left = ObjectStore.LoadDoubleProperty("left"); _Width = ObjectStore.LoadDoubleProperty("width"); }
public override void Load(LoadObjectStore ObjectStore) { base.Load(ObjectStore); _BackgroundColor = ObjectStore.LoadColorProperty("background-color"); _BorderColor = ObjectStore.LoadColorProperty("border-color"); _Height = ObjectStore.LoadDoubleProperty("height"); _Office = ObjectStore.LoadOfficeProperty("office"); _Width = ObjectStore.LoadDoubleProperty("width"); _X = ObjectStore.LoadDoubleProperty("x"); _Y = ObjectStore.LoadDoubleProperty("y"); }
public override void Load(LoadObjectStore ObjectStore) { base.Load(ObjectStore); Cat = ObjectStore.LoadCatProperty("cat"); FirstDesk = ObjectStore.LoadDeskProperty("first-desk"); FirstLamp = ObjectStore.LoadLampProperty("first-lamp"); FourthDesk = ObjectStore.LoadDeskProperty("fourth-desk"); SecondDesk = ObjectStore.LoadDeskProperty("second-desk"); SecondLamp = ObjectStore.LoadLampProperty("second-lamp"); ThirdDesk = ObjectStore.LoadDeskProperty("third-desk"); ThirdLamp = ObjectStore.LoadLampProperty("third-lamp"); }
public override void Load(LoadObjectStore ObjectStore) { base.Load(ObjectStore); _ActionFraction = ObjectStore.LoadDoubleProperty("action-fraction"); _AnimationFraction = ObjectStore.LoadDoubleProperty("animation-fraction"); _AnimationState = ObjectStore.LoadAnimationStateProperty("animation-state"); _ArrivesAtMinute = ObjectStore.LoadUInt64Property("arrives-at-minute"); _ArrivesAtMinuteOfDay = ObjectStore.LoadUInt64Property("arrives-at-minute-of-day"); _AtDesk = ObjectStore.LoadBooleanProperty("at-desk"); _BackgroundColor = ObjectStore.LoadColorProperty("background-color"); _BorderColor = ObjectStore.LoadColorProperty("border-color"); _Desk = ObjectStore.LoadDeskProperty("desk"); _Height = ObjectStore.LoadDoubleProperty("height"); _LeavesAtMinute = ObjectStore.LoadUInt64Property("leaves-at-minute"); _LivingSide = ObjectStore.LoadLivingSideProperty("living-side"); _Name = ObjectStore.LoadStringProperty("name"); _Wage = ObjectStore.LoadUInt64Property("wage"); _Width = ObjectStore.LoadDoubleProperty("width"); _WorkMinutes = ObjectStore.LoadUInt64Property("work-minutes"); _X = ObjectStore.LoadDoubleProperty("x"); _Y = ObjectStore.LoadDoubleProperty("y"); }
public void Load(LoadObjectStore ObjectStore) { X = ObjectStore.LoadDoubleProperty("x"); X = ObjectStore.LoadDoubleProperty("y"); }
public override void Load(LoadObjectStore ObjectStore) { base.Load(ObjectStore); _BonusPromille = ObjectStore.LoadUInt64Property("bonus-promille"); }
public override void Load(LoadObjectStore ObjectStore) { base.Load(ObjectStore); _RepairingTarget = ObjectStore.LoadObjectProperty("repairing-target"); }
public override void Load(LoadObjectStore ObjectStore) { base.Load(ObjectStore); _MinutesUntilBroken = ObjectStore.LoadDoubleProperty("minutes-until-broken"); _Rectangle = ObjectStore.LoadRectangleProperty("rectangle"); }