Beispiel #1
0
 public void Load(byte[] _bytes)
 {
     if (this.LevelProperties != null)
     {
         MekaItem file = MekaItem.FromBytesEncrypted(_bytes);
         this.Properties = PropertySaver.Load(PropertyReflector.GetPropertyTypes(this.LevelProperties), file["Properties"].Children /*file.Contains("Info") ? file["Info"].Children : new List<MekaItem>()*/);
     }
 }
Beispiel #2
0
        public Region(RegionBase _base, Action <Level, T> _onlevelload = null, Action <Level, T> _onlevelenter = null, Action <Level, T> _onlevelexit = null, Action <Level, T> _onlevelupdate = null)
        {
            this._RegionBase = _base;

            if (_onlevelload != null)
            {
                this._RegionBase._OnLevelLoad = b => _onlevelload(b, (T)b._Properties);
            }
            if (_onlevelenter != null)
            {
                this._RegionBase._OnLevelEnter = b => _onlevelenter(b, (T)b._Properties);
            }
            if (_onlevelexit != null)
            {
                this._RegionBase._OnLevelExit = b => _onlevelexit(b, (T)b._Properties);
            }
            if (_onlevelupdate != null)
            {
                this._RegionBase._OnLevelUpdate = b => _onlevelupdate(b, (T)b._Properties);
            }

            this._RegionBase._LoadInfo = m => (T)PropertySaver.Load(typeof(T), m);
        }
Beispiel #3
0
 public void Apply(Entity _entity) => PropertyReflector.ApplyProperties(_entity, PropertySaver.Load(PropertyReflector.GetPropertyTypes <SavableAttribute>(_entity.GetType()), this.Properties));
Beispiel #4
0
 public SavedEntity(Bunch <FieldInfo> _fields, Entity _entity)
 {
     this.Identifier = _entity.Identifier;
     this.Properties = PropertySaver.Save(_fields.ToDictionary(item => item.Name, item => item.GetValue(_entity)));
 }
Beispiel #5
0
 public MekaItem Export() => new MekaItem("Properties", this.LevelProperties != null ? (PropertySaver.Save(this.IsInitialized ? this.PropertyEditor.GetProperties() : this.Properties)) : new List <MekaItem>());