コード例 #1
0
        private void _Save(PersistentObject PersistentObject)
        {
            if (PersistentObject != null)
            {
                if (_Objects.ContainsKey(PersistentObject) == false)
                {
                    var Identifier = _Objects.Count.ToUInt32();

                    _Objects.Add(PersistentObject, new Pair <Boolean, ObjectReference>(false, new ObjectReference(Identifier)));
                }
                if (_Objects[PersistentObject].First == false)
                {
                    _Objects[PersistentObject].First = true;

                    var Element = _Document.CreateElement("object");

                    Element.Attributes.Append(_CreateAttribute("identifier", _GetIdentifier(PersistentObject).Identifier.ToString(_CultureInfo)));
                    Element.Attributes.Append(_CreateTypeAttribute(PersistentObject.GetType()));

                    var ObjectStore = new SaveObjectStore(this, Element);

                    PersistentObject.Save(ObjectStore);
                    Debug.Assert(_Document.DocumentElement != null);
                    _Document.DocumentElement.AppendChild(Element);
                }
            }
        }
コード例 #2
0
 public override void Save(SaveObjectStore ObjectStore)
 {
     base.Save(ObjectStore);
     ObjectStore.Save("computer", _Computer);
     ObjectStore.Save("janitor", _Janitor);
     ObjectStore.Save("office", _Office);
     ObjectStore.Save("person", _Person);
     ObjectStore.Save("rectangle", _Rectangle);
     ObjectStore.Save("trash-level", _TrashLevel);
 }
コード例 #3
0
 public override void Save(SaveObjectStore ObjectStore)
 {
     base.Save(ObjectStore);
     ObjectStore.Save("bottom", _Bottom);
     ObjectStore.Save("height", _Height);
     ObjectStore.Save("left", _Left);
     ObjectStore.Save("minutes-until-broken", _MinutesUntilBroken);
     ObjectStore.Save("office", _Office);
     ObjectStore.Save("width", _Width);
 }
コード例 #4
0
ファイル: Building.cs プロジェクト: punytroll/buttonoffice
 public override void Save(SaveObjectStore ObjectStore)
 {
     base.Save(ObjectStore);
     ObjectStore.Save("background-color", _BackgroundColor);
     ObjectStore.Save("border-color", _BorderColor);
     ObjectStore.Save("floor", _Floor);
     ObjectStore.Save("height", _Height);
     ObjectStore.Save("left", _Left);
     ObjectStore.Save("width", _Width);
 }
コード例 #5
0
 public override void Save(SaveObjectStore ObjectStore)
 {
     base.Save(ObjectStore);
     ObjectStore.Save("background-color", _BackgroundColor);
     ObjectStore.Save("border-color", _BorderColor);
     ObjectStore.Save("height", _Height);
     ObjectStore.Save("office", _Office);
     ObjectStore.Save("width", _Width);
     ObjectStore.Save("x", _X);
     ObjectStore.Save("y", _Y);
 }
コード例 #6
0
 public override void Save(SaveObjectStore ObjectStore)
 {
     base.Save(ObjectStore);
     ObjectStore.Save("cat", Cat);
     ObjectStore.Save("first-desk", FirstDesk);
     ObjectStore.Save("first-lamp", FirstLamp);
     ObjectStore.Save("fourth-desk", FourthDesk);
     ObjectStore.Save("second-desk", SecondDesk);
     ObjectStore.Save("second-lamp", SecondLamp);
     ObjectStore.Save("third-desk", ThirdDesk);
     ObjectStore.Save("third-lamp", ThirdLamp);
 }
コード例 #7
0
ファイル: Game.cs プロジェクト: punytroll/buttonoffice
 public override void Save(SaveObjectStore ObjectStore)
 {
     ObjectStore.Save("broken-things", _BrokenThings);
     ObjectStore.Save("buildings", _Buildings);
     ObjectStore.Save("cat-stock", _CatStock);
     ObjectStore.Save("cents", _Cents);
     ObjectStore.Save("highest-floor", _HighestFloor);
     ObjectStore.Save("left-border", _LeftBorder);
     ObjectStore.Save("lowest-floor", _LowestFloor);
     ObjectStore.Save("minutes", _Minutes);
     ObjectStore.Save("next-cat-at-number-of-employees", _NextCatAtNumberOfEmployees);
     ObjectStore.Save("persons", _Persons);
     ObjectStore.Save("right-border", _RightBorder);
 }
コード例 #8
0
        public void SaveContained(String PropertyName, Object Value)
        {
            if (Value is PersistentObject)
            {
                throw new Exception("Cannot store contained persistent objects.");
            }
            else if (Value is IPersistable)
            {
                var ChildElement = _GameSaver.CreateChildElement(_Element, PropertyName, Value.GetType());
                var ObjectStore  = new SaveObjectStore(_GameSaver, ChildElement);

                (Value as IPersistable).Save(ObjectStore);
            }
        }
コード例 #9
0
ファイル: Person.cs プロジェクト: punytroll/buttonoffice
 public override void Save(SaveObjectStore ObjectStore)
 {
     base.Save(ObjectStore);
     ObjectStore.Save("action-fraction", _ActionFraction);
     ObjectStore.Save("animation-fraction", _AnimationFraction);
     ObjectStore.Save("animation-state", _AnimationState);
     ObjectStore.Save("arrives-at-minute", _ArrivesAtMinute);
     ObjectStore.Save("arrives-at-minute-of-day", _ArrivesAtMinuteOfDay);
     ObjectStore.Save("at-desk", _AtDesk);
     ObjectStore.Save("background-color", _BackgroundColor);
     ObjectStore.Save("border-color", _BorderColor);
     ObjectStore.Save("desk", _Desk);
     ObjectStore.Save("height", _Height);
     ObjectStore.Save("leaves-at-minute", _LeavesAtMinute);
     ObjectStore.Save("living-side", _LivingSide);
     ObjectStore.Save("name", _Name);
     ObjectStore.Save("wage", _Wage);
     ObjectStore.Save("width", _Width);
     ObjectStore.Save("work-minutes", _WorkMinutes);
     ObjectStore.Save("x", _X);
     ObjectStore.Save("y", _Y);
 }
コード例 #10
0
ファイル: Vector2.cs プロジェクト: punytroll/buttonoffice
 public void Save(SaveObjectStore ObjectStore)
 {
     ObjectStore.Save("x", X);
     ObjectStore.Save("y", Y);
 }
コード例 #11
0
ファイル: Accountant.cs プロジェクト: punytroll/buttonoffice
 public override void Save(SaveObjectStore ObjectStore)
 {
     base.Save(ObjectStore);
     ObjectStore.Save("bonus-promille", _BonusPromille);
 }
コード例 #12
0
ファイル: ITTech.cs プロジェクト: punytroll/buttonoffice
 public override void Save(SaveObjectStore ObjectStore)
 {
     base.Save(ObjectStore);
     ObjectStore.Save("repairing-target", _RepairingTarget);
 }
コード例 #13
0
ファイル: Computer.cs プロジェクト: punytroll/buttonoffice
 public override void Save(SaveObjectStore ObjectStore)
 {
     ObjectStore.Save("minutes-until-broken", _MinutesUntilBroken);
     ObjectStore.Save("rectangle", _Rectangle);
 }
コード例 #14
0
ファイル: Janitor.cs プロジェクト: punytroll/buttonoffice
 public override void Save(SaveObjectStore ObjectStore)
 {
     base.Save(ObjectStore);
     ObjectStore.Save("cleaning-targets", _CleaningTargets);
 }