Ver Fonte

Smal fixes with the UI on the mapScene

Axel Nordh há 8 meses atrás
pai
commit
59ee007f9f

+ 21 - 9
Assets/Resources/UI/Map/TravelUI.uss

@@ -1,16 +1,16 @@
 /* Travel UI Styles */
 .travel-container {
-    /* Position to the right side instead of center */
+    /* Full screen overlay that blocks all clicks */
     position: absolute !important;
-    top: 20px !important;
-    right: 20px !important;
-    left: auto !important;
-    bottom: auto !important;
-    width: auto !important;
-    height: auto !important;
+    top: 0 !important;
+    left: 0 !important;
+    right: 0 !important;
+    bottom: 0 !important;
+    width: 100% !important;
+    height: 100% !important;
     background-color: transparent !important;
-    justify-content: flex-start !important;
-    align-items: flex-start !important;
+    justify-content: center !important;
+    align-items: center !important;
     display: none;
 }
 
@@ -349,3 +349,15 @@
     white-space: nowrap;
     overflow: hidden;
 }
+
+/* Click blocker - invisible overlay that blocks all clicks */
+.click-blocker {
+    position: absolute;
+    top: 0;
+    left: 0;
+    right: 0;
+    bottom: 0;
+    width: 100%;
+    height: 100%;
+    background-color: rgba(0, 0, 0, 0); /* Transparent but still blocks clicks */
+}

+ 2 - 0
Assets/Resources/UI/Map/TravelUI.uxml

@@ -1,6 +1,8 @@
 <ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" editor-extension-mode="False">
     <Style src="project://database/Assets/UI/Map/TravelUI.uss?fileID=7433441132597879392&amp;guid=1e7ef30c959791b42ae6ef3a6741c9bd&amp;type=3#TravelUI" />
     <ui:VisualElement name="TravelContainer" class="travel-container" style="display: none; visibility: visible;">
+        <!-- Click-blocking overlay that covers the entire screen -->
+        <ui:VisualElement name="ClickBlocker" class="click-blocker" />
         <ui:VisualElement name="TravelPanel" class="travel-panel">
             <ui:VisualElement name="TravelHeader" class="travel-header">
                 <ui:Label text="Travel Planning" class="travel-title" />

+ 19 - 18
Assets/Scripts/UI/TravelUI.cs

@@ -18,6 +18,7 @@ public class TravelUI : MonoBehaviour
     // UI Elements
     private VisualElement travelContainer;
     private VisualElement travelPanel;
+    private VisualElement clickBlocker;
     private Label distanceLabel;
     private Label timeLabel;
     private Label specialCostsLabel;
@@ -106,6 +107,7 @@ public class TravelUI : MonoBehaviour
         // Find UI elements
         travelContainer = root.Q<VisualElement>("TravelContainer");
         travelPanel = root.Q<VisualElement>("TravelPanel");
+        clickBlocker = root.Q<VisualElement>("ClickBlocker");
         distanceLabel = root.Q<Label>("DistanceLabel");
         timeLabel = root.Q<Label>("TimeLabel");
         specialCostsLabel = root.Q<Label>("SpecialCostsLabel");
@@ -164,19 +166,19 @@ public class TravelUI : MonoBehaviour
             cancelTravelButton.clicked += OnCancelTravelClicked;
         }
 
-        // REMOVE THIS DUPLICATE HANDLER - it's conflicting with SetupClickBlocking()
-        // travelContainer.RegisterCallback<ClickEvent>(evt =>
-        // {
-        //     // Allow clicks on buttons and other interactive elements
-        //     if (evt.target is Button || evt.target.GetType().Name.Contains("Button"))
-        //     {
-        //         Debug.Log("🔓 TravelUI: Allowing click on button element");
-        //         return; // Don't stop propagation for buttons
-        //     }
-        //
-        //     Debug.Log("🛡️ TravelUI: TravelContainer blocking click - stopping propagation");
-        //     evt.StopPropagation(); // Prevent clicks from passing through to the map
-        // });
+        // Setup click blocking on the invisible overlay
+        if (clickBlocker != null)
+        {
+            clickBlocker.RegisterCallback<ClickEvent>(evt =>
+            {
+                Debug.Log("�️ TravelUI: Click blocked by overlay - stopping propagation");
+                evt.StopPropagation(); // Prevent clicks from passing through to the map
+            });
+        }
+        else
+        {
+            Debug.LogWarning("⚠️ TravelUI: ClickBlocker element not found!");
+        }
 
         // Hide UI initially
         HideTravelPanel();
