From 38a64af971b8ee97b4dbebfcbe3ea1a7f570eb4a Mon Sep 17 00:00:00 2001 From: JoshuaReason Date: Mon, 22 Apr 2019 15:22:21 +1000 Subject: [PATCH] Fixed lobby and client --- Assets/Materials/Tint.mat | 84 +++++++++++++++++++ Assets/Materials/Tint.mat.meta | 8 ++ Assets/Models.meta | 8 ++ Assets/Scenes/Client Scenes/LoginScreen.unity | 67 +++++++++++---- Assets/Scenes/Server Scenes/Lobby.unity | 9 +- Assets/Scripts/LogicBlocks.meta | 8 ++ Assets/Scripts/UI/Lobby/LobbyUIController.cs | 13 ++- 7 files changed, 177 insertions(+), 20 deletions(-) create mode 100644 Assets/Materials/Tint.mat create mode 100644 Assets/Materials/Tint.mat.meta create mode 100644 Assets/Models.meta create mode 100644 Assets/Scripts/LogicBlocks.meta diff --git a/Assets/Materials/Tint.mat b/Assets/Materials/Tint.mat new file mode 100644 index 0000000..350fc1d --- /dev/null +++ b/Assets/Materials/Tint.mat @@ -0,0 +1,84 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Tint + m_Shader: {fileID: 10760, guid: 0000000000000000f000000000000000, type: 0} + m_ShaderKeywords: + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + 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} + - _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: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + 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} + m_Floats: + - _BumpScale: 1 + - _ColorMask: 15 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _Stencil: 0 + - _StencilComp: 8 + - _StencilOp: 0 + - _StencilReadMask: 255 + - _StencilWriteMask: 255 + - _UVSec: 0 + - _UseUIAlphaClip: 0 + - _ZWrite: 1 + m_Colors: + - _Color: {r: 0.77254903, g: 0.07843139, b: 0.2031904, a: 0.20392157} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} diff --git a/Assets/Materials/Tint.mat.meta b/Assets/Materials/Tint.mat.meta new file mode 100644 index 0000000..5d4aa6f --- /dev/null +++ b/Assets/Materials/Tint.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8c9a41e0f500cfe4b81c5662abf8edf7 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Models.meta b/Assets/Models.meta new file mode 100644 index 0000000..5346456 --- /dev/null +++ b/Assets/Models.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 296bd90e667df1f4697823a0aa45acf0 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/Client Scenes/LoginScreen.unity b/Assets/Scenes/Client Scenes/LoginScreen.unity index 5f6b7f5..d78882f 100644 --- a/Assets/Scenes/Client Scenes/LoginScreen.unity +++ b/Assets/Scenes/Client Scenes/LoginScreen.unity @@ -38,7 +38,7 @@ RenderSettings: m_ReflectionIntensity: 1 m_CustomReflection: {fileID: 0} m_Sun: {fileID: 0} - m_IndirectSpecularColor: {r: 0.44657898, g: 0.4964133, b: 0.5748178, a: 1} + m_IndirectSpecularColor: {r: 0.44657868, g: 0.49641263, b: 0.57481706, a: 1} m_UseRadianceAmbientProbe: 0 --- !u!157 &3 LightmapSettings: @@ -324,7 +324,7 @@ MonoBehaviour: m_PersistentCalls: m_Calls: - m_Target: {fileID: 872212411} - m_MethodName: OnClickConnect + m_MethodName: OnClick_Connect m_Mode: 1 m_Arguments: m_ObjectArgument: {fileID: 0} @@ -572,7 +572,18 @@ MonoBehaviour: Culture=neutral, PublicKeyToken=null m_OnValueChanged: m_PersistentCalls: - m_Calls: [] + m_Calls: + - m_Target: {fileID: 872212411} + m_MethodName: OnChange_ServerAddress + m_Mode: 0 + m_Arguments: + m_ObjectArgument: {fileID: 0} + m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine + m_IntArgument: 0 + m_FloatArgument: 0 + m_StringArgument: + m_BoolArgument: 0 + m_CallState: 2 m_TypeName: TMPro.TMP_InputField+OnChangeEvent, Unity.TextMeshPro, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null m_CaretColor: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} @@ -850,11 +861,11 @@ MonoBehaviour: lineCount: 1 pageCount: 1 materialCount: 1 - m_havePropertiesChanged: 1 + m_havePropertiesChanged: 0 m_isUsingLegacyAnimationComponent: 0 m_isVolumetricText: 0 m_spriteAnimator: {fileID: 0} - m_isInputParsingRequired: 1 + m_isInputParsingRequired: 0 m_inputSource: 0 m_hasFontAssetChanged: 0 m_subTextObjects: @@ -1074,7 +1085,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: -0.0018920898, y: 0.0022277832} + m_AnchoredPosition: {x: -0.001953125, y: 0.0022583008} m_SizeDelta: {x: 0.19995117, y: 0.009979248} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &425791972 @@ -1227,7 +1238,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0.0018920898, y: -73.927} + m_AnchoredPosition: {x: 0.0018310547, y: -73.92697} m_SizeDelta: {x: -0.19995117, y: -147.85999} m_Pivot: {x: 0.5, y: 0.5} --- !u!1 &716278963 @@ -1605,7 +1616,18 @@ MonoBehaviour: Culture=neutral, PublicKeyToken=null m_OnValueChanged: m_PersistentCalls: - m_Calls: [] + m_Calls: + - m_Target: {fileID: 872212411} + m_MethodName: OnChange_Name + m_Mode: 0 + m_Arguments: + m_ObjectArgument: {fileID: 0} + m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine + m_IntArgument: 0 + m_FloatArgument: 0 + m_StringArgument: + m_BoolArgument: 0 + m_CallState: 2 m_TypeName: TMPro.TMP_InputField+OnChangeEvent, Unity.TextMeshPro, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null m_CaretColor: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} @@ -2463,11 +2485,11 @@ MonoBehaviour: lineCount: 1 pageCount: 1 materialCount: 1 - m_havePropertiesChanged: 1 + m_havePropertiesChanged: 0 m_isUsingLegacyAnimationComponent: 0 m_isVolumetricText: 0 m_spriteAnimator: {fileID: 0} - m_isInputParsingRequired: 1 + m_isInputParsingRequired: 0 m_inputSource: 0 m_hasFontAssetChanged: 0 m_subTextObjects: @@ -3414,11 +3436,11 @@ MonoBehaviour: lineCount: 1 pageCount: 1 materialCount: 1 - m_havePropertiesChanged: 1 + m_havePropertiesChanged: 0 m_isUsingLegacyAnimationComponent: 0 m_isVolumetricText: 0 m_spriteAnimator: {fileID: 0} - m_isInputParsingRequired: 1 + m_isInputParsingRequired: 0 m_inputSource: 0 m_hasFontAssetChanged: 0 m_subTextObjects: @@ -3785,7 +3807,7 @@ MonoBehaviour: m_PersistentCalls: m_Calls: - m_Target: {fileID: 872212411} - m_MethodName: OnClickConnect + m_MethodName: OnClick_Done m_Mode: 1 m_Arguments: m_ObjectArgument: {fileID: 0} @@ -3870,7 +3892,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: -0.0018920898, y: 0.0022277832} + m_AnchoredPosition: {x: -0.001953125, y: 0.0022583008} m_SizeDelta: {x: 0.19995117, y: 0.009979248} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1584683395 @@ -4267,11 +4289,11 @@ MonoBehaviour: lineCount: 1 pageCount: 1 materialCount: 1 - m_havePropertiesChanged: 1 + m_havePropertiesChanged: 0 m_isUsingLegacyAnimationComponent: 0 m_isVolumetricText: 0 m_spriteAnimator: {fileID: 0} - m_isInputParsingRequired: 1 + m_isInputParsingRequired: 0 m_inputSource: 0 m_hasFontAssetChanged: 0 m_subTextObjects: @@ -4455,7 +4477,18 @@ MonoBehaviour: Culture=neutral, PublicKeyToken=null m_OnValueChanged: m_PersistentCalls: - m_Calls: [] + m_Calls: + - m_Target: {fileID: 872212411} + m_MethodName: OnChange_ServerPort + m_Mode: 0 + m_Arguments: + m_ObjectArgument: {fileID: 0} + m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine + m_IntArgument: 0 + m_FloatArgument: 0 + m_StringArgument: + m_BoolArgument: 0 + m_CallState: 2 m_TypeName: TMPro.TMP_InputField+OnChangeEvent, Unity.TextMeshPro, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null m_CaretColor: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} diff --git a/Assets/Scenes/Server Scenes/Lobby.unity b/Assets/Scenes/Server Scenes/Lobby.unity index 1a17815..aa2dc23 100644 --- a/Assets/Scenes/Server Scenes/Lobby.unity +++ b/Assets/Scenes/Server Scenes/Lobby.unity @@ -38,7 +38,7 @@ RenderSettings: m_ReflectionIntensity: 1 m_CustomReflection: {fileID: 0} m_Sun: {fileID: 0} - m_IndirectSpecularColor: {r: 0.44657898, g: 0.4964133, b: 0.5748178, a: 1} + m_IndirectSpecularColor: {r: 0.44657868, g: 0.49641263, b: 0.57481706, a: 1} m_UseRadianceAmbientProbe: 0 --- !u!157 &3 LightmapSettings: @@ -148,7 +148,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 1, y: 0} m_AnchorMax: {x: 1, y: 0} - m_AnchoredPosition: {x: -129.6, y: 74.4} + m_AnchoredPosition: {x: -129.59998, y: 74.3999} m_SizeDelta: {x: 219.19995, y: 108.79999} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &90571882 @@ -591,6 +591,11 @@ MonoBehaviour: IPText: {fileID: 910932172} Content: {fileID: 1584683394} ClientTag: {fileID: 263791918} + PlayerColors: + - {r: 0.06732824, g: 0.1707894, b: 0.8396226, a: 1} + - {r: 1, g: 0, b: 0.71488476, a: 1} + - {r: 1, g: 0.93624943, b: 0.023584902, a: 1} + - {r: 0, g: 0.9622642, b: 0.020812215, a: 1} --- !u!114 &872212412 MonoBehaviour: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/LogicBlocks.meta b/Assets/Scripts/LogicBlocks.meta new file mode 100644 index 0000000..98af9d1 --- /dev/null +++ b/Assets/Scripts/LogicBlocks.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8936b441d7647f74884c94f97bfb8931 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/UI/Lobby/LobbyUIController.cs b/Assets/Scripts/UI/Lobby/LobbyUIController.cs index c8e3643..a42baac 100644 --- a/Assets/Scripts/UI/Lobby/LobbyUIController.cs +++ b/Assets/Scripts/UI/Lobby/LobbyUIController.cs @@ -26,6 +26,8 @@ public class LobbyUIController : MonoBehaviour [SerializeField] private GameObject ClientTag; + [SerializeField] + private Color[] PlayerColors; // Start is called before the first frame update void Start() @@ -53,14 +55,23 @@ public class LobbyUIController : MonoBehaviour if (child.gameObject != ClientTag) Destroy(child.gameObject); - foreach (ClientData client in Clients.ConnectedClients) + + for (int i = 0; i < Clients.ConnectedClients.Count; i++) { + ClientData client = Clients.ConnectedClients[i]; + client.Color = PlayerColors[i % PlayerColors.Length]; + GameObject clientObject = Instantiate(ClientTag, Content); TextMeshProUGUI clientText = clientObject.GetComponent(); clientText.text = client.Name; clientText.color = client.Color; clientObject.SetActive(true); } + + + + + } public void OnClick_StartGame()