Exemplo n.º 1
0
#pragma warning restore IDE0051 // 使用されていないプライベート メンバーを削除する
        public void EmitStatusUpdate(ChangedProperty changedProps, BeatSaberEvent e)
        {
            this.GameStatus.updateCause = e.GetDescription();
            if ((changedProps & ChangedProperty.Game) == ChangedProperty.Game)
            {
                this.UpdateGameJSON();
            }
            if ((changedProps & ChangedProperty.Beatmap) == ChangedProperty.Beatmap)
            {
                this.UpdateBeatmapJSON();
            }
            if ((changedProps & ChangedProperty.Performance) == ChangedProperty.Performance)
            {
                this.UpdatePerformanceJSON();
            }
            if ((changedProps & ChangedProperty.NoteCut) == ChangedProperty.NoteCut)
            {
                this.UpdateNoteCutJSON();
            }
            if ((changedProps & ChangedProperty.Mod) == ChangedProperty.Mod)
            {
                this.UpdateModJSON();
                this.UpdatePlayerSettingsJSON();
            }
            if ((changedProps & ChangedProperty.BeatmapEvent) == ChangedProperty.BeatmapEvent)
            {
                this.UpdateBeatmapEventJSON();
            }
            this.EnqueueMessage(changedProps, e);
        }
Exemplo n.º 2
0
        private void EnqueueMessage(ChangedProperty changedProps, BeatSaberEvent e)
        {
            var eventJSON = this.JsonPool.Spawn();

            eventJSON["event"] = e.GetDescription();

            if ((changedProps & ChangedProperty.AllButNoteCut) == ChangedProperty.AllButNoteCut)
            {
                eventJSON["status"] = this.StatusJSON;
            }
            else
            {
                var status = new JSONObject();

                if ((changedProps & ChangedProperty.Game) == ChangedProperty.Game)
                {
                    status["game"] = this.StatusJSON["game"];
                }
                if ((changedProps & ChangedProperty.Beatmap) == ChangedProperty.Beatmap)
                {
                    status["beatmap"] = this.StatusJSON["beatmap"];
                }
                if ((changedProps & ChangedProperty.Performance) == ChangedProperty.Performance)
                {
                    status["performance"] = this.StatusJSON["performance"];
                }
                if ((changedProps & ChangedProperty.Mod) == ChangedProperty.Mod)
                {
                    status["mod"]            = this.StatusJSON["mod"];
                    status["playerSettings"] = this.StatusJSON["playerSettings"];
                }
                eventJSON["status"] = status;
            }
            if ((changedProps & ChangedProperty.NoteCut) == ChangedProperty.NoteCut)
            {
                eventJSON["noteCut"] = this.NoteCutJSON;
            }
            if ((changedProps & ChangedProperty.BeatmapEvent) == ChangedProperty.BeatmapEvent)
            {
                eventJSON["beatmapEvent"] = this.BeatmapEventJSON;
            }
            if ((changedProps & ChangedProperty.Other) != 0)
            {
                eventJSON["other"] = this.OtherJSON;
            }
            this.JsonQueue.Enqueue(eventJSON);
        }