Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions Assets/Prefabs/Main Camera.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -894,7 +894,6 @@ GameObject:
m_Component:
- component: {fileID: 588703733079249260}
- component: {fileID: 7693705571979151744}
- component: {fileID: 8154041069363273802}
- component: {fileID: 6680414142456925996}
m_Layer: 0
m_Name: Main Camera
Expand Down Expand Up @@ -970,20 +969,6 @@ Camera:
m_OcclusionCulling: 0
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!114 &8154041069363273802
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4190906850344886629}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b169decaa258d8040aa25a280b495cad, type: 3}
m_Name:
m_EditorClassIdentifier:
mainCamera: {fileID: 7693705571979151744}
gridObject: {fileID: 0}
--- !u!114 &6680414142456925996
MonoBehaviour:
m_ObjectHideFlags: 0
Expand Down
23 changes: 9 additions & 14 deletions Assets/Prefabs/RoomSystem/Corridor/CorridorX7.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -1286,7 +1286,7 @@ TilemapRenderer:
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: -1791178601
m_SortingLayer: 3
m_SortingLayer: 4
m_SortingOrder: 0
m_ChunkSize: {x: 32, y: 32, z: 32}
m_ChunkCullingBounds: {x: 0, y: 0, z: 0}
Expand Down Expand Up @@ -1341,7 +1341,6 @@ GameObject:
serializedVersion: 6
m_Component:
- component: {fileID: 3022020511561805294}
- component: {fileID: 1349095506272017240}
m_Layer: 0
m_Name: CorridorX7
m_TagString: Map
Expand Down Expand Up @@ -1369,18 +1368,6 @@ Transform:
- {fileID: 417082257302647601}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1349095506272017240
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6369746937129949933}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9880ea29492da44c995f334244a5d19e, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &7452483412117750499
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -2258,6 +2245,10 @@ PrefabInstance:
propertyPath: newRoomPrefab
value:
objectReference: {fileID: 6459706332820108789, guid: 35bed5d2a54129845bcff6b3abaa746b, type: 3}
- target: {fileID: 6515928562466559834, guid: 7c74a234ff40ec9449b23765de7189b9, type: 3}
propertyPath: m_TagString
value: SpawnPoint
objectReference: {fileID: 0}
- target: {fileID: 6885118029593512627, guid: 7c74a234ff40ec9449b23765de7189b9, type: 3}
propertyPath: m_LocalPosition.x
value: -0.5
Expand Down Expand Up @@ -2302,6 +2293,10 @@ PrefabInstance:
propertyPath: m_Name
value: Door
objectReference: {fileID: 0}
- target: {fileID: 8481200938870355337, guid: 7c74a234ff40ec9449b23765de7189b9, type: 3}
propertyPath: m_TagString
value: Untagged
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
Expand Down
4 changes: 2 additions & 2 deletions Assets/Prefabs/RoomSystem/Doors/Door.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ GameObject:
- component: {fileID: 3423160260848129340}
m_Layer: 0
m_Name: point_of_spawn
m_TagString: Untagged
m_TagString: SpawnPoint
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 2147483647
Expand Down Expand Up @@ -163,7 +163,7 @@ SpriteRenderer:
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: -1791178601
m_SortingLayer: 3
m_SortingLayer: 4
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Attention : Incohérence dans les couches de rendu détectée

La modification du SortingLayer de 3 à 4 pour Door.prefab n'est pas totalement cohérente avec l'ensemble des préfabriqués. Les résultats montrent une division :

  • SortingLayer 4 : Door.prefab, CorridorX7.prefab, Room.prefab
  • SortingLayer 3 : Forgeron.prefab, Altar.prefab

Cette différence pourrait créer des problèmes de rendu avec les éléments d'événements de corridor (Forgeron, Altar). Une harmonisation complète des SortingLayers devrait être envisagée.

🔗 Analysis chain

Ajustement cohérent de la couche de rendu.

La modification du SortingLayer de 3 à 4 maintient la cohérence visuelle avec les autres préfabriqués, notamment le CorridorX7.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Vérifier la cohérence des SortingLayers dans les préfabriqués connexes
# Test: Rechercher d'autres modifications de SortingLayer pour assurer la cohérence

rg -l "m_SortingLayer: [34]" "Assets/Prefabs/RoomSystem"

Length of output: 309


Script:

#!/bin/bash
# Vérifions la valeur exacte du SortingLayer dans chaque fichier
rg "m_SortingLayer: [34]" -A 1 "Assets/Prefabs/RoomSystem"

Length of output: 1226

