Exemplo n.º 1
0
        public override ICustomObject recreate(Dictionary <string, string> additionalSaveData, object replacement)
        {
            Vector2      offsetKey = new Vector2(Convert.ToInt32(additionalSaveData["offsetKeyX"]), Convert.ToInt32(additionalSaveData["offsetKeyY"]));
            string       GUID      = additionalSaveData["GUID"];
            TrashCanTile self      = Revitalize.ModCore.Serializer.DeserializeGUID <TrashCanTile>(additionalSaveData["GUID"]);

            if (ModCore.IsNullOrDefault <TrashCanTile>(self))
            {
                return(null);
            }
            try
            {
                if (!Revitalize.ModCore.ObjectGroups.ContainsKey(additionalSaveData["ParentGUID"]))
                {
                    MultiTiledObject obj = (MultiTiledObject)Revitalize.ModCore.Serializer.DeserializeGUID <MultiTiledObject>(additionalSaveData["ParentGUID"]);
                    self.containerObject = obj;
                    self.containerObject.removeComponent(offsetKey);
                    self.containerObject.addComponent(offsetKey, self);
                    Revitalize.ModCore.ObjectGroups.Add(additionalSaveData["ParentGUID"], obj);
                }
                else
                {
                    self.containerObject = Revitalize.ModCore.ObjectGroups[additionalSaveData["ParentGUID"]];
                    self.containerObject.removeComponent(offsetKey);
                    self.containerObject.addComponent(offsetKey, self);
                }
            }
            catch (Exception err)
            {
                ModCore.log(err);
            }

            return(self);
        }
Exemplo n.º 2
0
        public override Item getOne()
        {
            TrashCanTile component = new TrashCanTile(this.data, this.info.Copy());

            component.containerObject = this.containerObject;
            component.offsetKey       = this.offsetKey;
            return(component);
        }