Пример #1
0
        private void load()
        {
            token = null;

            bool failed = false;

            var req = new CreateRoomScoreRequest(room.RoomID.Value ?? 0, playlistItemId);

            req.Success += r => token = r.ID;
            req.Failure += e =>
            {
                failed = true;

                Logger.Error(e, "Failed to retrieve a score submission token.");

                Schedule(() =>
                {
                    ValidForResume = false;
                    this.Exit();
                });
            };

            api.Queue(req);

            while (!failed && !token.HasValue)
            {
                Thread.Sleep(1000);
            }
        }
Пример #2
0
        private void load()
        {
            Token = null;

            bool failed = false;

            // Sanity checks to ensure that PlaylistsPlayer matches the settings for the current PlaylistItem
            if (Beatmap.Value.BeatmapInfo.OnlineBeatmapID != PlaylistItem.Beatmap.Value.OnlineBeatmapID)
            {
                throw new InvalidOperationException("Current Beatmap does not match PlaylistItem's Beatmap");
            }

            if (ruleset.Value.ID != PlaylistItem.Ruleset.Value.ID)
            {
                throw new InvalidOperationException("Current Ruleset does not match PlaylistItem's Ruleset");
            }

            if (!PlaylistItem.RequiredMods.All(m => Mods.Value.Any(m.Equals)))
            {
                throw new InvalidOperationException("Current Mods do not match PlaylistItem's RequiredMods");
            }

            var req = new CreateRoomScoreRequest(RoomId.Value ?? 0, PlaylistItem.ID, Game.VersionHash);

            req.Success += r => Token = r.ID;
            req.Failure += e =>
            {
                failed = true;

                if (string.IsNullOrEmpty(e.Message))
                {
                    Logger.Error(e, "Failed to retrieve a score submission token.");
                }
                else
                {
                    Logger.Log($"You are not able to submit a score: {e.Message}", level: LogLevel.Important);
                }

                Schedule(() =>
                {
                    ValidForResume = false;
                    this.Exit();
                });
            };

            api.Queue(req);

            while (!failed && !Token.HasValue)
            {
                Thread.Sleep(1000);
            }
        }
        private void load()
        {
            token = null;

            bool failed = false;

            // Sanity checks to ensure that TimeshiftPlayer matches the settings for the current PlaylistItem
            if (Beatmap.Value.BeatmapInfo.OnlineBeatmapID != playlistItem.Beatmap.Value.OnlineBeatmapID)
            {
                throw new InvalidOperationException("Current Beatmap does not match PlaylistItem's Beatmap");
            }

            if (ruleset.Value.ID != playlistItem.Ruleset.Value.ID)
            {
                throw new InvalidOperationException("Current Ruleset does not match PlaylistItem's Ruleset");
            }

            if (!playlistItem.RequiredMods.All(m => Mods.Value.Any(m.Equals)))
            {
                throw new InvalidOperationException("Current Mods do not match PlaylistItem's RequiredMods");
            }

            var req = new CreateRoomScoreRequest(roomId.Value ?? 0, playlistItem.ID, Game.VersionHash);

            req.Success += r => token = r.ID;
            req.Failure += e =>
            {
                failed = true;

                Logger.Error(e, "Failed to retrieve a score submission token.\n\nThis may happen if you are running an old or non-official release of osu! (ie. you are self-compiling).");

                Schedule(() =>
                {
                    ValidForResume = false;
                    this.Exit();
                });
            };

            api.Queue(req);

            while (!failed && !token.HasValue)
            {
                Thread.Sleep(1000);
            }
        }
Пример #4
0
        private void load()
        {
            token = null;

            bool failed = false;

            // Sanity checks to ensure that TimeshiftPlayer matches the settings for the current PlaylistItem
            if (Beatmap.Value.BeatmapInfo.OnlineBeatmapID != playlistItem.Beatmap.OnlineBeatmapID)
            {
                throw new InvalidOperationException("Current Beatmap does not match PlaylistItem's Beatmap");
            }

            if (ruleset.Value.ID != playlistItem.Ruleset.ID)
            {
                throw new InvalidOperationException("Current Ruleset does not match PlaylistItem's Ruleset");
            }

            if (!playlistItem.RequiredMods.All(m => selectedMods.Value.Contains(m)))
            {
                throw new InvalidOperationException("Current Mods do not match PlaylistItem's RequiredMods");
            }

            var req = new CreateRoomScoreRequest(roomId.Value ?? 0, playlistItem.ID);

            req.Success += r => token = r.ID;
            req.Failure += e =>
            {
                failed = true;

                Logger.Error(e, "Failed to retrieve a score submission token.");

                Schedule(() =>
                {
                    ValidForResume = false;
                    this.Exit();
                });
            };

            api.Queue(req);

            while (!failed && !token.HasValue)
            {
                Thread.Sleep(1000);
            }
        }
Пример #5
0
        private void load()
        {
            Token = null;

            bool failed = false;

            // Sanity checks to ensure that PlaylistsPlayer matches the settings for the current PlaylistItem
            if (Beatmap.Value.BeatmapInfo.OnlineBeatmapID != PlaylistItem.Beatmap.Value.OnlineBeatmapID)
            {
                throw new InvalidOperationException("Current Beatmap does not match PlaylistItem's Beatmap");
            }

            if (ruleset.Value.ID != PlaylistItem.Ruleset.Value.ID)
            {
                throw new InvalidOperationException("Current Ruleset does not match PlaylistItem's Ruleset");
            }

            if (!PlaylistItem.RequiredMods.All(m => Mods.Value.Any(m.Equals)))
            {
                throw new InvalidOperationException("Current Mods do not match PlaylistItem's RequiredMods");
            }

            var req = new CreateRoomScoreRequest(RoomId.Value ?? 0, PlaylistItem.ID, Game.VersionHash);

            req.Success += r => Token = r.ID;
            req.Failure += e =>
            {
                failed = true;

                Logger.Error(e, "無法獲取分數提交令牌.\n\n這可能是因爲你正在遊玩比較遠古或者非官方發行版osu! (比如自編譯版本).");

                Schedule(() =>
                {
                    ValidForResume = false;
                    this.Exit();
                });
            };

            api.Queue(req);

            while (!failed && !Token.HasValue)
            {
                Thread.Sleep(1000);
            }
        }