瀏覽代碼

Deprecated warning fixed

Axel Nordh 4 月之前
父節點
當前提交
fc18237f59

+ 0 - 1
Assets/Scripts/Farm.cs

@@ -3,7 +3,6 @@ using UnityEngine;
 public class Farm : MonoBehaviour
 {
     [SerializeField] private int maxWorkers = 2;
-    [SerializeField] private float foodProductionRate = 1f;
     private int currentWorkers = 0;
 
     void Start()

+ 5 - 2
Assets/Scripts/GameUI.cs

@@ -399,8 +399,11 @@ public class GameUI : MonoBehaviour
             Debug.Log($"Assigned {currentSelectedVillager.name} to {job} (no specific workplace found)");
         }
 
-        // Update the villager panel to show new job
-        UpdateVillagerPanel(currentSelectedVillager);
+        // Deselect the villager to prevent accidental clicks
+        if (GameManager.Instance?.selectionManager != null)
+        {
+            GameManager.Instance.selectionManager.DeselectAll();
+        }
     }
 
     void ShowTemporaryMessage(string message)

+ 0 - 3
Assets/Scripts/ResourceNode.cs

@@ -28,7 +28,6 @@ public class ResourceNode : MonoBehaviour, ISelectable
     public GameObject selectionIndicator;
     public GameObject depletedVisual;
 
-    private bool isSelected = false;
     private float lastRegenerationTime;
 
     public bool IsAvailable => currentResources > 0;
@@ -155,14 +154,12 @@ public class ResourceNode : MonoBehaviour, ISelectable
 
     public void OnSelected()
     {
-        isSelected = true;
         if (selectionIndicator != null)
             selectionIndicator.SetActive(true);
     }
 
     public void OnDeselected()
     {
-        isSelected = false;
         if (selectionIndicator != null)
             selectionIndicator.SetActive(false);
     }

+ 5 - 2
Assets/Scripts/SelectionManager.cs

@@ -32,7 +32,7 @@ public class SelectionManager : MonoBehaviour
     {
         playerCamera = Camera.main;
         if (playerCamera == null)
-            playerCamera = FindObjectOfType<Camera>();
+            playerCamera = FindFirstObjectByType<Camera>();
     }
 
     void Update()
@@ -282,6 +282,9 @@ public class SelectionManager : MonoBehaviour
             // Assign job and specific workplace
             villagerManager.AssignVillagerToSpecificWorkplace(selectedVillager, newJob, dropTarget);
             Debug.Log($"Assigned {selectedVillager.villagerName} to {newJob} at specific {dropTarget.name}");
+
+            // Deselect to prevent accidental clicks
+            DeselectAll();
         }
     }
     public void SelectVillager(Villager villager)
@@ -385,7 +388,7 @@ public class SelectionManager : MonoBehaviour
         );
 
         // Find all villagers
-        Villager[] allVillagers = FindObjectsOfType<Villager>();
+        Villager[] allVillagers = FindObjectsByType<Villager>(FindObjectsSortMode.None);
         Villager firstVillager = null;
 
         foreach (Villager villager in allVillagers)

+ 2 - 2
Assets/Scripts/Villager.cs

