diff --git a/Assets/2DAssets/404.png b/Assets/2DAssets/404.png new file mode 100644 index 0000000..bc8ffd0 --- /dev/null +++ b/Assets/2DAssets/404.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:508a222c7dc67e9d419f08799d448347b16a25bee849047848b35c1868bd2d35 +size 114714 diff --git a/Assets/2DAssets/404.png.meta b/Assets/2DAssets/404.png.meta new file mode 100644 index 0000000..3dd979e --- /dev/null +++ b/Assets/2DAssets/404.png.meta @@ -0,0 +1,166 @@ +fileFormatVersion: 2 +guid: 9ff1e55f8bf477a569e826492485e011 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 12 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Server + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/PhoneView.unity b/Assets/Scenes/PhoneView.unity index b71104a..04664cf 100644 --- a/Assets/Scenes/PhoneView.unity +++ b/Assets/Scenes/PhoneView.unity @@ -862,6 +862,7 @@ GameObject: - component: {fileID: 429358649} - component: {fileID: 429358651} - component: {fileID: 429358652} + - component: {fileID: 429358653} m_Layer: 0 m_Name: '[Managers]' m_TagString: Untagged @@ -925,6 +926,42 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: Canvas: {fileID: 1202782726} +--- !u!114 &429358653 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 429358648} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 27a435387a7644784a6fc6ae538b68e5, type: 3} + m_Name: + m_EditorClassIdentifier: + currentPlayer: + name: + id: + creationDate: 0 + explanationTime: 4 + roomCodeField: {fileID: 2023851070} + roomError: {fileID: 991600093} + playerNameField: {fileID: 1163479463} + nameError: {fileID: 1224049646} + submitNewPlayer: {fileID: 1158329299} + listPlayersUI: {fileID: 1891690322} + submitStartGame: {fileID: 638947073} + HomeConnection: {fileID: 2027556831} + WaitingRoom: {fileID: 1590939977} + BeforeStart: {fileID: 563000513} + TakePicture: {fileID: 1181392805} + VotePicture: {fileID: 531335861} + WaitingOtherPlayers: {fileID: 2095389711} + EndGame: {fileID: 1850164816} + myRoom: + code: + currentQuestion: 0 + creationDate: 0 + currentState: 0 --- !u!1 &436596783 GameObject: m_ObjectHideFlags: 0 @@ -1257,7 +1294,7 @@ MonoBehaviour: m_OnClick: m_PersistentCalls: m_Calls: - - m_Target: {fileID: 1202782732} + - m_Target: {fileID: 429358653} m_TargetAssemblyTypeName: GameManager, Assembly-CSharp m_MethodName: StartGame m_Mode: 1 @@ -3032,7 +3069,7 @@ MonoBehaviour: m_OnClick: m_PersistentCalls: m_Calls: - - m_Target: {fileID: 1202782732} + - m_Target: {fileID: 429358653} m_TargetAssemblyTypeName: GameManager, Assembly-CSharp m_MethodName: OnClickSubmitSignIn m_Mode: 1 @@ -3407,7 +3444,6 @@ GameObject: - component: {fileID: 1202782729} - component: {fileID: 1202782728} - component: {fileID: 1202782727} - - component: {fileID: 1202782732} m_Layer: 5 m_Name: Canvas m_TagString: Untagged @@ -3865,7 +3901,7 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_Texture: {fileID: 0} + m_Texture: {fileID: 2800000, guid: 9ff1e55f8bf477a569e826492485e011, type: 3} m_UVRect: serializedVersion: 2 x: 0 diff --git a/Assets/Scripts/CameraManager.cs b/Assets/Scripts/CameraManager.cs index 3034fc8..32f4568 100644 --- a/Assets/Scripts/CameraManager.cs +++ b/Assets/Scripts/CameraManager.cs @@ -31,8 +31,11 @@ void Start() // Update is called once per frame void Update() { - photoBox.texture = GetPhoto(); - Resources.UnloadUnusedAssets(); + if (wTexture) + { + photoBox.texture = GetPhoto(); + Resources.UnloadUnusedAssets(); + } } public void WebcamResume() @@ -115,11 +118,13 @@ Texture2D CropTexture(WebCamTexture originalTexture) public Texture2D GetPhoto() { - if (photo) { + if (photo) + { return photo; } - if (!wTexture) { + if (!wTexture) + { return null; } diff --git a/Assets/Scripts/GameManager.cs b/Assets/Scripts/GameManager.cs index bbb065f..a4afc4c 100644 --- a/Assets/Scripts/GameManager.cs +++ b/Assets/Scripts/GameManager.cs @@ -59,12 +59,13 @@ private void Start() HomeConnection.SetActive(true); submitNewPlayer.interactable = false; } + private void OnApplicationQuit() { myOnlineRoom.Child("players").Child(currentPlayer.id).RemoveValueAsync().ContinueWithOnMainThread(task => { Debug.Log($"delete player {currentPlayer.name}"); - if(myOnlineRoom!= null) + if (myOnlineRoom != null) { myOnlineRoom.ValueChanged -= OnRoomUpdate; } @@ -299,7 +300,8 @@ private void OnRoomUpdate(object sender, ValueChangedEventArgs e) { Debug.LogException(ex); } - if(myRoom == null) { + if (myRoom == null) + { return; } switch (myRoom.currentState) @@ -347,12 +349,12 @@ private void CheckIfIAmTheFirst(List players) if (players.Count > 1) { - IOrderedEnumerable sortedList = players.OrderBy(x=>x.creationDate); + IOrderedEnumerable sortedList = players.OrderBy(x => x.creationDate); - if(sortedList.Last().id == currentPlayer.id) + if (sortedList.Last().id == currentPlayer.id) { isFirst = true; - } + } } if (isFirst) @@ -360,7 +362,7 @@ private void CheckIfIAmTheFirst(List players) submitStartGame.SetActive(true); } } - public void sendCurrentState(GameState state,Action callback_oncCurrentStateSent) + public void sendCurrentState(GameState state, Action callback_oncCurrentStateSent) { myOnlineRoom.Child("currentState").SetValueAsync((int)state).ContinueWithOnMainThread(task => { diff --git a/Assets/Scripts/StorageManager.cs b/Assets/Scripts/StorageManager.cs index 03a9453..bb93e6a 100644 --- a/Assets/Scripts/StorageManager.cs +++ b/Assets/Scripts/StorageManager.cs @@ -42,7 +42,7 @@ public void UploadPhoto() GameManager game = Canvas.GetComponent(); string imageUuid = Guid.NewGuid().ToString(); - StorageReference imageRef = storage.Child(game.myRoom.code).Child(game.currentPlayer.id).Child($"{imageUuid}.jpg"); + StorageReference imageRef = storage.Child($"{game.myRoom.code}/{game.currentPlayer.id}/{imageUuid}.png"); imageRef.PutBytesAsync(photoBytes).ContinueWith((Task task) => {