public void Add(ClipView clip) { Util.Parent(clip.gameObject, this.gameObject); ModifyClip(clip); clip.Play(); clips.Add(clip.gameObject.GetInstanceID(), clip); }
/// <summary> /// Plays the clip then destroys it. /// </summary> /// <param name="resourceLocation">The resource location.</param> /// <returns></returns> private IEnumerator PlayThenDestroy(string resourceLocation) { ClipView clip = ObjectPoolManager.Instance.Get <ClipView>(clipPrefab); clip.Clip = Sound[resourceLocation]; clip.Volume = SOUND_VOLUME; oneShotHolder.Add(clip); while (clip.IsPlaying) { yield return(null); } oneShotHolder.Stop(clip.GetInstanceID()); yield break; }
public void ClipViewChanged(object sender, NotifyCollectionChangedEventArgs e) { foreach (var it in ClipView.OfType<ClipViewModel>().Select((el, i) => new { Item = el, Index = i })) { if (it.Index < 10) { it.Item.IndexInClipView = it.Index; } else { it.Item.IndexInClipView = -1; } } }
/// <summary> /// Loops the music. /// </summary> /// <param name="resourceLocation">The resource location.</param> public void LoopMusic(string resourceLocation) { if (string.IsNullOrEmpty(resourceLocation)) { return; } string loc = MUSIC_PREFIX + resourceLocation; Util.Assert(Resources.Load <AudioClip>(loc) != null, "Music location does not exist!"); if (!Sound.ContainsKey(resourceLocation)) { Sound[resourceLocation] = Resources.Load <AudioClip>(loc); } ClipView clip = ObjectPoolManager.Instance.Get <ClipView>(clipPrefab); clip.Clip = Sound[resourceLocation]; clip.Volume = MUSIC_VOLUME; loopHolder.Add(clip); }
public void SetRange(double lowerValue, double upperValue, double pageSize, double pageIncrement, double stepIncrement, double value) { LowerValue = lowerValue; UpperValue = upperValue; PageSize = pageSize; PageIncrement = pageIncrement; if (vertical) { scrollView.VerticalLineScroll = (float)stepIncrement; } else { scrollView.HorizontalLineScroll = (float)stepIncrement; } ClipView.UpdateDocumentSize(); if (Value != value) { Value = value; } }
/// <summary> /// Modifies the clip to loop. /// </summary> /// <param name="clip">The clip.</param> protected override void ModifyClip(ClipView clip) { clip.IsLoop = true; }
/// <summary> /// Modifies the clip. /// </summary> /// <param name="clip">The clip.</param> protected override void ModifyClip(ClipView clip) { }
protected abstract void ModifyClip(ClipView clip);