// Context: All
 public override void Init(MyObjectBuilder_EntityBase objectBuilder)
 {
     me          = Entity as IMyProjector;
     NeedsUpdate = MyEntityUpdateEnum.BEFORE_NEXT_FRAME;
     if (Constants.IsServer)
     {
         if (me.Storage == null)
         {
             me.Storage = new MyModStorageComponent();
         }
         storage = me.Storage;
     }
 }
예제 #2
0
        public static ZoneDescription Load(IMyEntity ent)
        {
            MyModStorageComponentBase storage = GetStorage(ent);

            if (storage.ContainsKey(StorageGuid))
            {
                return(MyAPIGateway.Utilities.SerializeFromXML <ZoneDescription>(storage[StorageGuid]));
            }
            else
            {
                Tools.Log(MyLogSeverity.Info, $"No data saved for:{ent.EntityId}. Loading Defaults");
                return(GetDefaultSettings());
            }
        }
예제 #3
0
        public void Save(IMyEntity ent)
        {
            MyModStorageComponentBase storage = GetStorage(ent);

            if (storage.ContainsKey(StorageGuid))
            {
                storage[StorageGuid] = MyAPIGateway.Utilities.SerializeToXML(this);
            }
            else
            {
                Tools.Log(MyLogSeverity.Info, $"Saved new Data");
                storage.Add(new KeyValuePair <Guid, string>(StorageGuid, MyAPIGateway.Utilities.SerializeToXML(this)));
            }
        }