@@ -249,11 +251,10 @@ public class TravelUI : MonoBehaviour
     /// </summary>
     private void SetupClickBlocking()
     {
-        // Using coordinate-based blocking only - no visual overlay needed
-        // The IsPointWithinUI() method will handle blocking map clicks
-        // UI elements will work normally without any overlay interference
-
-        Debug.Log("🔧 TravelUI: Using coordinate-based click blocking only - no visual overlay needed");
+        // The click blocker overlay handles blocking all clicks that aren't on UI elements
+        // This is already set up in SetupUI() via the clickBlocker element
+        
+        Debug.Log("🔧 TravelUI: Click blocking active - overlay will prevent map clicks");
     }
 
     /// <summary>

+ 19 - 8
Assets/UI/Map/TravelUI.uss

@@ -1,17 +1,16 @@
 /* Travel UI Styles */
 .travel-container {
-    /* Position to the left-center instead of right to avoid TeamOverview overlap */
+    /* Full screen overlay that blocks all clicks */
     position: absolute !important;
-    top: 50% !important;
-    left: 50% !important;
-    right: auto !important;
-    bottom: auto !important;
-    width: auto !important;
-    height: auto !important;
+    top: 0 !important;
+    left: 0 !important;
+    right: 0 !important;
+    bottom: 0 !important;
+    width: 100% !important;
+    height: 100% !important;
     background-color: transparent !important;
     justify-content: center !important;
     align-items: center !important;
-    transform: translate(-50%, -50%) !important;
     display: none;
 }
 
@@ -350,3 +349,15 @@
     white-space: nowrap;
     overflow: hidden;
 }
+
+/* Click blocker - invisible overlay that blocks all clicks */
+.click-blocker {
+    position: absolute;
+    top: 0;
+    left: 0;
+    right: 0;
+    bottom: 0;
+    width: 100%;
+    height: 100%;
+    background-color: rgba(0, 0, 0, 0); /* Transparent but still blocks clicks */
+}

+ 2 - 0
Assets/UI/Map/TravelUI.uxml

@@ -1,6 +1,8 @@
 <ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" editor-extension-mode="False">
     <Style src="project://database/Assets/UI/Map/TravelUI.uss?fileID=7433441132597879392&amp;guid=1e7ef30c959791b42ae6ef3a6741c9bd&amp;type=3#TravelUI" />
     <ui:VisualElement name="TravelContainer" class="travel-container" style="display: none; visibility: visible;">
+        <!-- Click-blocking overlay that covers the entire screen -->
+        <ui:VisualElement name="ClickBlocker" class="click-blocker" />
         <ui:VisualElement name="TravelPanel" class="travel-panel">
             <!-- Draggable Header -->
             <ui:VisualElement name="TravelHeader" class="travel-header">

+ 87 - 0
UNICODE_FONT_FIX_GUIDE.md

