예제 #1
0
    void PrintConfirm()
    {
        OsuFile osu = ToGameValue.instance.FinalOsu;

        string modString = "";

        foreach (var m in Userpref.data.mods)
        {
            modString += ", " + PlayStat.ModString[(int)m];
        }
        if (modString == "")
        {
            modString = "null";
        }
        else
        {
            modString = modString.Substring(2);
        }

        string s = $"Mods: <color=yellow>{modString}</color>\n";

        s += $"<color=yellow>{osu.Title}</color> - <color=yellow>{osu.Artist}</color>\n";
        s += $"<color=yellow>{osu.Creator}</color>\'s <color=yellow>{osu.Version}</color>\n";
        s += "<size=20><b>ARE YOU READY?</b></size>";
        confirmPanel_Text.text = s;
        mod_AutoClick.transform.Find("Icon").GetComponent <Image>().enabled = Userpref.HasModStatic(PlayStat.Mods.AutoClick);
        mod_AutoMove.transform.Find("Icon").GetComponent <Image>().enabled  = Userpref.HasModStatic(PlayStat.Mods.AutoMove);
    }
예제 #2
0
        public static Beatmap UpdateFromOSharp(this Beatmap beatmap, OsuFile osuFile)
        {
            beatmap.Artist        = osuFile.Metadata.Artist;
            beatmap.ArtistUnicode = osuFile.Metadata.ArtistUnicode;
            beatmap.Title         = osuFile.Metadata.Title;
            beatmap.TitleUnicode  = osuFile.Metadata.TitleUnicode;
            beatmap.Creator       = osuFile.Metadata.Creator;
            beatmap.Version       = osuFile.Metadata.Version;
            //BeatmapFileName = osuFile.BeatmapFileName;
            //LastModifiedTime = osuFile.LastModifiedTime;
            //DiffSrNoneStandard = osuFile.DiffStarRatingStandard.ContainsKey(Mods.None)
            //    ? osuFile.DiffStarRatingStandard[Mods.None]
            //    : -1;
            //DiffSrNoneTaiko = osuFile.DiffStarRatingTaiko.ContainsKey(Mods.None)
            //    ? osuFile.DiffStarRatingTaiko[Mods.None]
            //    : -1;
            //DiffSrNoneCtB = osuFile.DiffStarRatingCtB.ContainsKey(Mods.None) ? osuFile.DiffStarRatingCtB[Mods.None] : -1;
            //DiffSrNoneMania = osuFile.DiffStarRatingMania.ContainsKey(Mods.None)
            //    ? osuFile.DiffStarRatingMania[Mods.None]
            //    : -1;
            beatmap.DrainTimeSeconds = (int)(osuFile.HitObjects.MaxTime -
                                             osuFile.HitObjects.MinTime -
                                             osuFile.Events.Breaks.Select(k => k.EndTime - k.StartTime).Sum());
            beatmap.TotalTime        = (int)osuFile.HitObjects.MaxTime;
            beatmap.AudioPreviewTime = osuFile.General.PreviewTime;
            beatmap.BeatmapId        = osuFile.Metadata.BeatmapId;
            beatmap.BeatmapSetId     = osuFile.Metadata.BeatmapSetId;
            beatmap.GameMode         = osuFile.General.Mode;
            beatmap.SongSource       = osuFile.Metadata.Source;
            beatmap.SongTags         = string.Join(" ", osuFile.Metadata.TagList);
            //FolderName = osuFile.FolderName;
            beatmap.AudioFileName = osuFile.General.AudioFilename;

            return(beatmap);
        }
