Skip to content

Commit 1e01173

Browse files
committed
fix: changing styling, layering and size of settingPanelCanvasUITK UI elements; fixing naming and button execution in scripts
1 parent 815effe commit 1e01173

File tree

8 files changed

+100
-100
lines changed

8 files changed

+100
-100
lines changed

Assets/Prefabs/UI/UIToolkit/SettingsPanelCanvasUITK.prefab

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ MonoBehaviour:
4949
m_PanelSettings: {fileID: 11400000, guid: 30704bc49d34869449e8bfdb3ab57841, type: 2}
5050
m_ParentUI: {fileID: 0}
5151
sourceAsset: {fileID: 9197481963319205126, guid: b3d4e0fc4dc0779409b489ef4872ba77, type: 3}
52-
m_SortingOrder: 0
52+
m_SortingOrder: 1
5353
m_WorldSpaceSizeMode: 1
5454
m_WorldSpaceWidth: 1920
5555
m_WorldSpaceHeight: 1080

Assets/Prefabs/UI/UIToolkit/USS/GeneralUI.uss

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,26 @@
4848
border-left-width: 0;
4949
width: 408px;
5050
height: 90px;
51+
-unity-text-align: middle-center;
5152
}
5253

5354
.menuButton:active {
5455
-unity-font-definition: url("project://database/Assets/TextMesh%20Pro/Fonts/Bungee-Regular.ttf?fileID=12800000&guid=b8a509d3b3ce60847bbafb5a38462ecf&type=3#Bungee-Regular");
5556
color: rgb(247, 213, 32);
56-
-unity-background-image-tint-color: rgb(128, 128, 128);
57+
-unity-background-image-tint-color: rgb(144, 144, 144);
58+
}
59+
60+
.menuButton:disabled {
61+
background-image: url("project://database/Assets/Textures/UI/ui_btn_blank.png?fileID=2800000&guid=41948b4cc6087644b983dce55b466d50&type=3#ui_btn_blank");
62+
-unity-font-definition: url("project://database/Assets/TextMesh%20Pro/Fonts/Bungee-Regular.ttf?fileID=12800000&guid=b8a509d3b3ce60847bbafb5a38462ecf&type=3#Bungee-Regular");
63+
color: rgb(247, 213, 32);
64+
font-size: 190%;
65+
background-color: rgba(0, 0, 0, 0);
66+
border-top-width: 0;
67+
border-right-width: 0;
68+
border-bottom-width: 0;
69+
border-left-width: 0;
70+
width: 408px;
71+
height: 90px;
72+
-unity-background-image-tint-color: rgb(164, 164, 164);
5773
}

Assets/Prefabs/UI/UIToolkit/USS/SettingsPanelCanvas.uss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,5 @@
5454
height: 376px;
5555
position: absolute;
5656
top: -156px;
57-
right: 111px;
57+
right: -764px;
5858
}

Assets/Prefabs/UI/UIToolkit/UXML/SettingsPanelCanvas.uxml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<engine:Button name="quitButton" class="simpleButton ExitButton exitButton" style="background-size: 70% 70%; margin-top: 0; margin-right: 0; margin-bottom: 0; margin-left: 0; padding-top: 0; padding-right: 0; padding-bottom: 0; padding-left: 0;" />
66
<engine:Button name="settingsButton" class="settingsButton" style="background-size: 70% 70%; margin-top: 0; margin-right: 0; margin-bottom: 0; margin-left: 0; padding-top: 0; padding-right: 0; padding-bottom: 0; padding-left: 0;" />
77
</engine:VisualElement>
8-
<engine:VisualElement name="root" style="flex-grow: 1;">
8+
<engine:VisualElement name="root" style="flex-grow: 1; width: 335px; height: 103px;">
99
<engine:VisualElement name="settingsPanelRoot" class="panel" style="scale: 0.8 0.8;">
1010
<engine:Button name="closeButton" class="ExitButton exitButton" style="position: absolute; top: -10px; right: -64px; background-size: 90% 90%; visibility: visible; overflow: visible;" />
1111
<engine:Label text="Settings" name="settingsLabel" class="settingsLabel label" style="margin-bottom: 8px;" />

Assets/Scenes/PostGame.unity

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:7e534777638d85f5d4ae6fb3694efe209e4e7208e38811cd2479d1aacbc8029e
3-
size 36125
2+
oid sha256:62f3d6e8211c3f6077a052be1427d998c2e87db9ae673cf3207195e58b03d0dd
3+
size 36846

