public DisplayerController(OsuListenerManager mamger)
        {
            var listenerManager = mamger;

            listenerManager.OnCount300Changed  += c => _n300 = c;
            listenerManager.OnCountGekiChanged += c => _ngeki = c;
            listenerManager.OnCountKatuChanged += c => _nkatu = c;
            listenerManager.OnCount100Changed  += c => _n100 = c;
            listenerManager.OnCount50Changed   += c => _n50 = c;
            listenerManager.OnCountMissChanged += c => _nmiss = c;
            listenerManager.OnScoreChanged     += s => _score = s;
            listenerManager.OnComboChanged     += (combo) =>
            {
                if (_status != OsuStatus.Playing)
                {
                    return;
                }
                if (combo <= ((_ppCalculator as OppaiPerformanceCalculator)?.Oppai.FullCombo ?? 20000))
                {
                    _combo    = combo;
                    _maxCombo = Math.Max(_maxCombo, _combo);
                }
            };

            listenerManager.OnModsChanged += (mods) =>
            {
                if (Setting.IgnoreTouchScreenDecrease)
                {
                    mods.Mod = (mods.Mod & ~ModsInfo.Mods.TouchDevice);
                }
                _curMods = mods;
                if (_status != OsuStatus.Playing)
                {
                    _ppCalculator.ClearCache();
                }
            };

            listenerManager.OnPlayModeChanged    += RtppOnPlayModeChanged;
            listenerManager.OnStatusChanged      += RtppOnStatusChanged;
            listenerManager.OnBeatmapChanged     += RtppOnBeatmapChanged;
            listenerManager.OnPlayingTimeChanged += RtppOnPlayingTimeChanged;
        }
Ejemplo n.º 2
0
        public object GetFcpp(double acc)
        {
            PerformanceCalculatorBase cal = GetCalculator();

            if (cal is null)
            {
                return(new ActionResult(null, 500, "The server could not get pp calculator."));
            }

            if (_beatmap is null)
            {
                return(new ActionResult(null, 500, "The server could not get beatmap."));
            }

            if (_reader is null ||
                _reader.OrtdpBeatmap.BeatmapID != _beatmap.BeatmapID)
            {
                cal.ClearCache();
                _reader = new BeatmapReader(_beatmap, (int)_mode);
            }

            if (_reader is null)
            {
                return(new ActionResult(null, 500, "The server could not create BeatmapReader."));
            }

            cal.AccuracyRound(acc, _reader.ObjectsCount, 0, out int n300, out int n100, out int n50);

            cal.Mods      = _mods;
            cal.Beatmap   = _reader;
            cal.Count50   = n50;
            cal.Count100  = n100;
            cal.Count300  = n300;
            cal.CountMiss = 0;

            var pptuple = cal.GetPerformance();

            return(new ActionResult(new
            {
                pp = pptuple.FullComboPP,
                aim_pp = pptuple.FullComboAimPP,
                speed_pp = pptuple.FullComboSpeedPP,
                acc_pp = pptuple.FullComboAccuracyPP,
            }));
        }
Ejemplo n.º 3
0
        public PPControl(OsuListenerManager mamger, int?id)
        {
            m_listener_manager = mamger;

            m_listener_manager.OnModsChanged      += (mods) => { m_cur_mods = mods; m_pp_calculator.ClearCache(); };
            m_listener_manager.OnCount300Changed  += c => m_n300 = c;
            m_listener_manager.OnCountGekiChanged += c => m_ngeki = c;
            m_listener_manager.OnCountKatuChanged += c => m_nkatu = c;
            m_listener_manager.OnCount100Changed  += c => m_n100 = c;
            m_listener_manager.OnCount50Changed   += c => m_n50 = c;
            m_listener_manager.OnCountMissChanged += c => m_nmiss = c;
            m_listener_manager.OnScoreChanged     += s => m_score = s;
            m_listener_manager.OnPlayModeChanged  += (last, mode) =>
            {
                switch (mode)
                {
                case OsuPlayMode.Osu:
                    m_pp_calculator = new StdPPCalculator(); break;

                case OsuPlayMode.Taiko:
                    m_pp_calculator = new TaikoPerformanceCalculator(); break;

                case OsuPlayMode.Mania:
                    m_pp_calculator = new ManiaPerformanceCalculator(); break;

                default:
                    Sync.Tools.IO.CurrentIO.WriteColor("[RealTimePPDisplayer]Unsupported Mode", ConsoleColor.Red);
                    m_pp_calculator = null; break;
                }
                m_mode = mode;
            };

            m_listener_manager.OnStatusChanged += (last, cur) =>
            {
                m_status = cur;
                if (cur == OsuStatus.Listening || cur == OsuStatus.Editing)//Clear Output
                {
                    m_combo     = 0;
                    m_max_combo = 0;
                    m_n100      = 0;
                    m_n50       = 0;
                    m_nmiss     = 0;
                    foreach (var p in m_displayers)
                    {
                        p.Value.Clear();
                    }
                }
            };

            m_listener_manager.OnComboChanged += (combo) =>
            {
                if (m_status != OsuStatus.Playing)
                {
                    return;
                }
                if (combo <= ((m_pp_calculator as OppaiPerformanceCalculator)?.Oppai.FullCombo ?? 20000))
                {
                    m_combo     = combo;
                    m_max_combo = Math.Max(m_max_combo, m_combo);
                }
            };

            m_listener_manager.OnBeatmapChanged     += RTPPOnBeatmapChanged;
            m_listener_manager.OnPlayingTimeChanged += RTPPOnPlayingTimeChanged;
        }