예제 #1
0
 public Func <DisplayerBase, string> ExecuteWrapper()
 {
     return(new Func <DisplayerBase, string>(x =>
     {
         ctx = x;
         return Execute(x);
     }));
 }
        public string Execute(DisplayerBase display)
        {
            var n100  = display.HitCount.Count100;
            var n50   = display.HitCount.Count50;
            var nmiss = display.HitCount.CountMiss;

            var cb = display.HitCount.Combo;

            if (cb < prev_combo)
            {
                break_time++;
            }

            prev_combo = cb;

            return($"{n100}x100 {n50}x50 {nmiss}xMoe {break_time}xBrk");
        }
예제 #3
0
        private void AddDisplayer(MultiOutputItem item)
        {
            var fmt = RealTimePPDisplayerPlugin.Instance.NewFormatter(item.formatter, item.format);
            var ctx = new DisplayerContext()
            {
                item      = item,
                displayer = null,
                fmtter    = fmt
            };

            DisplayerBase displayer = null;

            if (_displayer_creators.TryGetValue(item.type, out var creator))
            {
                displayer = creator(Id, item, ctx.fmtter);
            }

            ctx.displayer = displayer;

            _displayers.TryAdd(item.name, ctx);
        }
 /// <summary>
 /// Add a displayer to update list
 /// </summary>
 /// <param name="name"></param>
 /// <param name="displayer"></param>
 public void AddDisplayer(string name, DisplayerBase displayer)
 {
     _displayers[name] = displayer;
 }
 /// <summary>
 /// Add a displayer to update list
 /// </summary>
 /// <param name="name"></param>
 /// <param name="displayer"></param>
 public void AddDisplayer(string name, DisplayerBase displayer)
 {
     Displayers[name] = displayer;
     displayer.OnReady();
 }
예제 #6
0
        /*@@addition@@*/

        public string Execute(DisplayerBase display)
        {
            /*@@script@@*/
        }
예제 #7
0
        /// <summary>
        ///     通过OsuRTDataProvider.BeatmapInfo.Beatmap构造Beatmap对象。
        /// </summary>
        /// <param name="x"></param>
        public Beatmap(OsuRTDataProvider.BeatmapInfo.Beatmap x)
        {
            //bmap = x;

            var rt = new DisplayerBase();

            Title              = x.Title;
            BeatmapId          = x.BeatmapID;
            TitleUnicode       = x.TitleUnicode;
            Artist             = x.Artist;
            ArtistUnicode      = x.ArtistUnicode;
            Creator            = x.Creator;
            Difficulty         = x.Difficulty;
            Version            = x.Version;
            FileName           = x.Filename;
            FullPath           = x.FilenameFull;
            DownloadLink       = x.DownloadLink;
            BackgroundFileName = x.BackgroundFilename;
            BeatmapId          = x.BeatmapID;
            VideoFileName      = x.VideoFilename;
            Source             = "";
            Tags          = "";
            Maker         = "";
            AudioFileName = x.AudioFilename;
            _md5Calc.ComputeHash(File.ReadAllBytes(x.FilenameFull));
            Md5   = _md5Calc.GetMd5String();
            Stars = rt.BeatmapTuple.Stars;
            _b    = new StringBuilder(FullPath);
            _b.Replace(FileName, VideoFileName);
            FullVideoFileName = _b.ToString();
            _b = new StringBuilder(FullPath);
            _b.Replace(FileName, BackgroundFileName);
            FullBackgroundFileName = _b.ToString();
            var alllines = File.ReadAllLines(x.FilenameFull);

            if (!alllines[0].Contains("osu file format"))
            {
                NotValid = true;

                throw new InvalidBeatmapFileException($"文件{x.FilenameFull}不是谱面文件。");
            }

            StringBuilder b = new StringBuilder();

            foreach (var c in alllines[0])
            {
                if (char.IsDigit(c))
                {
                    b.Append(c);
                }
            }
            BeatmapVersion = int.Parse(b.ToString());
            foreach (var line in alllines)
            {
                var temparr = line.Split(':');
                if (temparr[0].Contains("CircleSize"))
                {
                    double.TryParse(temparr[1].Trim(), out var c);
                    CircleSize = c;
                    continue;
                }

                if (temparr[0].Contains("OverallDifficulty"))
                {
                    double.TryParse(temparr[1].Trim(), out var o);
                    OverallDifficulty = o;
                    continue;
                }

                if (temparr[0].Contains("ApproachRate"))
                {
                    double.TryParse(temparr[1].Trim(), out var a);
                    ApproachRate = a;
                    continue;
                }

                if (temparr[0].Contains("HPDrainRate"))
                {
                    double.TryParse(temparr[1].Trim(), out var h);
                    HpDrain = h;
                    continue;
                }

                if (temparr[0].Contains("Maker:"))
                {
                    Maker = line.Replace("Maker:", "").Trim();
                    continue;
                }

                if (temparr[0].Contains("Source:"))
                {
                    Source = line.Replace("Source:", "").Trim();
                    continue;
                }

                if (temparr[0].Contains("Tags:"))
                {
                    Tags = line.Replace("Tags:", "").Trim();
                    continue;
                }

                if (temparr[0].StartsWith("0,0,\""))
                {
                    if (string.IsNullOrEmpty(BackgroundFileName))
                    {
                        BackgroundFileName = temparr[0].Split(',')[2].Replace("\"", "").Trim();
                    }
                    FullBackgroundFileName = Path.Combine(BeatmapFolder, BackgroundFileName);
                    continue;
                }

                if (temparr[0].StartsWith("Video,"))
                {
                    if (!string.IsNullOrEmpty(VideoFileName))
                    {
                        VideoFileName     = temparr[0].Split(',')[2].Replace("\"", "").Trim();
                        FullVideoFileName = Path.Combine(BeatmapFolder, VideoFileName);
                        HasVideo          = true;
                    }
                    else
                    {
                        HasVideo = false;
                    }

                    continue;
                }

                if (temparr[0].Contains("Mode"))
                {
                    if (!_modeHasSet)
                    {
                        int.TryParse(temparr[1].Trim(), out _m);
                        Mode        = (OsuGameMode)_m;
                        _modeHasSet = true;
                    }

                    continue;
                }

                if (line.Contains("TimingPoints"))
                {
                    break;
                }
            }

            FullAudioFileName = x.FilenameFull.Replace(x.Filename, x.AudioFilename);
            FullVideoFileName = x.FilenameFull.Replace(x.Filename, x.VideoFilename);
            getAddtionalInfo(alllines);
        }