Skip to content

Commit 9d7b634

Browse files
committed
Add victory panel and unify game status HUD controller
Introduces a new victory panel to the GameHUD with corresponding styles and UI elements. Refactors GameOverHUDController to GameStatusHUDController to handle both game over and victory states, updating references and logic accordingly. Updates material sun direction values and scene references to match the new controller.
1 parent 9bd414a commit 9d7b634

File tree

11 files changed

+78
-14
lines changed

11 files changed

+78
-14
lines changed

Red Strike/Assets/GameStateSystem/GameStateManager.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,7 @@ public void GameOver()
2727
{
2828
Debug.Log("Oyun Bitti!");
2929
CurrentState = GameState.GameOver;
30-
UISystem.GameOverHUDController gameOverHUDController = FindAnyObjectByType<UISystem.GameOverHUDController>();
31-
if (gameOverHUDController != null)
32-
{
33-
gameOverHUDController.ShowGameOverPanel();
34-
}
30+
FindAnyObjectByType<UISystem.GameStatusHUDController>().ShowGameOverPanel();
3531
CommanderData.LocalCommander?.OnDisconnect();
3632
}
3733
}

Red Strike/Assets/PlanetAtmosphereSystem/AtmosphereMaterial.mat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Material:
4747
- _GunesYonu: {r: -0.91, g: 0.4, b: 3.24, a: 0}
4848
- _RenkUzak: {r: 0, g: 0.10166844, b: 2.152374, a: 1}
4949
- _RenkYakin: {r: 0, g: 5.670685, b: 8, a: 1}
50-
- _SunDirection: {r: -0.04795202, g: -0.9484175, b: 0.31337708, a: 0}
50+
- _SunDirection: {r: -0.09429583, g: -0.8149934, b: 0.5717467, a: 0}
5151
m_BuildTextureStacks: []
5252
m_AllowLocking: 1
5353
--- !u!114 &1522106816477559216

Red Strike/Assets/PlanetAtmosphereSystem/CloudMaterial.mat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Material:
4343
m_Colors:
4444
- _Color: {r: 0, g: 3.8274493, b: 5.992155, a: 1}
4545
- _GunesYonu: {r: -1, g: 0, b: 0, a: 0}
46-
- _SunDirection: {r: -0.04795202, g: -0.9484175, b: 0.31337708, a: 0}
46+
- _SunDirection: {r: -0.09429583, g: -0.8149934, b: 0.5717467, a: 0}
4747
m_BuildTextureStacks: []
4848
m_AllowLocking: 1
4949
--- !u!114 &8499732345945835446

Red Strike/Assets/PlanetAtmosphereSystem/FogMaterial.mat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,6 @@ Material:
5454
- _QueueControl: 0
5555
- _QueueOffset: 0
5656
m_Colors:
57-
- _SunDirection: {r: -0.04795202, g: -0.9484175, b: 0.31337708, a: 0}
57+
- _SunDirection: {r: -0.09429583, g: -0.8149934, b: 0.5717467, a: 0}
5858
m_BuildTextureStacks: []
5959
m_AllowLocking: 1

Red Strike/Assets/Scenes/BluePlanetArea.unity

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1583280,7 +1583280,7 @@ MonoBehaviour:
15832801583280
m_GameObject: {fileID: 2126698095}
15832811583281
m_Enabled: 1
15832821583282
m_EditorHideFlags: 0
1583283-
m_Script: {fileID: 11500000, guid: 508797d78c25d0a41a624e12108fe2c7, type: 3}
1583283+
m_Script: {fileID: 11500000, guid: 14c1e9364681d8a4dbb53c6fbb5dbf6f, type: 3}
15832841583284
m_Name:
15832851583285
m_EditorClassIdentifier:
15832861583286
--- !u!1001 &2126960356

Red Strike/Assets/UISystem/GameHUD.uxml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,13 @@
5656
<ui:Button text="Return to Main Menu" name="return-to-menu-button" class="overlay-button" />
5757
</ui:VisualElement>
5858

59+
<!-- VICTORY PANEL -->
60+
<ui:VisualElement name="victory-panel" class="overlay-panel" style="display: none;" picking-mode="Position">
61+
<ui:Label text="VICTORY!" name="victory-title" class="victory-title" />
62+
<ui:Label text="Mission Accomplished, Commander." name="victory-message" class="overlay-message" />
63+
<ui:Button text="Menu" name="victory-menu-button" class="victory-secondary-button" />
64+
</ui:VisualElement>
65+
5966
<!-- FADE PANEL -->
6067
<ui:VisualElement name="fade-panel" class="fade-panel" style="display: none;" />
6168
</ui:VisualElement>

