コード例 #1
0
ファイル: HitObjectSampleTest.cs プロジェクト: stanriders/osu
 public TestWorkingBeatmap(BeatmapInfo skinBeatmapInfo, IResourceStore <byte[]> resourceStore, IBeatmap beatmap, Storyboard storyboard, IFrameBasedClock referenceClock, IStorageResourceProvider resources)
     : base(beatmap, storyboard, referenceClock, resources.AudioManager)
 {
     this.skinBeatmapInfo = skinBeatmapInfo;
     this.resourceStore   = resourceStore;
     this.resources       = resources;
 }
コード例 #2
0
ファイル: Skin.cs プロジェクト: shadiwolf/e
        protected Skin(SkinInfo skin, IStorageResourceProvider resources)
        {
            SkinInfo = skin;

            // we may want to move this to some kind of async operation in the future.
            foreach (SkinnableTarget skinnableTarget in Enum.GetValues(typeof(SkinnableTarget)))
            {
                string filename = $"{skinnableTarget}.json";

                // skininfo files may be null for default skin.
                var fileInfo = SkinInfo.Files?.FirstOrDefault(f => f.Filename == filename);

                if (fileInfo == null)
                {
                    continue;
                }

                var bytes = resources?.Files.Get(fileInfo.FileInfo.StoragePath);

                if (bytes == null)
                {
                    continue;
                }

                string jsonContent         = Encoding.UTF8.GetString(bytes);
                var    deserializedContent = JsonConvert.DeserializeObject <IEnumerable <SkinnableInfo> >(jsonContent);

                if (deserializedContent == null)
                {
                    continue;
                }

                DrawableComponentInfo[skinnableTarget] = deserializedContent.ToArray();
            }
        }
コード例 #3
0
ファイル: Skin.cs プロジェクト: bdach/osu
        protected Skin(SkinInfo skin, IStorageResourceProvider resources, [CanBeNull] Stream configurationStream = null)
        {
            SkinInfo       = skin.ToLive();
            this.resources = resources;

            configurationStream ??= getConfigurationStream();

            if (configurationStream != null)
            {
                // stream will be closed after use by LineBufferedReader.
                ParseConfigurationStream(configurationStream);
            }
            else
            {
                Configuration = new SkinConfiguration();
            }

            // skininfo files may be null for default skin.
            SkinInfo.PerformRead(s =>
            {
                // we may want to move this to some kind of async operation in the future.
                foreach (SkinnableTarget skinnableTarget in Enum.GetValues(typeof(SkinnableTarget)))
                {
                    string filename = $"{skinnableTarget}.json";

                    // skininfo files may be null for default skin.
                    var fileInfo = s.Files.FirstOrDefault(f => f.Filename == filename);

                    if (fileInfo == null)
                    {
                        continue;
                    }

                    byte[] bytes = resources?.Files.Get(fileInfo.File.GetStoragePath());

                    if (bytes == null)
                    {
                        continue;
                    }

                    try
                    {
                        string jsonContent      = Encoding.UTF8.GetString(bytes);
                        var deserializedContent = JsonConvert.DeserializeObject <IEnumerable <SkinnableInfo> >(jsonContent);

                        if (deserializedContent == null)
                        {
                            continue;
                        }

                        DrawableComponentInfo[skinnableTarget] = deserializedContent.ToArray();
                    }
                    catch (Exception ex)
                    {
                        Logger.Error(ex, "Failed to load skin configuration.");
                    }
                }
            });
        }
コード例 #4
0
ファイル: SkinModelManager.cs プロジェクト: omkelderman/osu
        public SkinModelManager(Storage storage, RealmAccess realm, IStorageResourceProvider skinResources)
            : base(storage, realm)
        {
            this.skinResources = skinResources;

            // can be removed 20220420.
            populateMissingHashes();
        }
コード例 #5
0
ファイル: SkinModelManager.cs プロジェクト: roridev/osu
        public SkinModelManager(Storage storage, RealmContextFactory contextFactory, GameHost host, IStorageResourceProvider skinResources)
            : base(storage, contextFactory)
        {
            this.skinResources = skinResources;

            // can be removed 20220420.
            populateMissingHashes();
        }
