Beispiel #1
0
        public SkinManager(Storage storage, DatabaseContextFactory contextFactory, GameHost host, IResourceStore <byte[]> resources, AudioManager audio)
        {
            this.audio     = audio;
            this.host      = host;
            this.resources = resources;

            skinStore = new SkinStore(contextFactory, storage);
            userFiles = new FileStore(contextFactory, storage).Store;

            skinModelManager = new SkinModelManager(storage, contextFactory, skinStore, host, this);

            DefaultLegacySkin = new DefaultLegacySkin(this);
            DefaultSkin       = new DefaultSkin(this);

            CurrentSkinInfo.ValueChanged += skin => CurrentSkin.Value = GetSkin(skin.NewValue);

            CurrentSkin.Value         = DefaultSkin;
            CurrentSkin.ValueChanged += skin =>
            {
                if (skin.NewValue.SkinInfo != CurrentSkinInfo.Value)
                {
                    throw new InvalidOperationException($"Setting {nameof(CurrentSkin)}'s value directly is not supported. Use {nameof(CurrentSkinInfo)} instead.");
                }

                SourceChanged?.Invoke();
            };
        }
Beispiel #2
0
        public SkinModelManager(Storage storage, DatabaseContextFactory contextFactory, SkinStore skinStore, GameHost host, IStorageResourceProvider skinResources)
            : base(storage, contextFactory, skinStore, host)
        {
            this.skinResources = skinResources;

            // can be removed 20220420.
            populateMissingHashes();
        }