Singelton patch
This commit is contained in:
@@ -11,10 +11,22 @@ config_version=5
|
||||
[application]
|
||||
|
||||
config/name="Dawn Godot"
|
||||
run/main_scene="res://scenes/Meta/RootScene.tscn"
|
||||
run/main_scene="uid://w1q5eoiejmy3"
|
||||
config/features=PackedStringArray("4.4", "GL Compatibility")
|
||||
config/icon="res://icon.svg"
|
||||
|
||||
[autoload]
|
||||
|
||||
BATTLE="*res://scripts/Singletons/Battle.gd"
|
||||
COOKING="*res://scripts/Singletons/Cooking.gd"
|
||||
CUTSCENE="*res://scripts/Singletons/Cutscene.gd"
|
||||
ITEM="*res://scripts/Singletons/Item.gd"
|
||||
OVERWORLD="*res://scripts/Singletons/Overworld.gd"
|
||||
PAUSE="*res://scripts/Singletons/Pause.gd"
|
||||
QUEST="*res://scripts/Singletons/Quest.gd"
|
||||
SCENE_MANAGER="*res://scripts/Singletons/SceneManager.gd"
|
||||
VN="*res://scripts/Singletons/VN.gd"
|
||||
|
||||
[dotnet]
|
||||
|
||||
project/assembly_name="Dawn Godot"
|
||||
|
@@ -31,10 +31,6 @@ text = "Prototype Overworld"
|
||||
|
||||
[node name="MapDropdown" type="OptionButton" parent="UI/VBoxContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
selected = 0
|
||||
item_count = 1
|
||||
popup/item_0/text = "TEST_MAP"
|
||||
popup/item_0/id = 0
|
||||
|
||||
[node name="Quests" type="Button" parent="UI/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
@@ -1,12 +0,0 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://tanovye003t2"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cj4jxqpykhteg" path="res://scripts/Scenes/RootScene.gd" id="1_xu06r"]
|
||||
[ext_resource type="PackedScene" uid="uid://iibqlagufwhm" path="res://scenes/Meta/Systems.tscn" id="2_et43v"]
|
||||
[ext_resource type="PackedScene" uid="uid://dfwwtbs3ywcyq" path="res://scenes/Meta/UI.tscn" id="3_fwr0j"]
|
||||
|
||||
[node name="RootScene" type="Node3D"]
|
||||
script = ExtResource("1_xu06r")
|
||||
|
||||
[node name="Systems" parent="." instance=ExtResource("2_et43v")]
|
||||
|
||||
[node name="UI" parent="." instance=ExtResource("3_fwr0j")]
|
@@ -1,43 +0,0 @@
|
||||
[gd_scene load_steps=11 format=3 uid="uid://iibqlagufwhm"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cj8athi16655p" path="res://scripts/System/Systems.gd" id="1_uen2c"]
|
||||
[ext_resource type="Script" uid="uid://d2b7r3t5ownc5" path="res://scripts/System/CutsceneSystem.gd" id="2_sf62c"]
|
||||
[ext_resource type="Script" uid="uid://bc4c4eqfrnegb" path="res://scripts/System/ItemSystem.gd" id="3_nwp6i"]
|
||||
[ext_resource type="Script" uid="uid://dnlg1e8une55l" path="res://scripts/System/QuestSystem.gd" id="4_d00wi"]
|
||||
[ext_resource type="Script" uid="uid://chux5imw4pse6" path="res://scripts/System/VNSystem.gd" id="5_22p3i"]
|
||||
[ext_resource type="Script" uid="uid://bontk8ex2kxkb" path="res://scripts/System/PauseSystem.gd" id="6_hdi8m"]
|
||||
[ext_resource type="Script" uid="uid://mr6i8copcn37" path="res://scripts/System/BattleSystem.gd" id="7_miqgj"]
|
||||
[ext_resource type="Script" uid="uid://drcaiuyla2psa" path="res://scripts/System/CookingSystem.gd" id="7_nou1j"]
|
||||
[ext_resource type="Script" uid="uid://bbd8gcx6byjhf" path="res://scripts/System/SceneSystem.gd" id="9_budbk"]
|
||||
[ext_resource type="Script" uid="uid://btowswycywrgc" path="res://scripts/System/OverworldSystem.gd" id="10_56i3s"]
|
||||
|
||||
[node name="Systems" type="Node"]
|
||||
script = ExtResource("1_uen2c")
|
||||
metadata/_custom_type_script = "uid://cj8athi16655p"
|
||||
|
||||
[node name="Cutscene" type="Node" parent="."]
|
||||
script = ExtResource("2_sf62c")
|
||||
|
||||
[node name="Item" type="Node" parent="."]
|
||||
script = ExtResource("3_nwp6i")
|
||||
|
||||
[node name="Quest" type="Node" parent="."]
|
||||
script = ExtResource("4_d00wi")
|
||||
|
||||
[node name="VN" type="Node" parent="."]
|
||||
script = ExtResource("5_22p3i")
|
||||
|
||||
[node name="Pause" type="Node" parent="."]
|
||||
script = ExtResource("6_hdi8m")
|
||||
|
||||
[node name="Cooking" type="Node" parent="."]
|
||||
script = ExtResource("7_nou1j")
|
||||
|
||||
[node name="Battle" type="Node" parent="."]
|
||||
script = ExtResource("7_miqgj")
|
||||
|
||||
[node name="Scene" type="Node" parent="."]
|
||||
script = ExtResource("9_budbk")
|
||||
|
||||
[node name="Overworld" type="Node" parent="."]
|
||||
script = ExtResource("10_56i3s")
|
@@ -1,10 +1,9 @@
|
||||
class_name VerticalSlice extends "res://scripts/Cooking/Recipe/CookingRecipe.gd"
|
||||
const ItemSystem = preload("res://scripts/System/ItemSystem.gd")
|
||||
|
||||
func _init() -> void:
|
||||
super._init();
|
||||
|
||||
func getIngredients() -> Array[ItemStack]:
|
||||
return [
|
||||
ItemStack.new(ItemSystem.ITEM_POTION, 1)
|
||||
ItemStack.new(ITEM.ITEM_POTION, 1)
|
||||
];
|
||||
|
@@ -1,5 +1,4 @@
|
||||
class_name CutsceneEvent
|
||||
const Systems = preload("res://scripts/System/Systems.gd")
|
||||
|
||||
var started:bool = false;
|
||||
var cutscene = null;
|
||||
@@ -24,9 +23,3 @@ func reset() -> void:
|
||||
|
||||
func getCutscene():
|
||||
return cutscene
|
||||
|
||||
func getCutsceneSystem():
|
||||
return cutscene.cutsceneSystem;
|
||||
|
||||
func getSystems() -> Systems:
|
||||
return getCutsceneSystem().get_node("..") as Systems;
|
||||
|
@@ -1,5 +1,4 @@
|
||||
class_name CutscenePauseEvent extends "res://scripts/Cutscene/CutsceneEvent.gd"
|
||||
const PauseSystem = preload("res://scripts/System/PauseSystem.gd")
|
||||
|
||||
var pauseType:PauseSystem.PauseType;
|
||||
var pauseEntities:Array = [];
|
||||
@@ -13,4 +12,4 @@ func _init(
|
||||
self.pauseEntities = entities;
|
||||
|
||||
func start() -> void:
|
||||
getSystems().PAUSE.pause(self.pauseType, self.pauseEntities);
|
||||
PAUSE.pause(self.pauseType, self.pauseEntities);
|
||||
|
@@ -9,7 +9,7 @@ func _init(
|
||||
self.text = text;
|
||||
|
||||
func start() -> void:
|
||||
getSystems().VN.getTextbox().setText(self.text);
|
||||
VN.getTextbox().setText(self.text);
|
||||
|
||||
func isDone() -> bool:
|
||||
return getSystems().VN.getTextbox().isClosed;
|
||||
return VN.getTextbox().isClosed;
|
||||
|
@@ -31,12 +31,12 @@ func interact(interactor:OverworldEntity) -> void:
|
||||
# Cutscene in this manner must take two entities
|
||||
# (self, speaker, and interactor, player)
|
||||
var cs:Cutscene = interactCutscene.new(self, interactor);
|
||||
getSystems().CUTSCENE.setCurrentCutscene(cs);
|
||||
CUTSCENE.setCurrentCutscene(cs);
|
||||
return
|
||||
|
||||
if interactType == BasicNPCInteractType.TEXTS:
|
||||
var cs:Cutscene = OverworldConversationEvent.new(self, interactor, interactTexts);
|
||||
getSystems().CUTSCENE.setCurrentCutscene(cs);
|
||||
CUTSCENE.setCurrentCutscene(cs);
|
||||
return
|
||||
|
||||
pass
|
||||
|
@@ -1,7 +1,5 @@
|
||||
class_name OverworldEntity extends CharacterBody3D
|
||||
|
||||
const PauseSystem = preload("res://scripts/System/PauseSystem.gd")
|
||||
|
||||
enum Direction {
|
||||
NORTH,
|
||||
EAST,
|
||||
@@ -33,9 +31,6 @@ func _updateMaterial():
|
||||
return
|
||||
material.set_shader_parameter("direction", direction)
|
||||
|
||||
func getSystems() -> Systems:
|
||||
return get_tree().current_scene.get_node("Systems") as Systems;
|
||||
|
||||
func getDirectionVector() -> Vector3:
|
||||
match direction:
|
||||
Direction.NORTH:
|
||||
@@ -70,19 +65,18 @@ func updateOverworldLogic(delta) -> void:
|
||||
pass
|
||||
|
||||
func isPaused() -> bool:
|
||||
var pause = getSystems().PAUSE;
|
||||
var ps = pause.getPauseState();
|
||||
var ps = PAUSE.getPauseState();
|
||||
|
||||
if ps == PauseSystem.PauseType.NOT_PAUSED:
|
||||
return false;
|
||||
elif ps == PauseSystem.PauseType.FULLY_PAUSED:
|
||||
return true;
|
||||
elif ps == PauseSystem.PauseType.ENTITY_PAUSED:
|
||||
if pause.entities.find(self) != -1:
|
||||
if PAUSE.entities.find(self) != -1:
|
||||
return true;
|
||||
return false
|
||||
elif ps == PauseSystem.PauseType.CUTSCENE_PAUSED:
|
||||
if pause.entities.find(self) != -1:
|
||||
if PAUSE.entities.find(self) != -1:
|
||||
return false;
|
||||
return true;
|
||||
return false;
|
||||
|
@@ -22,7 +22,7 @@ func updateOverworldLogic(delta) -> void:
|
||||
collider.interact(self)
|
||||
|
||||
if Input.is_action_just_pressed("pause"):
|
||||
getSystems().PAUSE.playerPauseToggle();
|
||||
PAUSE.playerPauseToggle();
|
||||
|
||||
func updateMovement(delta) -> void:
|
||||
# User movement
|
||||
|
@@ -3,9 +3,17 @@ class_name MainMenuScene extends Node3D
|
||||
var mapDropdown:OptionButton
|
||||
|
||||
func _ready() -> void:
|
||||
mapDropdown = $UI/VBoxContainer/HBoxContainer/MapDropdown;
|
||||
# mapDropdown = $UI/VBoxContainer/HBoxContainer/MapDropdown;
|
||||
# var i:int = 0;
|
||||
# for map in OverworldSystem.MAPS.keys():
|
||||
# mapDropdown.add_item(map, i);
|
||||
# i = i + 1;
|
||||
pass
|
||||
|
||||
func _on_Overworld_pressed():
|
||||
# var keys:Array[String] = OverworldSystem.MAPS.keys()
|
||||
# var key:String = keys[mapDropdown.selected]
|
||||
# print("Overworld pressed" + OverworldSystem.MAPS[key])
|
||||
print("Overworld pressed")
|
||||
|
||||
func _on_Quests_pressed():
|
||||
|
@@ -1,10 +0,0 @@
|
||||
class_name RootScene extends Node3D
|
||||
const Systems = preload("res://scripts/System/Systems.gd");
|
||||
const SceneSystem = preload("res://scripts/System/SceneSystem.gd");
|
||||
|
||||
var systems:Systems;
|
||||
|
||||
func _ready() -> void:
|
||||
print("Game started");
|
||||
systems = $Systems;
|
||||
systems.SCENE.setScene(SceneSystem.DawnScene.MAIN_MENU);
|
@@ -1 +0,0 @@
|
||||
class_name UIScene extends Control
|
@@ -1,11 +1,9 @@
|
||||
class_name BattleSystem extends Node
|
||||
extends Node
|
||||
|
||||
const Battle = preload("res://scripts/Battle/Battle.gd");
|
||||
|
||||
var battle:Battle = null;
|
||||
|
||||
func getSystems():
|
||||
return get_tree().current_scene.get_node("Systems");
|
||||
|
||||
func startBattle(battle:Battle) -> void:
|
||||
print("start battle");
|
||||
self.battle = battle;
|
1
scripts/Singletons/Battle.gd.uid
Normal file
1
scripts/Singletons/Battle.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://2ejo2auklqhu
|
5
scripts/Singletons/Cooking.gd
Normal file
5
scripts/Singletons/Cooking.gd
Normal file
@@ -0,0 +1,5 @@
|
||||
extends Node
|
||||
|
||||
const CookingGame = preload("res://scripts/Cooking/CookingGame.gd");
|
||||
|
||||
var game:CookingGame = null;
|
1
scripts/Singletons/Cooking.gd.uid
Normal file
1
scripts/Singletons/Cooking.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://dnnr0o0af78jl
|
@@ -1,14 +1,9 @@
|
||||
class_name CutsceneSystem extends Node
|
||||
const Cutscene = preload("res://scripts/Cutscene/Cutscene.gd");
|
||||
const PauseSystem = preload("res://scripts/System/PauseSystem.gd");
|
||||
extends Node
|
||||
|
||||
var currentCutscene:Cutscene = null;
|
||||
|
||||
func getSystems():
|
||||
return get_tree().current_scene.get_node("Systems");
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
if getSystems().PAUSE.getPauseState() == PauseSystem.PauseType.FULLY_PAUSED:
|
||||
if PAUSE.getPauseState() == PAUSE.PauseType.FULLY_PAUSED:
|
||||
return;
|
||||
|
||||
if currentCutscene != null:
|
1
scripts/Singletons/Cutscene.gd.uid
Normal file
1
scripts/Singletons/Cutscene.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://b83dwcvh76qs7
|
@@ -1,4 +1,5 @@
|
||||
class_name ItemSystem extends Node
|
||||
extends Node
|
||||
|
||||
const Item = preload("res://scripts/Item/Item.gd");
|
||||
const ItemStack = preload("res://scripts/Item/ItemStack.gd");
|
||||
|
1
scripts/Singletons/Item.gd.uid
Normal file
1
scripts/Singletons/Item.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://1vd57s0j3b2o
|
13
scripts/Singletons/Overworld.gd
Normal file
13
scripts/Singletons/Overworld.gd
Normal file
@@ -0,0 +1,13 @@
|
||||
extends Node
|
||||
|
||||
const MAPS:Dictionary[String, String] = {
|
||||
"TestMap": "res://scenes/Maps/TestMap.tscn"
|
||||
};
|
||||
|
||||
var currentMap:String = "";
|
||||
|
||||
func setMap(map:String) -> void:
|
||||
if MAPS.has(map):
|
||||
currentMap = map
|
||||
else:
|
||||
push_error("Map not found: " + map)
|
1
scripts/Singletons/Overworld.gd.uid
Normal file
1
scripts/Singletons/Overworld.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://cnc1qkusjrf3k
|
1
scripts/Singletons/Pause.gd.uid
Normal file
1
scripts/Singletons/Pause.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://cr0ne40l5jf7m
|
1
scripts/Singletons/Quest.gd.uid
Normal file
1
scripts/Singletons/Quest.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://d0060jeyftia7
|
@@ -1,4 +1,5 @@
|
||||
class_name SceneSystem extends Node
|
||||
extends Node
|
||||
|
||||
const MainMenu = preload("res://scenes/MainMenu.tscn");
|
||||
const OverworldScene = preload("res://scenes/Meta/Overworld.tscn");
|
||||
|
||||
@@ -10,6 +11,11 @@ enum DawnScene {
|
||||
COOKING
|
||||
};
|
||||
|
||||
# static const SCENES:Dictionary[String, PackedScene] = {
|
||||
# "MainMenu": MainMenu,
|
||||
# "Overworld": OverworldScene
|
||||
# };
|
||||
|
||||
var scene:DawnScene = DawnScene.INITIAL;
|
||||
|
||||
func getMainMenuScene():
|
1
scripts/Singletons/SceneManager.gd.uid
Normal file
1
scripts/Singletons/SceneManager.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://ciexpxnj51uux
|
6
scripts/Singletons/VN.gd
Normal file
6
scripts/Singletons/VN.gd
Normal file
@@ -0,0 +1,6 @@
|
||||
class_name VNSystem extends Node
|
||||
const VNTextbox = preload("res://scripts/UI/VNTextbox.gd")
|
||||
|
||||
func getTextbox() -> VNTextbox:
|
||||
return null
|
||||
# return get_tree().current_scene.get_node("UI/VNTextbox") as VNTextbox;
|
1
scripts/Singletons/VN.gd.uid
Normal file
1
scripts/Singletons/VN.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://benvf7v4p4i2l
|
@@ -1,11 +0,0 @@
|
||||
class_name CookingSystem extends Node;
|
||||
const CookingGame = preload("res://scripts/Cooking/CookingGame.gd");
|
||||
|
||||
var game:CookingGame = null;
|
||||
|
||||
func getSystems():
|
||||
return get_tree().current_scene.get_node("Systems");
|
||||
|
||||
func setCookingGame(game:CookingGame):
|
||||
self.game = game;
|
||||
print("CookingSystem: CookingGame set");
|
@@ -1,14 +0,0 @@
|
||||
class_name OverworldSystem extends Node
|
||||
|
||||
enum Map {
|
||||
TEST_MAP
|
||||
};
|
||||
|
||||
var MAPS = [
|
||||
"res://scenes/Maps/TestMap.tscn"
|
||||
];
|
||||
|
||||
var currentMap:String = "";
|
||||
|
||||
func setMap(map:Map):
|
||||
pass
|
@@ -1,31 +0,0 @@
|
||||
class_name Systems extends Node
|
||||
const ItemSystem = preload("res://scripts/System/ItemSystem.gd");
|
||||
const CutsceneSystem = preload("res://scripts/System/CutsceneSystem.gd");
|
||||
const QuestSystem = preload("res://scripts/System/QuestSystem.gd");
|
||||
const VNSystem = preload("res://scripts/System/VNSystem.gd");
|
||||
const PauseSystem = preload("res://scripts/System/PauseSystem.gd");
|
||||
const BattleSystem = preload("res://scripts/System/BattleSystem.gd");
|
||||
const CookingSystem = preload("res://scripts/System/CookingSystem.gd");
|
||||
const SceneSystem = preload("res://scripts/System/SceneSystem.gd");
|
||||
const OverworldSystem = preload("res://scripts/System/OverworldSystem.gd");
|
||||
|
||||
var ITEM:ItemSystem;
|
||||
var CUTSCENE:CutsceneSystem;
|
||||
var QUEST:QuestSystem;
|
||||
var VN:VNSystem;
|
||||
var PAUSE:PauseSystem;
|
||||
var BATTLE:BattleSystem;
|
||||
var COOKING:CookingSystem;
|
||||
var SCENE:SceneSystem;
|
||||
var OVERWORLD:OverworldSystem;
|
||||
|
||||
func _ready():
|
||||
ITEM = $Item;
|
||||
CUTSCENE = $Cutscene;
|
||||
QUEST = $Quest;
|
||||
VN = $VN;
|
||||
PAUSE = $Pause;
|
||||
BATTLE = $Battle;
|
||||
COOKING = $Cooking;
|
||||
SCENE = $Scene;
|
||||
OVERWORLD = $Overworld;
|
@@ -1,8 +0,0 @@
|
||||
class_name VNSystem extends Node
|
||||
const VNTextbox = preload("res://scripts/UI/VNTextbox.gd")
|
||||
|
||||
func getSystems():
|
||||
return get_tree().current_scene.get_node("Systems");
|
||||
|
||||
func getTextbox() -> VNTextbox:
|
||||
return get_tree().current_scene.get_node("UI/VNTextbox") as VNTextbox;
|
Reference in New Issue
Block a user