Exemplo n.º 1
0
        private void playButton_Click(object sender, EventArgs e)
        {
            if (songListView.SelectedItems.Count > 0 && difficultyDropdown.SelectedIndex >= 0)
            {
                var playerSettings = new PlayerSpecificSettings();
                playerSettings.leftHanded     = mirrorCheckbox.Checked;
                playerSettings.staticLights   = staticLightsCheckbox.Checked;
                playerSettings.noTextsAndHuds = noHudCheckbox.Checked;
                playerSettings.advancedHud    = advancedHudCheckbox.Checked;
                playerSettings.reduceDebris   = reduceDebrisCheckbox.Checked;

                var modifiers = new GameplayModifiers();
                modifiers.noFail           = noFailCheckbox.Checked;
                modifiers.noBombs          = noBombsCheckbox.Checked;
                modifiers.noObstacles      = noWallsCheckbox.Checked;
                modifiers.instaFail        = instaFailCheckbox.Checked && !modifiers.noFail;
                modifiers.failOnSaberClash = failOnClashCheckbox.Checked;
                modifiers.batteryEnergy    = batteryEnergyCheckbox.Checked && !modifiers.noFail && !modifiers.instaFail;
                modifiers.fastNotes        = fastNotesCheckbox.Checked;
                modifiers.songSpeed        = fastSongCheckbox.Checked ?
                                             GameplayModifiers.SongSpeed.Faster :
                                             slowSongCheckbox.Checked ?
                                             GameplayModifiers.SongSpeed.Slower :
                                             GameplayModifiers.SongSpeed.Normal;
                modifiers.disappearingArrows = disappearingArrowsCheckbox.Checked && !ghostNotesCheckbox.Checked;
                modifiers.ghostNotes         = ghostNotesCheckbox.Checked;

                var characteristic = currentSelection.beatmapCharacteristics.First(x => x.serializedName == characteristicDropdown.SelectedItem as string);
                SaberUtilities.PlaySong(currentSelection, characteristic, (BeatmapDifficulty)difficultyDropdown.SelectedItem, modifiers, playerSettings);
            }
        }
Exemplo n.º 2
0
        private void Client_PacketRecieved(Packet packet)
        {
            if (packet.Type == PacketType.PlaySong)
            {
                PlaySong playSong = packet.SpecificPacket as PlaySong;

                var desiredLevel          = Plugin.masterLevelList.First(x => x.levelID == playSong.levelId);
                var desiredCharacteristic = desiredLevel.previewDifficultyBeatmapSets.GetBeatmapCharacteristics().First(x => x.serializedName == playSong.characteristic.SerializedName);
                var desiredDifficulty     = (BeatmapDifficulty)playSong.difficulty;


                SaberUtilities.PlaySong(desiredLevel, desiredCharacteristic, desiredDifficulty, playSong);
            }
            else if (packet.Type == PacketType.LoadSong)
            {
                LoadSong loadSong = packet.SpecificPacket as LoadSong;

                Action <IBeatmapLevel> SongLoaded = (loadedLevel) =>
                {
                    var loadedSong   = new LoadedSong();
                    var beatmapLevel = new PreviewBeatmapLevel();
                    beatmapLevel.Characteristics = loadedLevel.beatmapLevelData.difficultyBeatmapSets.ToList().Select(x => {
                        var characteristic            = new Characteristic();
                        characteristic.SerializedName = x.beatmapCharacteristic.serializedName;
                        characteristic.difficulties   =
                            loadedLevel.beatmapLevelData.difficultyBeatmapSets
                            .First(y => y.beatmapCharacteristic.serializedName == x.beatmapCharacteristic.serializedName)
                            .difficultyBeatmaps.Select(y => (Characteristic.BeatmapDifficulty)y.difficulty).ToArray();

                        return(characteristic);
                    }).ToArray();

                    beatmapLevel.LevelId = loadedLevel.levelID;
                    beatmapLevel.Name    = loadedLevel.songName;
                    beatmapLevel.Loaded  = true;

                    loadedSong.level = beatmapLevel;

                    client.Send(new Packet(loadedSong).ToBytes());
                };

                LoadSong(loadSong.levelId, SongLoaded);
            }
            else if (packet.Type == PacketType.Command)
            {
                Command command = packet.SpecificPacket as Command;
                if (command.commandType == Command.CommandType.ReturnToMenu)
                {
                    SaberUtilities.ReturnToMenu();
                }
            }
        }