예제 #3
0
        static void Main(string[] args)
        {
            Stopwatch sw = new Stopwatch();

            sw.Start();
            //OsuFileManager manager =
            //    new OsuFileManager(
            //        @"D:\Program Files (x86)\osu!\Songs\699819 nao - Towa naru Kizuna to Omoi no Kiseki (1)");
            //Console.WriteLine("Folder:" + sw.ElapsedMilliseconds);
            //sw.Reset();
            OsuFile file =
                new OsuFile(
                    @"D:\Program Files (x86)\osu!\Songs\hey\DJ NAGAI feat. aru - Benibotan (yf_bmp) [Another].osu");// manager.FileList.First(k => k.Metadata.Version == "yf's Insane");

            Console.WriteLine("Select:" + sw.ElapsedMilliseconds);
            sw.Reset();
            var g = file.GetInterval(3);

            Console.WriteLine("Get Interval:" + sw.ElapsedMilliseconds);
            sw.Reset(); foreach (var d in g)
            {
                Console.WriteLine(d.Value);
            }

            var ok  = file.GetTimingBars();
            var ok2 = file.GetTimingKiais();

            file.GenerateFile(file.FileName);
            Console.ReadLine();
        }
예제 #4
0
파일: Program.cs 프로젝트: vebin/Coosu
        static void Main(string[] args)
        {
            var o = OsuFile.ReadFromFileAsync(@"D:\ValveUnhandledExceptionFilter.txt").Result;

            var fileName = "op.avi";
            var fi       = new FileInfo(@"F:\项目\GitHub\CoosuLocal\folder \" + fileName);

            if (fi.Exists)
            {
                Console.WriteLine(fi.FullName);
            }

            var directDirName    = fi.DirectoryName;
            var dir              = fi.Directory;
            var dirFullName      = dir.FullName;
            var dirName          = dir.Name;
            var toStringResult   = dir.ToString();
            var pathWithCombine  = Path.Combine(dirFullName, fi.Name);
            var pathWithCombine2 = Path.Combine(toStringResult, fi.Name);

            Console.WriteLine(pathWithCombine);
            Console.WriteLine(pathWithCombine2);

            var sb = OsuFile.ReadFromFileAsync(
                @"D:\Games\osu!\Songs\EastNewSound - Gensoukyou Matsuribayashi (Aki)\EastNewSound - Gensoukyou Matsuribayashi (Aki) (yf_bmp) [test].osu").Result;

            foreach (var rawHitObject in sb.HitObjects.HitObjectList)
            {
                var ticks = rawHitObject.SliderInfo.Ticks;
                var slids = rawHitObject.SliderInfo.BallTrail;
            }
        }
        public static async Task AddToCollectionAsync(Collection col, IList <Beatmap> entries)
        {
            if (entries.Count <= 0)
            {
                return;
            }
            if (string.IsNullOrEmpty(col.ImagePath))
            {
                var first   = entries[0];
                var osuFile =
                    await OsuFile.ReadFromFileAsync(Path.Combine(Domain.OsuSongPath, first.FolderName,
                                                                 first.BeatmapFileName));

                if (osuFile.Events.BackgroundInfo != null)
                {
                    var imgPath = Path.Combine(Domain.OsuSongPath, first.FolderName,
                                               osuFile.Events.BackgroundInfo.Filename);
                    if (File.Exists(imgPath))
                    {
                        col.ImagePath = imgPath;
                        _appDbOperator.UpdateCollection(col);
                    }
                }
            }

            _appDbOperator.AddMapsToCollection(entries, col);
        }
예제 #6
0
        protected override List <HitsoundElement> FillHitsoundList(OsuFile osuFile, DirectoryInfo dirInfo)
        {
            List <HitsoundElement> hitsoundList = new List <HitsoundElement>();
            var sampleList = osuFile.Events.SampleInfo;

            if (sampleList == null)
            {
                return(hitsoundList);
            }
            foreach (var sampleData in sampleList)
            {
                var element = new HitsoundElement(
                    mapFolderName: dirInfo.FullName,
                    mapWaveFiles: new string[0],
                    gameMode: osuFile.General.Mode,
                    offset: sampleData.Offset,
                    track: -1,
                    lineSample: OSharp.Beatmap.Sections.Timing.TimingSamplesetType.None,
                    hitsound: OSharp.Beatmap.Sections.HitObject.HitsoundType.Normal,
                    sample: OSharp.Beatmap.Sections.HitObject.ObjectSamplesetType.Auto,
                    addition: OSharp.Beatmap.Sections.HitObject.ObjectSamplesetType.Auto,
                    customFile: sampleData.Filename,
                    volume: sampleData.Volume / 100f,
                    balance: 0,
                    forceTrack: 0,
                    fullHitsoundType: null
                    );

                hitsoundList.Add(element);
            }

            return(hitsoundList);
        }
예제 #7
0
    void GoConfirm(string osujson)
    {
        OsuFile osu = JsonUtility.FromJson <OsuFile>(osujson);

        ToGameValue.instance.FinalOsu = osu;
        PrintConfirm();
    }
예제 #8
0
        private async Task ScanPrivateFolderAsync(DirectoryInfo privateFolder)
        {
            var beatmaps = new List <Beatmap>();

            foreach (var fileInfo in privateFolder.EnumerateFiles(searchPattern: "*.osu", searchOption: SearchOption.TopDirectoryOnly))
            {
                if (_scanCts.IsCancellationRequested)
                {
                    return;
                }
                try
                {
                    var osuFile = await OsuFile.ReadFromFileAsync(@"\\?\" + fileInfo.FullName,
                                                                  options =>
                    {
                        options.IncludeSection("General", "Metadata", "TimingPoints", "Difficulty", "HitObjects", "Events");
                        options.IgnoreSample();
                        options.IgnoreStoryboard();
                    });

                    var beatmap = GetBeatmapObj(osuFile, fileInfo);
                    beatmaps.Add(beatmap);
                }
                catch (Exception ex)
                {
                    Console.WriteLine($"{ex.Message} ignored '{fileInfo.FullName}'");
                }
            }

            _beatmapDbOperator.AddNewMaps(beatmaps);
        }
        public static async Task AddToCollectionAsync(Collection col, IList <Beatmap> entries)
        {
            var appDbOperator = new AppDbOperator();

            if (entries == null || entries.Count <= 0)
            {
                return;
            }
            if (string.IsNullOrEmpty(col.ImagePath))
            {
                var first = entries[0];
                var dir   = first.InOwnFolder
                    ? Path.Combine(Domain.CustomSongPath, first.FolderName)
                    : Path.Combine(Domain.OsuSongPath, first.FolderName);
                var filePath = Path.Combine(dir, first.BeatmapFileName);
                var osuFile  = await OsuFile.ReadFromFileAsync(@"\\?\" + filePath, options =>
                {
                    options.IncludeSection("Events");
                    options.IgnoreSample();
                    options.IgnoreStoryboard();
                });

                if (osuFile.Events.BackgroundInfo != null)
                {
                    var imgPath = Path.Combine(dir, osuFile.Events.BackgroundInfo.Filename);
                    if (File.Exists(imgPath))
                    {
                        col.ImagePath = imgPath;
                        appDbOperator.UpdateCollection(col);
                    }
                }
            }

            appDbOperator.AddMapsToCollection(entries, col);
        }
예제 #10
0
        public void SetNewLyric(Lyric lyric, OsuFile osuFile)
        {
            StopWork();

            _lyricList = lyric?.LyricSentencs ?? new List <Sentence>();
            _lyricList.Insert(0,
                              new Sentence(osuFile.Metadata.GetUnicodeArtist() + " - " + osuFile.Metadata.GetUnicodeTitle(), 0));
        }
예제 #11
0
        public void SetNewLyric(Lyrics lyric, OsuFile osuFile)
        {
            StopWork();

            _lyricList = lyric?.LyricSentencs ?? new List <Sentence>();
            _lyricList.Insert(0,
                              new Sentence(osuFile.Metadata.ArtistMeta.ToUnicodeString() + " - " + osuFile.Metadata.TitleMeta.ToUnicodeString(), 0));
        }
예제 #12
0
        public HitsoundChannel(OsuMixPlayer player, OsuFile osuFile, string sourceFolder, AudioPlaybackEngine engine)
            : base(engine)
        {
            _player       = player;
            _osuFile      = osuFile;
            _sourceFolder = sourceFolder;

            Description = nameof(HitsoundChannel);
        }
예제 #13
0
 public void OnOsuSongSelected(OsuFile file)
 {
     selectedFileType     = 0;
     osuFile              = file;
     mapHash              = file.BeatmapID;
     mapVersion           = file.Version;
     mapName              = file.TitleUnicode;
     isSongSelectFinished = true;
 }
예제 #14
0
        public async Task LoadFromDirectoryAsync(string path)
        {
            DirectoryInfo di = new DirectoryInfo(path);

            FileInfo[] files = di.GetFiles("*.osu");
            foreach (var file in files)
            {
                FileList.Add(await OsuFile.ReadFromFileAsync(file.FullName));
            }
        }
예제 #15
0
        private async Task AddFileAsync(BeatmapDbOperator dbOperator, OsuFile osuFile, FileInfo fileInfo)
        {
            var beatmap = Data.EF.Model.Beatmap.ParseFromOSharp(osuFile);

            beatmap.BeatmapFileName  = fileInfo.Name;
            beatmap.LastModifiedTime = fileInfo.LastWriteTime;
            beatmap.FolderName       = fileInfo.Directory.Name;
            beatmap.InOwnFolder      = true;
            await dbOperator.AddNewMapAsync(beatmap);
        }
예제 #16
0
        private Beatmap GetBeatmapObj(OsuFile osuFile, FileInfo fileInfo)
        {
            var beatmap = Beatmap.ParseFromOSharp(osuFile);

            beatmap.BeatmapFileName  = fileInfo.Name;
            beatmap.LastModifiedTime = fileInfo.LastWriteTime;
            beatmap.FolderName       = fileInfo.Directory.Name;
            beatmap.InOwnFolder      = true;
            return(beatmap);
        }
예제 #17
0
        public SampleChannel(OsuFile osuFile, string sourceFolder, AudioPlaybackEngine engine,
                             ICollection <Subchannel> referencedChannels, FileCache cache = null)
            : base(engine, new MixSettings(), referencedChannels)
        {
            _cache        = cache;
            _osuFile      = osuFile;
            _sourceFolder = sourceFolder;

            Description = nameof(SampleChannel);
        }
예제 #18
0
        public void LoadStoryboard(string dir, OsuFile osu)
        {
            ClearLayer();

            List <Element> backEle = null;
            List <Element> foreEle = null;
            Stopwatch      sw      = new Stopwatch();

            Console.WriteLine(@"Parsing..");
            sw.Start();
            string osbFile = Path.Combine(dir, osu.OsbFileName);

            if (osu.Events.ElementGroup != null)
            {
                var osb = osu.Events.ElementGroup;

                sw.Restart();
                osb.Expand();
                Console.WriteLine($@"Osu's osb expanded done in {sw.ElapsedMilliseconds} ms");

                FillLayerList(ref backEle, ref foreEle, osb);
            }

            if (File.Exists(osbFile))
            {
                sw.Restart();
                var osb = ElementGroup.Parse(osbFile);
                Console.WriteLine($@"Parse osb done in {sw.ElapsedMilliseconds} ms");

                sw.Restart();
                osb.Expand();
                Console.WriteLine($@"Osb expanded done in {sw.ElapsedMilliseconds} ms");

                FillLayerList(ref backEle, ref foreEle, osb);
            }

            sw.Stop();
            Directory = dir;
            if (backEle == null && foreEle == null)
            {
                return;
            }
            StoryboardTiming.Reset();
            if (foreEle != null)
            {
                backEle?.AddRange(foreEle);
            }
            HwndRenderBase.AddLayers(new CustomLayer[]
            {
                new StoryboardLayer(HwndRenderBase.RenderTarget, backEle ?? foreEle, StoryboardTiming),
                new FpsLayer(HwndRenderBase.RenderTarget),
            });
            StoryboardTiming.Start();
        }
예제 #19
0
    ///<summary>
    /// 如果輸入的成績(trueScore)比原本高,便會覆蓋原資料
    ///</summary>
    static public void SetBestRecord(OsuFile osu, PlayStat playStat)
    {
        BestRecord best = LoadBestRecord(osu);

        if (playStat.trueScore > best.trueScore ||
            (playStat.trueScore == best.trueScore && playStat.mods.Length < best.usingMods.Length))
        {
            best.trueScore     = playStat.trueScore;
            best.usingMods     = playStat.mods;
            best.originalScore = playStat.score;
        }
    }
예제 #20
0
        public HitsoundChannel(OsuFile osuFile, string sourceFolder, AudioPlaybackEngine engine, FileCache cache = null)
            : base(engine, new MixSettings {
            ForceMode = true
        })
        {
            _cache = cache ?? new FileCache();

            _osuFile      = osuFile;
            _sourceFolder = sourceFolder;

            Description = nameof(HitsoundChannel);
        }
예제 #21
0
        public static async Task <bool> AddToCollectionAsync([NotNull] Collection col, IList <Beatmap> beatmaps)
        {
            var controller = Service.Get <ObservablePlayController>();

            await using var dbContext = new ApplicationDbContext();
            if (beatmaps == null || beatmaps.Count <= 0)
            {
                return(false);
            }
            if (string.IsNullOrEmpty(col.ImagePath))
            {
                var first    = beatmaps[0];
                var dir      = first.GetFolder(out var isFromDb, out var freePath);
                var filePath = isFromDb ? Path.Combine(dir, first.BeatmapFileName) : freePath;
                var osuFile  = await OsuFile.ReadFromFileAsync(filePath, options =>
                {
                    options.IncludeSection("Events");
                    options.IgnoreSample();
                    options.IgnoreStoryboard();
                });

                if (!osuFile.ReadSuccess)
                {
                    return(false);
                }
                if (osuFile.Events.BackgroundInfo != null)
                {
                    var imgPath = Path.Combine(dir, osuFile.Events.BackgroundInfo.Filename);
                    if (File.Exists(imgPath))
                    {
                        col.ImagePath = imgPath;
                        await dbContext.AddOrUpdateCollection(col);
                    }
                }
            }

            await dbContext.AddBeatmapsToCollection(beatmaps, col);

            if (col.IsDefault)
            {
                foreach (var beatmap in beatmaps)
                {
                    if (controller.PlayList.CurrentInfo.Beatmap.Equals(beatmap))
                    {
                        controller.PlayList.CurrentInfo.BeatmapDetail.Metadata.IsFavorite = true;
                        break;
                    }
                }
            }

            return(true);
        }
예제 #22
0
        private async Task ScanPrivateFolderAsync(DirectoryInfo privateFolder)
        {
            foreach (var fileInfo in privateFolder.EnumerateFiles(searchPattern: "*.osu", searchOption: SearchOption.TopDirectoryOnly))
            {
                if (_scanCts.IsCancellationRequested)
                {
                    return;
                }

                var osuFile = await OsuFile.ReadFromFileAsync(fileInfo.FullName);
                await AddFileAsync(osuFile, fileInfo);
            }
        }
예제 #23
0
        public static async Task <bool> AddToCollectionAsync([NotNull] Collection col, IList <Beatmap> entries)
        {
            var controller    = Service.Get <ObservablePlayController>();
            var appDbOperator = new AppDbOperator();

            if (entries == null || entries.Count <= 0)
            {
                return(false);
            }
            if (string.IsNullOrEmpty(col.ImagePath))
            {
                var first    = entries[0];
                var dir      = first.GetFolder(out var isFromDb, out var freePath);
                var filePath = isFromDb ? Path.Combine(dir, first.BeatmapFileName) : freePath;
                var osuFile  = await OsuFile.ReadFromFileAsync(filePath, options =>
                {
                    options.IncludeSection("Events");
                    options.IgnoreSample();
                    options.IgnoreStoryboard();
                });

                if (!osuFile.ReadSuccess)
                {
                    return(false);
                }
                if (osuFile.Events.BackgroundInfo != null)
                {
                    var imgPath = Path.Combine(dir, osuFile.Events.BackgroundInfo.Filename);
                    if (File.Exists(imgPath))
                    {
                        col.ImagePath = imgPath;
                        appDbOperator.UpdateCollection(col);
                    }
                }
            }

            appDbOperator.AddMapsToCollection(entries, col);
            foreach (var beatmap in entries)
            {
                if (!controller.PlayList.CurrentInfo.Beatmap.GetIdentity().Equals(beatmap.GetIdentity()) ||
                    !col.LockedBool)
                {
                    continue;
                }
                controller.PlayList.CurrentInfo.BeatmapDetail.Metadata.IsFavorite = false;
                break;
            }

            return(true);
        }
예제 #24
0
        private static async Task ExportOsu()
        {
            var path = "F:\\milkitic\\Songs\\" +
                       "1346316 Nekomata Master feat. Mimi Nyami - TWINKLING\\" +
                       "Nekomata Master feat. Mimi Nyami - TWINKLING (yf_bmp) [Another].osu";

            //var path = "E:\\Games\\osu!\\Songs\\3198 Rhapsody - Emerald Sword\\" +
            //           //"1376486 Risshuu feat. Choko - Take\\" +
            //           "Rhapsody - Emerald Sword (Reikin) [net].osu";

            var folder  = Path.GetDirectoryName(path);
            var osuFile = await OsuFile.ReadFromFileAsync(path);

            if (!osuFile.ReadSuccess)
            {
                throw osuFile.ReadException;
            }

            using var engine = new AudioPlaybackEngine();
            var mp3Path = Path.Combine(folder, osuFile?.General.AudioFilename ?? ".");

            var fileCache = new FileCache();

            await using var directChannel   = new DirectChannel(mp3Path, osuFile.General.AudioLeadIn, engine);
            await using var hitsoundChannel = new HitsoundChannel(osuFile, engine, fileCache)
                        {
                            ManualOffset = 50,
                        };
            await using var sampleChannel = new SampleChannel(osuFile, engine, new Subchannel[]
            {
                directChannel, hitsoundChannel
            }, fileCache)
                        {
                            ManualOffset = 50,
                        };

            var    exporter = new Mp3Exporter(new MultiElementsChannel[] { directChannel, hitsoundChannel, sampleChannel }, engine);
            string pre      = null;
            await exporter.ExportAsync("test.mp3", progress =>
            {
                var p = $"Progress: {progress:P0}";
                if (pre != p)
                {
                    Console.WriteLine(p);
                    pre = p;
                }
            });
        }
예제 #25
0
    void Start()
    {
        string path = Application.persistentDataPath;

        var dirs = Directory.GetDirectories(path);

        var rootFiles = Directory.GetFiles(path);

        foreach (var file in rootFiles)
        {
            if (file.Substring(file.Length - 4, 4).ToLower() == ".osz")
            {
                print(file);
                string name = Path.GetFileNameWithoutExtension(file);
                if (!System.Array.Exists(dirs, e => e == name))                    // New .osz
                {
                    var resultPath = Path.Combine(path, name);
                    Directory.CreateDirectory(resultPath);
                    Debug.Log(file + " => " + resultPath);
                    ExtractZipFile(file, resultPath);
                }
            }
        }

        dirs = Directory.GetDirectories(path);

        OsuFile osuFile = null;

        foreach (var dir in dirs)
        {
            print(dir);
            var files = Directory.GetFiles(dir);
            foreach (var file in files)
            {
                if (file.Substring(file.Length - 4, 4).ToLower() == ".osu")
                {
                    print(file);
                    var text = File.ReadAllText(file);
                    osuFile = new OsuFile(text, dir);

                    var go   = Instantiate(uiScrollItemProto, uiScrollTrans);
                    var item = go.GetComponent <SongItemUiController>();
                    item.Init(osuFile);
                }
            }
        }
    }
예제 #26
0
        private async Task ScanPrivateFolderAsync(DirectoryInfo privateFolder)
        {
            var beatmaps = new List <Beatmap>();

            foreach (var fileInfo in privateFolder.EnumerateFiles("*.osu", SearchOption.TopDirectoryOnly))
            {
                if (_scanCts.IsCancellationRequested)
                {
                    return;
                }
                try
                {
                    var osuFile = await OsuFile.ReadFromFileAsync(fileInfo.FullName,
                                                                  options =>
                    {
                        options.IncludeSection("General", "Metadata", "TimingPoints", "Difficulty", "HitObjects",
                                               "Events");
                        options.IgnoreSample();
                        options.IgnoreStoryboard();
                    });

                    if (!osuFile.ReadSuccess)
                    {
                        Logger.Warn(osuFile.ReadException, "Osu file format error, skipped {0}", fileInfo.FullName);
                        continue;
                    }

                    var beatmap = GetBeatmapObj(osuFile, fileInfo);
                    beatmaps.Add(beatmap);
                }
                catch (Exception ex)
                {
                    Logger.Error(ex, "Error during scanning file, ignored {0}", fileInfo.FullName);
                }
            }

            try
            {
                await using var dbContext = new ApplicationDbContext();
                await dbContext.AddNewBeatmaps(beatmaps);
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
                throw;
            }
        }
예제 #27
0
 public static void AddToCollection(Collection col, BeatmapEntry entry)
 {
     if (string.IsNullOrEmpty(col.ImagePath))
     {
         OsuFile osuFile =
             new OsuFile(Path.Combine(Domain.OsuSongPath, entry.FolderName, entry.BeatmapFileName));
         if (osuFile.Events.BackgroundInfo != null)
         {
             var imgPath = Path.Combine(Domain.OsuSongPath, entry.FolderName, osuFile.Events.BackgroundInfo.Filename);
             if (File.Exists(imgPath))
             {
                 col.ImagePath = imgPath;
                 DbOperator.UpdateCollection(col);
             }
         }
     }
     DbOperator.AddMapToCollection(entry, col);
 }
    public void Init(OsuFile osuFile)
    {
        this.osuFile = osuFile;

        uiLeftText.text = string.Format(
            "<size=12>{0}</size>\n<size=10>{1}</size>",
            osuFile.Version,
            osuFile.Source);
        uiMiddleText.text = string.Format(
            "<size=12>{0}</size>\n<size=8>{1}</size>",
            string.IsNullOrEmpty(osuFile.TitleUnicode) ? osuFile.Title : osuFile.TitleUnicode,
            string.IsNullOrEmpty(osuFile.ArtistUnicode) ? osuFile.Artist : osuFile.ArtistUnicode);
        uiRightText.text = string.Format(
            "<size=14>{0}</size>\n<size=12>{1}</size>",
            "--",
            "--");

        FetchProgress();
    }
    public void Init(OsuFile osuFile)
    {
        uiLeftText.text = string.Format(
            "<size=12>{0}</size>\n<size=10>{1}</size>",
            osuFile.Version,
            osuFile.Source);
        uiMiddleText.text = string.Format(
            "<size=12>{0}</size>\n<size=8>{1}</size>",
            osuFile.TitleUnicode,
            osuFile.ArtistUnicode);
        uiRightText.text = string.Format(
            "<size=14>{0}</size>\n<size=12>{1}</size>",
            "--",
            "--");

        if (GlobalStatic.IsLoggedIn)
        {
            StartCoroutine(InitHandler());
        }
    }
예제 #30
0
        public static async Task AddToCollectionAsync(Collection col, BeatmapEntry entry)
        {
            if (string.IsNullOrEmpty(col.ImagePath))
            {
                var osuFile =
                    await OsuFile.ReadFromFileAsync(Path.Combine(Domain.OsuSongPath, entry.FolderName,
                                                                 entry.BeatmapFileName));

                if (osuFile.Events.BackgroundInfo != null)
                {
                    var imgPath = Path.Combine(Domain.OsuSongPath, entry.FolderName, osuFile.Events.BackgroundInfo.Filename);
                    if (File.Exists(imgPath))
                    {
                        col.ImagePath = imgPath;
                        DbOperate.UpdateCollection(col);
                    }
                }
            }
            DbOperate.AddMapToCollection(entry, col);
        }