创建场景部署单元,更新主场景镜头配置,更新 ground 节点结构
BIN
asset/art/bg.JPG
Before Width: | Height: | Size: 644 KiB |
Before Width: | Height: | Size: 201 B |
Before Width: | Height: | Size: 8.4 KiB After Width: | Height: | Size: 8.4 KiB |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 443 B After Width: | Height: | Size: 443 B |
Before Width: | Height: | Size: 540 B After Width: | Height: | Size: 540 B |
Before Width: | Height: | Size: 598 B After Width: | Height: | Size: 598 B |
Before Width: | Height: | Size: 5.4 KiB |
Before Width: | Height: | Size: 1.4 MiB After Width: | Height: | Size: 1.4 MiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 479 B After Width: | Height: | Size: 479 B |
Before Width: | Height: | Size: 506 B After Width: | Height: | Size: 506 B |
Before Width: | Height: | Size: 500 B After Width: | Height: | Size: 500 B |
Before Width: | Height: | Size: 543 B After Width: | Height: | Size: 543 B |
Before Width: | Height: | Size: 486 B After Width: | Height: | Size: 486 B |
Before Width: | Height: | Size: 514 B After Width: | Height: | Size: 514 B |
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 26 KiB |
22
config/animation/ux_frames.tres
Normal file
@ -0,0 +1,22 @@
|
||||
[gd_resource type="SpriteFrames" load_steps=4 format=3 uid="uid://bgbk80qo7mi7y"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://gb3p6ry0bs5x" path="res://asset/art/ui/action_mark/说话标识1.png" id="1_7otjv"]
|
||||
[ext_resource type="Texture2D" uid="uid://dsofwe6knklyo" path="res://asset/art/ui/action_mark/说话标识2.png" id="2_3thvv"]
|
||||
[ext_resource type="Texture2D" uid="uid://blvlw8fgmmu8n" path="res://asset/art/ui/action_mark/说话标识3.png" id="3_32slc"]
|
||||
|
||||
[resource]
|
||||
animations = [{
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("1_7otjv")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("2_3thvv")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("3_32slc")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"sign",
|
||||
"speed": 2.0
|
||||
}]
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
38
config/art/static_frames_loader.gd
Normal file
@ -0,0 +1,38 @@
|
||||
extends Control
|
||||
|
||||
@export var path = "res://asset/art/scene/"
|
||||
@export var static_frames = preload("res://config/art/static_sprite_frames.tres")
|
||||
@export var placeholder_texture = preload("res://config/art/placeholder_pic.webp")
|
||||
|
||||
@onready var load_btn = %LoadButton as Button
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
load_btn.pressed.connect(_reload_all)
|
||||
|
||||
|
||||
func _reload_all():
|
||||
static_frames.clear_all()
|
||||
var dir = DirAccess.open(path) as DirAccess
|
||||
static_frames.add_animation("placeholder")
|
||||
static_frames.add_frame("placeholder", placeholder_texture)
|
||||
for c_dir in dir.get_directories():
|
||||
print("c_dir=", c_dir)
|
||||
var c_path = path + c_dir + "/"
|
||||
var c_dir_access = DirAccess.open(c_path) as DirAccess
|
||||
for s_dir in c_dir_access.get_directories():
|
||||
print("s_dir=", s_dir)
|
||||
var s_path = c_path + s_dir + "/"
|
||||
var s_dir_access = DirAccess.open(s_path) as DirAccess
|
||||
for png_file in s_dir_access.get_files():
|
||||
if png_file.ends_with(".png"):
|
||||
#print("png_file=", png_file)
|
||||
var png_path = s_path + png_file
|
||||
var texture = load(png_path) as Texture
|
||||
var c = c_dir.split("_")[0]
|
||||
var s = s_dir.split("_")[0]
|
||||
var title = c + "_" + s + "_" + png_file.get_basename()
|
||||
static_frames.add_animation(title)
|
||||
static_frames.add_frame(title, texture)
|
||||
ResourceSaver.save(static_frames)
|
22
config/art/static_frames_loader.tscn
Normal file
@ -0,0 +1,22 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://dn425m8dg6ddn"]
|
||||
|
||||
[ext_resource type="Script" path="res://config/art/static_frames_loader.gd" id="1_y1hex"]
|
||||
[ext_resource type="Script" path="res://ui/button/sound_button.gd" id="2_5w5c5"]
|
||||
|
||||
[node name="StaticFramesLoader" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_y1hex")
|
||||
|
||||
[node name="LoadButton" type="Button" parent="."]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 0
|
||||
offset_right = 8.0
|
||||
offset_bottom = 8.0
|
||||
text = "load
|
||||
"
|
||||
script = ExtResource("2_5w5c5")
|
1243
config/art/static_sprite_frames.tres
Normal file
@ -1,11 +0,0 @@
|
||||
class_name DeploymentConfig extends Resource
|
||||
|
||||
|
||||
class DeploymentItemConfig:
|
||||
extends Resource
|
||||
var entity_name: String = ""
|
||||
var position: Vector2 = Vector2(0, 0)
|
||||
|
||||
|
||||
@export var scene_name: String = ""
|
||||
@export var items := {} # entity_name: DeploymentItemConfig
|
@ -10,13 +10,17 @@ class_name EntityConfig extends Resource
|
||||
# var sound: String = "" # bind to animation
|
||||
|
||||
@export var entity_name: String = ""
|
||||
@export var placeholder_size := Vector2(32, 64)
|
||||
@export var entity_title: String = ""
|
||||
@export var entity_note: String = ""
|
||||
@export var offset := Vector2.ZERO
|
||||
@export var scale := Vector2.ONE
|
||||
@export var physical_vibe_effect: PackedScene
|
||||
@export var pickable := false
|
||||
# @export var entity_notes := [] as Array[String]
|
||||
# @export var hud_texture: Texture2D
|
||||
# @export var pickable := false
|
||||
@export var inspection_texture: Texture2D
|
||||
@export var inspection_note: String = ""
|
||||
@export var inspection_gameplay: PackedScene
|
||||
# @export var offset := Vector2.ZERO
|
||||
# @export var scale := Vector2.ONE
|
||||
# @export var physical_vibe_effect: PackedScene
|
||||
# @export var hud_thumbnail := "" # searched by entity_name
|
||||
# @export var entity_state_inspection: EntityStateConfig
|
||||
@export var inspection_gameplay: PackedScene
|
||||
|
||||
@export var placeholder_size := Vector2(32, 64)
|
||||
|
@ -26,5 +26,5 @@ const FOOTSTEP_AUDIO = {
|
||||
|
||||
## sound
|
||||
@export_enum("none", "wood", "carpet", "concrete", "grass", "snow")
|
||||
var footstep_type: String = "concrete"
|
||||
var footstep_type: String = "grass"
|
||||
var bgm: String = ""
|
||||
|
10
config/deploy/section_config.gd
Normal file
@ -0,0 +1,10 @@
|
||||
class_name SectionConfig extends Resource
|
||||
|
||||
|
||||
class DeploymentConfig:
|
||||
extends Resource
|
||||
var entity_name: String = ""
|
||||
var position: Vector2 = Vector2(0, 0)
|
||||
|
||||
@export var section_name: String = ""
|
||||
@export var deloyment_dict := {} # entity_name: DeploymentItemConfig
|
@ -2,7 +2,8 @@ extends Node
|
||||
|
||||
|
||||
func play_animation_sound(animation):
|
||||
pass
|
||||
#TODO
|
||||
print("Playing sound for animation: ", animation)
|
||||
|
||||
|
||||
func play_sfx(sfx: String) -> void:
|
||||
|
@ -7,11 +7,12 @@ const DEBUG = true
|
||||
const RES_FILE_FORMAT = ".tres"
|
||||
|
||||
## layers
|
||||
const CANVAS_LAYER_VIGNETTE = 1000
|
||||
const CANVAS_LAYER_PROP_INSPECTOR = 100
|
||||
const CANVAS_LAYER_VIGNETTE = 100
|
||||
const CANVAS_LAYER_PROP_INSPECTOR = 98
|
||||
const CANVAS_LAYER_UI = 99
|
||||
const CANVAS_LAYER_FG = 50
|
||||
const CANVAS_LAYER_BG = -100
|
||||
const CANVAS_LAYER_FG = 10
|
||||
|
||||
const AUDIO_BUS_SFX = "game_sfx"
|
||||
|
||||
signal current_selected_archive_id_changed
|
||||
signal auto_save_seconds_changed
|
||||
|
@ -1,3 +0,0 @@
|
||||
[gd_scene format=3 uid="uid://ducfqojekphh6"]
|
||||
|
||||
[node name="Assembler" type="Node2D"]
|
@ -1,23 +0,0 @@
|
||||
@tool
|
||||
extends Node2D
|
||||
|
||||
@export var placeholder_name := "placeholder":
|
||||
set(val):
|
||||
placeholder_name = val
|
||||
_reload()
|
||||
@export var placeholder_size: Vector2 = Vector2(32, 64):
|
||||
set(val):
|
||||
placeholder_size = val
|
||||
_reload()
|
||||
@export var offset: Vector2 = Vector2(0, 0):
|
||||
set(val):
|
||||
offset = val
|
||||
_reload()
|
||||
@export var packed_scene: PackedScene:
|
||||
set(val):
|
||||
packed_scene = val
|
||||
_reload()
|
||||
|
||||
|
||||
func _reload():
|
||||
pass
|
@ -1,6 +0,0 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://c1ekdt4b08nac"]
|
||||
|
||||
[ext_resource type="Script" path="res://manager/deploy/assemble/placeholder_2d.gd" id="1_0l7tn"]
|
||||
|
||||
[node name="Placeholder2D" type="Node2D"]
|
||||
script = ExtResource("1_0l7tn")
|
10
manager/deploy/deployer/deployer_window.gd
Normal file
@ -0,0 +1,10 @@
|
||||
extends Window
|
||||
|
||||
signal changed
|
||||
|
||||
@export var archive: AssembledArchive
|
||||
|
||||
func _ready() -> void:
|
||||
var screen_size = DisplayServer.screen_get_size()
|
||||
position = screen_size / 3
|
||||
close_requested.connect(queue_free)
|
12
manager/deploy/deployer/deployer_window.tscn
Normal file
@ -0,0 +1,12 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://dfbmctdmc4ue6"]
|
||||
|
||||
[ext_resource type="Script" path="res://manager/deploy/deployer/deployer_window.gd" id="1_rhcam"]
|
||||
|
||||
[node name="DeployerWindow" type="Window"]
|
||||
auto_translate_mode = 1
|
||||
title = "deployer"
|
||||
position = Vector2i(2000, 300)
|
||||
size = Vector2i(1200, 1000)
|
||||
always_on_top = true
|
||||
min_size = Vector2i(100, 100)
|
||||
script = ExtResource("1_rhcam")
|
12
manager/deploy/deployer/section_deployer.gd
Normal file
@ -0,0 +1,12 @@
|
||||
extends Node2D
|
||||
|
||||
@export var section_config: SectionConfig
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
pass
|
15
manager/deploy/deployer/section_deployer.tscn
Normal file
@ -0,0 +1,15 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://jveao8k40jp1"]
|
||||
|
||||
[ext_resource type="Script" path="res://manager/deploy/deployer/section_deployer.gd" id="1_komad"]
|
||||
[ext_resource type="PackedScene" uid="uid://dygvcmykn02n8" path="res://scene/main.tscn" id="2_si45r"]
|
||||
[ext_resource type="PackedScene" uid="uid://dfbmctdmc4ue6" path="res://manager/deploy/deployer/deployer_window.tscn" id="3_iq8me"]
|
||||
|
||||
[node name="SectionDeployer" type="Node2D"]
|
||||
script = ExtResource("1_komad")
|
||||
|
||||
[node name="Main" parent="." instance=ExtResource("2_si45r")]
|
||||
|
||||
[node name="DeployerWindow" parent="." instance=ExtResource("3_iq8me")]
|
||||
position = Vector2i(390, 300)
|
||||
|
||||
[editable path="Main"]
|
@ -1,44 +0,0 @@
|
||||
@tool
|
||||
class_name EntityLoader extends Node2D
|
||||
|
||||
@export var entity_config: EntityConfig:
|
||||
set(value):
|
||||
entity_config = value
|
||||
_reload()
|
||||
|
||||
@onready var sprite2d = %AnimatedSoundSprite2D as AnimatedSoundSprite2D
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
if GlobalConfig.DEBUG:
|
||||
var label = DebugLabel.new()
|
||||
add_child(label)
|
||||
label.name = "DebugLabel"
|
||||
_reload()
|
||||
|
||||
|
||||
func _reload() -> void:
|
||||
if not entity_config or not sprite2d:
|
||||
return
|
||||
# Load current state according to entity config
|
||||
var entity_name = entity_config.entity_name
|
||||
if entity_name and sprite2d.sprite_frames.has_animation(entity_name):
|
||||
sprite2d.scale = entity_config.scale
|
||||
sprite2d.offset = entity_config.offset
|
||||
sprite2d.play_with_sound(entity_config.entity_name)
|
||||
else:
|
||||
_init_placeholder()
|
||||
|
||||
|
||||
func _init_placeholder():
|
||||
if not entity_config.placeholder_size:
|
||||
return
|
||||
sprite2d.play_with_sound("placeholder")
|
||||
var frames = sprite2d.sprite_frames as SpriteFrames
|
||||
var first_frame_size = frames.get_frame_texture("placeholder", 0).get_size()
|
||||
sprite2d.scale = entity_config.placeholder_size / first_frame_size
|
||||
sprite2d.offset = Vector2.ZERO
|
||||
var label = get_node_or_null("DebugLabel")
|
||||
if label:
|
||||
label.text = ("[" + entity_config.entity_name + "]" + entity_config.entity_title)
|
||||
label.modulate = Color.GREEN
|
@ -1,27 +0,0 @@
|
||||
[gd_scene load_steps=6 format=3 uid="uid://do5j7vqrviv48"]
|
||||
|
||||
[ext_resource type="Script" path="res://manager/deploy/entity/entity_loader.gd" id="1_0ynbr"]
|
||||
[ext_resource type="Script" path="res://config/deploy/entity_config.gd" id="2_ig6vo"]
|
||||
[ext_resource type="SpriteFrames" uid="uid://c3s8u4ifaucpj" path="res://config/animation/entity_sprite_frames.tres" id="3_7kkap"]
|
||||
[ext_resource type="Script" path="res://manager/deploy/assemble/animated_sound_sprite_2d.gd" id="4_cffgr"]
|
||||
|
||||
[sub_resource type="Resource" id="Resource_2isy3"]
|
||||
script = ExtResource("2_ig6vo")
|
||||
entity_name = "name24"
|
||||
placeholder_size = Vector2(32, 64)
|
||||
entity_title = "title1"
|
||||
entity_note = ""
|
||||
offset = Vector2(0, 0)
|
||||
scale = Vector2(1, 1)
|
||||
pickable = false
|
||||
|
||||
[node name="EntityLoader" type="Node2D"]
|
||||
script = ExtResource("1_0ynbr")
|
||||
entity_config = SubResource("Resource_2isy3")
|
||||
|
||||
[node name="AnimatedSoundSprite2D" type="AnimatedSprite2D" parent="."]
|
||||
unique_name_in_owner = true
|
||||
scale = Vector2(0.125, 0.25)
|
||||
sprite_frames = ExtResource("3_7kkap")
|
||||
animation = &"placeholder"
|
||||
script = ExtResource("4_cffgr")
|
@ -1,13 +0,0 @@
|
||||
@tool
|
||||
extends Node2D
|
||||
|
||||
@export var scene_config: SceneConfig
|
||||
@export var foreground: ParallaxBackground
|
||||
@export var background: ParallaxBackground
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
foreground = get_node_or_null("/root/Main/ParallaxForeground")
|
||||
background = get_node_or_null("/root/Main/ParallaxBackground")
|
||||
if Engine.is_editor_hint():
|
||||
return
|
@ -1,6 +0,0 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://d2l4smij7t5bf"]
|
||||
|
||||
[ext_resource type="Script" path="res://manager/deploy/scene/scene_loader.gd" id="1_6om2h"]
|
||||
|
||||
[node name="SceneLoader" type="Node2D"]
|
||||
script = ExtResource("1_6om2h")
|
@ -51,6 +51,7 @@ window/size/viewport_width=564
|
||||
window/size/viewport_height=317
|
||||
window/size/window_width_override=1692
|
||||
window/size/window_height_override=951
|
||||
window/subwindows/embed_subwindows=false
|
||||
window/stretch/mode="canvas_items"
|
||||
window/stretch/scale_mode="integer"
|
||||
|
||||
@ -104,6 +105,21 @@ jump={
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"key_label":0,"unicode":32,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
interact={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":69,"key_label":0,"unicode":101,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
cancel={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":81,"key_label":0,"unicode":113,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
|
||||
[layer_names]
|
||||
|
||||
2d_physics/layer_1="player"
|
||||
2d_physics/layer_2="wall"
|
||||
|
||||
[rendering]
|
||||
|
||||
|
@ -1,6 +1,10 @@
|
||||
extends Marker2D
|
||||
|
||||
@export var lock_horizontal = true
|
||||
|
||||
func tweak_position(velocity, facing_direction):
|
||||
position.x = facing_direction.x * abs(velocity.x) * 0.2
|
||||
if lock_horizontal:
|
||||
global_position.y = 0
|
||||
else:
|
||||
position.y = facing_direction.y * abs(velocity.y) * 0.2
|
||||
|
@ -1 +1,31 @@
|
||||
extends Control
|
||||
|
||||
@export var character := "吕萍":
|
||||
set(value):
|
||||
character = value
|
||||
_reload()
|
||||
@export var character_color := "orange":
|
||||
set(value):
|
||||
character_color = value
|
||||
_reload()
|
||||
@export var content := "你好,我是吕萍。":
|
||||
set(value):
|
||||
content = value
|
||||
_reload()
|
||||
@export var content_color := "white":
|
||||
set(value):
|
||||
content_color = value
|
||||
_reload()
|
||||
|
||||
@onready var label = %RichTextLabel as RichTextLabel
|
||||
|
||||
func _ready():
|
||||
_reload()
|
||||
|
||||
func _reload():
|
||||
label.clear()
|
||||
label.append_bbcode("[color=" + character_color + "][b]" + character + "[/b]:[/color]")
|
||||
label.append_bbcode("[color=" + content_color + "]" + content + "[/color]")
|
||||
|
||||
func append():
|
||||
pass
|
||||
|
@ -1,44 +1,30 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://dmkt1roqc4he7"]
|
||||
[gd_scene load_steps=2 format=3 uid="uid://dmkt1roqc4he7"]
|
||||
|
||||
[ext_resource type="Script" path="res://scene/dialog/dialog_container.gd" id="1_s1ka3"]
|
||||
[ext_resource type="Theme" uid="uid://j42sexotwnvk" path="res://config/default_theme.tres" id="2_q6yks"]
|
||||
|
||||
[node name="DialogContainer" type="MarginContainer"]
|
||||
anchors_preset = 12
|
||||
anchors_preset = 7
|
||||
anchor_left = 0.5
|
||||
anchor_top = 1.0
|
||||
anchor_right = 1.0
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 1.0
|
||||
offset_top = -86.0
|
||||
offset_left = -250.0
|
||||
offset_top = -58.0
|
||||
offset_right = 250.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 0
|
||||
size_flags_vertical = 8
|
||||
theme_override_constants/margin_left = 32
|
||||
theme_override_constants/margin_top = 16
|
||||
theme_override_constants/margin_right = 32
|
||||
mouse_filter = 2
|
||||
theme_override_constants/margin_bottom = 42
|
||||
script = ExtResource("1_s1ka3")
|
||||
|
||||
[node name="DialogPanelContainer" type="PanelContainer" parent="."]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="DialogMarginContainer" type="MarginContainer" parent="DialogPanelContainer"]
|
||||
layout_mode = 2
|
||||
theme = ExtResource("2_q6yks")
|
||||
theme_type_variation = &"dialog_container"
|
||||
theme_override_constants/margin_left = 12
|
||||
theme_override_constants/margin_top = 8
|
||||
theme_override_constants/margin_right = 12
|
||||
theme_override_constants/margin_bottom = 8
|
||||
|
||||
[node name="RichTextLabel" type="RichTextLabel" parent="DialogPanelContainer/DialogMarginContainer"]
|
||||
[node name="RichTextLabel" type="RichTextLabel" parent="."]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(460, 0)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
size_flags_vertical = 4
|
||||
mouse_filter = 2
|
||||
text = "Dialog: test
|
||||
2
|
||||
3
|
||||
4
|
||||
5"
|
||||
bbcode_enabled = true
|
||||
text = " [center][b][color=orange]吕萍:[/color][/b]「你好呀」[/center]"
|
||||
fit_content = true
|
||||
|
68
scene/entity/normal.gd
Normal file
@ -0,0 +1,68 @@
|
||||
extends Sprite2D
|
||||
|
||||
@export var entity_config: EntityConfig:
|
||||
set(value):
|
||||
entity_config = value
|
||||
|
||||
@onready var sprite2d = %AnimatedSoundSprite2D as AnimatedSoundSprite2D
|
||||
@onready var sign_mark = %Sign as Sprite2D
|
||||
@onready var area2d = %InteractArea2D as Area2D
|
||||
@onready var collision_shape = %CollisionShape2D as CollisionShape2D
|
||||
|
||||
var listening = false
|
||||
|
||||
func _ready() -> void:
|
||||
_relocate_sign()
|
||||
area2d.body_entered.connect(_reset)
|
||||
area2d.body_exited.connect(_on_cancel)
|
||||
area2d.body_entered.connect(sign_mark.activate)
|
||||
area2d.body_exited.connect(sign_mark.disactivate)
|
||||
sign_mark.interacted.connect(_on_interacted)
|
||||
sign_mark.cancel.connect(_on_cancel)
|
||||
# if GlobalConfig.DEBUG:
|
||||
# var label = DebugLabel.new()
|
||||
# add_child(label)
|
||||
# label.name = "DebugLabel"
|
||||
# _reload()
|
||||
|
||||
# func _reload() -> void:
|
||||
# if not entity_config or not sprite2d:
|
||||
# return
|
||||
# # Load current state according to entity config
|
||||
# var entity_name = entity_config.entity_name
|
||||
# if entity_name and sprite2d.sprite_frames.has_animation(entity_name):
|
||||
# # sprite2d.scale = entity_config.scale
|
||||
# # sprite2d.offset = entity_config.offset
|
||||
# sprite2d.play_with_sound(entity_config.entity_name)
|
||||
# var texture = sprite2d.sprite_frames.get_frame_texture(entity_name, 0)
|
||||
# # set collision shape size
|
||||
# if collision_shape:
|
||||
# collision_shape.shape.size = texture.get_size()
|
||||
# else:
|
||||
# _init_placeholder()
|
||||
|
||||
# func _init_placeholder():
|
||||
# if not entity_config.placeholder_size:
|
||||
# return
|
||||
# sprite2d.play_with_sound("placeholder")
|
||||
# var frames = sprite2d.sprite_frames as SpriteFrames
|
||||
# var first_frame_size = frames.get_frame_texture("placeholder", 0).get_size()
|
||||
# sprite2d.scale = entity_config.placeholder_size / first_frame_size
|
||||
# sprite2d.offset = Vector2.ZERO
|
||||
# var label = get_node_or_null("DebugLabel")
|
||||
# if label:
|
||||
# label.text = ("[" + entity_config.entity_name + "]" + entity_config.entity_title)
|
||||
# label.modulate = Color.GREEN
|
||||
|
||||
func _relocate_sign():
|
||||
# 根据 sprite 大小,调整位置
|
||||
pass
|
||||
|
||||
func _on_interacted() -> void:
|
||||
pass
|
||||
|
||||
func _on_cancel():
|
||||
pass
|
||||
|
||||
func _reset():
|
||||
pass
|
80
scene/entity/normal.tscn
Normal file
@ -0,0 +1,80 @@
|
||||
[gd_scene load_steps=10 format=3 uid="uid://do5j7vqrviv48"]
|
||||
|
||||
[ext_resource type="Script" path="res://scene/entity/normal.gd" id="1_thex5"]
|
||||
[ext_resource type="SpriteFrames" uid="uid://c3s8u4ifaucpj" path="res://config/animation/entity_sprite_frames.tres" id="3_3rf47"]
|
||||
[ext_resource type="Script" path="res://scene/entity/ux/sign.gd" id="3_4nd6g"]
|
||||
[ext_resource type="Texture2D" uid="uid://dvg6wjwn1qxiv" path="res://asset/art/ui/action_mark/探索ui.png" id="3_thqpp"]
|
||||
[ext_resource type="Texture2D" uid="uid://t526pexw4ng4" path="res://asset/art/neutral_point_light.webp" id="4_3ohmd"]
|
||||
[ext_resource type="Script" path="res://manager/deploy/entity/animated_sound_sprite_2d.gd" id="4_bsxot"]
|
||||
|
||||
[sub_resource type="GDScript" id="GDScript_ngryc"]
|
||||
script/source = "class_name EntityConfig extends Resource
|
||||
|
||||
# class EntityStateConfig:
|
||||
# extends Resource
|
||||
# var animation: String = \"\"
|
||||
# var scale: Vector2 = Vector2.ONE
|
||||
# var offset: Vector2 = Vector2.ZERO
|
||||
# var expected_duration: float = 1.0 # for placeholder demo only
|
||||
# var loop: bool = false # set with animation
|
||||
# var sound: String = \"\" # bind to animation
|
||||
|
||||
@export var entity_name: String = \"\"
|
||||
@export var entity_title: String = \"\"
|
||||
# @export var entity_notes := [] as Array[String]
|
||||
# @export var hud_texture: Texture2D
|
||||
# @export var pickable := false
|
||||
@export var inspection_texture: Texture2D
|
||||
@export var inspection_note: String = \"\"
|
||||
@export var inspection_gameplay: PackedScene
|
||||
# @export var offset := Vector2.ZERO
|
||||
# @export var scale := Vector2.ONE
|
||||
# @export var physical_vibe_effect: PackedScene
|
||||
# @export var hud_thumbnail := \"\" # searched by entity_name
|
||||
# @export var entity_state_inspection: EntityStateConfig
|
||||
|
||||
@export var placeholder_size := Vector2(32, 64)
|
||||
"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_w82oj"]
|
||||
script = SubResource("GDScript_ngryc")
|
||||
entity_name = "placeholder"
|
||||
entity_title = ""
|
||||
inspection_note = ""
|
||||
placeholder_size = Vector2(32, 64)
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_4fuic"]
|
||||
resource_local_to_scene = true
|
||||
size = Vector2(33, 43)
|
||||
|
||||
[node name="Normal" type="Sprite2D"]
|
||||
script = ExtResource("1_thex5")
|
||||
entity_config = SubResource("Resource_w82oj")
|
||||
|
||||
[node name="Sign" type="Sprite2D" parent="."]
|
||||
unique_name_in_owner = true
|
||||
position = Vector2(0, -35)
|
||||
scale = Vector2(0.2, 0.2)
|
||||
texture = ExtResource("3_thqpp")
|
||||
script = ExtResource("3_4nd6g")
|
||||
|
||||
[node name="PointLight2D" type="PointLight2D" parent="Sign"]
|
||||
unique_name_in_owner = true
|
||||
position = Vector2(0, -2.54313e-05)
|
||||
energy = 0.1
|
||||
texture = ExtResource("4_3ohmd")
|
||||
texture_scale = 0.5
|
||||
|
||||
[node name="AnimatedSoundSprite2D" type="AnimatedSprite2D" parent="."]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
sprite_frames = ExtResource("3_3rf47")
|
||||
script = ExtResource("4_bsxot")
|
||||
|
||||
[node name="InteractArea2D" type="Area2D" parent="."]
|
||||
unique_name_in_owner = true
|
||||
collision_layer = 0
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="InteractArea2D"]
|
||||
unique_name_in_owner = true
|
||||
shape = SubResource("RectangleShape2D_4fuic")
|
27
scene/entity/note.gd
Normal file
@ -0,0 +1,27 @@
|
||||
extends Marker2D
|
||||
|
||||
# @export var title := ""
|
||||
@export var notes := [] as Array[String]
|
||||
@onready var sign_mark = %Sign as Sprite2D
|
||||
@onready var area2d = %Area2D as Area2D
|
||||
|
||||
var listening = false
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
area2d.body_entered.connect(_reset)
|
||||
area2d.body_exited.connect(_on_cancel)
|
||||
area2d.body_entered.connect(sign_mark.activate)
|
||||
area2d.body_exited.connect(sign_mark.disactivate)
|
||||
sign_mark.interacted.connect(_on_interacted)
|
||||
sign_mark.cancel.connect(_on_cancel)
|
||||
|
||||
|
||||
func _on_interacted() -> void:
|
||||
print("note interacted")
|
||||
|
||||
func _on_cancel():
|
||||
pass
|
||||
|
||||
func _reset():
|
||||
pass
|
37
scene/entity/note.tscn
Normal file
@ -0,0 +1,37 @@
|
||||
[gd_scene load_steps=7 format=3 uid="uid://jr1yd46wm5je"]
|
||||
|
||||
[ext_resource type="Script" path="res://scene/entity/note.gd" id="1_3igk8"]
|
||||
[ext_resource type="Texture2D" uid="uid://dvg6wjwn1qxiv" path="res://asset/art/ui/action_mark/探索ui.png" id="1_eew1k"]
|
||||
[ext_resource type="Script" path="res://scene/entity/ux/sign.gd" id="3_2x3g1"]
|
||||
[ext_resource type="Texture2D" uid="uid://t526pexw4ng4" path="res://asset/art/neutral_point_light.webp" id="3_xb81s"]
|
||||
[ext_resource type="Resource" uid="uid://d0wynwv8stclg" path="res://config/audio/action/action_book_open.tres" id="4_14cx5"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_k6och"]
|
||||
resource_local_to_scene = true
|
||||
size = Vector2(60, 150)
|
||||
|
||||
[node name="Note" type="Marker2D"]
|
||||
script = ExtResource("1_3igk8")
|
||||
notes = Array[String](["(note)"])
|
||||
|
||||
[node name="Sign" type="Sprite2D" parent="."]
|
||||
unique_name_in_owner = true
|
||||
position = Vector2(0, -35)
|
||||
scale = Vector2(0.2, 0.2)
|
||||
texture = ExtResource("1_eew1k")
|
||||
script = ExtResource("3_2x3g1")
|
||||
audio_collection = ExtResource("4_14cx5")
|
||||
|
||||
[node name="PointLight2D" type="PointLight2D" parent="Sign"]
|
||||
unique_name_in_owner = true
|
||||
position = Vector2(0, -2.54313e-05)
|
||||
energy = 0.1
|
||||
texture = ExtResource("3_xb81s")
|
||||
texture_scale = 0.5
|
||||
|
||||
[node name="Area2D" type="Area2D" parent="."]
|
||||
unique_name_in_owner = true
|
||||
collision_layer = 0
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
|
||||
shape = SubResource("RectangleShape2D_k6och")
|
27
scene/entity/npc.gd
Normal file
@ -0,0 +1,27 @@
|
||||
extends AnimatedSprite2D
|
||||
|
||||
@onready var speaking_sign = %SpeakingSignAnimation as AnimatedSprite2D
|
||||
|
||||
@onready var sign_mark = %Sign as Sprite2D
|
||||
@onready var area2d = %Area2D as Area2D
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
area2d.body_entered.connect(_reset)
|
||||
area2d.body_exited.connect(_on_cancel)
|
||||
area2d.body_entered.connect(sign_mark.activate)
|
||||
area2d.body_exited.connect(sign_mark.disactivate)
|
||||
sign_mark.interacted.connect(_on_interacted)
|
||||
sign_mark.cancel.connect(_on_cancel)
|
||||
|
||||
func _on_interacted() -> void:
|
||||
print("npc interacted")
|
||||
pass
|
||||
|
||||
|
||||
func _on_cancel():
|
||||
pass
|
||||
|
||||
func _reset():
|
||||
pass
|
43
scene/entity/npc.tscn
Normal file
@ -0,0 +1,43 @@
|
||||
[gd_scene load_steps=7 format=3 uid="uid://0sofmhrl358m"]
|
||||
|
||||
[ext_resource type="Script" path="res://scene/entity/npc.gd" id="1_jegr2"]
|
||||
[ext_resource type="SpriteFrames" uid="uid://bgbk80qo7mi7y" path="res://config/animation/ux_frames.tres" id="2_6xo6s"]
|
||||
[ext_resource type="SpriteFrames" uid="uid://c3s8u4ifaucpj" path="res://config/animation/entity_sprite_frames.tres" id="3_1e8sl"]
|
||||
[ext_resource type="Script" path="res://scene/entity/ux/sign.gd" id="3_kgq8p"]
|
||||
[ext_resource type="Texture2D" uid="uid://t526pexw4ng4" path="res://asset/art/neutral_point_light.webp" id="4_jrmg5"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_4fuic"]
|
||||
resource_local_to_scene = true
|
||||
size = Vector2(33, 43)
|
||||
|
||||
[node name="Npc" type="AnimatedSprite2D"]
|
||||
sprite_frames = ExtResource("3_1e8sl")
|
||||
animation = &"c02_李氏_idle"
|
||||
script = ExtResource("1_jegr2")
|
||||
|
||||
[node name="Sign" type="Sprite2D" parent="."]
|
||||
unique_name_in_owner = true
|
||||
position = Vector2(0, -72)
|
||||
script = ExtResource("3_kgq8p")
|
||||
|
||||
[node name="PointLight2D" type="PointLight2D" parent="Sign"]
|
||||
unique_name_in_owner = true
|
||||
energy = 0.1
|
||||
texture = ExtResource("4_jrmg5")
|
||||
texture_scale = 0.1
|
||||
|
||||
[node name="SpeakingSignAnimation" type="AnimatedSprite2D" parent="."]
|
||||
unique_name_in_owner = true
|
||||
position = Vector2(2, -72)
|
||||
scale = Vector2(0.2, 0.2)
|
||||
sprite_frames = ExtResource("2_6xo6s")
|
||||
animation = &"sign"
|
||||
autoplay = "sign"
|
||||
|
||||
[node name="InteractArea2D" type="Area2D" parent="."]
|
||||
unique_name_in_owner = true
|
||||
collision_layer = 0
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="InteractArea2D"]
|
||||
unique_name_in_owner = true
|
||||
shape = SubResource("RectangleShape2D_4fuic")
|
34
scene/entity/portal.gd
Normal file
@ -0,0 +1,34 @@
|
||||
extends Sprite2D
|
||||
|
||||
@export var portal_name := "0":
|
||||
set(value):
|
||||
portal_name = value
|
||||
|
||||
@onready var sign_mark = %Sign as Sprite2D
|
||||
@onready var area2d = %Area2D as Area2D
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
area2d.body_entered.connect(_reset)
|
||||
area2d.body_exited.connect(_on_cancel)
|
||||
area2d.body_entered.connect(sign_mark.activate)
|
||||
area2d.body_exited.connect(sign_mark.disactivate)
|
||||
sign_mark.interacted.connect(_on_interacted)
|
||||
sign_mark.cancel.connect(_on_cancel)
|
||||
if GlobalConfig.DEBUG:
|
||||
var label = Label.new()
|
||||
label.text = portal_name
|
||||
label.name = "Label"
|
||||
add_child(label)
|
||||
|
||||
func _on_interacted() -> void:
|
||||
# 传送
|
||||
print("传送")
|
||||
pass
|
||||
|
||||
func _on_cancel():
|
||||
pass
|
||||
|
||||
func _reset():
|
||||
pass
|
35
scene/entity/portal.tscn
Normal file
@ -0,0 +1,35 @@
|
||||
[gd_scene load_steps=7 format=3 uid="uid://61pis75a8fdq"]
|
||||
|
||||
[ext_resource type="Script" path="res://scene/entity/portal.gd" id="1_jyh6v"]
|
||||
[ext_resource type="Texture2D" uid="uid://dcafeofupga6j" path="res://asset/art/scene/c02/s06_院子回忆版/e_1014 开门.png" id="1_ynrqg"]
|
||||
[ext_resource type="Texture2D" uid="uid://dbi1whlvfrt5k" path="res://asset/art/ui/action_mark/传送.png" id="2_ay30q"]
|
||||
[ext_resource type="Script" path="res://scene/entity/ux/sign.gd" id="4_lu5q5"]
|
||||
[ext_resource type="Texture2D" uid="uid://t526pexw4ng4" path="res://asset/art/neutral_point_light.webp" id="4_qn6pi"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_munml"]
|
||||
resource_local_to_scene = true
|
||||
size = Vector2(70, 130)
|
||||
|
||||
[node name="Portal" type="Sprite2D"]
|
||||
texture = ExtResource("1_ynrqg")
|
||||
script = ExtResource("1_jyh6v")
|
||||
|
||||
[node name="Sign" type="Sprite2D" parent="."]
|
||||
unique_name_in_owner = true
|
||||
position = Vector2(0, -86)
|
||||
scale = Vector2(0.05, 0.05)
|
||||
texture = ExtResource("2_ay30q")
|
||||
script = ExtResource("4_lu5q5")
|
||||
|
||||
[node name="PointLight2D" type="PointLight2D" parent="Sign"]
|
||||
unique_name_in_owner = true
|
||||
position = Vector2(0, -2.54313e-05)
|
||||
energy = 0.1
|
||||
texture = ExtResource("4_qn6pi")
|
||||
texture_scale = 1.8
|
||||
|
||||
[node name="Area2D" type="Area2D" parent="."]
|
||||
unique_name_in_owner = true
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
|
||||
shape = SubResource("RectangleShape2D_munml")
|
47
scene/entity/ux/sign.gd
Normal file
@ -0,0 +1,47 @@
|
||||
extends Node2D
|
||||
|
||||
@export var audio_collection: AudioStreamCollection
|
||||
|
||||
signal interacted
|
||||
signal cancel
|
||||
|
||||
var activated = false
|
||||
var base_scale: Vector2
|
||||
var random_audio_player = RandomAudioStreamPlayer.new()
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
var point_light = get_node("./PointLight2D")
|
||||
if point_light:
|
||||
point_light.energy = 0.0
|
||||
modulate.a = 0
|
||||
base_scale = scale
|
||||
random_audio_player.audio_collections.append(audio_collection)
|
||||
random_audio_player.bus = GlobalConfig.AUDIO_BUS_SFX
|
||||
add_child(random_audio_player)
|
||||
|
||||
|
||||
func activate(_body: Node2D) -> void:
|
||||
# point_light.energy = 1.0
|
||||
activated = true
|
||||
var tween = create_tween()
|
||||
tween.tween_property(self, "modulate:a", 1.0, 0.2)
|
||||
var p_tween = tween.parallel()
|
||||
p_tween.tween_property(self, "scale", base_scale * Vector2(1.2, 1.2), 0.3)
|
||||
p_tween.tween_property(self, "scale", base_scale, 0.1)
|
||||
|
||||
|
||||
func disactivate(_body: Node2D) -> void:
|
||||
# point_light.energy = 0.0
|
||||
activated = false
|
||||
create_tween().tween_property(self, "modulate:a", 0.0, 0.2)
|
||||
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if activated:
|
||||
if event.is_action_pressed("interact"):
|
||||
interacted.emit()
|
||||
if audio_collection:
|
||||
random_audio_player.play_random()
|
||||
elif event.is_action_pressed("cancel"):
|
||||
cancel.emit()
|
@ -2,7 +2,6 @@ extends Node2D
|
||||
|
||||
@export var scene_config: SceneConfig
|
||||
|
||||
@onready var background = %ParallaxBackground as ParallaxBackground
|
||||
@onready var foreground = %ParallaxForeground as ParallaxBackground
|
||||
@onready var bg_sprite = %BGSprite2D as Sprite2D
|
||||
@onready var fg_sprite = %FGSprite2D as Sprite2D
|
||||
@ -12,7 +11,6 @@ extends Node2D
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
background.layer = GlobalConfig.CANVAS_LAYER_BG
|
||||
foreground.layer = GlobalConfig.CANVAS_LAYER_FG
|
||||
reload()
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
[ext_resource type="Script" path="res://scene/ground/ground.gd" id="1_0vrlo"]
|
||||
[ext_resource type="Script" path="res://config/deploy/scene_config.gd" id="2_bx7rv"]
|
||||
[ext_resource type="Texture2D" uid="uid://cjyk6lbbdxiwf" path="res://asset/art/scene/c02/s06_院子回忆版/bg_院子1楼(黄昏有人).png" id="3_amw1x"]
|
||||
[ext_resource type="Script" path="res://config/audio/random_audio_stream_player.gd" id="4_gui8l"]
|
||||
[ext_resource type="PackedScene" uid="uid://jr1yd46wm5je" path="res://scene/entity/note.tscn" id="4_i8g3k"]
|
||||
[ext_resource type="Texture2D" uid="uid://by8h2yuqve7fw" path="res://asset/art/scene/c02/s06_院子回忆版/fg_有人.png" id="5_i5hii"]
|
||||
|
||||
[sub_resource type="Resource" id="Resource_6ux50"]
|
||||
@ -17,36 +17,37 @@ player_initial_position = Vector2(300, 186)
|
||||
player_initial_direction = Vector2(1, -1)
|
||||
player_movement_rect = Rect2(0, 0, 0, 0)
|
||||
camera_rect = Rect2(0, -1000, 664, 2317)
|
||||
footstep_type = "concrete"
|
||||
footstep_type = "grass"
|
||||
|
||||
[node name="Ground" type="Node2D"]
|
||||
script = ExtResource("1_0vrlo")
|
||||
scene_config = SubResource("Resource_6ux50")
|
||||
|
||||
[node name="ParallaxBackground" type="ParallaxBackground" parent="."]
|
||||
[node name="BGSprite2D" type="Sprite2D" parent="."]
|
||||
unique_name_in_owner = true
|
||||
|
||||
[node name="ParallaxLayer" type="ParallaxLayer" parent="ParallaxBackground"]
|
||||
|
||||
[node name="BGSprite2D" type="Sprite2D" parent="ParallaxBackground/ParallaxLayer"]
|
||||
unique_name_in_owner = true
|
||||
scale = Vector2(1.33649, 1.32083)
|
||||
scale = Vector2(1.1, 1.1)
|
||||
texture = ExtResource("3_amw1x")
|
||||
centered = false
|
||||
offset = Vector2(0, -120)
|
||||
|
||||
[node name="DeployLayer" type="Node2D" parent="ParallaxBackground/ParallaxLayer"]
|
||||
[node name="DeployLayer" type="Node2D" parent="."]
|
||||
unique_name_in_owner = true
|
||||
|
||||
[node name="Note" parent="DeployLayer" instance=ExtResource("4_i8g3k")]
|
||||
position = Vector2(268, 8)
|
||||
|
||||
[node name="ParallaxForeground" type="ParallaxBackground" parent="."]
|
||||
unique_name_in_owner = true
|
||||
layer = 10
|
||||
|
||||
[node name="ParallaxLayer" type="ParallaxLayer" parent="ParallaxForeground"]
|
||||
[node name="BGParallaxLayer" type="ParallaxLayer" parent="ParallaxForeground"]
|
||||
|
||||
[node name="FGParallaxLayer" type="ParallaxLayer" parent="ParallaxForeground"]
|
||||
motion_scale = Vector2(1.1, 1.1)
|
||||
|
||||
[node name="FGSprite2D" type="Sprite2D" parent="ParallaxForeground/ParallaxLayer"]
|
||||
[node name="FGSprite2D" type="Sprite2D" parent="ParallaxForeground/FGParallaxLayer"]
|
||||
unique_name_in_owner = true
|
||||
position = Vector2(-4, 23)
|
||||
scale = Vector2(1.2, 1.2)
|
||||
position = Vector2(0, -120)
|
||||
texture = ExtResource("5_i5hii")
|
||||
centered = false
|
||||
|
||||
@ -76,11 +77,3 @@ grow_horizontal = 2
|
||||
grow_vertical = 0
|
||||
mouse_filter = 2
|
||||
color = Color(0.0519829, 0.0179176, 0.00269875, 1)
|
||||
|
||||
[node name="FootstepAudioStreamPlayer" type="AudioStreamPlayer" parent="."]
|
||||
unique_name_in_owner = true
|
||||
volume_db = -10.0
|
||||
pitch_scale = 0.6
|
||||
bus = &"game_sfx"
|
||||
script = ExtResource("4_gui8l")
|
||||
audio_collections = Array[Object]([])
|
||||
|
41
scene/ground/ground_loader.gd
Normal file
@ -0,0 +1,41 @@
|
||||
extends Node2D
|
||||
|
||||
@export var chapter := 2
|
||||
@export var section := 1
|
||||
|
||||
@onready var ground = %Ground
|
||||
|
||||
var scenes_dir = "res://scene/ground/scene/"
|
||||
|
||||
var ground_dict = {}
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
_read_grounds()
|
||||
|
||||
|
||||
func _read_grounds():
|
||||
var dir = DirAccess.open(scenes_dir)
|
||||
for c_dir in dir.get_directories():
|
||||
var c = int(c_dir.substr(1))
|
||||
var c_path = scenes_dir + c_dir + "/"
|
||||
for s_file in DirAccess.open(c_path).get_files():
|
||||
if s_file.ends_with(".tscn"):
|
||||
var s = int(s_file.substr(1, 2))
|
||||
var s_path = c_path + s_file
|
||||
ground_dict[str(c + s)] = s_path
|
||||
|
||||
|
||||
func play_footstep_sound() -> void:
|
||||
ground.play_footstep_sound()
|
||||
|
||||
|
||||
func transition_to_scene(c: int, s: int, portal: String) -> void:
|
||||
var scene_path = ground_dict[str(c + s)]
|
||||
if scene_path:
|
||||
ground.scene_config = load(scene_path)
|
||||
ground.reload()
|
||||
chapter = c
|
||||
section = s
|
||||
else:
|
||||
print("Scene not found: " + str(c) + "-" + str(s))
|
21
scene/ground/ground_loader.tscn
Normal file
@ -0,0 +1,21 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://clxgkj80yin2"]
|
||||
|
||||
[ext_resource type="Script" path="res://scene/ground/ground_loader.gd" id="1_6mjre"]
|
||||
[ext_resource type="PackedScene" uid="uid://dayyx4jerj7io" path="res://scene/ground/ground.tscn" id="2_2ob1l"]
|
||||
[ext_resource type="Script" path="res://config/audio/random_audio_stream_player.gd" id="3_vvkgn"]
|
||||
|
||||
[node name="GroundLoader" type="Node2D"]
|
||||
script = ExtResource("1_6mjre")
|
||||
|
||||
[node name="Ground" parent="." instance=ExtResource("2_2ob1l")]
|
||||
unique_name_in_owner = true
|
||||
|
||||
[node name="FootstepAudioStreamPlayer" type="AudioStreamPlayer" parent="."]
|
||||
unique_name_in_owner = true
|
||||
volume_db = -10.0
|
||||
pitch_scale = 0.6
|
||||
bus = &"game_sfx"
|
||||
script = ExtResource("3_vvkgn")
|
||||
audio_collections = Array[Object]([])
|
||||
|
||||
[editable path="Ground"]
|
3
scene/ground/scene/c02/s01_街道.tscn
Normal file
@ -0,0 +1,3 @@
|
||||
[gd_scene format=3 uid="uid://djc2uaefhmu7"]
|
||||
|
||||
[node name="S01" type="Node2D"]
|
@ -1 +1,32 @@
|
||||
extends Control
|
||||
|
||||
@export var inventory := []
|
||||
|
||||
@onready var mark = %Mark as TextureRect
|
||||
|
||||
# var red_mark := preload("res://asset/art/ui/hud/red_hand.png")
|
||||
|
||||
# func _ready() -> void:
|
||||
# toogle_mark(true)
|
||||
|
||||
|
||||
func toogle_mark(show_mark := true, banned := true) -> void:
|
||||
# TODO
|
||||
# if banned:
|
||||
# # use red mark
|
||||
# mark.modulate = Color(1, 1, 1, mark.modulate.a)
|
||||
# # mark.texture = red_mark
|
||||
# else:
|
||||
# # use green mark
|
||||
# mark.modulate = Color(0.2, 1, 0.2, mark.modulate.a)
|
||||
|
||||
var tween = create_tween()
|
||||
if show_mark:
|
||||
tween.tween_property(mark, "modulate:a", 0.5, 0.2)
|
||||
tween.tween_property(mark, "modulate:a", 1.0, 0.2)
|
||||
tween.parallel().tween_property(mark, "scale", Vector2(1.2, 1.2), 0.3).set_trans(
|
||||
Tween.TRANS_CUBIC
|
||||
)
|
||||
tween.tween_property(mark, "scale", Vector2.ONE, 0.3).set_trans(Tween.TRANS_CUBIC)
|
||||
else:
|
||||
tween.tween_property(mark, "modulate:a", 0.0, 0.6)
|
||||
|
@ -1,16 +1,16 @@
|
||||
[gd_scene load_steps=12 format=3 uid="uid://dc778gsjfr3ky"]
|
||||
|
||||
[ext_resource type="Script" path="res://scene/hud/prop_hud.gd" id="1_bbv0a"]
|
||||
[ext_resource type="Texture2D" uid="uid://chyumeohdhwnh" path="res://asset/art/ui/道具快捷栏/normal_left.png" id="2_bjc2b"]
|
||||
[ext_resource type="Texture2D" uid="uid://cvepj6u80c5wv" path="res://asset/art/ui/道具快捷栏/pressed_left.png" id="3_fca7p"]
|
||||
[ext_resource type="Texture2D" uid="uid://chyumeohdhwnh" path="res://asset/art/ui/hud/normal_left.png" id="2_bjc2b"]
|
||||
[ext_resource type="Texture2D" uid="uid://cvepj6u80c5wv" path="res://asset/art/ui/hud/pressed_left.png" id="3_fca7p"]
|
||||
[ext_resource type="Script" path="res://ui/button/sound_texture_button.gd" id="3_xijdf"]
|
||||
[ext_resource type="Texture2D" uid="uid://bospbmb0gr2sb" path="res://asset/art/ui/道具快捷栏/Prop.png" id="5_6tt77"]
|
||||
[ext_resource type="Texture2D" uid="uid://bospbmb0gr2sb" path="res://asset/art/ui/hud/Prop.png" id="5_6tt77"]
|
||||
[ext_resource type="Script" path="res://config/audio/audio_stream_collection.gd" id="5_wmvnw"]
|
||||
[ext_resource type="Resource" uid="uid://cor5ec6ogq3fe" path="res://config/audio/casino/card_slide.tres" id="6_32vbt"]
|
||||
[ext_resource type="Texture2D" uid="uid://optvgar5g2c" path="res://asset/art/prop/c02/绳子物品.png" id="8_kpmil"]
|
||||
[ext_resource type="Texture2D" uid="uid://bgsbwhy1c2jna" path="res://asset/art/ui/道具快捷栏/hand.png" id="9_0crjo"]
|
||||
[ext_resource type="Texture2D" uid="uid://boqpr7i2a5uan" path="res://asset/art/ui/道具快捷栏/normal_right.png" id="10_vkaik"]
|
||||
[ext_resource type="Texture2D" uid="uid://daj2n408y2vfp" path="res://asset/art/ui/道具快捷栏/pressed_right.png" id="11_a512b"]
|
||||
[ext_resource type="Texture2D" uid="uid://bgsbwhy1c2jna" path="res://asset/art/ui/hud/red_hand.png" id="9_0crjo"]
|
||||
[ext_resource type="Texture2D" uid="uid://boqpr7i2a5uan" path="res://asset/art/ui/hud/normal_right.png" id="10_vkaik"]
|
||||
[ext_resource type="Texture2D" uid="uid://daj2n408y2vfp" path="res://asset/art/ui/hud/pressed_right.png" id="11_a512b"]
|
||||
|
||||
[node name="PropHUD" type="HBoxContainer"]
|
||||
offset_left = 10.0
|
||||
@ -41,8 +41,7 @@ stretch_mode = 5
|
||||
script = ExtResource("3_xijdf")
|
||||
audio_collections = Array[ExtResource("5_wmvnw")]([ExtResource("6_32vbt")])
|
||||
|
||||
[node name="Prop" type="TextureRect" parent="HudPanel"]
|
||||
unique_name_in_owner = true
|
||||
[node name="CenterContainer" type="CenterContainer" parent="HudPanel"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
@ -55,6 +54,10 @@ offset_right = 73.0
|
||||
offset_bottom = 41.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="Prop" type="TextureRect" parent="HudPanel/CenterContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
texture = ExtResource("8_kpmil")
|
||||
|
||||
[node name="Mark" type="TextureRect" parent="HudPanel"]
|
||||
|
@ -1,16 +0,0 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://dpgmgc5qf0apc"]
|
||||
|
||||
[sub_resource type="GDScript" id="GDScript_5nh3u"]
|
||||
script/source = "extends StaticBody2D
|
||||
|
||||
func _ready() -> void:
|
||||
pass"
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_gyjm3"]
|
||||
size = Vector2(38, 38)
|
||||
|
||||
[node name="PropHudItem2D" type="StaticBody2D"]
|
||||
script = SubResource("GDScript_5nh3u")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("RectangleShape2D_gyjm3")
|
@ -4,20 +4,11 @@ extends Node2D
|
||||
set(val):
|
||||
scene_config = val
|
||||
_load_scene_config()
|
||||
@export var deployment_config: DeploymentConfig:
|
||||
set(val):
|
||||
deployment_config = val
|
||||
_load_deployment_config()
|
||||
|
||||
func _ready() -> void:
|
||||
$UILayer.layer = GlobalConfig.CANVAS_LAYER_VIGNETTE
|
||||
_load_scene_config()
|
||||
_load_deployment_config()
|
||||
|
||||
func _load_scene_config() -> void:
|
||||
if !scene_config:
|
||||
return
|
||||
|
||||
func _load_deployment_config() -> void:
|
||||
if !deployment_config:
|
||||
return
|
||||
|
@ -9,44 +9,50 @@
|
||||
[ext_resource type="PackedScene" uid="uid://cjhw5ecygrqty" path="res://scene/player/main_player.tscn" id="6_6geb0"]
|
||||
[ext_resource type="PackedScene" uid="uid://cqkeegrcdjyg4" path="res://scene/camera/camera_focus_marker.tscn" id="7_n7qcv"]
|
||||
[ext_resource type="PackedScene" uid="uid://ogyvstscr0kx" path="res://scene/camera/main_camera.tscn" id="8_nj084"]
|
||||
[ext_resource type="PackedScene" uid="uid://dayyx4jerj7io" path="res://scene/ground/ground.tscn" id="10_wcvoq"]
|
||||
[ext_resource type="PackedScene" uid="uid://clxgkj80yin2" path="res://scene/ground/ground_loader.tscn" id="10_8rc5n"]
|
||||
|
||||
[node name="Main" type="Node2D"]
|
||||
script = ExtResource("1_pks84")
|
||||
|
||||
[node name="GroundLoader" parent="." instance=ExtResource("10_8rc5n")]
|
||||
|
||||
[node name="UILayer" type="CanvasLayer" parent="."]
|
||||
layer = 5
|
||||
|
||||
[node name="HUD2D" parent="UILayer" instance=ExtResource("4_t7gb2")]
|
||||
scale = Vector2(0.24, 0.24)
|
||||
mouse_filter = 0
|
||||
metadata/_edit_use_anchors_ = true
|
||||
|
||||
[node name="DialogLayer" parent="UILayer" instance=ExtResource("3_prpss")]
|
||||
offset_top = -134.0
|
||||
mouse_filter = 2
|
||||
offset_left = -230.0
|
||||
offset_top = -70.0
|
||||
offset_right = 230.0
|
||||
metadata/_edit_use_anchors_ = true
|
||||
|
||||
[node name="Notification" parent="UILayer" instance=ExtResource("5_3gg5t")]
|
||||
metadata/_edit_use_anchors_ = true
|
||||
|
||||
[node name="VignetteShading" parent="." instance=ExtResource("2_d1re1")]
|
||||
intensity = 0.1
|
||||
|
||||
[node name="PropInspector2D" parent="." instance=ExtResource("5_ux0rw")]
|
||||
|
||||
[node name="MainPlayer" parent="." instance=ExtResource("6_6geb0")]
|
||||
unique_name_in_owner = true
|
||||
position = Vector2(300, 187)
|
||||
position = Vector2(80, 42)
|
||||
scale = Vector2(0.6, 0.6)
|
||||
|
||||
[node name="CameraFocusMarker" parent="MainPlayer" instance=ExtResource("7_n7qcv")]
|
||||
unique_name_in_owner = true
|
||||
|
||||
[node name="MainCamera" parent="MainPlayer/CameraFocusMarker" instance=ExtResource("8_nj084")]
|
||||
unique_name_in_owner = true
|
||||
position = Vector2(1, 0)
|
||||
position = Vector2(1.66667, 0)
|
||||
limit_left = 0
|
||||
limit_top = -1000
|
||||
limit_right = 1500
|
||||
limit_bottom = 1317
|
||||
limit_bottom = 1000
|
||||
limit_smoothed = true
|
||||
position_smoothing_enabled = true
|
||||
position_smoothing_speed = 8.0
|
||||
|
||||
[node name="Ground" parent="." instance=ExtResource("10_wcvoq")]
|
||||
|
@ -52,7 +52,8 @@ func _ready() -> void:
|
||||
|
||||
|
||||
func _on_footstep_timer_timeout():
|
||||
var ground = get_node_or_null("/root/Main/Ground")
|
||||
# ground node is sibling of the player node.
|
||||
var ground = get_node_or_null("../GroundLoader")
|
||||
if ground:
|
||||
ground.play_footstep_sound()
|
||||
|
||||
|
@ -5,9 +5,10 @@
|
||||
[ext_resource type="Texture2D" uid="uid://t526pexw4ng4" path="res://asset/art/neutral_point_light.webp" id="3_scilj"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_fno82"]
|
||||
size = Vector2(105, 238.5)
|
||||
size = Vector2(78.25, 205.062)
|
||||
|
||||
[node name="MainPlayer" type="CharacterBody2D"]
|
||||
collision_mask = 2
|
||||
script = ExtResource("1_3a78y")
|
||||
|
||||
[node name="FootstepTimer" type="Timer" parent="."]
|
||||
@ -19,12 +20,13 @@ sprite_frames = ExtResource("2_3w63u")
|
||||
animation = &"idle_r"
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
position = Vector2(-1, -1)
|
||||
shape = SubResource("RectangleShape2D_fno82")
|
||||
|
||||
[node name="PointLight2D" type="PointLight2D" parent="."]
|
||||
position = Vector2(-1, -110)
|
||||
visible = false
|
||||
position = Vector2(-2, -29)
|
||||
scale = Vector2(0.810547, 0.849609)
|
||||
energy = 0.4
|
||||
texture = ExtResource("3_scilj")
|
||||
texture_scale = 1.5
|
||||
height = 50.0
|
||||
|