void SetSelectedSound(ScrollingListItemUI item) { CloseDialogs(); if (item != null) { string id = item.name; SoundEffect effect = soundEffectSystem.GetSoundEffect(id); if (effect == null) { // Someone remotely deleted this sound... Refresh(); return; } else { ui.exportDropdownMenu.gameObject.SetActive(false); ui.copyButton.gameObject.SetActive(true); ui.trashButton.gameObject.SetActive(true); if (effect.content.effectType == SoundEffectType.Synthesized) { // Launch the synthesized sound editor. synthSoundEditor.Open(id); } else if (effect.content.effectType == SoundEffectType.SteamWorkshop) { // Launch the imported sound editor. importedSoundEditor.Open(id); } else { // TODO: launch editor appropriate for this type of sound. } } } else { ui.copyButton.gameObject.SetActive(false); ui.trashButton.gameObject.SetActive(false); } if (selectedListItem != null) { selectedListItem.actorListItemSelected.SetActive(false); } selectedListItem = item; if (selectedListItem != null) { selectedListItem.actorListItemSelected.SetActive(true); } onSoundSelected?.Invoke(selectedListItem?.name); }
void UpdateFromModel() { soundEffect = soundEffectSystem.GetSoundEffect(sfxId); // Be forgiving with data errors because this data can come from serialized // data, over the network, etc, so just fail instead of crashing if there // is something wrong: if (soundEffect.content.effectType != SoundEffectType.Synthesized) { Debug.LogWarning("SynthSoundEditor can only edit synth based sounds."); Close(); return; } if (soundEffect.content.synthParams == null) { Debug.LogWarning("SynthSoundEditor: missing synth params. Can't edit."); Close(); return; } UpdateWidgetsFromModel(); ClipSynthesizer synth = new ClipSynthesizer(soundEffect.content.synthParams); previewClip = synth.GetAudioClip(); }
void UpdateSound() { this.soundEffect = soundEffectSystem.GetSoundEffect(sfxId); ui.nameField.text = soundEffect.name; ui.spatializedToggle.onValueChanged.RemoveListener(OnSpatializedChanged); ui.spatializedToggle.isOn = soundEffect.content.spatialized; ui.spatializedToggle.onValueChanged.AddListener(OnSpatializedChanged); }
public VoosActor RequestActor(ActorableSearchResult _requestedResult, Vector3 rootSpawnPosition, Quaternion additionalRotation, Vector3 spawnScale) { Quaternion spawnRotation = additionalRotation * _requestedResult.preferredRotation; // NOTE: We could also have additionalScale here, in which case we'd want to multiply it with preferredLocalScale and apply it. // If, for example, the new tool gave you the ability to scale (like it lets you rotate now). if (_requestedResult.renderableReference.assetType == AssetType.Actor || _requestedResult.renderableReference.assetType == AssetType.AssetPack) { return(_requestedResult.actorPrefab.Instantiate(voosEngine, behaviorSystem, rootSpawnPosition, spawnRotation, setupActor => { // IMPORTANT! The setupActor could be a child of the hierarchy! So the // position is not necessarily rootSpawnPosition. setupActor.SetSpawnPosition(setupActor.transform.position); setupActor.SetSpawnRotation(setupActor.transform.rotation); // Post-setup for effect results string pfxId = _requestedResult.pfxId; if (pfxId != null) { setupActor.SetPfxId(pfxId); ParticleEffect pfx = particleEffectSystem.GetParticleEffect(pfxId); if (pfx != null) { setupActor.SetDisplayName(pfx.name); } } string sfxId = _requestedResult.sfxId; if (sfxId != null) { setupActor.SetSfxId(sfxId); SoundEffect sfx = soundEffectSystem.GetSoundEffect(sfxId); if (sfx != null) { setupActor.SetDisplayName(sfx.name); } } })); } else { return(voosEngine.CreateActor(rootSpawnPosition, spawnRotation, actor => { if (_requestedResult.forceConcave) { actor.SetUseConcaveCollider(true); } actor.SetLocalScale(spawnScale); actor.SetDisplayName(_requestedResult.name); actor.SetRenderableUri(_requestedResult.renderableReference.uri); })); } }
private void Update() { string sfxId = (string)editor.data; if (!string.IsNullOrEmpty(sfxId) && sfxSystem.GetSoundEffect(sfxId) == null) { sfxId = null; } dropdown.onValueChanged.RemoveListener(OnDropdownValueChanged); dropdown.value = sfxIdValues.IndexOf(sfxId); dropdown.onValueChanged.AddListener(OnDropdownValueChanged); }
private void UpdateFields() { if (!visualsTabUI.colorField.IsBeingEdited()) { visualsTabUI.colorField.SetColor(actor.GetTint()); } visualsTabUI.emitLightToggle.onValueChanged.RemoveListener(OnEmitLightToggleChanged); visualsTabUI.emitLightToggle.isOn = actor.GetLightSettings().range > 0; visualsTabUI.emitLightToggle.onValueChanged.AddListener(OnEmitLightToggleChanged); visualsTabUI.particleEffectName.text = actor.GetPfxId() != null? pfxSystem.GetParticleEffect(actor.GetPfxId())?.name : null; visualsTabUI.soundEffectName.text = actor.GetSfxId() != null? sfxSystem.GetSoundEffect(actor.GetSfxId())?.name : null; }