From b6ddfada53caf5fce265532e9ec3fb32a9f15d52 Mon Sep 17 00:00:00 2001 From: Josh Date: Mon, 10 Jul 2023 10:24:18 -0400 Subject: [PATCH] alternating slot bg --- namedropper/Assets/Scenes/GoldMiner.unity | 2 +- .../Assets/Scenes/LevelSelectScene.unity | 200 ++++++++++++++++-- namedropper/Assets/Spinner.cs | 36 +++- 3 files changed, 220 insertions(+), 18 deletions(-) diff --git a/namedropper/Assets/Scenes/GoldMiner.unity b/namedropper/Assets/Scenes/GoldMiner.unity index 37fb74c..b8fbda9 100644 --- a/namedropper/Assets/Scenes/GoldMiner.unity +++ b/namedropper/Assets/Scenes/GoldMiner.unity @@ -3273,7 +3273,7 @@ MonoBehaviour: m_HorizontalOverflow: 1 m_VerticalOverflow: 0 m_LineSpacing: 1 - m_Text: D&D Monsters + m_Text: --- !u!222 &1415156233 CanvasRenderer: m_ObjectHideFlags: 0 diff --git a/namedropper/Assets/Scenes/LevelSelectScene.unity b/namedropper/Assets/Scenes/LevelSelectScene.unity index 37b8fcf..2e67ae8 100644 --- a/namedropper/Assets/Scenes/LevelSelectScene.unity +++ b/namedropper/Assets/Scenes/LevelSelectScene.unity @@ -748,8 +748,8 @@ MonoBehaviour: m_fontMaterials: [] m_fontColor32: serializedVersion: 2 - rgba: 2751463423 - m_fontColor: {r: 1, g: 1, b: 1, a: 0.6392157} + rgba: 3120562176 + m_fontColor: {r: 0, g: 0, b: 0, a: 0.7294118} m_enableVertexGradient: 0 m_colorMode: 3 m_fontColorGradient: @@ -866,13 +866,97 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 6 + m_RootOrder: 5 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} m_AnchoredPosition: {x: -2.46, y: -1.33} m_SizeDelta: {x: 1920, y: 5} m_Pivot: {x: 0.5, y: 0.5} +--- !u!1 &622483133 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 622483135} + - component: {fileID: 622483134} + m_Layer: 0 + m_Name: slotBackgroundBottom + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!212 &622483134 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 622483133} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 7482667652216324306, guid: 311925a002f4447b3a28927169b83ea6, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 1, y: 1} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!4 &622483135 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 622483133} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: -2.51, y: -1.87, z: 37.9} + m_LocalScale: {x: 7.5200434, y: 2.5102441, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 13 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1001 &688218922 PrefabInstance: m_ObjectHideFlags: 0 @@ -1255,7 +1339,7 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 7 + m_RootOrder: 6 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} @@ -1451,7 +1535,7 @@ GameObject: - component: {fileID: 894434945} - component: {fileID: 894434944} m_Layer: 0 - m_Name: blackground + m_Name: slotBackground m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -1517,12 +1601,12 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 894434943} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: -2.51, y: -0.32, z: 40.47} + m_LocalPosition: {x: -2.5100098, y: -0.32000732, z: 40.47} m_LocalScale: {x: 7.5200434, y: 2.5102441, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 4 + m_RootOrder: 12 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &985132082 GameObject: @@ -1571,8 +1655,8 @@ MonoBehaviour: m_fontMaterials: [] m_fontColor32: serializedVersion: 2 - rgba: 2751463423 - m_fontColor: {r: 1, g: 1, b: 1, a: 0.6392157} + rgba: 3120562176 + m_fontColor: {r: 0, g: 0, b: 0, a: 0.7294118} m_enableVertexGradient: 0 m_colorMode: 3 m_fontColorGradient: @@ -1689,7 +1773,7 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 8 + m_RootOrder: 7 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} @@ -1730,6 +1814,10 @@ MonoBehaviour: _mainText: {fileID: 693543459} _bottomText: {fileID: 985132083} _instructions: {fileID: 2030516559} + _slotBackgrounds: + - {fileID: 1088460467} + - {fileID: 894434944} + - {fileID: 622483134} _tingSound: {fileID: 8300000, guid: a4094b6328f12884d8f174a320bff865, type: 3} _audSource: [] --- !u!4 &1037632149 @@ -1745,7 +1833,7 @@ Transform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 10 + m_RootOrder: 9 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &1037632150 MonoBehaviour: @@ -1764,6 +1852,90 @@ MonoBehaviour: - {fileID: 591775156} - {fileID: 688218924} - {fileID: 2068306297} +--- !u!1 &1088460466 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1088460468} + - component: {fileID: 1088460467} + m_Layer: 0 + m_Name: slotBackgroundTop + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!212 &1088460467 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1088460466} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 7482667652216324306, guid: 311925a002f4447b3a28927169b83ea6, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 1, y: 1} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!4 &1088460468 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1088460466} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: -2.51, y: 1.61, z: 37.74} + m_LocalScale: {x: 7.5200434, y: 2.5102441, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 11 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1132382650 GameObject: m_ObjectHideFlags: 0 @@ -1797,7 +1969,7 @@ Transform: - {fileID: 1526105807} - {fileID: 1177381788} m_Father: {fileID: 0} - m_RootOrder: 5 + m_RootOrder: 4 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1167115249 GameObject: @@ -1832,7 +2004,7 @@ RectTransform: - {fileID: 688218923} - {fileID: 2068306296} m_Father: {fileID: 0} - m_RootOrder: 11 + m_RootOrder: 10 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} @@ -2540,7 +2712,7 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 9 + m_RootOrder: 8 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} diff --git a/namedropper/Assets/Spinner.cs b/namedropper/Assets/Spinner.cs index 6728763..fe1eb2f 100644 --- a/namedropper/Assets/Spinner.cs +++ b/namedropper/Assets/Spinner.cs @@ -15,6 +15,7 @@ public class Spinner : MonoBehaviour [SerializeField] TextMeshPro _bottomText; [SerializeField] TextMeshPro _instructions; List _gameList = new List(); + [SerializeField] SpriteRenderer[] _slotBackgrounds = new SpriteRenderer[3]; bool _spinning = false; int _targetGameIndex = 0; @@ -126,25 +127,54 @@ public class Spinner : MonoBehaviour do { currentGameIndex++; - if (currentGameIndex > _gameList.Count) + if (currentGameIndex >= _gameList.Count) currentGameIndex = 0; _topText.text = GetGameName(currentGameIndex - 1); _mainText.text = GetGameName(currentGameIndex); _bottomText.text = GetGameName(currentGameIndex + 1); + FlipColors(); PlayHitClip(); delay *= 1.1f; //Debug.Log("delay: " + delay); yield return new WaitForSeconds(delay); } while (delay < .5f); - + PlayHitClip(); _mainText.color = Color.cyan; - yield return new WaitForSeconds(1.0f); + yield return new WaitForSeconds(2.0f); LoadScene(_mainText.text); } + void FlipColors() + { + foreach (SpriteRenderer spriteRenderer in _slotBackgrounds) + { + FlipColor(spriteRenderer); + } + + FlipColor(_topText); + FlipColor(_mainText); + FlipColor(_bottomText); + } + + void FlipColor(SpriteRenderer spriteRenderer) + { + if (spriteRenderer.color.r == 0) + spriteRenderer.color = Color.white; + else + spriteRenderer.color = Color.black; + } + + void FlipColor(TextMeshPro textMeshPro) + { + if (textMeshPro.color.r == 0) + textMeshPro.color = Color.white; + else + textMeshPro.color = Color.black; + } + public void PlayHitClip() { for (int i = 0; i < _audSource.Length; i++)