public void UpdatePlayButton() { if (Data.Steam.SteamAPI.GetConnectionState() != SteamAPI.ConnectionState.CONNECTED || (!_partyFlowCoordinator || !_partyFlowCoordinator.isActivated)) { return; } Button play = detailView.playButton; if (!SteamAPI.IsHost()) { play.SetButtonText("You need to be host"); play.interactable = false; } else if (!Controllers.PlayerController.Instance.AllPlayersInMenu()) { play.SetButtonText("Players still in song"); play.interactable = false; } else if (!songExists) { play.SetButtonText("Song not on BeatSaver"); play.interactable = false; } else { play.SetButtonText("Play"); play.interactable = true; } }
private void toggleButtons(bool val) { Button play = ReflectionUtil.GetPrivateField <Button>(detail, "_playButton"); Button practice = ReflectionUtil.GetPrivateField <Button>(detail, "_practiceButton"); if (Data.Steam.SteamAPI.GetConnectionState() != SteamAPI.ConnectionState.CONNECTED || (!_partyFlowCoordinator || !_partyFlowCoordinator.isActivated)) { play.gameObject.SetActive(true); play.gameObject.SetActiveRecursively(true); // something else in another plugin/base game is calling this and we need to forcibly override it practice.gameObject.SetActive(true); play.interactable = true; practice.interactable = true; mPlay.gameObject.SetActive(false); return; } if (play && play.gameObject) { play.gameObject.SetActive(val); play.gameObject.SetActiveRecursively(false); // something else in another plugin/base game is calling this and we need to forcibly override it play.interactable = false; } if (practice && practice.gameObject) { practice.gameObject.SetActive(val); practice.interactable = false; } if (mPlay && mPlay.gameObject) { mPlay.gameObject.SetActive(!val); } if (mPlay && !SteamAPI.IsHost()) { mPlay.SetButtonText("You need to be host"); mPlay.interactable = false; } }
public void didPressPlay(StandardLevelDetailViewController controller) { Logger.Debug("press play"); try { if (!SteamAPI.IsHost() || !Controllers.PlayerController.Instance.AllPlayersInMenu()) { return; } if (!_partyFlowCoordinator || !_partyFlowCoordinator.isActivated) { toggleButtons(true); return; } if (songExists) { toggleButtons(false); SteamAPI.RequestPlay(new GameplayModifiers(_gameplaySetupViewController.gameplayModifiers)); } } catch (Exception e) { Logger.Error(e); } }