コード例 #6
0
        public virtual Skin CreateInstance(IStorageResourceProvider resources)
        {
            var type = string.IsNullOrEmpty(InstantiationInfo)
                       // handle the case of skins imported before InstantiationInfo was added.
                ? typeof(LegacySkin)
                : Type.GetType(InstantiationInfo).AsNonNull();

            return((Skin)Activator.CreateInstance(type, this, resources));
        }
コード例 #7
0
ファイル: DefaultLegacySkin.cs プロジェクト: zi-jing/osu
        public DefaultLegacySkin(SkinInfo skin, IStorageResourceProvider resources)
            : base(skin, new NamespacedResourceStore <byte[]>(resources.Resources, "Skins/Legacy"), resources, string.Empty)
        {
            Configuration.CustomColours["SliderBall"] = new Color4(2, 170, 255, 255);
            Configuration.AddComboColours(
                new Color4(255, 192, 0, 255),
                new Color4(0, 202, 0, 255),
                new Color4(18, 124, 255, 255),
                new Color4(242, 24, 57, 255)
                );

            Configuration.LegacyVersion = 2.7m;
        }
コード例 #8
0
ファイル: DefaultLegacySkin.cs プロジェクト: zh010zh/osu
        public DefaultLegacySkin(IResourceStore <byte[]> storage, IStorageResourceProvider resources)
            : base(Info, storage, resources, string.Empty)
        {
            Configuration.CustomColours["SliderBall"] = new Color4(2, 170, 255, 255);
            Configuration.AddComboColours(
                new Color4(255, 192, 0, 255),
                new Color4(0, 202, 0, 255),
                new Color4(18, 124, 255, 255),
                new Color4(242, 24, 57, 255)
                );

            Configuration.LegacyVersion = 2.7m;
        }
コード例 #9
0
ファイル: DefaultLegacySkin.cs プロジェクト: omkelderman/osu
        public DefaultLegacySkin(SkinInfo skin, IStorageResourceProvider resources)
            : base(
                skin,
                resources,
                // In the case of the actual default legacy skin (ie. the fallback one, which a user hasn't applied any modifications to) we want to use the game provided resources.
                skin.Protected ? new NamespacedResourceStore <byte[]>(resources.Resources, "Skins/Legacy") : null
                )
        {
            Configuration.CustomColours["SliderBall"] = new Color4(2, 170, 255, 255);
            Configuration.CustomComboColours          = new List <Color4>
            {
                new Color4(255, 192, 0, 255),
                new Color4(0, 202, 0, 255),
                new Color4(18, 124, 255, 255),
                new Color4(242, 24, 57, 255)
            };

            Configuration.LegacyVersion = 2.7m;
        }
コード例 #10
0
        public DefaultLegacySkin(SkinInfo skin, IStorageResourceProvider resources)
            : base(
                skin,
                new NamespacedResourceStore <byte[]>(resources.Resources, "Skins/Legacy"),
                resources,
                // A default legacy skin may still have a skin.ini if it is modified by the user.
                // We must specify the stream directly as we are redirecting storage to the osu-resources location for other files.
                new LegacyDatabasedSkinResourceStore(skin, resources.Files).GetStream("skin.ini")
                )
        {
            Configuration.CustomColours["SliderBall"] = new Color4(2, 170, 255, 255);
            Configuration.CustomComboColours          = new List <Color4>
            {
                new Color4(255, 192, 0, 255),
                new Color4(0, 202, 0, 255),
                new Color4(18, 124, 255, 255),
                new Color4(242, 24, 57, 255)
            };

            Configuration.LegacyVersion = 2.7m;
        }
コード例 #11
0
 public DefaultSkin(SkinInfo skin, IStorageResourceProvider resources)
     : base(skin, resources)
 {
     this.resources = resources;
     Configuration  = new DefaultSkinConfiguration();
 }
コード例 #12
0
 public DefaultSkin(IStorageResourceProvider resources)
     : this(SkinInfo.Default, resources)
 {
 }
コード例 #13
0
 /// <summary>
 /// Construct a new legacy skin instance.
 /// </summary>
 /// <param name="skin">The model for this skin.</param>
 /// <param name="storage">A storage for looking up files within this skin using user-facing filenames.</param>
 /// <param name="resources">Access to raw game resources.</param>
 /// <param name="configurationFilename">The user-facing filename of the configuration file to be parsed. Can accept an .osu or skin.ini file.</param>
 protected LegacySkin(SkinInfo skin, [CanBeNull] IResourceStore <byte[]> storage, [CanBeNull] IStorageResourceProvider resources, string configurationFilename)
     : this(skin, storage, resources, storage?.GetStream(configurationFilename))
 {
 }