@@ -0,0 +1,87 @@
+# Solving Unicode Character Warning for Crossed Swords Symbol (⚔)
+
+## Problem
+The character with Unicode value \u2694 (crossed swords ⚔) was not found in the [LiberationSans SDF] font asset, causing it to be replaced with a square placeholder (□).
+
+## Solution Options
+
+### Option 1: Add Fallback Font (Recommended)
+1. **Download a Unicode Symbol Font:**
+   - Use Noto Color Emoji font from Google Fonts
+   - Use Segoe UI Symbol (Windows system font)
+   - Use Arial Unicode MS
+
+2. **Import Font into Unity:**
+   - Place font file in `Assets/Fonts/` directory
+   - Select the font in Project window
+   - In Inspector, set Font Size: 512, Sampling Point Size: Auto, Padding: 5
+   - Click "Generate Font Atlas"
+
+3. **Set up Fallback Font:**
+   - Open Window → TextMeshPro → Font Asset Creator
+   - Create a new TMP font asset from your symbol font
+   - Include Unicode range: 0x2600-0x26FF (Miscellaneous Symbols)
+   - Generate the font atlas
+
+4. **Configure Fallback in TMP Settings:**
+   - Go to Edit → Project Settings → TextMeshPro → Settings
+   - In "Fallback Font Assets" list, add your new symbol font
+   - OR directly assign to specific text components
+
+### Option 2: Use Alternative Characters
+Replace the crossed swords symbol with text alternatives:
+- "⚔" → "X" or "VS" or "v"
+- "⚔" → "[COMBAT]" or "BATTLE"
+- Use TextMeshPro rich text: `<sprite name="sword">` if you have sprite assets
+
+### Option 3: Create Custom Font Atlas
+1. Use FontForge or similar tool to add the missing character to LiberationSans
+2. Or create a comprehensive font that includes all needed symbols
+
+### Option 4: Use Sprite Assets Instead
+1. Create a sprite image of crossed swords
+2. Import as TMP Sprite Asset
+3. Use `<sprite="crossed_swords">` in text instead of Unicode character
+
+## Implementation Steps for Option 1:
+
+### Step 1: Download Noto Emoji Font
+```bash
+# Download from Google Fonts or use system fonts
+# Windows: C:\Windows\Fonts\seguisym.ttf (Segoe UI Symbol)
+```
+
+### Step 2: Create TMP Font Asset
+1. Window → TextMeshPro → Font Asset Creator
+2. Source Font File: Select your symbol font
+3. Sampling Point Size: Auto Sizing
+4. Character Set: Unicode Range
+5. Character Sequence (Hex): 2600-26FF
+6. Render Mode: SDFAA
+7. Generate Font Atlas
+
+### Step 3: Configure Fallback
+Add to TMP Settings or assign directly to text components that need symbols.
+
+## Quick Fix for Development
+If you want a quick temporary fix, you can replace the character in your code:
+
+```csharp
+// Replace crossed swords with alternative
+string text = originalText.Replace("⚔", "[X]");
+// or
+string text = originalText.Replace("\u2694", "VS");
+```
+
+## Finding the Source
+To find where this character is being used, search your project for:
+- "⚔" (the actual character)
+- "\u2694" (Unicode escape)
+- Any text files or scripts that might be setting this character
+
+The warning indicates it's in a text object named "Title", so check:
+- UI elements named "Title"
+- TextMeshPro components in your scenes
+- Dynamic text setting in scripts
+
+This should resolve the Unicode character warning and properly display symbols in your game.

+ 6 - 6
UserSettings/EditorUserSettings.asset

@@ -12,22 +12,22 @@ EditorUserSettings:
       value: 01530d5351035e5a0b595e2614725b44134e49722d2c25607b794935e6b76369
       flags: 0
     RecentlyUsedSceneGuid-1:
-      value: 5a08575f5207595a0f5d59741173094444164f7d7d2a23317c7a4465bbe1646d
+      value: 5655020755505a0d5e0a5577457b0a44154f1a7f2a7e70697e284b30e4b2623b
       flags: 0
     RecentlyUsedSceneGuid-2:
-      value: 5309060006570d5f0c580e2715270c44144e1c722a7d20612c2d4b37b1b4643a
+      value: 510500025d560a0c095d092111730d44464f4b78757b72357a701c31b7b16368
       flags: 0
     RecentlyUsedSceneGuid-3:
-      value: 5655020755505a0d5e0a5577457b0a44154f1a7f2a7e70697e284b30e4b2623b
+      value: 51020c5550545a0354575e7b47270744174e4b787e2b77687b7e1b37e7e4366d
       flags: 0
     RecentlyUsedSceneGuid-4:
-      value: 5a090503000558580f0d557342700844144f4d7c7b7d74692c281e63b0e2623c
+      value: 5309060006570d5f0c580e2715270c44144e1c722a7d20612c2d4b37b1b4643a
       flags: 0
     RecentlyUsedSceneGuid-5:
-      value: 510500025d560a0c095d092111730d44464f4b78757b72357a701c31b7b16368
+      value: 5a08575f5207595a0f5d59741173094444164f7d7d2a23317c7a4465bbe1646d
       flags: 0
     RecentlyUsedSceneGuid-6:
-      value: 51020c5550545a0354575e7b47270744174e4b787e2b77687b7e1b37e7e4366d
+      value: 5a090503000558580f0d557342700844144f4d7c7b7d74692c281e63b0e2623c
       flags: 0
     vcSharedLogLevel:
       value: 0d5e400f0650