// Use this for initialization void Start() { ServicePointManager.ServerCertificateValidationCallback = MyRemoteCertificateValidationCallback; ImplicitGrantAuth(); context = _spotify.GetPlayback(); Debug.Log("Device Id: " + context.Device.Id); shuffleState = context.ShuffleState; repeatState = context.RepeatState; privateProfile = _spotify.GetPrivateProfile(); Debug.Log(privateProfile.Country); audioVisualizer = GameObject.Find("AudioVisualizer"); audioVisualizerScript = audioVisualizer.GetComponent <AudioVisualizer>(); featuredPlaylistTabScript = FeaturedPlaylistTab.GetComponent <FeaturedPlaylistTabScript>(); searchResultsScript = searchResultsTab.GetComponent <SearchResultsScript>(); currentSongScript = CurrentSongGameObject.GetComponent <CurrentSong>(); recordPlayerScript = recordPlayer.GetComponent <RecordPlayer>(); //Ignore collisions between character controller and vinyls Physics.IgnoreLayerCollision(8, 9); OnClicked += SendAudioAnaylisToParticleVisualizer; }
public SetPlayModeCommand(int playerId, RepeatState repeatState, ShuffleState shuffleState) : base($"player/set_play_mode?pid={playerId}&repeat={repeatState.ToCommandString()}&shuffle={shuffleState.ToString().ToLower()}") { PlayerId = playerId; RepeatState = repeatState; ShuffleState = shuffleState; }
/// <summary> /// Set the repeat state in Spotify. /// </summary> /// <param name="state">The repeat state to set to</param> public void SetRepeat(Repeat state) { RepeatState repeatState = SpotifyAPI.Web.Enums.RepeatState.Off; switch (state) { case Repeat.Disabled: repeatState = SpotifyAPI.Web.Enums.RepeatState.Off; break; case Repeat.Playlist: repeatState = SpotifyAPI.Web.Enums.RepeatState.Context; break; case Repeat.Track: repeatState = SpotifyAPI.Web.Enums.RepeatState.Track; break; } RepeatState = state; m_webAPI.SetRepeatMode(repeatState); OnRepeatChanged?.Invoke(RepeatState); Analysis.Log($"Set Repeat state to {state.ToString()}"); }
/// <inheritdoc /> public Task <WebResponse> SetRepeat(RepeatState state, string deviceId = null) { return(ApiClient.PutAsync <object>( BaseApi.MakeUri($"me/player/repeat?state={state.ToString().ToLower()}{BaseApi.AddDeviceId("&", deviceId)}"), null, this.Token)); }
/// <summary>Handles the currently playing context changed event.</summary> /// <param name="data">The data.</param> private void HandleCurrentlyPlayingContextChanged(CurrentlyPlayingContext data) { this.isReadingEvents = true; this.TrackName = data.Item?.Name; this.ArtistsNames = data.Item == null ? null : string.Join(", ", data.Item.Artists.Select(o => o.Name)); if (!this.ProgressHasFocus) { if (data.Item != null) { this.Progress = data.ProgressMs ?? 0; this.Duration = data.Item.DurationMs; } else { this.Progress = 0; this.Duration = 1; } } this.isPlaying = data.IsPlaying; this.PlayPauseGlyph = this.isPlaying ? PlayerPageViewModel.PauseGlyph : PlayerPageViewModel.PlayGlyph; this.isShuffleActive = data.ShuffleState; this.ShuffleOpacity = this.isShuffleActive ? 1.0 : 0.3; this.repeatState = string.IsNullOrEmpty(data.RepeatState) ? RepeatState.Off : Enum.Parse <RepeatState>(data.RepeatState, true); this.RepeatGlyph = this.repeatState == RepeatState.Track ? PlayerPageViewModel.RepeatOneGlyph : PlayerPageViewModel.RepeatAllGlyph; this.RepeatOpacity = this.repeatState == RepeatState.Off ? 0.3 : 1.0; this.isReadingEvents = false; }
/// <summary> /// Set the repeat mode for the user’s playback. Options are repeat-track, repeat-context, and off. /// </summary> /// <param name="repeatState">track, context or off.</param> /// <param name="deviceId">The id of the device this command is targeting. If not supplied, the user's currently active device is the target.</param> /// <returns></returns> public string SetRepeatMode(RepeatState repeatState, string deviceId = "") { if (string.IsNullOrEmpty(deviceId)) { return($"{APIBase}/me/player/repeat?state={repeatState.GetStringAttribute()}"); } return($"{APIBase}/me/player/repeat?state={repeatState.GetStringAttribute()}&device_id={deviceId}"); }
public void SetRepeat(RepeatState repeat) { ErrorResponse er = WebAPI.SetRepeatMode(repeat); if (CorrectResponse(er)) { return; } }
public GameController() { prepare = new PrepareState(this, new GameController.Context(this)); playing = new PlayingState(this, new GameController.Context(this)); win = new WinState(this, new GameController.Context(this)); menu = new MenuState(this, new GameController.Context(this)); remember = new RememberState(this, new GameController.Context(this)); repeat = new RepeatState(this, new GameController.Context(this)); fail = new FailState(this, new GameController.Context(this)); }
public AppState(Client_User user) { player = new MediaPlayer(); player.Volume = 0.7; playTimer = new DispatcherTimer(); currentPlaylist = new Song_Playlist(); IsPlaying = false; repeat = RepeatState.NoRepeat; Current_Tab = null; this.user = user; playlists = new ObservableCollection <Song_Playlist>(user.Playlists); }
public void SetRepeatModeThread() { context = _spotify.GetPlayback(); repeatState = context.RepeatState; if (repeatState == RepeatState.Off) { ErrorResponse error = _spotify.SetRepeatMode(RepeatState.Context); if (error.Error != null) { Debug.Log(error.Error.Message); } else { repeatState = RepeatState.Context; Debug.Log("Repeat state is context"); } } else if (repeatState == RepeatState.Context) { ErrorResponse error = _spotify.SetRepeatMode(RepeatState.Track); if (error.HasError()) { Debug.Log(error.Error.Message); } else { repeatState = RepeatState.Track; Debug.Log("Repeat state is track"); } } else if (repeatState == RepeatState.Track) { ErrorResponse error = _spotify.SetRepeatMode(RepeatState.Off); if (error.HasError()) { Debug.Log(error.Error.Message); } else { repeatState = RepeatState.Off; Debug.Log("Repeat state is off"); } } // setRepeatRunning = false; }
public bool IsRepeat(InputType.Button button) { if (!IsEnable) { return(false); } bool ret = false; if (IsPress(button)) { switch (_repeatState) { case RepeatState.Stop: _repeatState = RepeatState.Start; _repeatWait = RepeatStartWait; ret = true; break; case RepeatState.Start: _repeatWait -= Time.deltaTime; if (_repeatWait < 0.0f) { _repeatState = RepeatState.Repeat; _repeatWait = RepeatingWait; ret = true; } break; case RepeatState.Repeat: _repeatWait -= Time.deltaTime; if (_repeatWait < 0.0f) { _repeatWait = RepeatingWait; ret = true; } break; default: break; } } else { _repeatState = RepeatState.Stop; } return(ret); }
public static string ToCommandString(this RepeatState repeatState) { switch (repeatState) { case RepeatState.OnAll: return("on_all"); case RepeatState.OnOne: return("on_one"); case RepeatState.Off: return("off"); default: throw new ArgumentOutOfRangeException(nameof(repeatState), repeatState, null); } }
public void SetRepeatMode() { if (repeatState == RepeatState.Off) { ErrorResponse error = _spotify.SetRepeatMode(RepeatState.Context); if (error.Error != null) { Debug.Log(error.Error.Message); } else { repeatState = RepeatState.Context; Debug.Log("Repeat state is context"); } } else if (repeatState == RepeatState.Context) { ErrorResponse error = _spotify.SetRepeatMode(RepeatState.Track); if (error.Error != null) { Debug.Log(error.Error.Message); } else { repeatState = RepeatState.Track; Debug.Log("Repeat state is track"); } } else if (repeatState == RepeatState.Track) { ErrorResponse error = _spotify.SetRepeatMode(RepeatState.Off); if (error.Error != null) { Debug.Log(error.Error.Message); } else { repeatState = RepeatState.Off; Debug.Log("Repeat state is off"); } } }
private bool RepeatTryParse(string value, out RepeatState repeat) { switch (value) { case null: repeat = RepeatState.Off; return(false); case "-1": PlaybackContext pc = parent.WebApi.GetPlayback(); RepeatState repeatState = pc.RepeatState; switch (repeatState) { case RepeatState.Track: repeat = RepeatState.Context; break; case RepeatState.Context: repeat = RepeatState.Off; break; case RepeatState.Off: repeat = RepeatState.Track; break; default: repeat = RepeatState.Off; return(false); } return(true); case "0": repeat = RepeatState.Off; return(true); default: return(Enum.TryParse(value, out repeat)); } }
void Start() { donePatrol = false; if (PatrolTargets.Length > 0) { targetIndex = 0; } agent = GetComponent <NavMeshAgent>(); //nextTarget = PatrolTargets[0]; SetNewDestination(); if (PatrolTargets.Length >= targetIndex + 1) { //targetIndex++; } if ((LoopState == RepeatState.Backtrack || LoopState == RepeatState.Looping) && PatrolTargets.Length <= 1) { LoopState = RepeatState.NoRepeat; } }
/// <inheritdoc /> public Task SetRepeat(RepeatState state, Device device = null) { throw new NotImplementedException(); }
/// <summary> /// Updates the current tween. /// </summary> /// <param name="time">Elapsed time in seconds.</param> public void Update(float time) { if (this.finished || !this.running) { return; } if (this.currentState != null) { if (this.currentState.Value.Update(this, time)) { this.currentState.Value.Leave(); if (this.currentState.Value is RepeatState) { RepeatState state = this.currentState.Value as RepeatState; if (state.Count == 0) { this.currentState = this.currentState.Next; } else { this.currentState = this.states.First; } } else { this.currentState = this.currentState.Next; } if (this.currentState == null) { this.finished = true; if (this.Finished != null) { this.Finished(this); } } else { this.currentState.Value.Enter(); if (this.currentState.Value is ActionState) { this.currentState = this.currentState.Next; if (this.currentState == null) { this.finished = true; if (this.Finished != null) { this.Finished(this); } } else { this.currentState.Value.Enter(); } } } } } }
/// <summary>Sets the playbacks repeat state.</summary> /// <param name="state">The next repeat state.</param> public void SetRepeat(RepeatState state) { this.api.Player.SetRepeat(state); }
public PlayerSetRepeatRequest(RepeatState state) { // GuardAgainst.ArgumentBeingNull(state, nameof(state)); StateParam = state; }
public PlayModeResponse(RepeatState repeatState, ShuffleState shuffleState) { RepeatState = repeatState; ShuffleState = shuffleState; }
internal override bool AddToPage(RPLWriter rplWriter, PageContext pageContext, double pageLeft, double pageTop, double pageRight, double pageBottom, RepeatState repeatState) { if (HitsCurrentPage(pageLeft, pageTop, pageRight, pageBottom)) { WriteStartItemToStream(rplWriter, pageContext); OmitBorderOnPageBreak(rplWriter, pageLeft, pageTop, pageRight, pageBottom); List <PageItem> list = null; if (m_children != null) { double pageLeft2 = Math.Max(0.0, pageLeft - base.ItemPageSizes.Left); double pageTop2 = Math.Max(0.0, pageTop - base.ItemPageSizes.Top); double pageRight2 = pageRight - base.ItemPageSizes.Left; double pageBottom2 = pageBottom - base.ItemPageSizes.Top; double num = 0.0; list = new List <PageItem>(); for (int i = 0; i < m_children.Length; i++) { PageItem pageItem = m_children[i]; if (pageItem == null) { continue; } if (pageItem.AddToPage(rplWriter, pageContext, pageLeft2, pageTop2, pageRight2, pageBottom2, repeatState)) { if (pageItem.ContentOnPage) { list.Add(pageItem); } if (pageItem.Release(pageBottom2, pageRight2)) { if (repeatState == RepeatState.None && (pageItem.ContentOnPage || !pageContext.ConsumeWhitespace || m_bottomPadding <= 0.0)) { m_children[i] = null; } } else { num = Math.Max(num, pageItem.OriginalRight); } } else { num = Math.Max(num, pageItem.OriginalRight); } } m_rightPadding = Math.Max(0.0, OriginalRight - num); } WriteEndItemToStream(rplWriter, list); return(true); } return(false); }
public override bool AddToPage(RPLWriter rplWriter, PageContext pageContext, double pageLeft, double pageTop, double pageRight, double pageBottom, RepeatState repeatState) { bool inSubReport = pageContext.Common.InSubReport; pageContext.Common.InSubReport = true; bool result = base.AddToPage(rplWriter, pageContext, pageLeft, pageTop, pageRight, pageBottom, repeatState); pageContext.Common.InSubReport = inSubReport; return(result); }