-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
609 additions
and
497 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
using Godot; | ||
using System; | ||
|
||
public class GameOverScreen : CanvasLayer | ||
{ | ||
// Declare member variables here. Examples: | ||
// private int a = 2; | ||
// private string b = "text"; | ||
|
||
Game MyGame; | ||
CanvasLayer ourGui; | ||
Serilog.Core.Logger _serilogger; | ||
|
||
// Called when the node enters the scene tree for the first time. | ||
public override void _Ready() | ||
{ | ||
MyGame = GetNode<Game>("/root/Game"); | ||
_serilogger = MyGame._serilogger; | ||
|
||
ourGui = MyGame.GetNode<CanvasLayer>("GUI"); | ||
} | ||
|
||
// // Called every frame. 'delta' is the elapsed time since the previous frame. | ||
// public override void _Process(float delta) | ||
// { | ||
// | ||
// } | ||
|
||
public void _on_TryAgainButton_button_up() | ||
{ | ||
// send the join message | ||
bool success = MyGame.JoinGameAsPlayer(MyGame.myUuid); | ||
if (!success) | ||
{ | ||
_serilogger.Information($"GameOverScreen.cs: join failed TODO tell player why"); | ||
// TODO: alert errors or something | ||
} | ||
else | ||
{ | ||
// since we successfully joined the game, we can remove this node | ||
// which is the game over screen. removing the screen "displays" | ||
// the main game window | ||
QueueFree(); | ||
|
||
// re-show the GUI | ||
MyGame.initializeGameUI(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
[gd_scene load_steps=3 format=2] | ||
|
||
[ext_resource path="res://Assets/UIElements/MainTheme.tres" type="Theme" id=1] | ||
[ext_resource path="res://Scenes/GameOverScreen.cs" type="Script" id=2] | ||
|
||
[node name="GameOverScreen" type="CanvasLayer"] | ||
script = ExtResource( 2 ) | ||
|
||
[node name="CenterContainer" type="CenterContainer" parent="."] | ||
anchor_right = 1.0 | ||
anchor_bottom = 1.0 | ||
|
||
[node name="VBoxContainer" type="VBoxContainer" parent="CenterContainer"] | ||
margin_left = 882.0 | ||
margin_top = 494.0 | ||
margin_right = 1038.0 | ||
margin_bottom = 586.0 | ||
|
||
[node name="GameOverLabel" type="Label" parent="CenterContainer/VBoxContainer"] | ||
margin_right = 156.0 | ||
margin_bottom = 41.0 | ||
theme = ExtResource( 1 ) | ||
text = "Game Over" | ||
|
||
[node name="TryAgainButton" type="Button" parent="CenterContainer/VBoxContainer"] | ||
margin_top = 45.0 | ||
margin_right = 156.0 | ||
margin_bottom = 92.0 | ||
theme = ExtResource( 1 ) | ||
text = "Try Again?" | ||
|
||
[connection signal="button_up" from="CenterContainer/VBoxContainer/TryAgainButton" to="." method="_on_TryAgainButton_button_up"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.