From 5d75c6b827dfbfa9f7fd23ed7cec2e5d685e0ca8 Mon Sep 17 00:00:00 2001 From: Michel Roux Date: Sun, 28 Jan 2024 00:04:18 +0100 Subject: [PATCH] fix: Move nearly all managers on Managers --- Assets/Scenes/PhoneView.unity | 94 ++++++++++++++---------------- Assets/Scripts/CameraManager.cs | 3 +- Assets/Scripts/PromptListLoader.cs | 2 +- Assets/Scripts/StorageManager.cs | 5 +- 4 files changed, 48 insertions(+), 56 deletions(-) diff --git a/Assets/Scenes/PhoneView.unity b/Assets/Scenes/PhoneView.unity index ca999a1..aea3ed5 100644 --- a/Assets/Scenes/PhoneView.unity +++ b/Assets/Scenes/PhoneView.unity @@ -231,6 +231,9 @@ MonoBehaviour: waitingForPlayersPage: {fileID: 0} roomCodeLabel: {fileID: 0} waitingForPlayersLabels: [] + promptList: {fileID: 0} + explanationPage: {fileID: 0} + counter: {fileID: 0} waitingForPropositionsPage: {fileID: 0} waitingForPropositionsLabels: [] propositionTime: 60 @@ -360,7 +363,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: -66.94092} + m_AnchoredPosition: {x: 0, y: -66.941} m_SizeDelta: {x: 0, y: 112.377} m_Pivot: {x: 0.5, y: 1} --- !u!114 &204401156 @@ -542,7 +545,7 @@ MonoBehaviour: m_OnClick: m_PersistentCalls: m_Calls: - - m_Target: {fileID: 1316036599} + - m_Target: {fileID: 429358651} m_TargetAssemblyTypeName: CameraManager, Assembly-CSharp m_MethodName: WebcamStop m_Mode: 1 @@ -857,8 +860,10 @@ GameObject: m_Component: - component: {fileID: 429358650} - component: {fileID: 429358649} + - component: {fileID: 429358651} + - component: {fileID: 429358652} m_Layer: 0 - m_Name: '[FirebaseInitialise]' + m_Name: '[Managers]' m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -891,6 +896,36 @@ Transform: m_Children: [] m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &429358651 +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: efbbc7abb0db8c7e0b29ec4bb986d783, type: 3} + m_Name: + m_EditorClassIdentifier: + wTexture: {fileID: 0} + freezeButton: {fileID: 223773138} + resumeButton: {fileID: 1114535086} + photoBox: {fileID: 1316036600} +--- !u!114 &429358652 +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: 3b41deef4ebd372d5a18eabdb00cfbb4, type: 3} + m_Name: + m_EditorClassIdentifier: + PicturePlayer: {fileID: 1316036595} + Canvas: {fileID: 1202782726} --- !u!1 &436596783 GameObject: m_ObjectHideFlags: 0 @@ -2865,7 +2900,7 @@ MonoBehaviour: m_OnClick: m_PersistentCalls: m_Calls: - - m_Target: {fileID: 1316036599} + - m_Target: {fileID: 429358651} m_TargetAssemblyTypeName: CameraManager, Assembly-CSharp m_MethodName: WebcamResume m_Mode: 1 @@ -3480,16 +3515,6 @@ MonoBehaviour: name: id: creationDate: 0 - currentQuestion: - promptId: - propositions: - photoUrl: - owner: - name: - id: - creationDate: 0 - voters: [] - creationDate: 0 explanationTime: 4 roomCodeField: {fileID: 2023851070} roomError: {fileID: 991600093} @@ -3786,7 +3811,6 @@ GameObject: - component: {fileID: 1316036596} - component: {fileID: 1316036598} - component: {fileID: 1316036600} - - component: {fileID: 1316036599} m_Layer: 5 m_Name: PicturePlayer m_TagString: Untagged @@ -3821,21 +3845,6 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1316036595} m_CullTransparentMesh: 1 ---- !u!114 &1316036599 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1316036595} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: efbbc7abb0db8c7e0b29ec4bb986d783, type: 3} - m_Name: - m_EditorClassIdentifier: - wTexture: {fileID: 0} - freezeButton: {fileID: 223773138} - resumeButton: {fileID: 1114535086} --- !u!114 &1316036600 MonoBehaviour: m_ObjectHideFlags: 0 @@ -3920,7 +3929,7 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_Sprite: {fileID: 21300000, guid: 141de4e4cebc12c489ea471b0df36fd8, type: 3} + m_Sprite: {fileID: 0} m_Type: 0 m_PreserveAspect: 0 m_FillCenter: 1 @@ -4288,7 +4297,7 @@ MonoBehaviour: m_OnClick: m_PersistentCalls: m_Calls: - - m_Target: {fileID: 1316036599} + - m_Target: {fileID: 429358651} m_TargetAssemblyTypeName: CameraManager, Assembly-CSharp m_MethodName: WebcamChange m_Mode: 1 @@ -4320,7 +4329,7 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_Sprite: {fileID: 21300000, guid: 1380dfa5b6a644f45a1b60c91f4e151e, type: 3} + m_Sprite: {fileID: 21300000, guid: 446bab8e06600e1418d7601d9ffe3fc6, type: 3} m_Type: 0 m_PreserveAspect: 0 m_FillCenter: 1 @@ -6198,7 +6207,6 @@ GameObject: - component: {fileID: 2010012970} - component: {fileID: 2010012969} - component: {fileID: 2010012968} - - component: {fileID: 2010012971} m_Layer: 5 m_Name: SubmitBtn m_TagString: Untagged @@ -6270,9 +6278,9 @@ MonoBehaviour: m_OnClick: m_PersistentCalls: m_Calls: - - m_Target: {fileID: 2010012971} + - m_Target: {fileID: 429358652} m_TargetAssemblyTypeName: StorageManager, Assembly-CSharp - m_MethodName: SaveFile + m_MethodName: UploadPhoto m_Mode: 1 m_Arguments: m_ObjectArgument: {fileID: 0} @@ -6320,20 +6328,6 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 2010012966} m_CullTransparentMesh: 1 ---- !u!114 &2010012971 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2010012966} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 3b41deef4ebd372d5a18eabdb00cfbb4, type: 3} - m_Name: - m_EditorClassIdentifier: - PicturePlayer: {fileID: 1316036595} - Canvas: {fileID: 1202782726} --- !u!1 &2023851068 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/CameraManager.cs b/Assets/Scripts/CameraManager.cs index 00a46c2..3034fc8 100644 --- a/Assets/Scripts/CameraManager.cs +++ b/Assets/Scripts/CameraManager.cs @@ -8,6 +8,7 @@ public class CameraManager : MonoBehaviour public WebCamDevice wDevice; public Button freezeButton; public Button resumeButton; + public RawImage photoBox; private Texture2D photo; // Start is called before the first frame update @@ -30,7 +31,7 @@ void Start() // Update is called once per frame void Update() { - gameObject.GetComponent().texture = GetPhoto(); + photoBox.texture = GetPhoto(); Resources.UnloadUnusedAssets(); } diff --git a/Assets/Scripts/PromptListLoader.cs b/Assets/Scripts/PromptListLoader.cs index 879bd51..d17c9eb 100644 --- a/Assets/Scripts/PromptListLoader.cs +++ b/Assets/Scripts/PromptListLoader.cs @@ -16,7 +16,7 @@ public class PromptListLoader : MonoBehaviour private FirebaseFirestore db; - private void Start() + private void Awake() { FirebaseInitializer.Instance.onFirebaseReady += Initialize; } diff --git a/Assets/Scripts/StorageManager.cs b/Assets/Scripts/StorageManager.cs index 2fe0648..03a9453 100644 --- a/Assets/Scripts/StorageManager.cs +++ b/Assets/Scripts/StorageManager.cs @@ -6,20 +6,17 @@ public class StorageManager : MonoBehaviour { - public GameObject PicturePlayer; public GameObject Canvas; private StorageReference storage; private DatabaseReference realtimeDB; void Awake() { - Debug.Log("non"); FirebaseInitializer.Instance.onFirebaseReady += Initialize; } void Initialize() { - Debug.Log("oui"); FirebaseInitializer.Instance.onFirebaseReady -= Initialize; storage = FirebaseStorage.DefaultInstance.RootReference; realtimeDB = FirebaseDatabase.DefaultInstance.RootReference; @@ -39,7 +36,7 @@ void Update() public void UploadPhoto() { - Texture2D photo = PicturePlayer.GetComponent().GetPhoto(); + Texture2D photo = gameObject.GetComponent().GetPhoto(); byte[] photoBytes = ImageConversion.EncodeToJPG(photo); GameManager game = Canvas.GetComponent();