Assets/Scripts/Gameplay/GameState/NetworkPostGame.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using Unity.BossRoom.Gameplay.UI;
33
using Unity.Netcode;
4+
using UnityEngine;
45
using VContainer;
56

67
namespace Unity.BossRoom.Gameplay.GameState
@@ -11,15 +12,15 @@ public class NetworkPostGame : NetworkBehaviour
1112

1213
[Inject]
1314
PostGameUI m_PostGameUI;
14-
15+
1516
[Inject]
1617
PersistentGameState m_PersistentGameState;
1718

1819
public override void OnNetworkSpawn()
1920
{
2021
// only hosts can restart the game, other players see a wait message
2122
m_PostGameUI.Initialize(IsHost);
22-
23+
2324
if (IsServer)
2425
{
2526
WinState.Value = m_PersistentGameState.WinState;

Assets/Scripts/Gameplay/UI/PostGameUI.cs

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,33 +14,34 @@ public class PostGameUI : MonoBehaviour
1414
{
1515
[SerializeField]
1616
UIDocument m_PostGameUIDocument;
17-
18-
[SerializeField]
19-
UIDocument m_MessageFeedDocument;
2017

2118
ServerPostGameState m_PostGameState;
22-
19+
2320
Label m_WinEndMessage;
2421
Label m_LoseGameMessage;
2522
Button m_ReplayButton;
26-
Button m_WaitOnHostMsg;
23+
Button m_WaitOnHostButton;
24+
Button m_MainMenuButton;
25+
2726
VisualElement m_MessageFeed;
2827
ListView m_MessageList;
29-
/*VisualElement m_SceneLight;
30-
Color m_WinLightColor;
31-
Color m_LoseLightColor;*/
3228

3329
void Awake()
3430
{
3531
var root = m_PostGameUIDocument.rootVisualElement;
36-
32+
3733
m_WinEndMessage = root.Q<Label>("gameWinText");
3834
m_LoseGameMessage = root.Q<Label>("gameLostText");
3935
m_ReplayButton = root.Q<Button>("playAgainBtn");
40-
m_WaitOnHostMsg = root.Q<Button>("waitOnHostBtn");
41-
42-
m_WinEndMessage.style.display = DisplayStyle.None;
43-
m_LoseGameMessage.style.display = DisplayStyle.None;
36+
m_WaitOnHostButton = root.Q<Button>("waitOnHostBtn");
37+
m_MainMenuButton = root.Q<Button>("menuBtn");
38+
39+
m_WaitOnHostButton.SetEnabled(false);
40+
m_ReplayButton.SetEnabled(true);
41+
m_MainMenuButton.SetEnabled(true);
42+
43+
m_ReplayButton.clicked += OnPlayAgainClicked;
44+
m_MainMenuButton.clicked += OnMainMenuClicked;
4445
}
4546

4647
[Inject]
@@ -54,14 +55,16 @@ public void Initialize(bool isHost)
5455
// only hosts can restart the game, other players see a wait message
5556
if (isHost)
5657
{
57-
m_ReplayButton.SetEnabled(true);
58-
m_WaitOnHostMsg.SetEnabled(false);
58+
m_ReplayButton.style.display = DisplayStyle.Flex;
59+
m_WaitOnHostButton.style.display = DisplayStyle.None;
60+
m_MainMenuButton.style.display = DisplayStyle.Flex;
5961
}
60-
62+
6163
else
6264
{
63-
m_ReplayButton.SetEnabled(false);
64-
m_WaitOnHostMsg.SetEnabled(true);
65+
m_ReplayButton.style.display = DisplayStyle.None;
66+
m_WaitOnHostButton.style.display = DisplayStyle.Flex;
67+
m_MainMenuButton.style.display = DisplayStyle.Flex;
6568
}
6669
}
6770

@@ -88,14 +91,11 @@ void SetPostGameUI(WinState winState)
8891
{
8992
switch (winState)
9093
{
91-
// Set end message and background color based last game outcome
9294
case WinState.Win:
93-
// m_SceneLight.color = m_WinLightColor;
9495
m_WinEndMessage.SetEnabled(true);
9596
m_LoseGameMessage.SetEnabled(false);
9697
break;
9798
case WinState.Loss:
98-
//m_SceneLight.color = m_LoseLightColor;
9999
m_WinEndMessage.SetEnabled(false);
100100
m_LoseGameMessage.SetEnabled(true);
101101
break;
@@ -115,4 +115,4 @@ public void OnMainMenuClicked()
115115
m_PostGameState.GoToMainMenu();
116116
}
117117
}
118-
}
118+
}

0 commit comments

Comments
 (0)