@@ -286,7 +286,7 @@ public class Villager : MonoBehaviour
         if (currentJob == JobType.Farmer && homeBuilding != null)
         {
             // Check if there are fewer than 2 fields near the farmhouse
-            Field[] nearbyFields = FindObjectsOfType<Field>();
+            Field[] nearbyFields = FindObjectsByType<Field>(FindObjectsSortMode.None);
             int fieldsNearHome = 0;
             foreach (Field field in nearbyFields)
             {
@@ -514,7 +514,7 @@ public class Villager : MonoBehaviour
         if (assignedConstructionSite != null) return;
 
         // Find nearest construction site that needs a builder
-        ConstructionSite[] sites = FindObjectsOfType<ConstructionSite>();
+        ConstructionSite[] sites = FindObjectsByType<ConstructionSite>(FindObjectsSortMode.None);
         ConstructionSite nearestSite = null;
         float nearestDistance = float.MaxValue;
 

+ 1 - 1
Assets/Scripts/VillagerManager.cs

@@ -143,7 +143,7 @@ public class VillagerManager : MonoBehaviour
         // Handle Builder job differently since it doesn't use tags
         if (job == JobType.Builder)
         {
-            Building[] buildings = FindObjectsOfType<Building>();
+            Building[] buildings = FindObjectsByType<Building>(FindObjectsSortMode.None);
             List<GameObject> builderWorkplaces = new List<GameObject>();
             foreach (Building building in buildings)
             {

+ 1 - 0
Logs/shadercompiler-UnityShaderCompiler.exe-0.log

@@ -3,3 +3,4 @@ Cmd: initializeCompiler
 
 Cmd: initializeCompiler
 
+Cmd: shutdown

+ 1 - 0
ProjectSettings/TagManager.asset

@@ -11,6 +11,7 @@ TagManager:
   - Villager
   - Ground
   - ConstructionSite
+  - BuildingWorkshop
   layers:
   - Default
   - TransparentFX

+ 21 - 21
UserSettings/Layouts/default-6000.dwlt

@@ -19,7 +19,7 @@ MonoBehaviour:
     width: 3440
     height: 1349
   m_ShowMode: 4
-  m_Title: Game
+  m_Title: Console
   m_RootView: {fileID: 5}
   m_MinSize: {x: 875, y: 332}
   m_MaxSize: {x: 10000, y: 10000}
@@ -74,7 +74,7 @@ MonoBehaviour:
   m_MinSize: {x: 200, y: 50}
   m_MaxSize: {x: 16192, y: 8096}
   vertical: 0
-  controlID: 119
+  controlID: 117
   draggingID: 0
 --- !u!114 &4
 MonoBehaviour:
@@ -198,7 +198,7 @@ MonoBehaviour:
   m_MinSize: {x: 400, y: 100}
   m_MaxSize: {x: 32384, y: 16192}
   vertical: 0
-  controlID: 148
+  controlID: 146
   draggingID: 0
 --- !u!114 &9
 MonoBehaviour:
@@ -416,8 +416,8 @@ MonoBehaviour:
     m_TextWithWhitespace: "Game\u200B"
   m_Pos:
     serializedVersion: 2
-    x: 1589
-    y: 24
+    x: 1588
+    y: 79
     width: 1173
     height: 828
   m_SerializedDataModeController:
@@ -557,7 +557,7 @@ MonoBehaviour:
   m_Pos:
     serializedVersion: 2
     x: 0
-    y: 24
+    y: 79
     width: 618
     height: 828
   m_SerializedDataModeController:
@@ -574,9 +574,9 @@ MonoBehaviour:
   m_SceneHierarchy:
     m_TreeViewState:
       scrollPos: {x: 0, y: 0}
-      m_SelectedIDs: 
+      m_SelectedIDs: 70020000
       m_LastClickedID: 0
-      m_ExpandedIDs: 14fbffff
+      m_ExpandedIDs: 14fbfffff4ffffff
       m_RenameOverlay:
         m_UserAcceptedRename: 0
         m_Name: 
@@ -622,8 +622,8 @@ MonoBehaviour:
     m_TextWithWhitespace: "Scene\u200B"
   m_Pos:
     serializedVersion: 2
-    x: 620
-    y: 24
+    x: 619
+    y: 79
     width: 967
     height: 828
   m_SerializedDataModeController:
@@ -1371,7 +1371,7 @@ MonoBehaviour:
   m_Pos:
     serializedVersion: 2
     x: 0
-    y: 24
+    y: 933
     width: 1673
     height: 413
   m_SerializedDataModeController:
@@ -1396,7 +1396,7 @@ MonoBehaviour:
     m_SkipHidden: 0
     m_SearchArea: 1
     m_Folders:
-    - Assets
+    - Assets/Scripts
     m_Globs: []
     m_ProductIds: 
     m_AnyWithAssetOrigin: 0
@@ -1406,16 +1406,16 @@ MonoBehaviour:
   m_ViewMode: 1
   m_StartGridSize: 67
   m_LastFolders:
-  - Assets
+  - Assets/Scripts
   m_LastFoldersGridSize: 67
   m_LastProjectPath: C:\Users\Axel-PC\GathererOfSouls
   m_LockTracker:
     m_IsLocked: 0
   m_FolderTreeState:
     scrollPos: {x: 0, y: 0}
-    m_SelectedIDs: 30ac0000
-    m_LastClickedID: 44080
-    m_ExpandedIDs: 0000000030ac000032ac000034ac0000
+    m_SelectedIDs: 7ead0000
+    m_LastClickedID: 44414
+    m_ExpandedIDs: 0000000030ac000032ac000034ac000000ca9a3b
     m_RenameOverlay:
       m_UserAcceptedRename: 0
       m_Name: 
@@ -1472,7 +1472,7 @@ MonoBehaviour:
   m_ListAreaState:
     m_SelectedInstanceIDs: 
     m_LastClickedInstanceID: 0
-    m_HadKeyboardFocusLastEvent: 0
+    m_HadKeyboardFocusLastEvent: 1
     m_ExpandedInstanceIDs: c6230000040a0100d8ce000056ae000054e0000044bd00004eb500003cb1000000000000
     m_RenameOverlay:
       m_UserAcceptedRename: 0
@@ -1523,8 +1523,8 @@ MonoBehaviour:
     m_TextWithWhitespace: "Console\u200B"
   m_Pos:
     serializedVersion: 2
-    x: 1675
-    y: 24
+    x: 1674
+    y: 933
     width: 1087
     height: 413
   m_SerializedDataModeController:
@@ -1559,8 +1559,8 @@ MonoBehaviour:
     m_TextWithWhitespace: "Inspector\u200B"
   m_Pos:
     serializedVersion: 2
-    x: 2764
-    y: 24
+    x: 2763
+    y: 79
     width: 676
     height: 1267
   m_SerializedDataModeController: