Push project up
This commit is contained in:
20
scripts/data/data_bridge.tscn
Normal file
20
scripts/data/data_bridge.tscn
Normal file
@@ -0,0 +1,20 @@
|
||||
[gd_scene load_steps=5 format=3 uid="uid://dy51wny4x53f4"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://b808va021l1w7" path="res://scripts/data/game_data.gd" id="1_hulqm"]
|
||||
[ext_resource type="Script" uid="uid://cai8lpy7e00d6" path="res://scripts/data/game_state.gd" id="2_6ash1"]
|
||||
[ext_resource type="Script" uid="uid://cihlohg5ouy6q" path="res://scripts/data/lobby_data.gd" id="3_80q4n"]
|
||||
[ext_resource type="Script" uid="uid://dof720ujunrw8" path="res://scripts/data/multiplayer_data.gd" id="4_setx2"]
|
||||
|
||||
[node name="data_bridge" type="Node"]
|
||||
|
||||
[node name="game_data" type="Node" parent="."]
|
||||
script = ExtResource("1_hulqm")
|
||||
|
||||
[node name="game_state" type="Node" parent="."]
|
||||
script = ExtResource("2_6ash1")
|
||||
|
||||
[node name="lobby_data" type="Node" parent="."]
|
||||
script = ExtResource("3_80q4n")
|
||||
|
||||
[node name="multiplayer_data" type="Node" parent="."]
|
||||
script = ExtResource("4_setx2")
|
||||
5
scripts/data/game_data.gd
Normal file
5
scripts/data/game_data.gd
Normal file
@@ -0,0 +1,5 @@
|
||||
class_name GameData extends Node
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
Globals.game_data = self
|
||||
1
scripts/data/game_data.gd.uid
Normal file
1
scripts/data/game_data.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://b808va021l1w7
|
||||
32
scripts/data/game_state.gd
Normal file
32
scripts/data/game_state.gd
Normal file
@@ -0,0 +1,32 @@
|
||||
class_name GameState extends Node
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
Globals.game_state = self
|
||||
|
||||
func load_game_scene(scene_str: String) -> void:
|
||||
var scene = load(scene_str).instantiate()
|
||||
var target = get_tree().root.get_node("shell/scene")
|
||||
|
||||
target.add_child(scene)
|
||||
|
||||
func set_game_scene(scene_str: String) -> void:
|
||||
var scene = load(scene_str).instantiate()
|
||||
var target = get_tree().root.get_node("shell/scene")
|
||||
|
||||
if "game" in scene_str:
|
||||
scene.name = "game"
|
||||
elif "lobby" in scene_str:
|
||||
scene.name = "lobby_screen"
|
||||
elif "start" in scene_str:
|
||||
scene.name = "start_screen"
|
||||
|
||||
clear_game_scene(target)
|
||||
|
||||
target.add_child(scene)
|
||||
|
||||
func clear_game_scene(container: Node) -> void:
|
||||
for child in container.get_children():
|
||||
child.queue_free()
|
||||
|
||||
await get_tree().process_frame
|
||||
1
scripts/data/game_state.gd.uid
Normal file
1
scripts/data/game_state.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://cai8lpy7e00d6
|
||||
5
scripts/data/lobby_data.gd
Normal file
5
scripts/data/lobby_data.gd
Normal file
@@ -0,0 +1,5 @@
|
||||
class_name LobbyData extends Node
|
||||
|
||||
|
||||
func _init() -> void:
|
||||
Globals.lobby_data = self
|
||||
1
scripts/data/lobby_data.gd.uid
Normal file
1
scripts/data/lobby_data.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://cihlohg5ouy6q
|
||||
13
scripts/data/multiplayer_data.gd
Normal file
13
scripts/data/multiplayer_data.gd
Normal file
@@ -0,0 +1,13 @@
|
||||
class_name MultiplayerData extends Node
|
||||
|
||||
|
||||
var is_multiplayer_active: bool = false
|
||||
var multiplayer_synchronizer: MultiplayerSynchronizer = MultiplayerSynchronizer.new()
|
||||
var synchronizer_config: SceneReplicationConfig = SceneReplicationConfig.new()
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
Globals.multiplayer_data = self
|
||||
multiplayer_synchronizer.name = "multiplayer_synchronizer"
|
||||
multiplayer_synchronizer.replication_config = synchronizer_config
|
||||
multiplayer_synchronizer.root_path = "/root/shell"
|
||||
1
scripts/data/multiplayer_data.gd.uid
Normal file
1
scripts/data/multiplayer_data.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://dof720ujunrw8
|
||||
Reference in New Issue
Block a user