Пример #1
0
        public ModelComposition(AssetTypeDefinition definition, BasePieceModel modelLeft, BasePieceModel modelRight, GameObject additionalData)
        {
            AssetTypeDefinition       = definition;
            _modelLeft                = modelLeft;
            _modelRight               = modelRight;
            AdditionalInstanceHandler = new AdditionalInstanceHandler(additionalData);

            if (_modelLeft == null && _modelRight == null)
            {
                return;
            }

            if (_modelLeft != null)
            {
                _modelLeft.ModelComposition          = this;
                _modelLeft.AdditionalInstanceHandler = AdditionalInstanceHandler;
                _modelLeft.Init();

                _metaData = modelLeft.GetMetaData();
            }

            if (_modelRight != null)
            {
                _modelRight.ModelComposition          = this;
                _modelRight.AdditionalInstanceHandler = AdditionalInstanceHandler;
                _modelRight.Init();
            }
        }
 internal PreloadMetaData(AssetMetaPath assetMetaPath, ICustomListItem customListItem, AssetTypeDefinition assetTypeDefinition)
 {
     AssetMetaPath       = assetMetaPath;
     AssetTypeDefinition = assetTypeDefinition;
     ListName            = customListItem.ListName;
     ListAuthor          = customListItem.ListAuthor;
     _coverSprite        = customListItem.ListCover;
 }
Пример #3
0
        public async Task LoadFromFile(string path)
        {
            var fs        = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read);
            var formatter = new BinaryFormatter();
            var ser       = (SerializableMeta)formatter.Deserialize(fs);

            fs.Close();

            await UnityMainThreadTaskScheduler.Factory.StartNew(() =>
            {
                _name               = ser.Name;
                _author             = ser.Author;
                _coverData          = ser.CoverData;
                AssetTypeDefinition = ser.AssetTypeDefinition;

                LoadSprite();
            });
        }
Пример #4
0
 public T this[AssetTypeDefinition definition]
 {
     get => GetPiece(definition);