m_SortingOrder: 60
m_Sprite: {fileID: 1393557473, guid: 839b37de7ba78b044b490bdf2ac7c489, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
Expand Down
2 changes: 1 addition & 1 deletion Assets/Prefabs/UI/DialogueBox/Dialogue_vertical.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 1292551081983489310, guid: 2915528a48cff2a4f972254b123a3e0b, type: 3}
propertyPath: m_PresetInfoIsWorld
value: 1
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1675780870698966960, guid: 2915528a48cff2a4f972254b123a3e0b, type: 3}
propertyPath: m_SizeDelta.y
Expand Down
5 changes: 5 additions & 0 deletions Assets/Scenes/EmptyRoom_2.unity
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ MonoBehaviour:
stageText: {fileID: 1219144881}
blacksmithPrefab: {fileID: 181369798890271941, guid: e4326c266f4d3fc4482daabdf57ea4f3, type: 3}
altarPrefab: {fileID: 4671168421616932687, guid: 52d0b7df8b3db394988157e997abbc1f, type: 3}
waitingRoomPrefab: {fileID: 6577988205983815687, guid: 56b8e144977b94114b4eb95ac32bfe84, type: 3}
--- !u!1001 &1122242796
PrefabInstance:
m_ObjectHideFlags: 0
Expand All @@ -178,6 +179,10 @@ PrefabInstance:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 1151693853599494121, guid: a29b258ccf5dc90498df6e925ee2a3e5, type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4239213568335062079, guid: a29b258ccf5dc90498df6e925ee2a3e5, type: 3}
propertyPath: m_LocalPosition.x
value: 503.8351
Expand Down
45 changes: 45 additions & 0 deletions Assets/Scenes/UI/Menu.unity
Original file line number Diff line number Diff line change
Expand Up @@ -1134,6 +1134,7 @@ GameObject:
- component: {fileID: 1617862431}
- component: {fileID: 1617862430}
- component: {fileID: 1617862429}
- component: {fileID: 1617862432}
m_Layer: 0
m_Name: Main Camera
m_TagString: MainCamera
Expand Down Expand Up @@ -1215,6 +1216,50 @@ Transform:
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1617862432
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1617862428}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a79441f348de89743a2939f4d699eac1, type: 3}
m_Name:
m_EditorClassIdentifier:
m_RenderShadows: 1
m_RequiresDepthTextureOption: 2
m_RequiresOpaqueTextureOption: 2
m_CameraType: 0
m_Cameras: []
m_RendererIndex: -1
m_VolumeLayerMask:
serializedVersion: 2
m_Bits: 1
m_VolumeTrigger: {fileID: 0}
m_VolumeFrameworkUpdateModeOption: 2
m_RenderPostProcessing: 0
m_Antialiasing: 0
m_AntialiasingQuality: 2
m_StopNaN: 0
m_Dithering: 0
m_ClearDepth: 1
m_AllowXRRendering: 1
m_AllowHDROutput: 1
m_UseScreenCoordOverride: 0
m_ScreenSizeOverride: {x: 0, y: 0, z: 0, w: 0}
m_ScreenCoordScaleBias: {x: 0, y: 0, z: 0, w: 0}
m_RequiresDepthTexture: 0
m_RequiresColorTexture: 0
m_Version: 2
m_TaaSettings:
m_Quality: 3
m_FrameInfluence: 0.1
m_JitterScale: 1
m_MipBias: 0
m_VarianceClampScale: 0.9
m_ContrastAdaptiveSharpening: 0
--- !u!1 &1905536008
GameObject:
m_ObjectHideFlags: 0
Expand Down
17 changes: 17 additions & 0 deletions Assets/Scripts/GameTracker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ public class GameTracker : MonoBehaviour
public GameObject blacksmithPrefab;
public GameObject altarPrefab;

public GameObject waitingRoomPrefab;

// Points de spawn (ils seront trouvés dynamiquement)
private Transform blacksmithSpawnPoint;
private Transform altarSpawnPoint;
Expand All @@ -27,6 +29,8 @@ public class GameTracker : MonoBehaviour
private GameObject currentBlacksmith;
private GameObject currentAltar;

private GameObject waitingRoom;

