コード例 #1
0
ファイル: TestSceneTauPlayfield.cs プロジェクト: Altenhh/tau
        public TestSceneTauPlayfield()
        {
            TauBeatmap beatmap;

            AddStep("set beatmap", () =>
            {
                Beatmap.Value = CreateWorkingBeatmap(beatmap = new TauBeatmap());
                beatmap.ControlPointInfo.Add(0, new TimingControlPoint {
                    BeatLength = 1000
                });
                Beatmap.Value.Track.Start();
            });

            AddStep("Load playfield", () => SetContents(_ => new TauPlayfield(Beatmap.Value.BeatmapInfo.Difficulty)
            {
                Anchor           = Anchor.Centre,
                Origin           = Anchor.Centre,
                RelativeSizeAxes = Axes.Both,
                Size             = new Vector2(0.6f),
                FillAspectRatio  = 1,
                FillMode         = FillMode.Fit
            }));

            DllResourceStore dllResourceStore = new DllResourceStore(DynamicCompilationOriginal.GetType().Assembly);

            foreach (var resource in dllResourceStore.GetAvailableResources())
            {
                Console.WriteLine(resource);
            }
        }
コード例 #2
0
ファイル: SkinnableTestScene.cs プロジェクト: yansaan/osu
        private static Skin getSkinFromResources(SkinManager skins, string name)
        {
            using (var storage = new DllResourceStore("osu.Game.Rulesets.Osu.Tests.dll"))
            {
                var tempName = Path.GetTempFileName();

                File.Delete(tempName);
                Directory.CreateDirectory(tempName);

                var files = storage.GetAvailableResources().Where(f => f.StartsWith($"Resources/{name}"));

                foreach (var file in files)
                {
                    using (var stream = storage.GetStream(file))
                        using (var newFile = File.Create(Path.Combine(tempName, Path.GetFileName(file))))
                            stream.CopyTo(newFile);
                }

                return(skins.GetSkin(skins.Import(tempName).Result));
            }
        }