Red Strike/Assets/UISystem/GameHUDController.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ public class GameHUDController : MonoBehaviour
1212
protected VisualElement vehicleDynamicContentContainer;
1313
protected VisualElement gameOverPanel;
1414
protected VisualElement fadePanel;
15+
protected VisualElement victoryPanel;
1516

1617
private void Start()
1718
{
@@ -33,6 +34,7 @@ protected virtual void OnEnable()
3334
vehicleDynamicContentContainer = root.Q<VisualElement>("vehicle-dynamic-content-container");
3435
gameOverPanel = root.Q<VisualElement>("game-over-panel");
3536
fadePanel = root.Q<VisualElement>("fade-panel");
37+
victoryPanel = root.Q<VisualElement>("victory-panel");
3638
}
3739

3840
protected virtual void OnDisable() { }

Red Strike/Assets/UISystem/GameHUDStyles.uss

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,4 +164,51 @@
164164
transition-duration: 6s;
165165
transition-timing-function: ease-in-out;
166166
display: flex;
167-
}
167+
}
168+
169+
/* Zafer Başlığı (Yeşil/Altın) */
170+
.victory-title {
171+
color: rgb(255, 215, 0); /* Gold rengi */
172+
font-size: 36px;
173+
-unity-font-style: bold;
174+
margin-bottom: 15px;
175+
text-shadow: 0px 0px 10px rgba(255, 215, 0, 0.5);
176+
}
177+
178+
/* Devam Et Butonu (Yeşil) */
179+
.victory-button {
180+
width: 140px;
181+
height: 45px;
182+
background-color: rgb(46, 139, 87);
183+
color: white;
184+
border-width: 0;
185+
border-radius: 6px;
186+
font-size: 14px;
187+
-unity-font-style: bold;
188+
margin-right: 5px;
189+
}
190+
191+
.victory-button:hover {
192+
background-color: rgb(60, 179, 113);
193+
scale: 1.05;
194+
}
195+
196+
.victory-button:active {
197+
background-color: rgb(34, 100, 60);
198+
}
199+
200+
/* Menü Butonu (Daha sönük) */
201+
.victory-secondary-button {
202+
width: 100px;
203+
height: 45px;
204+
background-color: rgba(100, 100, 100, 0.8);
205+
color: white;
206+
border-width: 0;
207+
border-radius: 6px;
208+
font-size: 14px;
209+
margin-left: 5px;
210+
}
211+
212+
.victory-secondary-button:hover {
213+
background-color: rgba(120, 120, 120, 1);
214+
}

Red Strike/Assets/UISystem/GameOverHUDController.cs.meta

Lines changed: 0 additions & 2 deletions
This file was deleted.

Red Strike/Assets/UISystem/GameOverHUDController.cs renamed to Red Strike/Assets/UISystem/GameStatusHUDController.cs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,29 @@
1+
using UnityEngine;
12
using UnityEngine.UIElements;
23
using UnityEngine.SceneManagement;
34

45
namespace UISystem
56
{
6-
public class GameOverHUDController : GameHUDController
7+
public class GameStatusHUDController : GameHUDController
78
{
89
protected override void OnEnable()
910
{
1011
base.OnEnable();
1112

1213
var returnToMenuButton = root.Q<Button>("return-to-menu-button");
14+
if (returnToMenuButton != null) returnToMenuButton.clicked += () => { StartFadeIn(); Invoke(nameof(GoToMenu), 4.5f); };
1315

14-
if (returnToMenuButton != null) returnToMenuButton.clicked += () => {StartFadeIn(); Invoke(nameof(GoToMenu), 4.5f); };
16+
var victoryMenuButton = root.Q<Button>("victory-menu-button");
17+
if (victoryMenuButton != null) victoryMenuButton.clicked += () => { StartFadeIn(); Invoke(nameof(GoToMenu), 4.5f); };
18+
}
19+
20+
public void ShowVictoryPanel()
21+
{
22+
if (victoryPanel != null)
23+
{
24+
victoryPanel.style.display = DisplayStyle.Flex;
25+
fadePanel.style.opacity = 1f;
26+
}
1527
}
1628

1729
public void ShowGameOverPanel()

0 commit comments

Comments
 (0)