完善消息提示功能
This commit is contained in:
parent
d42e40a4a0
commit
cdac22503b
File diff suppressed because one or more lines are too long
@ -18,13 +18,14 @@ class EntityActionConfig:
|
|||||||
var next_state: String = "" # empty means keep current state
|
var next_state: String = "" # empty means keep current state
|
||||||
var animation: String = ""
|
var animation: String = ""
|
||||||
var sound: String = ""
|
var sound: String = ""
|
||||||
var callback: String = ""
|
var callback: Callable
|
||||||
var callback_args := []
|
|
||||||
|
|
||||||
|
|
||||||
@export var entity_name: String = ""
|
@export var entity_name: String = ""
|
||||||
@export var placeholder_rect: Rect2 = Rect2(0, 0, 0, 0)
|
@export var placeholder_size: Vector2 = Vector2(32, 64)
|
||||||
|
@export var offset: Vector2 = Vector2(0, 0)
|
||||||
@export var entity_title: String = ""
|
@export var entity_title: String = ""
|
||||||
@export var entity_note: String = ""
|
@export var entity_note: String = ""
|
||||||
|
@export var initializer: Callable
|
||||||
@export var entity_states: Array[EntityStateConfig]
|
@export var entity_states: Array[EntityStateConfig]
|
||||||
@export var entity_actions: Array[EntityActionConfig]
|
@export var entity_actions: Array[EntityActionConfig]
|
||||||
|
@ -1,11 +1,22 @@
|
|||||||
class_name SceneConfig extends Resource
|
class_name SceneConfig extends Resource
|
||||||
|
|
||||||
@export var scene_name: String = ""
|
@export var scene_name: String = ""
|
||||||
|
|
||||||
|
## ground
|
||||||
@export var foreground_scale: Vector2 = Vector2(1.2, 1.2)
|
@export var foreground_scale: Vector2 = Vector2(1.2, 1.2)
|
||||||
@export var foreground_position: Vector2 = Vector2(0, 0)
|
@export var foreground_position: Vector2 = Vector2(0, 0)
|
||||||
|
@export var foreground_scene: PackedScene
|
||||||
@export var background_scale: Vector2 = Vector2(1.0, 1.0)
|
@export var background_scale: Vector2 = Vector2(1.0, 1.0)
|
||||||
@export var background_position: Vector2 = Vector2(0, 0)
|
@export var background_position: Vector2 = Vector2(0, 0)
|
||||||
|
@export var background_scene: PackedScene
|
||||||
|
|
||||||
|
## player and camera
|
||||||
@export var player_initial_position: Vector2 = Vector2(300, 186)
|
@export var player_initial_position: Vector2 = Vector2(300, 186)
|
||||||
@export var player_initial_direction: Vector2 = Vector2(1, -1)
|
@export var player_initial_direction: Vector2 = Vector2(1, -1)
|
||||||
@export var player_movement_rect: Rect2 = Rect2(0, 0, 0, 0)
|
@export var player_movement_rect: Rect2 = Rect2(0, 0, 0, 0)
|
||||||
@export var camera_rect: Rect2 = Rect2(0, -1000, 664, 2317) # 564*317, 16:9
|
@export var camera_rect: Rect2 = Rect2(0, -1000, 664, 2317) # 564*317, 16:9
|
||||||
|
|
||||||
|
## sound
|
||||||
|
@export_enum("none", "normal", "carpet", "concrete", "grass", "snow")
|
||||||
|
var footstep_type: String = "grass"
|
||||||
|
var bgm: String = ""
|
||||||
|
@ -1,5 +1,26 @@
|
|||||||
{
|
{
|
||||||
"items": [
|
"items": [
|
||||||
|
{
|
||||||
|
"event_date": "12/24/2024",
|
||||||
|
"item_id": "17350028043797",
|
||||||
|
"log_content": "* 完善消息提示功能\n * 0.5s 浮现,显示 3s,0.5s 隐藏(通过调整 alpha 通道实现)\n * 支持堆积消息\n * 如果有堆积的消息,显示 2s(而不是 3s)",
|
||||||
|
"tags": [
|
||||||
|
"2@ui",
|
||||||
|
"2@code"
|
||||||
|
],
|
||||||
|
"update_date": "12/24/2024"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"event_date": "12/23/2024",
|
||||||
|
"item_id": "4123576587",
|
||||||
|
"log_content": "动画资产管理:分页加载资源\n\n定义基本的规格配置、组装部署、资产填充数据结构",
|
||||||
|
"tags": [
|
||||||
|
"2@ui",
|
||||||
|
"3@art_tool",
|
||||||
|
"2@design"
|
||||||
|
],
|
||||||
|
"update_date": "12/24/2024"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"event_date": "12/22/2024",
|
"event_date": "12/22/2024",
|
||||||
"item_id": "876528753689",
|
"item_id": "876528753689",
|
||||||
@ -61,4 +82,4 @@
|
|||||||
"update_date": "12/22/2024"
|
"update_date": "12/22/2024"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
@ -21,6 +21,7 @@ var managers = {
|
|||||||
|
|
||||||
var autosave_timer := Timer.new()
|
var autosave_timer := Timer.new()
|
||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
accessible = _check_archive_dirs()
|
accessible = _check_archive_dirs()
|
||||||
if !accessible:
|
if !accessible:
|
||||||
@ -34,8 +35,6 @@ func _ready() -> void:
|
|||||||
GlobalConfigManager.config.current_selected_save_changed.connect(_check_autosave_options)
|
GlobalConfigManager.config.current_selected_save_changed.connect(_check_autosave_options)
|
||||||
GlobalConfigManager.config.auto_save_seconds_changed.connect(_check_autosave_options)
|
GlobalConfigManager.config.auto_save_seconds_changed.connect(_check_autosave_options)
|
||||||
load_all()
|
load_all()
|
||||||
SceneManager.pop_notification("预加载完成")
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
func _check_autosave_options():
|
func _check_autosave_options():
|
||||||
|
@ -12,4 +12,4 @@ func get_data_res() -> Resource:
|
|||||||
|
|
||||||
|
|
||||||
func load_data_res(data: Resource) -> void:
|
func load_data_res(data: Resource) -> void:
|
||||||
pass
|
pass
|
||||||
|
@ -1,23 +1,18 @@
|
|||||||
class_name GlobalConfig extends Resource
|
class_name GlobalConfig extends Resource
|
||||||
|
|
||||||
|
const DEBUG = true
|
||||||
|
# const DEBUG = false
|
||||||
|
|
||||||
# .res would be binary encoded, .tres is text encoded
|
# .res would be binary encoded, .tres is text encoded
|
||||||
const RES_FILE_FORMAT = ".tres"
|
const RES_FILE_FORMAT = ".tres"
|
||||||
|
|
||||||
const CONFIG_FILE_NAME = "config"
|
## layers
|
||||||
|
|
||||||
const DEBUG = true
|
|
||||||
#const DEBUG = false
|
|
||||||
|
|
||||||
const CANVAS_LAYER_VIGNETTE = 1000
|
const CANVAS_LAYER_VIGNETTE = 1000
|
||||||
const CANVAS_LAYER_PROP_INSPECTOR = 100
|
const CANVAS_LAYER_PROP_INSPECTOR = 100
|
||||||
const CANVAS_LAYER_UI = 99
|
const CANVAS_LAYER_UI = 99
|
||||||
const CANVAS_LAYER_FG = 50
|
const CANVAS_LAYER_FG = 50
|
||||||
const CANVAS_LAYER_BG = -100
|
const CANVAS_LAYER_BG = -100
|
||||||
|
|
||||||
const COLOR_BOARDER = Color.BLACK
|
|
||||||
|
|
||||||
const _ART_RESOURCE_BASE_DIR = "res://asset/art/"
|
|
||||||
|
|
||||||
signal current_selected_save_changed
|
signal current_selected_save_changed
|
||||||
signal auto_save_seconds_changed
|
signal auto_save_seconds_changed
|
||||||
|
|
||||||
|
10
manager/vibe/vibe_manager.gd
Normal file
10
manager/vibe/vibe_manager.gd
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
extends Node
|
||||||
|
|
||||||
|
enum VIBE {
|
||||||
|
NORAML,
|
||||||
|
MYSTERY,
|
||||||
|
DANGEROUS,
|
||||||
|
TOUCHING,
|
||||||
|
}
|
||||||
|
|
||||||
|
# light and wind
|
@ -42,6 +42,7 @@ DialogManager="*res://manager/assemble/dialog/dialog_manager.gd"
|
|||||||
CameraManager="*res://manager/camera_manager/camera_manager.gd"
|
CameraManager="*res://manager/camera_manager/camera_manager.gd"
|
||||||
CgManager="*res://manager/cg_manager/cg_manager.gd"
|
CgManager="*res://manager/cg_manager/cg_manager.gd"
|
||||||
InputManager="*res://manager/input/input_manager.gd"
|
InputManager="*res://manager/input/input_manager.gd"
|
||||||
|
VibeManager="*res://manager/vibe/vibe_manager.gd"
|
||||||
ArchiveManager="*res://manager/archive_manager/archive_manager.gd"
|
ArchiveManager="*res://manager/archive_manager/archive_manager.gd"
|
||||||
|
|
||||||
[display]
|
[display]
|
||||||
|
@ -2,5 +2,5 @@ extends Marker2D
|
|||||||
|
|
||||||
|
|
||||||
func tweak_position(velocity, facing_direction):
|
func tweak_position(velocity, facing_direction):
|
||||||
position.x = facing_direction.x * abs(velocity.x) * 0.3
|
position.x = facing_direction.x * abs(velocity.x) * 0.2
|
||||||
position.y = facing_direction.y * abs(velocity.y) * 0.3
|
position.y = facing_direction.y * abs(velocity.y) * 0.2
|
||||||
|
@ -3,6 +3,3 @@ extends Control
|
|||||||
@onready var color_top := %ColorRectTop as ColorRect
|
@onready var color_top := %ColorRectTop as ColorRect
|
||||||
@onready var color_bottom := %ColorRectBottom as ColorRect
|
@onready var color_bottom := %ColorRectBottom as ColorRect
|
||||||
|
|
||||||
func _ready() -> void:
|
|
||||||
color_top.color = GlobalConfig.COLOR_BOARDER
|
|
||||||
color_bottom.color = GlobalConfig.COLOR_BOARDER
|
|
||||||
|
@ -24,7 +24,7 @@ offset_right = 282.0
|
|||||||
offset_bottom = 40.0
|
offset_bottom = 40.0
|
||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
mouse_filter = 2
|
mouse_filter = 2
|
||||||
color = Color(0.372549, 0.0156863, 0.0156863, 1)
|
color = Color(0.0519829, 0.0179176, 0.00269875, 1)
|
||||||
|
|
||||||
[node name="ColorRectBottom" type="ColorRect" parent="."]
|
[node name="ColorRectBottom" type="ColorRect" parent="."]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
@ -41,4 +41,4 @@ offset_right = 282.0
|
|||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
grow_vertical = 0
|
grow_vertical = 0
|
||||||
mouse_filter = 2
|
mouse_filter = 2
|
||||||
color = Color(0.372549, 0.0156863, 0.0156863, 1)
|
color = Color(0.0519829, 0.0179176, 0.00269875, 1)
|
||||||
|
@ -1,4 +1,23 @@
|
|||||||
extends Node2D
|
extends Node2D
|
||||||
|
|
||||||
|
@export var scene_config: SceneConfig:
|
||||||
|
set(val):
|
||||||
|
scene_config = val
|
||||||
|
_load_scene_config()
|
||||||
|
@export var deployment_config: DeploymentConfig:
|
||||||
|
set(val):
|
||||||
|
deployment_config = val
|
||||||
|
_load_deployment_config()
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
$UILayer.layer = GlobalConfig.CANVAS_LAYER_VIGNETTE
|
$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
|
@ -37,13 +37,6 @@ mouse_filter = 2
|
|||||||
[node name="MainPlayer" parent="." instance=ExtResource("6_6geb0")]
|
[node name="MainPlayer" parent="." instance=ExtResource("6_6geb0")]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
position = Vector2(300, 187)
|
position = Vector2(300, 187)
|
||||||
current_status = 0
|
|
||||||
facing_direction = Vector2(1, -1)
|
|
||||||
running_locked = false
|
|
||||||
speed_walking = 100.0
|
|
||||||
speed_runnig = 170.0
|
|
||||||
speed_laying = 60.0
|
|
||||||
speed_climbing = 60.0
|
|
||||||
|
|
||||||
[node name="CameraFocusMarker" parent="MainPlayer" instance=ExtResource("7_n7qcv")]
|
[node name="CameraFocusMarker" parent="MainPlayer" instance=ExtResource("7_n7qcv")]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
|
@ -1,6 +1,46 @@
|
|||||||
extends Control
|
extends Control
|
||||||
|
|
||||||
|
@onready var label := %RichTextLabel as RichTextLabel
|
||||||
|
|
||||||
|
var pending_notifications = []
|
||||||
|
var tweening := false
|
||||||
|
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
modulate = Color(1, 1, 1, 0)
|
||||||
|
# test notification in editor
|
||||||
|
if GlobalConfig.DEBUG:
|
||||||
|
call_deferred("test")
|
||||||
|
|
||||||
|
|
||||||
|
func test():
|
||||||
|
show_notification("Hello, 1!", 42)
|
||||||
|
show_notification("Hello, 2! very very long message, very very loooonnnggggggg!", 2)
|
||||||
|
show_notification("Hello, 3!", 24)
|
||||||
|
|
||||||
|
|
||||||
func show_notification(msg, number):
|
func show_notification(msg, number):
|
||||||
#TODO: Implement this method
|
if tweening:
|
||||||
print("show_notification:", msg, number)
|
pending_notifications.append([msg, number])
|
||||||
|
else:
|
||||||
|
label.text = msg
|
||||||
|
tweening = true
|
||||||
|
var tween = create_tween()
|
||||||
|
# 0.5s to show the notification
|
||||||
|
tween.tween_property(self, "modulate:a", 1, 0.5).set_trans(Tween.TRANS_CUBIC)
|
||||||
|
# keep the notification
|
||||||
|
if pending_notifications.size() > 0:
|
||||||
|
tween.tween_interval(2)
|
||||||
|
else:
|
||||||
|
tween.tween_interval(3)
|
||||||
|
# 0.5s to hide the notification
|
||||||
|
tween.tween_property(self, "modulate:a", 0, 0.5).set_trans(Tween.TRANS_CUBIC)
|
||||||
|
# callback
|
||||||
|
tween.tween_callback(self._check_next)
|
||||||
|
|
||||||
|
|
||||||
|
func _check_next():
|
||||||
|
if pending_notifications.size() > 0:
|
||||||
|
var n = pending_notifications.pop_front()
|
||||||
|
tweening = false
|
||||||
|
show_notification(n[0], n[1])
|
||||||
|
@ -26,7 +26,8 @@ theme_override_constants/margin_top = 12
|
|||||||
theme_override_constants/margin_right = 24
|
theme_override_constants/margin_right = 24
|
||||||
|
|
||||||
[node name="RichTextLabel" type="RichTextLabel" parent="MarginContainer"]
|
[node name="RichTextLabel" type="RichTextLabel" parent="MarginContainer"]
|
||||||
custom_minimum_size = Vector2(200, 0)
|
unique_name_in_owner = true
|
||||||
|
custom_minimum_size = Vector2(50, 0)
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_horizontal = 8
|
size_flags_horizontal = 8
|
||||||
mouse_filter = 2
|
mouse_filter = 2
|
||||||
@ -34,4 +35,3 @@ text = "notification"
|
|||||||
fit_content = true
|
fit_content = true
|
||||||
scroll_active = false
|
scroll_active = false
|
||||||
autowrap_mode = 0
|
autowrap_mode = 0
|
||||||
text_direction = 2
|
|
||||||
|
Loading…
Reference in New Issue
Block a user