Skip to content

Commit 096fe3c

Browse files
committed
Refactor UI panels and update HUD styles
Reworked the structure and styling of building and vehicle details panels in the GameHUD. Updated UXML files to use 'dynamic-content' instead of 'info-panel' for content containers, and improved the GameHUDStyles.uss with new classes for top bar, side panel, and dynamic content. Adjusted labels and layout for clarity and consistency. Added template references in SampleScene.unity for main station, hangar, and energy tower.
1 parent dc7446a commit 096fe3c

File tree

6 files changed

+64
-46
lines changed

6 files changed

+64
-46
lines changed

Red Strike/Assets/Scenes/SampleScene.unity

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,9 @@ MonoBehaviour:
490490
m_Name:
491491
m_EditorClassIdentifier:
492492
inputController: {fileID: 1556403732}
493+
mainStationTemplate: {fileID: 9197481963319205126, guid: 7e5b2e72160062249ab83c27bd5a52e7, type: 3}
494+
hangarTemplate: {fileID: 9197481963319205126, guid: 5a649d49f0f531a49a7cdedc28d5fce4, type: 3}
495+
energyTowerTemplate: {fileID: 9197481963319205126, guid: 11d450df22e338a49886331ef99c2108, type: 3}
493496
--- !u!1 &460729958
494497
GameObject:
495498
m_ObjectHideFlags: 0

Red Strike/Assets/UISystem/EnergyTowerDetailsContent.uxml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<ui:UXML xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" noNamespaceSchemaLocation="../../UIElementsSchema/UIElements.xsd" editor-extension-mode="False">
22
<Style src="project://database/Assets/UISystem/GameHUDStyles.uss?fileID=7433441132597879392&amp;guid=76481a45a761bb147acf1059658d7ddd&amp;type=3#GameHUDStyles" />
3-
<ui:VisualElement name="root-container" style="flex-grow: 1;">
4-
<ui:VisualElement name="energy-tower-content" class="info-panel">
3+
<ui:VisualElement name="root-container">
4+
<ui:VisualElement name="energy-tower-content" class="dynamic-content">
55
<ui:Label text="Capacity:" name="capacity-label" class="details-text" />
66
<ui:Label text="Density:" name="density-label" class="details-text" />
77
</ui:VisualElement>

Red Strike/Assets/UISystem/GameHUD.uxml

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,36 @@
11
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:engine="UnityEngine.UIElements" editor-extension-mode="False">
22
<Style src="project://database/Assets/UI%20Toolkit/GameHUDStyles.uss?fileID=7433441132597879392&amp;guid=76481a45a761bb147acf1059658d7ddd&amp;type=3#GameHUDStyles" />
3-
<ui:VisualElement name="root-container" style="width: 100%; height: 100%; justify-content: space-between; align-items: stretch;">
4-
<ui:VisualElement name="top-bar-container" style="height: 30px; background-color: rgba(20, 20, 20, 0.9);" />
5-
<ui:VisualElement name="middle-content" style="flex-grow: 1;" />
3+
<ui:VisualElement name="root-container" style="width: 100%; height: 100%;">
64

5+
<!-- TOP BAR -->
6+
<ui:VisualElement name="top-bar-container" class="top-bar" />
7+
8+
<!-- SIDE PANEL (LEFT) -->
79
<ui:VisualElement name="left-panel" class="side-panel">
810
<ui:Button text="Main Station" name="main-station-button" class="build-button" />
911
<ui:Button text="Hangar" name="hangar-button" class="build-button" />
1012
<ui:Button text="Energy Tower" name="energy-tower-button" class="build-button" />
1113
</ui:VisualElement>
1214

15+
<!-- BUILDING DETAILS PANEL (RIGHT) -->
1316
<ui:VisualElement name="building-details-panel" class="info-panel" visible="false">
1417
<ui:Label text="Build Type:" name="shared-build-type-label" class="details-title" />
1518
<ui:Label text="Health:" name="shared-health-label" class="details-text" />
1619

17-
<ui:VisualElement name="building-dynamic-content-container" />
20+
<!-- CONTENT AREA (dynamic) -->
21+
<ui:VisualElement name="building-dynamic-content-container" class="dynamic-content" />
1822
</ui:VisualElement>
1923

24+
<!-- VEHICLE DETAILS PANEL (RIGHT) -->
2025
<ui:VisualElement name="vehicle-details-panel" class="info-panel" visible="false">
21-
<ui:Label text="Vehicle Type:" name="shared-vehicle-type-label" class="details-title" />
22-
<ui:Label text="Health:" name="shared-health-label" class="details-text" />
23-
<ui:Label text="Target:" name="shared-target-label" class="details-text" />
24-
<ui:Label text="Fuel:" name="shared-fuel-label" class="details-text" />
25-
<ui:Label text="Bullets:" name="shared-bullets-label" class="details-text" />
26+
<ui:Label text="Vehicle:" name="shared-vehicle-name-label" class="details-title" />
27+
<ui:Label text="Health:" name="shared-vehicle-health-label" class="details-text" />
28+
<ui:Label text="Fuel:" name="shared-vehicle-fuel-label" class="details-text" />
29+
<ui:Label text="Ammunition:" name="shared-vehicle-ammo-label" class="details-text" />
30+
<ui:Label text="Target:" name="shared-vehicle-target-label" class="details-text" />
2631