コード例 #14
0
        /// <summary>
        /// Construct a new legacy skin instance.
        /// </summary>
        /// <param name="skin">The model for this skin.</param>
        /// <param name="storage">A storage for looking up files within this skin using user-facing filenames.</param>
        /// <param name="resources">Access to raw game resources.</param>
        /// <param name="configurationStream">An optional stream containing the contents of a skin.ini file.</param>
        protected LegacySkin(SkinInfo skin, [CanBeNull] IResourceStore <byte[]> storage, [CanBeNull] IStorageResourceProvider resources, [CanBeNull] Stream configurationStream)
            : base(skin, resources, configurationStream)
        {
            if (storage != null)
            {
                var samples = resources?.AudioManager?.GetSampleStore(storage);
                if (samples != null)
                {
                    samples.PlaybackConcurrency = OsuGameBase.SAMPLE_CONCURRENCY;
                }

                Samples  = samples;
                Textures = new TextureStore(resources?.CreateTextureLoaderStore(storage));

                (storage as ResourceStore <byte[]>)?.AddExtension("ogg");
            }

            // todo: this shouldn't really be duplicated here (from ManiaLegacySkinTransformer). we need to come up with a better solution.
            hasKeyTexture = new Lazy <bool>(() => this.GetAnimation(
                                                lookupForMania <string>(new LegacyManiaSkinConfigurationLookup(4, LegacyManiaSkinConfigurationLookups.KeyImage, 0))?.Value ?? "mania-key1", true,
                                                true) != null);
        }
コード例 #15
0
 public LegacyBeatmapSkin(BeatmapInfo beatmap, IResourceStore <byte[]> storage, IStorageResourceProvider resources)
     : base(createSkinInfo(beatmap), new LegacySkinResourceStore <BeatmapSetFileInfo>(beatmap.BeatmapSet, storage), resources, beatmap.Path)
 {
     // Disallow default colours fallback on beatmap skins to allow using parent skin combo colours. (via SkinProvidingContainer)
     Configuration.AllowDefaultComboColoursFallback = false;
 }
コード例 #16
0
 public DefaultSkin(SkinInfo skin, IStorageResourceProvider resources)
     : base(skin, resources)
 {
     this.resources = resources;
 }
コード例 #17
0
 public DefaultSkin(IStorageResourceProvider resources)
     : this(CreateInfo(), resources)
 {
 }
コード例 #18
0
 public LegacySkin(SkinInfo skin, IStorageResourceProvider resources)
     : this(skin, new LegacySkinResourceStore <SkinFileInfo>(skin, resources.Files), resources, "skin.ini")
 {
 }
コード例 #19
0
 public TestSkin(string resourceName, IStorageResourceProvider resources)
     : base(DefaultLegacySkin.CreateInfo(), new TestResourceStore(resourceName), resources, "skin.ini")
 {
 }
コード例 #20
0
ファイル: SkinnableTestScene.cs プロジェクト: Azyyyyyy/osu
 public TestLegacySkin(SkinInfo skin, IResourceStore <byte[]> storage, IStorageResourceProvider resources, bool extrapolateAnimations)
     : base(skin, storage, resources, "skin.ini")
 {
     this.extrapolateAnimations = extrapolateAnimations;
 }
コード例 #21
0
 public LegacySkin(SkinInfo skin, IStorageResourceProvider resources)
     : this(skin, resources, null)
 {
 }
コード例 #22
0
 public DefaultLegacySkin(IStorageResourceProvider resources)
     : this(Info, resources)
 {
 }
コード例 #23
0
 public TestCustomSkinWorkingBeatmap(RulesetInfo ruleset, IStorageResourceProvider resources)
     : base(ruleset, null, resources.AudioManager)
 {
     this.resources = resources;
 }
コード例 #24
0
 public DefaultLegacySkin(IResourceStore <byte[]> storage, IStorageResourceProvider resources)
     : this(Info, storage, resources)
 {
 }