void Start()
{
stageText.text = "Stage: " + stageCounter;
Expand All @@ -44,10 +48,23 @@ void Update()

public void NextStage()
{
if (stageCounter == 0)
{
instantiateWaitingRoom();
}
stageCounter++;
stageText.text = "Stage: " + stageCounter;
}

private void instantiateWaitingRoom()
{
waitingRoom = GameObject.Find("WaitingRoom");
if (waitingRoom == null && waitingRoomPrefab != null)
{
Instantiate(waitingRoomPrefab, new Vector3(0, 0, 0), Quaternion.identity);
}
}

Comment on lines +59 to +67
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Optimisez la recherche de la salle d'attente.

La méthode instantiateWaitingRoom() présente plusieurs problèmes :

  1. GameObject.Find() est coûteux en performances
  2. Absence de vérification de la position d'instanciation
  3. Pas de gestion des erreurs si waitingRoomPrefab est null

Suggestion de refactorisation :

     private void instantiateWaitingRoom()
     {
-        waitingRoom = GameObject.Find("WaitingRoom");
-        if (waitingRoom == null && waitingRoomPrefab != null)
+        if (waitingRoomPrefab == null)
+        {
+            Debug.LogError("Le préfab de la salle d'attente n'est pas assigné !");
+            return;
+        }
+
+        if (waitingRoom != null)
         {
-            Instantiate(waitingRoomPrefab, new Vector3(0, 0, 0), Quaternion.identity);
+            Debug.LogWarning("Une instance de la salle d'attente existe déjà !");
+            return;
         }
+
+        waitingRoom = Instantiate(waitingRoomPrefab, Vector3.zero, Quaternion.identity);
+        if (waitingRoom == null)
+        {
+            Debug.LogError("Échec de l'instanciation de la salle d'attente !");
+        }
     }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
private void instantiateWaitingRoom()
{
waitingRoom = GameObject.Find("WaitingRoom");
if (waitingRoom == null && waitingRoomPrefab != null)
{
Instantiate(waitingRoomPrefab, new Vector3(0, 0, 0), Quaternion.identity);
}
}
private void instantiateWaitingRoom()
{
if (waitingRoomPrefab == null)
{
Debug.LogError("Le préfab de la salle d'attente n'est pas assigné !");
return;
}
if (waitingRoom != null)
{
Debug.LogWarning("Une instance de la salle d'attente existe déjà !");
return;
}
waitingRoom = Instantiate(waitingRoomPrefab, Vector3.zero, Quaternion.identity);
if (waitingRoom == null)
{
Debug.LogError("Échec de l'instanciation de la salle d'attente !");
}
}


public void SpawnCorridorEvents()
{
Expand Down
8 changes: 8 additions & 0 deletions Assets/Scripts/Map Control/DoorSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ public class RoomManager : MonoBehaviour
private SocketIOUnity clientSocket;
public static bool isInCorridorX7 = false;

private bool isGameCreated = false;

private void Start()
{
clientSocket = SocketManager.Instance.ClientSocket;
Expand Down Expand Up @@ -56,6 +58,12 @@ private void OnTriggerEnter2D(Collider2D other)
}
if (newRoom.name.Contains("CorridorX7"))
{
if (!isGameCreated)
{
isGameCreated = true;
clientSocket.Emit("rooms:create");
}

Comment on lines +61 to +66
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Suggestions d'amélioration pour la gestion des événements socket

  1. La structure du code pourrait être améliorée pour réduire l'imbrication des conditions.
  2. Il manque une gestion des erreurs pour l'émission des événements socket.

Voici une suggestion de refactorisation :

 if (newRoom.name.Contains("CorridorX7"))
 {
-    if (!isGameCreated)
-    {
-        isGameCreated = true;
-        clientSocket.Emit("rooms:create");
-    }
+    EmitRoomCreationEventOnce();
     gameTracker.SpawnCorridorEvents();
     gameTracker.NextStage();
     isInCorridorX7 = true;
     SocketEmitter();
 }

Ajoutez cette nouvelle méthode :

private async void EmitRoomCreationEventOnce()
{
    if (isGameCreated) return;
    
    try 
    {
        await clientSocket.EmitAsync("rooms:create");
        isGameCreated = true;
    }
    catch (System.Exception e)
    {
        Debug.LogError($"Erreur lors de l'émission de l'événement rooms:create : {e.Message}");
    }
}

gameTracker.SpawnCorridorEvents();
gameTracker.NextStage();
isInCorridorX7 = true;
Expand Down
3 changes: 2 additions & 1 deletion Assets/Scripts/UI/Dialogue/DialogueManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ public void Update()

if (godPrefabDictionary.TryGetValue(godId, out GodInfo godInfo))
{
Debug.Log("NTR");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Améliorer la qualité des messages de débogage

Les messages de débogage "NTR" ne sont pas descriptifs et n'apportent aucune information utile pour le débogage. De plus, ils risquent de polluer les logs en production.

Suggestions d'amélioration :

- Debug.Log("NTR");
+ Debug.Log($"Message traité pour le dieu {godId}: {messageText.Substring(0, Math.Min(messageText.Length, 50))}...");
- Debug.Log("NTR");
+ Debug.Log($"Affichage du dialogue: {nextMessage.title} - {nextMessage.dialogue.Substring(0, Math.Min(nextMessage.dialogue.Length, 50))}...");

Also applies to: 106-106

EnqueueMessage(godInfo.godSprite, messageText, godInfo.godName);
}
else
Expand All @@ -102,7 +103,7 @@ private IEnumerator ProcessMessageQueue()
if (messageQueue.Count > 0 && !isDisplayingMessage)
{
GodMessage nextMessage = messageQueue.Dequeue();

Debug.Log("NTR");
DisplayDialogue(nextMessage.godSprite, nextMessage.dialogue, nextMessage.title);
isDisplayingMessage = true;

Expand Down
2 changes: 0 additions & 2 deletions Assets/Scripts/UI/MainMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ public void QuitGame()

public async void StartRoom()
{
await clientSocket.EmitAsync("rooms:create");

SceneManager.LoadScene(selectedScene);
}
}
Loading