fix: "Cyclic references are not supported as you just discovered" 🫠🔫
This commit is contained in:
@@ -1,8 +1,7 @@
|
|||||||
[gd_scene load_steps=4 format=3 uid="uid://dcx5nvs0pa7me"]
|
[gd_scene load_steps=3 format=3 uid="uid://dcx5nvs0pa7me"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://bk22f71oximjk" path="res://scripts/AddressUI.cs" id="1_l6cm7"]
|
[ext_resource type="Script" uid="uid://bk22f71oximjk" path="res://scripts/AddressUI.cs" id="1_l6cm7"]
|
||||||
[ext_resource type="Script" uid="uid://cpjbiqn26khck" path="res://scripts/ConnectButtonUI.cs" id="2_ekxnf"]
|
[ext_resource type="Script" uid="uid://cpjbiqn26khck" path="res://scripts/ConnectButtonUI.cs" id="2_ekxnf"]
|
||||||
[ext_resource type="PackedScene" uid="uid://rl33x81cxlh0" path="res://scenes/bracket_view.tscn" id="3_bqqt6"]
|
|
||||||
|
|
||||||
[node name="Control" type="Control"]
|
[node name="Control" type="Control"]
|
||||||
layout_mode = 3
|
layout_mode = 3
|
||||||
@@ -45,7 +44,6 @@ text = "Connect"
|
|||||||
script = ExtResource("2_ekxnf")
|
script = ExtResource("2_ekxnf")
|
||||||
AddressUi = NodePath("../Address")
|
AddressUi = NodePath("../Address")
|
||||||
ErrorLabel = NodePath("../Label")
|
ErrorLabel = NodePath("../Label")
|
||||||
NextScene = ExtResource("3_bqqt6")
|
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="."]
|
[node name="Label" type="Label" parent="."]
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
|
|||||||
@@ -4,11 +4,11 @@ using System.Collections.Generic;
|
|||||||
|
|
||||||
public partial class BoardScreen : Node2D {
|
public partial class BoardScreen : Node2D {
|
||||||
|
|
||||||
[Export] public PackedScene BracketScene;
|
|
||||||
[Export] public BaseButton BackButton;
|
[Export] public BaseButton BackButton;
|
||||||
|
|
||||||
private const string RED_CHIP_PATH = "res://scenes/red_chip.tscn";
|
private const string RED_CHIP_PATH = "res://scenes/red_chip.tscn";
|
||||||
private const string YELLOW_CHIP_PATH = "res://scenes/yellow_chip.tscn";
|
private const string YELLOW_CHIP_PATH = "res://scenes/yellow_chip.tscn";
|
||||||
|
private const string BRACKET_SCENE_PATH = "res://scenes/bracket_screen.tscn";
|
||||||
private const int CHIP_SCALE = 3;
|
private const int CHIP_SCALE = 3;
|
||||||
private const int CHIP_SIZE = 24;
|
private const int CHIP_SIZE = 24;
|
||||||
private const int CHIP_PADDING = 2;
|
private const int CHIP_PADDING = 2;
|
||||||
@@ -150,14 +150,14 @@ public partial class BoardScreen : Node2D {
|
|||||||
|
|
||||||
private void TransitionToBracket()
|
private void TransitionToBracket()
|
||||||
{
|
{
|
||||||
GetTree().ChangeSceneToPacked(BracketScene);
|
GetTree().ChangeSceneToFile(BRACKET_SCENE_PATH);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called every frame. 'delta' is the elapsed time since the previous frame.
|
// Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
public override void _Process(double delta) {
|
public override void _Process(double delta) {
|
||||||
/*
|
/*
|
||||||
if(p1 != null) {
|
if(p1 != null) {
|
||||||
Label username = player1Card.GetNode<Label>("Name");
|
Label username = player1Card.GetNode<Label>("Name");
|
||||||
username.Text = p1.username;
|
username.Text = p1.username;
|
||||||
|
|
||||||
if(p1.isReady) {
|
if(p1.isReady) {
|
||||||
@@ -165,10 +165,10 @@ public partial class BoardScreen : Node2D {
|
|||||||
status.Text = "Ready!";
|
status.Text = "Ready!";
|
||||||
status.AddThemeColorOverride("font_color", Colors.LimeGreen);
|
status.AddThemeColorOverride("font_color", Colors.LimeGreen);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(p2 != null) {
|
if(p2 != null) {
|
||||||
Label username = player2Card.GetNode<Label>("Name");
|
Label username = player2Card.GetNode<Label>("Name");
|
||||||
username.Text = p2.username;
|
username.Text = p2.username;
|
||||||
|
|
||||||
if(p2.isReady) {
|
if(p2.isReady) {
|
||||||
@@ -176,8 +176,8 @@ public partial class BoardScreen : Node2D {
|
|||||||
status.Text = "Ready!";
|
status.Text = "Ready!";
|
||||||
status.AddThemeColorOverride("font_color", Colors.LimeGreen);
|
status.AddThemeColorOverride("font_color", Colors.LimeGreen);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -235,11 +235,11 @@ public partial class BoardScreen : Node2D {
|
|||||||
Sprite2D cardRight = playerCard.GetNode<Sprite2D>("Right");
|
Sprite2D cardRight = playerCard.GetNode<Sprite2D>("Right");
|
||||||
|
|
||||||
float offX = 16 * x / 2;
|
float offX = 16 * x / 2;
|
||||||
cardCenter.Scale = new Vector2(x, 2);
|
cardCenter.Scale = new Vector2(x, 2);
|
||||||
cardCenter.Position = new Vector2(CARD_CENTER_X_DEFAULT + offX, cardCenter.Position.Y);
|
cardCenter.Position = new Vector2(CARD_CENTER_X_DEFAULT + offX, cardCenter.Position.Y);
|
||||||
|
|
||||||
cardRight.Position = new Vector2(CARD_CENTER_X_DEFAULT + offX * 2 + 8, cardRight.Position.Y); // 8 is a magic number (im too lazy) for the size of the card edge multipled by 2
|
cardRight.Position = new Vector2(CARD_CENTER_X_DEFAULT + offX * 2 + 8, cardRight.Position.Y); // 8 is a magic number (im too lazy) for the size of the card edge multipled by 2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
enum Direction
|
enum Direction
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ public partial class BracketScene : Control
|
|||||||
[Export] public Tree Players;
|
[Export] public Tree Players;
|
||||||
[Export] public Tree Matches;
|
[Export] public Tree Matches;
|
||||||
[Export] public Texture2D JoinButton;
|
[Export] public Texture2D JoinButton;
|
||||||
[Export] public PackedScene BoardScene;
|
private const string BOARD_SCENE_PATH = "res://scenes/game.tscn";
|
||||||
|
|
||||||
private List<PlayerData> _playerList;
|
private List<PlayerData> _playerList;
|
||||||
private List<MatchData> _matchList;
|
private List<MatchData> _matchList;
|
||||||
@@ -90,6 +90,6 @@ public partial class BracketScene : Control
|
|||||||
|
|
||||||
private void TransitionToBoard()
|
private void TransitionToBoard()
|
||||||
{
|
{
|
||||||
GetTree().ChangeSceneToPacked(BoardScene);
|
GetTree().ChangeSceneToFile(BOARD_SCENE_PATH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,14 +5,14 @@ public partial class ConnectButtonUI : Button
|
|||||||
{
|
{
|
||||||
[Export] public TextEdit AddressUi;
|
[Export] public TextEdit AddressUi;
|
||||||
[Export] public Label ErrorLabel;
|
[Export] public Label ErrorLabel;
|
||||||
[Export] public PackedScene NextScene;
|
private const string BRACKET_SCENE_PATH = "res://scenes/bracket_view.tscn";
|
||||||
|
|
||||||
public override void _Pressed()
|
public override void _Pressed()
|
||||||
{
|
{
|
||||||
if (Connection.Instance.Connect(AddressUi.Text))
|
if (Connection.Instance.Connect(AddressUi.Text))
|
||||||
{
|
{
|
||||||
GD.Print("Success!");
|
GD.Print("Success!");
|
||||||
GetTree().ChangeSceneToPacked(NextScene);
|
GetTree().ChangeSceneToFile(BRACKET_SCENE_PATH);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user