Exemplo n.º 3
0
        private void Client_PacketRecieved(Packet packet)
        {
            if (packet.Type == PacketType.PlaySong)
            {
                PlaySong playSong = packet.SpecificPacket as PlaySong;

                var desiredLevel          = Plugin.masterLevelList.First(x => x.levelID == playSong.levelId);
                var desiredCharacteristic = desiredLevel.beatmapCharacteristics.First(x => x.serializedName == playSong.characteristic.SerializedName);
                var desiredDifficulty     = (BeatmapDifficulty)playSong.difficulty;

                var playerSpecificSettings = new PlayerSpecificSettings();
                playerSpecificSettings.advancedHud    = playSong.playerSettings.advancedHud;
                playerSpecificSettings.leftHanded     = playSong.playerSettings.leftHanded;
                playerSpecificSettings.noTextsAndHuds = playSong.playerSettings.noTextsAndHuds;
                playerSpecificSettings.reduceDebris   = playSong.playerSettings.reduceDebris;
                playerSpecificSettings.staticLights   = playSong.playerSettings.staticLights;

                var gameplayModifiers = new GameplayModifiers();
                gameplayModifiers.batteryEnergy      = playSong.gameplayModifiers.batteryEnergy;
                gameplayModifiers.disappearingArrows = playSong.gameplayModifiers.disappearingArrows;
                gameplayModifiers.failOnSaberClash   = playSong.gameplayModifiers.failOnSaberClash;
                gameplayModifiers.fastNotes          = playSong.gameplayModifiers.fastNotes;
                gameplayModifiers.ghostNotes         = playSong.gameplayModifiers.ghostNotes;
                gameplayModifiers.instaFail          = playSong.gameplayModifiers.instaFail;
                gameplayModifiers.noBombs            = playSong.gameplayModifiers.noBombs;
                gameplayModifiers.noFail             = playSong.gameplayModifiers.noFail;
                gameplayModifiers.noObstacles        = playSong.gameplayModifiers.noObstacles;
                gameplayModifiers.songSpeed          = (GameplayModifiers.SongSpeed)playSong.gameplayModifiers.songSpeed;

                SaberUtilities.PlaySong(desiredLevel, desiredCharacteristic, desiredDifficulty, gameplayModifiers, playerSpecificSettings);
            }
            else if (packet.Type == PacketType.LoadSong)
            {
                LoadSong loadSong = packet.SpecificPacket as LoadSong;

                Action <IBeatmapLevel> SongLoaded = (loadedLevel) =>
                {
                    var loadedSong   = new LoadedSong();
                    var beatmapLevel = new PreviewBeatmapLevel();
                    beatmapLevel.Characteristics = loadedLevel.beatmapCharacteristics.ToList().Select(x => {
                        var characteristic            = new Characteristic();
                        characteristic.SerializedName = x.serializedName;
                        characteristic.difficulties   =
                            loadedLevel.beatmapLevelData.difficultyBeatmapSets
                            .First(y => y.beatmapCharacteristic.serializedName == x.serializedName)
                            .difficultyBeatmaps.Select(y => (Characteristic.BeatmapDifficulty)y.difficulty).ToArray();

                        return(characteristic);
                    }).ToArray();

                    beatmapLevel.LevelId = loadedLevel.levelID;
                    beatmapLevel.Name    = loadedLevel.songName;
                    beatmapLevel.Loaded  = true;

                    loadedSong.level = beatmapLevel;

                    client.Send(new Packet(loadedSong).ToBytes());
                };

                LoadSong(loadSong.levelId, SongLoaded);
            }
            else if (packet.Type == PacketType.Command)
            {
                Command command = packet.SpecificPacket as Command;
                if (command.commandType == Command.CommandType.ReturnToMenu)
                {
                    SaberUtilities.ReturnToMenu();
                }
            }
        }