diff --git a/unity-renderer/Assets/DCLPlugins/ECS7/ECS7Plugin.asmdef b/unity-renderer/Assets/DCLPlugins/ECS7/ECS7Plugin.asmdef index ca9aea3d26..50ab302c3f 100644 --- a/unity-renderer/Assets/DCLPlugins/ECS7/ECS7Plugin.asmdef +++ b/unity-renderer/Assets/DCLPlugins/ECS7/ECS7Plugin.asmdef @@ -39,7 +39,8 @@ "GUID:7b4a5d0cf82e544daa512b41aec35b00", "GUID:acb0f5633d7c47aba96ee6b61c872d94", "GUID:1e10040ab6604cbe8ad0921047d49e65", - "GUID:ac62e852826a4b36aeb22931dad73edb" + "GUID:ac62e852826a4b36aeb22931dad73edb", + "GUID:f51ebe6a0ceec4240a699833d6309b23" ], "includePlatforms": [], "excludePlatforms": [], diff --git a/unity-renderer/Assets/DCLPlugins/ECS7/ECS7Plugin.cs b/unity-renderer/Assets/DCLPlugins/ECS7/ECS7Plugin.cs index 3b684a62c4..01a754731b 100644 --- a/unity-renderer/Assets/DCLPlugins/ECS7/ECS7Plugin.cs +++ b/unity-renderer/Assets/DCLPlugins/ECS7/ECS7Plugin.cs @@ -68,8 +68,8 @@ public ECS7Plugin() new WrappedComponentPool>(MAX_EXPECTED_SCENES, () => new ProtobufWrappedComponent(new PBEngineInfo())), new WrappedComponentPool>(MAX_EXPECTED_SCENES, () => new ProtobufWrappedComponent(new PBUiCanvasInformation())), new WrappedComponentPool>(MAX_EXPECTED_SCENES * 10, () => new ProtobufWrappedComponent(new PBPointerEventsResult())), - new WrappedComponentPool>(MAX_EXPECTED_SCENES * 10, () => new ProtobufWrappedComponent(new PBTweenState())) - ); + new WrappedComponentPool>(MAX_EXPECTED_SCENES * 10, () => new ProtobufWrappedComponent(new PBTweenState())), + new WrappedComponentPool>(MAX_EXPECTED_SCENES * 10, () => new ProtobufWrappedComponent(new PBAudioSource()))); systemsController = new ECSSystemsController(systemsContext); diff --git a/unity-renderer/Assets/DCLPlugins/ECS7/ECSComponents/AudioSource/DCL.ECSComponents.AudioSource.asmdef b/unity-renderer/Assets/DCLPlugins/ECS7/ECSComponents/AudioSource/DCL.ECSComponents.AudioSource.asmdef index 15a4f3213e..6eb9b4cb44 100644 --- a/unity-renderer/Assets/DCLPlugins/ECS7/ECSComponents/AudioSource/DCL.ECSComponents.AudioSource.asmdef +++ b/unity-renderer/Assets/DCLPlugins/ECS7/ECSComponents/AudioSource/DCL.ECSComponents.AudioSource.asmdef @@ -27,7 +27,8 @@ "GUID:760a1d365aad58044916992b072cf2a6", "GUID:140f4a13272cd0842ab22d3faca39af2", "GUID:9cccce9925d3495d8a5e4fa5b25f54a5", - "GUID:710b2089e5df4140b0d3e30fbc20d9bd" + "GUID:710b2089e5df4140b0d3e30fbc20d9bd", + "GUID:f51ebe6a0ceec4240a699833d6309b23" ], "includePlatforms": [], "excludePlatforms": [], diff --git a/unity-renderer/Assets/DCLPlugins/ECS7/ECSComponents/AudioSource/Handler/ECSAudioSourceComponentHandler.cs b/unity-renderer/Assets/DCLPlugins/ECS7/ECSComponents/AudioSource/Handler/ECSAudioSourceComponentHandler.cs index d64bca73ce..329f06653e 100644 --- a/unity-renderer/Assets/DCLPlugins/ECS7/ECSComponents/AudioSource/Handler/ECSAudioSourceComponentHandler.cs +++ b/unity-renderer/Assets/DCLPlugins/ECS7/ECSComponents/AudioSource/Handler/ECSAudioSourceComponentHandler.cs @@ -1,4 +1,5 @@ -using System; + +using System; using DCL.Controllers; using DCL.ECS7.InternalComponents; using DCL.ECSRuntime; @@ -60,10 +61,7 @@ public void OnComponentCreated(IParcelScene scene, IDCLEntity entity) dataStore.virtualAudioMixer.sceneSFXVolume.OnChange += OnVirtualAudioMixerChangedValue; sceneNumber.OnChange += OnCurrentSceneChanged; - audioSourceInternalComponent.PutFor(scene, entity, new InternalAudioSource() - { - audioSource = this.audioSource - }); + sbcInternalComponent.RegisterOnSceneBoundsStateChangeCallback(scene, entity, OnSceneBoundsStateChange); @@ -149,17 +147,13 @@ private void ApplyCurrentModel() audioSource.spatialBlend = 1; audioSource.dopplerLevel = 0.1f; - if (model.Playing != audioSource.isPlaying) - { - if (audioSource.isPlaying) - audioSource.Stop(); - else if (isAudioClipReady) - audioSource.Play(); - } - else if (audioSource.isPlaying) - { + if (model.Playing == audioSource.isPlaying) + return; + + if (!model.Playing && audioSource.isPlaying) audioSource.Stop(); - } + if (model.Playing && !audioSource.isPlaying && isAudioClipReady) + audioSource.Play(); } private void ApplyLoadedAudioClip(AudioClip clip) diff --git a/unity-renderer/Assets/DCLPlugins/ECS7/InternalECSComponents/Interfaces/InternalECSComponentModels.cs b/unity-renderer/Assets/DCLPlugins/ECS7/InternalECSComponents/Interfaces/InternalECSComponentModels.cs index 742d2b55e4..1d9519ce0e 100644 --- a/unity-renderer/Assets/DCLPlugins/ECS7/InternalECSComponents/Interfaces/InternalECSComponentModels.cs +++ b/unity-renderer/Assets/DCLPlugins/ECS7/InternalECSComponents/Interfaces/InternalECSComponentModels.cs @@ -114,6 +114,13 @@ public InternalRenderers(IList renderers) public struct InternalAudioSource : IInternalComponent { public bool dirty { get; set; } + public bool isPlaying; + public bool loop; + public float volume; + public float pitch; + public string audioClipUrl; + public float speed; + public float decay; public AudioSource audioSource; } diff --git a/unity-renderer/Assets/DCLPlugins/ECS7/Systems/AudioSourceSystem.meta b/unity-renderer/Assets/DCLPlugins/ECS7/Systems/AudioSourceSystem.meta new file mode 100644 index 0000000000..9997a95a63 --- /dev/null +++ b/unity-renderer/Assets/DCLPlugins/ECS7/Systems/AudioSourceSystem.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 61b7cb51d05b47a1a722372f24ad2259 +timeCreated: 1710500198 \ No newline at end of file diff --git a/unity-renderer/Assets/DCLPlugins/ECS7/Systems/AudioSourceSystem/ECS7Plugin.Systems.AudioSource.asmdef b/unity-renderer/Assets/DCLPlugins/ECS7/Systems/AudioSourceSystem/ECS7Plugin.Systems.AudioSource.asmdef new file mode 100644 index 0000000000..43d39d86a9 --- /dev/null +++ b/unity-renderer/Assets/DCLPlugins/ECS7/Systems/AudioSourceSystem/ECS7Plugin.Systems.AudioSource.asmdef @@ -0,0 +1,25 @@ +{ + "name": "ECS7Plugin.Systems.AudioSource", + "rootNamespace": "", + "references": [ + "GUID:9cccce9925d3495d8a5e4fa5b25f54a5", + "GUID:9239602a072d4e52b5f1cae20ab2b459", + "GUID:0a17d39e1dc14c038aa3c6483a185df0", + "GUID:37d2c04574c1d480d8c817e2a7c578e7", + "GUID:97d8897529779cb49bebd400c7f402a6", + "GUID:ac62e852826a4b36aeb22931dad73edb", + "GUID:1e10040ab6604cbe8ad0921047d49e65", + "GUID:a881b57670b1d2747a6d7f9e32b63230", + "GUID:3c7b57a14671040bd8c549056adc04f5", + "GUID:acb0f5633d7c47aba96ee6b61c872d94" + ], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": false +} \ No newline at end of file diff --git a/unity-renderer/Assets/DCLPlugins/ECS7/Systems/AudioSourceSystem/ECS7Plugin.Systems.AudioSource.asmdef.meta b/unity-renderer/Assets/DCLPlugins/ECS7/Systems/AudioSourceSystem/ECS7Plugin.Systems.AudioSource.asmdef.meta new file mode 100644 index 0000000000..9e4279eaa3 --- /dev/null +++ b/unity-renderer/Assets/DCLPlugins/ECS7/Systems/AudioSourceSystem/ECS7Plugin.Systems.AudioSource.asmdef.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: cfa7a9aba4cb4fdfac7f5a9abfb2c2c8 +timeCreated: 1710500255 \ No newline at end of file diff --git a/unity-renderer/Assets/DCLPlugins/ECS7/Systems/AudioSourceSystem/ECSAudioSourceSystem.cs b/unity-renderer/Assets/DCLPlugins/ECS7/Systems/AudioSourceSystem/ECSAudioSourceSystem.cs new file mode 100644 index 0000000000..9589675fce --- /dev/null +++ b/unity-renderer/Assets/DCLPlugins/ECS7/Systems/AudioSourceSystem/ECSAudioSourceSystem.cs @@ -0,0 +1,49 @@ +using DCL.ECS7; +using DCL.ECS7.ComponentWrapper.Generic; +using DCL.ECS7.InternalComponents; +using DCL.ECSComponents; +using System.Collections.Generic; + +namespace ECSSystems.AudioSourceSystem +{ + public class ECSAudioSourceSystem + { + private readonly IInternalECSComponent audioSourceComponent; + private readonly IReadOnlyDictionary componentsWriter; + private readonly WrappedComponentPool> audioSourcePool; + + public ECSAudioSourceSystem( + IInternalECSComponent audioSourceComponent, + IReadOnlyDictionary componentsWriter, + WrappedComponentPool> audioSourcePool) + { + this.audioSourceComponent = audioSourceComponent; + this.componentsWriter = componentsWriter; + this.audioSourcePool = audioSourcePool; + } + + public void Update() + { + var audioSourceComponentList = audioSourceComponent.GetForAll(); + + // Loop through every audio source component + for(var i = 0; i < audioSourceComponentList.Count; i++) + { + var component = audioSourceComponentList[i]; + var scene = component.key1; + long entity = component.key2; + var model = component.value.model; + + if (!componentsWriter.TryGetValue(scene.sceneData.sceneNumber, out var writer)) continue; + var wrappedComponent = audioSourcePool.Get(); + wrappedComponent.WrappedComponent.Model.Playing = model.audioSource.isPlaying; + wrappedComponent.WrappedComponent.Model.Loop = model.loop; + wrappedComponent.WrappedComponent.Model.Volume = model.volume; + wrappedComponent.WrappedComponent.Model.Pitch = model.pitch; + wrappedComponent.WrappedComponent.Model.AudioClipUrl ??= model.audioClipUrl; + wrappedComponent.WrappedComponent.Model.CurrentTime = model.audioSource.time; + writer.Put(entity, ComponentID.AUDIO_SOURCE, wrappedComponent); + } + } + } +} diff --git a/unity-renderer/Assets/DCLPlugins/ECS7/Systems/AudioSourceSystem/ECSAudioSourceSystem.cs.meta b/unity-renderer/Assets/DCLPlugins/ECS7/Systems/AudioSourceSystem/ECSAudioSourceSystem.cs.meta new file mode 100644 index 0000000000..d09735b467 --- /dev/null +++ b/unity-renderer/Assets/DCLPlugins/ECS7/Systems/AudioSourceSystem/ECSAudioSourceSystem.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: c92bbbaacb654a92894db9701b96e26b +timeCreated: 1710500294 \ No newline at end of file diff --git a/unity-renderer/Assets/DCLPlugins/ECS7/Systems/ECS7Plugin.Systems.asmdef b/unity-renderer/Assets/DCLPlugins/ECS7/Systems/ECS7Plugin.Systems.asmdef index 007bcefaa6..aa5143aa47 100644 --- a/unity-renderer/Assets/DCLPlugins/ECS7/Systems/ECS7Plugin.Systems.asmdef +++ b/unity-renderer/Assets/DCLPlugins/ECS7/Systems/ECS7Plugin.Systems.asmdef @@ -46,7 +46,8 @@ "GUID:1e10040ab6604cbe8ad0921047d49e65", "GUID:c76ce68567754cd0abab86915b7ba63e", "GUID:ed6f26f965aa4a39b494b55b335924b9", - "GUID:e55bb9116cf54f04a57453fc981dc81d" + "GUID:e55bb9116cf54f04a57453fc981dc81d", + "GUID:cfa7a9aba4cb4fdfac7f5a9abfb2c2c8" ], "includePlatforms": [], "excludePlatforms": [], diff --git a/unity-renderer/Assets/DCLPlugins/ECS7/Systems/ECSSystemsController.cs b/unity-renderer/Assets/DCLPlugins/ECS7/Systems/ECSSystemsController.cs index 3136d3f2c3..e449c89980 100644 --- a/unity-renderer/Assets/DCLPlugins/ECS7/Systems/ECSSystemsController.cs +++ b/unity-renderer/Assets/DCLPlugins/ECS7/Systems/ECSSystemsController.cs @@ -1,5 +1,6 @@ using DCL; using ECSSystems.AnimationSystem; +using ECSSystems.AudioSourceSystem; using ECSSystems.AvatarModifierAreaSystem; using ECSSystems.BillboardSystem; using ECSSystems.CameraSystem; @@ -38,6 +39,7 @@ public class ECSSystemsController : IDisposable private readonly ECSPlayerTransformSystem playerTransformSystem; private readonly ECSSceneBoundsCheckerSystem sceneBoundsCheckerSystem; private readonly ECSUiCanvasInformationSystem uiCanvasInformationSystem; + private readonly ECSAudioSourceSystem audioSourceSystem; private readonly GameObject hoverCanvas; private readonly GameObject scenesUi; private readonly IWorldState worldState; @@ -98,6 +100,11 @@ public ECSSystemsController(SystemsContext context) context.ComponentWriters, context.RaycastResultPool); + audioSourceSystem = new ECSAudioSourceSystem( + context.internalEcsComponents.audioSourceComponent, + context.ComponentWriters, + context.AudioSourcePool); + sceneBoundsCheckerSystem = new ECSSceneBoundsCheckerSystem( DataStore.i.ecs7.scenes, context.internalEcsComponents.sceneBoundsCheckComponent, @@ -178,7 +185,8 @@ public ECSSystemsController(SystemsContext context) billboardSystem.Update, videoPlayerSystem.Update, uiCanvasInformationSystem.Update, - animationSystem.Update + animationSystem.Update, + audioSourceSystem.Update }; lateUpdateSystems = new ECS7System[] diff --git a/unity-renderer/Assets/DCLPlugins/ECS7/Systems/SystemsContext/SystemsContext.cs b/unity-renderer/Assets/DCLPlugins/ECS7/Systems/SystemsContext/SystemsContext.cs index 28aba7a396..5a9a8ff781 100644 --- a/unity-renderer/Assets/DCLPlugins/ECS7/Systems/SystemsContext/SystemsContext.cs +++ b/unity-renderer/Assets/DCLPlugins/ECS7/Systems/SystemsContext/SystemsContext.cs @@ -16,14 +16,14 @@ public record SystemsContext public readonly WrappedComponentPool> TransformPool; public readonly WrappedComponentPool> VideoEventPool; public readonly WrappedComponentPool> RaycastResultPool; + public readonly WrappedComponentPool> AudioSourcePool; public readonly WrappedComponentPool> GltfContainerLoadingStatePool; public readonly WrappedComponentPool> EngineInfoPool; public readonly WrappedComponentPool> UiCanvasInformationPool; public readonly WrappedComponentPool> PointerEventsResultPool; public readonly WrappedComponentPool> TweenStatePool; - public SystemsContext( - IReadOnlyDictionary componentWriters, + public SystemsContext(IReadOnlyDictionary componentWriters, IInternalECSComponents internalEcsComponents, IComponentGroups componentGroups, ECSComponent billboards, @@ -37,7 +37,8 @@ public SystemsContext( WrappedComponentPool> engineInfoPool, WrappedComponentPool> uiCanvasInformationPool, WrappedComponentPool> pointerEventsResultPool, - WrappedComponentPool> tweenStatePool) + WrappedComponentPool> tweenStatePool, + WrappedComponentPool> audioSourcePool) { this.internalEcsComponents = internalEcsComponents; this.componentGroups = componentGroups; @@ -54,5 +55,6 @@ public SystemsContext( UiCanvasInformationPool = uiCanvasInformationPool; PointerEventsResultPool = pointerEventsResultPool; TweenStatePool = tweenStatePool; + AudioSourcePool = audioSourcePool; } } diff --git a/unity-renderer/Assets/Scripts/MainScripts/DCL/Components/Audio/DCLAudioSource.cs b/unity-renderer/Assets/Scripts/MainScripts/DCL/Components/Audio/DCLAudioSource.cs index c5ba8a5b94..e7a9bbceb4 100644 --- a/unity-renderer/Assets/Scripts/MainScripts/DCL/Components/Audio/DCLAudioSource.cs +++ b/unity-renderer/Assets/Scripts/MainScripts/DCL/Components/Audio/DCLAudioSource.cs @@ -9,6 +9,7 @@ namespace DCL.Components { + public class DCLAudioSource : BaseComponent, IOutOfSceneBoundariesHandler { [System.Serializable] diff --git a/unity-renderer/Assets/Scripts/MainScripts/DCL/DecentralandProtocol/AudioSource.gen.cs b/unity-renderer/Assets/Scripts/MainScripts/DCL/DecentralandProtocol/AudioSource.gen.cs index 4f18c5895e..b0cc200ee3 100644 --- a/unity-renderer/Assets/Scripts/MainScripts/DCL/DecentralandProtocol/AudioSource.gen.cs +++ b/unity-renderer/Assets/Scripts/MainScripts/DCL/DecentralandProtocol/AudioSource.gen.cs @@ -25,16 +25,17 @@ static AudioSourceReflection() { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( "Ci5kZWNlbnRyYWxhbmQvc2RrL2NvbXBvbmVudHMvYXVkaW9fc291cmNlLnBy", - "b3RvEhtkZWNlbnRyYWxhbmQuc2RrLmNvbXBvbmVudHMiowEKDVBCQXVkaW9T", + "b3RvEhtkZWNlbnRyYWxhbmQuc2RrLmNvbXBvbmVudHMi7wEKDVBCQXVkaW9T", "b3VyY2USFAoHcGxheWluZxgBIAEoCEgAiAEBEhMKBnZvbHVtZRgCIAEoAkgB", "iAEBEhEKBGxvb3AYAyABKAhIAogBARISCgVwaXRjaBgEIAEoAkgDiAEBEhYK", - "DmF1ZGlvX2NsaXBfdXJsGAUgASgJQgoKCF9wbGF5aW5nQgkKB192b2x1bWVC", - "BwoFX2xvb3BCCAoGX3BpdGNoQhSqAhFEQ0wuRUNTQ29tcG9uZW50c2IGcHJv", - "dG8z")); + "DmF1ZGlvX2NsaXBfdXJsGAUgASgJEhkKDGN1cnJlbnRfdGltZRgGIAEoAkgE", + "iAEBEhMKBmdsb2JhbBgHIAEoCEgFiAEBQgoKCF9wbGF5aW5nQgkKB192b2x1", + "bWVCBwoFX2xvb3BCCAoGX3BpdGNoQg8KDV9jdXJyZW50X3RpbWVCCQoHX2ds", + "b2JhbEIUqgIRRENMLkVDU0NvbXBvbmVudHNiBnByb3RvMw==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::DCL.ECSComponents.PBAudioSource), global::DCL.ECSComponents.PBAudioSource.Parser, new[]{ "Playing", "Volume", "Loop", "Pitch", "AudioClipUrl" }, new[]{ "Playing", "Volume", "Loop", "Pitch" }, null, null, null) + new pbr::GeneratedClrTypeInfo(typeof(global::DCL.ECSComponents.PBAudioSource), global::DCL.ECSComponents.PBAudioSource.Parser, new[]{ "Playing", "Volume", "Loop", "Pitch", "AudioClipUrl", "CurrentTime", "Global" }, new[]{ "Playing", "Volume", "Loop", "Pitch", "CurrentTime", "Global" }, null, null, null) })); } #endregion @@ -51,6 +52,13 @@ static AudioSourceReflection() { /// Note that the `audio_clip_url` is not actually a URL, but rather the path of a file bundled with /// the scene and declared in its manifest. The name was chosen because the URL use-case will /// eventually be supported. + /// + /// `playing=true` when it's previously `playing=true` + /// a) if clip is playing and `current_time` is NOT SET, the clip remains in the current `current_time` + /// b) if clip is stopped or `current_time` is set, the clip is played from the `current_time` (if set) or from the beginning + /// + /// If other property (volume, loop, pitch) is changed while playing, the clip is keep playing with the new properties + /// Changing `audio_clip_url` while playing stops the current clip and plays the new one (as a new instance) /// public sealed partial class PBAudioSource : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE @@ -93,6 +101,8 @@ public PBAudioSource(PBAudioSource other) : this() { loop_ = other.loop_; pitch_ = other.pitch_; audioClipUrl_ = other.audioClipUrl_; + currentTime_ = other.currentTime_; + global_ = other.global_; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } @@ -229,6 +239,62 @@ public string AudioClipUrl { } } + /// Field number for the "current_time" field. + public const int CurrentTimeFieldNumber = 6; + private float currentTime_; + /// + /// specifies the current playback time of the clip in seconds (default: 0). + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public float CurrentTime { + get { if ((_hasBits0 & 16) != 0) { return currentTime_; } else { return 0F; } } + set { + _hasBits0 |= 16; + currentTime_ = value; + } + } + /// Gets whether the "current_time" field is set + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool HasCurrentTime { + get { return (_hasBits0 & 16) != 0; } + } + /// Clears the value of the "current_time" field + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void ClearCurrentTime() { + _hasBits0 &= ~16; + } + + /// Field number for the "global" field. + public const int GlobalFieldNumber = 7; + private bool global_; + /// + /// whether the audio plays at constant volume across the scene. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Global { + get { if ((_hasBits0 & 32) != 0) { return global_; } else { return false; } } + set { + _hasBits0 |= 32; + global_ = value; + } + } + /// Gets whether the "global" field is set + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool HasGlobal { + get { return (_hasBits0 & 32) != 0; } + } + /// Clears the value of the "global" field + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void ClearGlobal() { + _hasBits0 &= ~32; + } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { @@ -249,6 +315,8 @@ public bool Equals(PBAudioSource other) { if (Loop != other.Loop) return false; if (!pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.Equals(Pitch, other.Pitch)) return false; if (AudioClipUrl != other.AudioClipUrl) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.Equals(CurrentTime, other.CurrentTime)) return false; + if (Global != other.Global) return false; return Equals(_unknownFields, other._unknownFields); } @@ -261,6 +329,8 @@ public override int GetHashCode() { if (HasLoop) hash ^= Loop.GetHashCode(); if (HasPitch) hash ^= pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(Pitch); if (AudioClipUrl.Length != 0) hash ^= AudioClipUrl.GetHashCode(); + if (HasCurrentTime) hash ^= pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(CurrentTime); + if (HasGlobal) hash ^= Global.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -299,6 +369,14 @@ public void WriteTo(pb::CodedOutputStream output) { output.WriteRawTag(42); output.WriteString(AudioClipUrl); } + if (HasCurrentTime) { + output.WriteRawTag(53); + output.WriteFloat(CurrentTime); + } + if (HasGlobal) { + output.WriteRawTag(56); + output.WriteBool(Global); + } if (_unknownFields != null) { _unknownFields.WriteTo(output); } @@ -329,6 +407,14 @@ public void WriteTo(pb::CodedOutputStream output) { output.WriteRawTag(42); output.WriteString(AudioClipUrl); } + if (HasCurrentTime) { + output.WriteRawTag(53); + output.WriteFloat(CurrentTime); + } + if (HasGlobal) { + output.WriteRawTag(56); + output.WriteBool(Global); + } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); } @@ -354,6 +440,12 @@ public int CalculateSize() { if (AudioClipUrl.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeStringSize(AudioClipUrl); } + if (HasCurrentTime) { + size += 1 + 4; + } + if (HasGlobal) { + size += 1 + 1; + } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } @@ -381,6 +473,12 @@ public void MergeFrom(PBAudioSource other) { if (other.AudioClipUrl.Length != 0) { AudioClipUrl = other.AudioClipUrl; } + if (other.HasCurrentTime) { + CurrentTime = other.CurrentTime; + } + if (other.HasGlobal) { + Global = other.Global; + } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -416,6 +514,14 @@ public void MergeFrom(pb::CodedInputStream input) { AudioClipUrl = input.ReadString(); break; } + case 53: { + CurrentTime = input.ReadFloat(); + break; + } + case 56: { + Global = input.ReadBool(); + break; + } } } #endif @@ -451,6 +557,14 @@ public void MergeFrom(pb::CodedInputStream input) { AudioClipUrl = input.ReadString(); break; } + case 53: { + CurrentTime = input.ReadFloat(); + break; + } + case 56: { + Global = input.ReadBool(); + break; + } } } }