From d16f8a7bec54d629037a2569d4bb241e1f84d44b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Buratto?= Date: Sun, 8 Jan 2023 19:41:08 -0300 Subject: [PATCH] Fix ready button issue with non-admin clients --- Assets/Scenes/Lobby.unity | 371 +++++++++--------- .../Systems/Lobby/UI/ChangeRoundStateView.cs | 9 +- .../SS3D/Systems/Lobby/UI/LobbyReadyView.cs | 14 +- 3 files changed, 205 insertions(+), 189 deletions(-) diff --git a/Assets/Scenes/Lobby.unity b/Assets/Scenes/Lobby.unity index 4365c39155..256fad741c 100644 --- a/Assets/Scenes/Lobby.unity +++ b/Assets/Scenes/Lobby.unity @@ -1022,6 +1022,98 @@ Light: m_UseViewFrustumForShadowCasterCull: 1 m_ShadowRadius: 0 m_ShadowAngle: 0 +--- !u!21 &347214977 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Palette Emission + m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} + m_ValidKeywords: + - _EMISSION + - _GLOSSYREFLECTIONS_OFF + - _SPECULARHIGHLIGHTS_OFF + m_InvalidKeywords: [] + m_LightmapFlags: 2 + m_EnableInstancingVariants: 1 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _Detail: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 2800000, guid: 133dea153b15ed1418cfbadaf99ba3e1, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 2800000, guid: 133dea153b15ed1418cfbadaf99ba3e1, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SpecGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _BumpScale: 1 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _GlossMapScale: 0 + - _Glossiness: 0 + - _GlossyReflections: 0 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _Shininess: 0.7 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 0 + - _SrcBlend: 1 + - _UVSec: 0 + - _ZWrite: 1 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _Emission: {r: 0, g: 0, b: 0, a: 0} + - _EmissionColor: {r: 2, g: 2, b: 2, a: 2} + - _SpecColor: {r: 0.2, g: 0.2, b: 0.2, a: 1} + m_BuildTextureStacks: [] --- !u!114 &435454046 stripped MonoBehaviour: m_CorrespondingSourceObject: {fileID: 3736358311493197141, guid: 8c378d8ec3d1cda4389f92d2d8703b6a, type: 3} @@ -2028,98 +2120,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 16bcf25f06fe95f05808c9ebd4bb4250, type: 3} m_Name: m_EditorClassIdentifier: ---- !u!21 &817813926 -Material: - serializedVersion: 8 - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_Name: Palette Emission - m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} - m_ValidKeywords: - - _EMISSION - - _GLOSSYREFLECTIONS_OFF - - _SPECULARHIGHLIGHTS_OFF - m_InvalidKeywords: [] - m_LightmapFlags: 2 - m_EnableInstancingVariants: 1 - m_DoubleSidedGI: 0 - m_CustomRenderQueue: -1 - stringTagMap: {} - disabledShaderPasses: [] - m_SavedProperties: - serializedVersion: 3 - m_TexEnvs: - - _BumpMap: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _Detail: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _DetailAlbedoMap: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _DetailMask: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _DetailNormalMap: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _EmissionMap: - m_Texture: {fileID: 2800000, guid: 133dea153b15ed1418cfbadaf99ba3e1, type: 3} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _MainTex: - m_Texture: {fileID: 2800000, guid: 133dea153b15ed1418cfbadaf99ba3e1, type: 3} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _MetallicGlossMap: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _OcclusionMap: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _ParallaxMap: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _SpecGlossMap: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - m_Ints: [] - m_Floats: - - _BumpScale: 1 - - _Cutoff: 0.5 - - _DetailNormalMapScale: 1 - - _DstBlend: 0 - - _GlossMapScale: 0 - - _Glossiness: 0 - - _GlossyReflections: 0 - - _Metallic: 0 - - _Mode: 0 - - _OcclusionStrength: 1 - - _Parallax: 0.02 - - _Shininess: 0.7 - - _SmoothnessTextureChannel: 0 - - _SpecularHighlights: 0 - - _SrcBlend: 1 - - _UVSec: 0 - - _ZWrite: 1 - m_Colors: - - _Color: {r: 1, g: 1, b: 1, a: 1} - - _Emission: {r: 0, g: 0, b: 0, a: 0} - - _EmissionColor: {r: 2, g: 2, b: 2, a: 2} - - _SpecColor: {r: 0.2, g: 0.2, b: 0.2, a: 1} - m_BuildTextureStacks: [] --- !u!1 &859488911 stripped GameObject: m_CorrespondingSourceObject: {fileID: 6199841308937614464, guid: 06c946c7c639138488b814e4448b82e4, type: 3} @@ -2147,7 +2147,7 @@ GameObject: - component: {fileID: 886594308} - component: {fileID: 886594309} m_Layer: 0 - m_Name: Start Round Button + m_Name: Change Round State View m_TagString: Untagged m_Icon: {fileID: 2800000, guid: 39036f56f13e21b48ac592bc470c2c6a, type: 3} m_NavMeshLayer: 0 @@ -3857,6 +3857,98 @@ MeshFilter: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1669161428} m_Mesh: {fileID: -3225770837458200932, guid: 2e56555ad4dc18b4a9667b5e0d83c93a, type: 3} +--- !u!21 &1672698169 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Palette Emission + m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} + m_ValidKeywords: + - _EMISSION + - _GLOSSYREFLECTIONS_OFF + - _SPECULARHIGHLIGHTS_OFF + m_InvalidKeywords: [] + m_LightmapFlags: 2 + m_EnableInstancingVariants: 1 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _Detail: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 2800000, guid: 133dea153b15ed1418cfbadaf99ba3e1, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 2800000, guid: 133dea153b15ed1418cfbadaf99ba3e1, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SpecGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _BumpScale: 1 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _GlossMapScale: 0 + - _Glossiness: 0 + - _GlossyReflections: 0 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _Shininess: 0.7 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 0 + - _SrcBlend: 1 + - _UVSec: 0 + - _ZWrite: 1 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _Emission: {r: 0, g: 0, b: 0, a: 0} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 0} + - _SpecColor: {r: 0.2, g: 0.2, b: 0.2, a: 1} + m_BuildTextureStacks: [] --- !u!1 &1698909251 GameObject: m_ObjectHideFlags: 0 @@ -4054,6 +4146,7 @@ MonoBehaviour: _networkObjectCache: {fileID: 914529552} _objectsToDisable: - {fileID: 107771120} + - {fileID: 886594307} --- !u!4 &1832382861 Transform: m_ObjectHideFlags: 0 @@ -4597,98 +4690,6 @@ Light: m_UseViewFrustumForShadowCasterCull: 1 m_ShadowRadius: 0 m_ShadowAngle: 0 ---- !u!21 &2096416214 -Material: - serializedVersion: 8 - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_Name: Palette Emission - m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} - m_ValidKeywords: - - _EMISSION - - _GLOSSYREFLECTIONS_OFF - - _SPECULARHIGHLIGHTS_OFF - m_InvalidKeywords: [] - m_LightmapFlags: 2 - m_EnableInstancingVariants: 1 - m_DoubleSidedGI: 0 - m_CustomRenderQueue: -1 - stringTagMap: {} - disabledShaderPasses: [] - m_SavedProperties: - serializedVersion: 3 - m_TexEnvs: - - _BumpMap: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _Detail: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _DetailAlbedoMap: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _DetailMask: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _DetailNormalMap: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _EmissionMap: - m_Texture: {fileID: 2800000, guid: 133dea153b15ed1418cfbadaf99ba3e1, type: 3} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _MainTex: - m_Texture: {fileID: 2800000, guid: 133dea153b15ed1418cfbadaf99ba3e1, type: 3} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _MetallicGlossMap: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _OcclusionMap: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _ParallaxMap: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _SpecGlossMap: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - m_Ints: [] - m_Floats: - - _BumpScale: 1 - - _Cutoff: 0.5 - - _DetailNormalMapScale: 1 - - _DstBlend: 0 - - _GlossMapScale: 0 - - _Glossiness: 0 - - _GlossyReflections: 0 - - _Metallic: 0 - - _Mode: 0 - - _OcclusionStrength: 1 - - _Parallax: 0.02 - - _Shininess: 0.7 - - _SmoothnessTextureChannel: 0 - - _SpecularHighlights: 0 - - _SrcBlend: 1 - - _UVSec: 0 - - _ZWrite: 1 - m_Colors: - - _Color: {r: 1, g: 1, b: 1, a: 1} - - _Emission: {r: 0, g: 0, b: 0, a: 0} - - _EmissionColor: {r: 0, g: 0, b: 0, a: 0} - - _SpecColor: {r: 0.2, g: 0.2, b: 0.2, a: 1} - m_BuildTextureStacks: [] --- !u!1 &2103898777 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/SS3D/Systems/Lobby/UI/ChangeRoundStateView.cs b/Assets/Scripts/SS3D/Systems/Lobby/UI/ChangeRoundStateView.cs index 8756b73a73..e53ddcbfaf 100644 --- a/Assets/Scripts/SS3D/Systems/Lobby/UI/ChangeRoundStateView.cs +++ b/Assets/Scripts/SS3D/Systems/Lobby/UI/ChangeRoundStateView.cs @@ -29,11 +29,18 @@ protected override void OnAwake() AddEventListeners(); } + protected override void OnDestroyed() + { + base.OnDestroyed(); + + _startRoundButton.OnPressedDown -= HandleEmbarkButtonPress; + } + private void AddEventListeners() { _startRoundButton.OnPressedDown += HandleEmbarkButtonPress; - RoundStateUpdated.AddListener(HandleRoundStateUpdated); + AddHandle(RoundStateUpdated.AddListener(HandleRoundStateUpdated)); } private void HandleRoundStateUpdated(ref EventContext context, in RoundStateUpdated e) diff --git a/Assets/Scripts/SS3D/Systems/Lobby/UI/LobbyReadyView.cs b/Assets/Scripts/SS3D/Systems/Lobby/UI/LobbyReadyView.cs index bb5b68aa1a..4c4414abb9 100644 --- a/Assets/Scripts/SS3D/Systems/Lobby/UI/LobbyReadyView.cs +++ b/Assets/Scripts/SS3D/Systems/Lobby/UI/LobbyReadyView.cs @@ -18,15 +18,23 @@ public sealed class LobbyReadyView : NetworkActor [SerializeField] private ToggleLabelButton _readyButton; [SerializeField] private LabelButton _embarkButton; - protected override void OnAwake() + protected override void OnAwake() { base.OnAwake(); _readyButton.OnPressedDown += HandleReadyButtonPressed; _embarkButton.OnPressedDown += HandleEmbarkButtonPressed; - RoundStateUpdated.AddListener(HandleRoundStateUpdated); - SpawnedPlayersUpdated.AddListener(HandleSpawnedPlayersUpdated); + AddHandle(RoundStateUpdated.AddListener(HandleRoundStateUpdated)); + AddHandle(SpawnedPlayersUpdated.AddListener(HandleSpawnedPlayersUpdated)); + } + + protected override void OnDestroyed() + { + base.OnDestroyed(); + + _readyButton.OnPressedDown -= HandleReadyButtonPressed; + _embarkButton.OnPressedDown -= HandleEmbarkButtonPressed; } private void HandleSpawnedPlayersUpdated(ref EventContext context, in SpawnedPlayersUpdated e)