27-
<ui:VisualElement name="vehicle-dynamic-content-container" />
32+
<!-- CONTENT AREA (dynamic) -->
33+
<ui:VisualElement name="vehicle-dynamic-content-container" class="dynamic-content" />
2834
</ui:VisualElement>
2935

3036
</ui:VisualElement>
Lines changed: 39 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,76 @@
1+
/* TOP BAR ------------------------------------------------------- */
2+
3+
.top-bar {
4+
position: absolute;
5+
top: 0;
6+
left: 0;
7+
right: 0;
8+
height: 30px;
9+
background-color: rgba(20, 20, 20, 0.9);
10+
}
11+
12+
/* LEFT PANEL ----------------------------------------------------- */
13+
114
.side-panel {
215
position: absolute;
316
left: 20px;
417
top: 50px;
518
flex-direction: column;
619
}
720

21+
/* DETAILS PANELS (RIGHT) ---------------------------------------- */
22+
823
.info-panel {
924
position: absolute;
1025
right: 20px;
1126
top: 50px;
1227
background-color: rgba(45, 45, 45, 0.85);
1328
padding: 15px;
1429
border-radius: 5px;
15-
min-width: 200px;
30+
min-width: 240px;
31+
height: auto;
1632
}
1733

18-
.unit-panel {
19-
position: absolute;
20-
bottom: 20px;
21-
left: 50%;
22-
transform: translateX(-50%);
23-
flex-direction: row;
34+
.dynamic-content {
35+
margin-top: 10px;
36+
padding-top: 10px;
37+
border-top-width: 1px;
38+
border-top-color: rgba(255, 255, 255, 0.2);
39+
width: 100%;
2440
}
2541

42+
/* BUTTONS --------------------------------------------------------- */
43+
2644
.build-button {
27-
width: 120px;
28-
height: 50px;
29-
background-color: rgba(60, 60, 60, 0.9);
45+
width: 140px;
46+
height: 45px;
47+
background-color: rgba(60,60,60,0.9);
3048
color: white;
3149
border-width: 0;
32-
border-radius: 3px;
50+
border-radius: 4px;
3351
margin-bottom: 10px;
3452
font-size: 14px;
3553
}
3654

37-
.unit-button {
38-
height: 60px;
39-
background-color: rgba(60, 60, 60, 0.9);
40-
color: white;
41-
border-width: 0;
42-
border-radius: 3px;
43-
margin: 0 4px;
44-
font-size: 14px;
45-
-unity-text-align: middle-center;
46-
white-space: normal;
55+
.build-button:hover {
56+
background-color: rgba(90, 90, 90, 0.95);
4757
}
4858

49-
.unit-button--large { width: 130px; font-size: 18px; }
50-
.unit-button--medium { width: 100px; }
51-
.unit-button--small { width: 80px; font-size: 12px; }
59+
.build-button:active {
60+
background-color: rgba(120, 120, 120, 1);
61+
}
5262

53-
.build-button:hover, .unit-button:hover { background-color: rgba(90, 90, 90, 0.95); }
54-
.build-button:active, .unit-button:active { background-color: rgba(120, 120, 120, 1); }
63+
/* TEXT STYLES --------------------------------------------------- */
5564

5665
.details-title {
5766
color: white;
58-
font-size: 24px;
67+
font-size: 20px;
5968
-unity-font-style: bold;
60-
margin-bottom: 10px;
69+
margin-bottom: 6px;
6170
}
6271

6372
.details-text {
6473
color: rgb(220, 220, 220);
6574
font-size: 14px;
66-
margin-bottom: 5px;
67-
}
75+
margin-bottom: 4px;
76+
}

Red Strike/Assets/UISystem/HangarDetailsContent.uxml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<ui:UXML xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" noNamespaceSchemaLocation="../../UIElementsSchema/UIElements.xsd" editor-extension-mode="False">
22
<Style src="project://database/Assets/UISystem/GameHUDStyles.uss?fileID=7433441132597879392&amp;guid=76481a45a761bb147acf1059658d7ddd&amp;type=3#GameHUDStyles" />
3-
<ui:VisualElement name="root-container" style="flex-grow: 1;">
4-
<ui:VisualElement name="hangar-content" class="info-panel">
3+
<ui:VisualElement name="root-container">
4+
<ui:VisualElement name="hangar-content" class="dynamic-content">
55
<ui:Label text="Is Ready:" name="is-ready-label" class="details-text" />
66
<ui:Label text="In production:" name="in-production-label" class="details-text" />
77
</ui:VisualElement>

Red Strike/Assets/UISystem/MainStationDetailsContent.uxml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<ui:UXML xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" noNamespaceSchemaLocation="../../UIElementsSchema/UIElements.xsd" editor-extension-mode="False">
22
<Style src="project://database/Assets/UISystem/GameHUDStyles.uss?fileID=7433441132597879392&amp;guid=76481a45a761bb147acf1059658d7ddd&amp;type=3#GameHUDStyles" />
3-
<ui:VisualElement name="root-container" style="flex-grow: 1;">
4-
<ui:VisualElement name="main-station-content" class="info-panel">
3+
<ui:VisualElement name="root-container">
4+
<ui:VisualElement name="main-station-content" class="dynamic-content">
55
<ui:Label text="Shield:" name="shield-label" class="details-text" />
66
</ui:VisualElement>
77
</ui:VisualElement>

0 commit comments

Comments
 (0)