This commit is contained in:
TsubakiLoL 2024-09-19 17:56:05 +08:00
parent fe8d8fba0e
commit 683848fd40
29 changed files with 431 additions and 36 deletions

View File

@ -0,0 +1,14 @@
extends Node
func set_bgm(value):
if %BGM.stream == null:
%BGM.stream = value
%BGM.play()
else:
var tween = get_tree().create_tween()
tween.tween_property(%BGM, "volume_db",-20 , 1)
await get_tree().create_timer(1).timeout
%BGM.stream = value
%BGM.play()
tween = get_tree().create_tween()
tween.tween_property(%BGM, "volume_db",0 , 0.5)

View File

@ -0,0 +1,10 @@
[gd_scene load_steps=2 format=3 uid="uid://bdjimjjwd0iur"]
[ext_resource type="Script" path="res://autoload/BGM/script/bgm.gd" id="1_ah4s8"]
[node name="BGM" type="Node"]
script = ExtResource("1_ah4s8")
[node name="BGM" type="AudioStreamPlayer" parent="."]
unique_name_in_owner = true
bus = &"BGM"

View File

@ -11,11 +11,22 @@ var event_json_path:String="res://json/event.json"
var event_data:Dictionary
var scene_json_path:String="res://json/scene.json"
var scene_data:Dictionary
var character_json_path:String="res://json/character.json"
var character_data:Dictionary
var system_config_data:Dictionary={
}
var now_game_data:Dictionary={
"time":99999
}
func _ready() -> void:
load_texture_data()
load_script_data()
load_event_data()
load_scene_data()
load_character_data()
func load_texture_data():
var file=FileAccess.open(texture_json_path,FileAccess.READ)
var str=file.get_as_text()
@ -52,6 +63,13 @@ func load_scene_data():
dictionary[i]["id"]=i
scene_data=dictionary
pass
func load_character_data():
var file=FileAccess.open(character_json_path,FileAccess.READ)
var str=file.get_as_text()
var dictionary:Dictionary=JSON.parse_string(str)
for i in dictionary.keys():
dictionary[i]["id"]=i
character_data=dictionary
func get_texture(id:String):
if texture_data.has(id):
return texture_data[id]
@ -78,3 +96,9 @@ func get_scene_data(id:String):
return dictionary.duplicate()
else:
return null
func get_character_data(id:String):
if character_data.has(id):
var dictionary:Dictionary=scene_data[id]
return dictionary.duplicate()
else:
return null

View File

@ -22,7 +22,7 @@ func change_scene_to(path:String):
percent.text="20"
await get_tree().create_timer(0.2).timeout
load_path=path
ResourceLoader.load_threaded_request(path,"PackedScene",true)
ResourceLoader.load_threaded_request(path,"PackedScene")
set_process(true)
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:

View File

@ -72,6 +72,7 @@ tracks/0/keys = {
[sub_resource type="Animation" id="Animation_m3y4q"]
resource_name = "breath"
length = 0.5
loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
@ -80,10 +81,10 @@ tracks/0/path = NodePath("ColorRect/HBoxContainer:modulate")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.5, 1),
"transitions": PackedFloat32Array(1, 1, 1),
"times": PackedFloat32Array(0, 0.25),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Color(1, 1, 1, 1), Color(0.54099, 0.54099, 0.54099, 1), Color(1, 1, 1, 1)]
"values": [Color(1, 1, 1, 1), Color(0.54099, 0.54099, 0.54099, 1)]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_8ttym"]
@ -93,6 +94,7 @@ _data = {
}
[node name="SceneManager" type="CanvasLayer"]
process_mode = 3
layer = 100
script = ExtResource("1_q8xsu")

View File

@ -156,6 +156,8 @@ func fit_children()->void:
##更改窗口的开闭状态,使用动画
func change_open(opened:bool=false):
if opened==is_open:
return
if now_keep_tween!=null:
now_keep_tween.kill()
if !opened:

16
default_bus_layout.tres Normal file
View File

@ -0,0 +1,16 @@
[gd_resource type="AudioBusLayout" format=3 uid="uid://dds0ostkug6qj"]
[resource]
bus/0/send = &"New Bus"
bus/1/name = &"BGM"
bus/1/solo = false
bus/1/mute = false
bus/1/bypass_fx = false
bus/1/volume_db = 0.0
bus/1/send = &"Master"
bus/2/name = &"Effect"
bus/2/solo = false
bus/2/mute = false
bus/2/bypass_fx = false
bus/2/volume_db = 0.0
bus/2/send = &"Master"

13
json/banner.json Normal file
View File

@ -0,0 +1,13 @@
{
"banner_01":{
"name":"测试卡池01",
"side_texture":"test_character",
"back":"test_scene",
"character":"test_character",
"probability":[
{
}
]
}
}

85
json/character.json Normal file
View File

@ -0,0 +1,85 @@
{
"test_character_01":{
"character":{
"name":"朱雀院椿(测试)",
"star":5,
"skin":[
{
"name":"皮肤1",
"card_face":"test_character_tsubaki",
"character":"角色图片路径"
}
],
"skin_now_use":0
},
"basic_mes":{
"script_category":"剧本类别",
"place":"地点",
"sex":0,
"race":"种族",
"birthday":"xxxx-xx-xx",
"introduction":"这是一个介绍",
"basic_attribute":[
{
"name":"体质",
"value":100,
},
{
"name":"敏捷",
"value":100,
},
{
"name":"智力",
"value":100,
},
{
"name":"感知",
"value":100,
},
],
"fight_attribute":[
{
"name":"生命",
"value":100,
},
{
"name":"精神",
"value":100,
},
{
"name":"物理攻击",
"value":100,
},
{
"name":"法术强度",
"value":100,
},
]
},
"special":[
{
"name":"倾国倾城",
"introduction":"鼠标点击显示具体效果鼠标点击显示具体效果鼠标点击显示具体效果鼠标点击显示具体效果鼠标点击显示具体效果鼠标点击显示具体效果鼠标点击显示具体效果鼠标点击显示具体效果"
}
],
"ability":[
{
"name":"武学 LV3",
"introduction":"鼠标点击显示具体效果鼠标点击显示具体效果鼠标点击显示具体效果鼠标点击显示具体效果鼠标点击显示具体效果鼠标点击显示具体效果鼠标点击显示具体效果鼠标点击显示具体效果"
}
],
"favor":[{
"name":"姐姐",
"value":100
}
],
"reputation":[
{
"name":"某地区",
"value":100
}
]
}
}

View File

@ -5,7 +5,36 @@
"text":"测试事件",
"choice":[
{
"name":"测试选项1"
"name":"测试选项1",
"triger":[{
"type":"change_scene"
},
{
"type":"change_event",
"data":"event_01"
},
{
"type":"change_texture",
"data":"test_character"
},
{
"type":"music",
"data":"res://test/audio/attack_0.wav"
},
{
"type":"fight"
},
{
"type":"identification"
},
{
"type":"change_attribute"
},
{
"type":"change_value"
},
]
},
{
"name":"测试选项2"

View File

@ -1,5 +1,6 @@
{
"texture_test":"res://test/texture/test_texture.png",
"test_scene":"res://test/texture/test_scene.png",
"test_character":"res://test/texture/test_character.png"
"test_character":"res://test/texture/test_character.png",
"test_character_tsubaki":"res://test/texture/tsubaki_1.png"
}

View File

@ -20,6 +20,7 @@ config/icon="res://icon.svg"
PopUpWindow="*res://addons/popupwindow/PopUpWindow.tscn"
Global="*res://autoload/global/tscn/global.tscn"
SceneManager="*res://autoload/scene_manager/tscn/scene_manager.tscn"
Bgm="*res://autoload/BGM/tscn/bgm.tscn"
[display]
@ -29,3 +30,11 @@ window/size/viewport_height=1080
[editor_plugins]
enabled=PackedStringArray("res://addons/popupwindow/plugin.cfg")
[input]
mouse_left={
"deadzone": 0.5,
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":1,"position":Vector2(272, 11),"global_position":Vector2(281, 57),"factor":1.0,"button_index":1,"canceled":false,"pressed":true,"double_click":false,"script":null)
]
}

View File

@ -1,5 +1,4 @@
shader_type canvas_item;
//@A shader by 刚学没几天的小策划@SL
uniform float power : hint_range(0.2, 4.0, 0.1) = 1.0;
uniform float up : hint_range(0.0, 1.0, 0.001) = 0.1;
uniform float down : hint_range(0.0, 1.0, 0.001) = 0.1;

30
scene/bag_side_card.gd Normal file
View File

@ -0,0 +1,30 @@
extends TextureRect
var is_mouse_enter:bool=false
signal click(data:Dictionary)
var data:Dictionary={
}
# 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
func _input(event: InputEvent) -> void:
if event.is_action_pressed("mouse_left") and is_mouse_enter:
click.emit(data)
func _get_drag_data(at_position: Vector2) -> Variant:
var texture_rect=TextureRect.new()
texture_rect.texture=Global.get_texture(data["texture"])
set_drag_preview(texture_rect)
return data
func _on_mouse_entered() -> void:
is_mouse_enter=true
pass # Replace with function body.
func _on_mouse_exited() -> void:
is_mouse_enter=false
pass # Replace with function body.

View File

@ -1,7 +1,8 @@
[gd_scene load_steps=4 format=3 uid="uid://dfhx4088ydrme"]
[gd_scene load_steps=5 format=3 uid="uid://dfhx4088ydrme"]
[ext_resource type="Texture2D" uid="uid://13g8uityud7a" path="res://res/ui/ui_008_bag/tuceng159.png" id="1_ep34g"]
[ext_resource type="Texture2D" uid="uid://li8e5ntlgcpg" path="res://res/ui/ui_003_select/test.png" id="2_4o4bp"]
[ext_resource type="Script" path="res://scene/bag_side_card.gd" id="2_frdwk"]
[ext_resource type="Texture2D" uid="uid://buq2xt621xilr" path="res://res/ui/ui_008_bag/tuceng160.png" id="3_if27l"]
[node name="bag_side_card" type="TextureRect"]
@ -13,6 +14,7 @@ offset_bottom = -150.0
size_flags_horizontal = 2
size_flags_vertical = 0
texture = ExtResource("1_ep34g")
script = ExtResource("2_frdwk")
metadata/_edit_use_anchors_ = true
[node name="face" type="TextureRect" parent="."]
@ -42,12 +44,5 @@ expand_mode = 1
stretch_mode = 5
metadata/_edit_use_anchors_ = true
[node name="Button" type="Button" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
focus_mode = 0
flat = true
[connection signal="mouse_entered" from="." to="." method="_on_mouse_entered"]
[connection signal="mouse_exited" from="." to="." method="_on_mouse_exited"]

View File

@ -355,6 +355,7 @@ theme_override_font_sizes/font_size = 34
text = "9999"
[node name="banner_detail" parent="." instance=ExtResource("19_mb4ei")]
visible = false
layout_mode = 1
[connection signal="pressed" from="MarginContainer/HBoxContainer/VBoxContainer/TextureRect/back" to="." method="_on_back_pressed"]

View File

@ -155,7 +155,7 @@ size_flags_horizontal = 3
[node name="character" type="TextureRect" parent="."]
layout_mode = 1
anchors_preset = -1
anchor_left = 0.33
anchor_left = 0.290417
anchor_top = 1.0
anchor_right = 0.33
anchor_bottom = 1.0
@ -163,7 +163,7 @@ offset_left = -266.6
offset_top = -977.0
offset_right = 266.4
expand_mode = 1
stretch_mode = 3
stretch_mode = 6
metadata/_edit_use_anchors_ = true
[node name="texture" type="TextureRect" parent="."]

View File

@ -4,8 +4,11 @@ const EVENT_CHOICE_BUTTON = preload("res://scene/event_choice_button.tscn")
@onready var event_texture: TextureRect = $MarginContainer/HBoxContainer/event_texture
@onready var event_intro: Label = $MarginContainer/NinePatchRect/VBoxContainer/event_intro
@onready var event_name: Label = $MarginContainer/NinePatchRect/TextureRect/event_name
@onready var animation_player: AnimationPlayer = $AnimationPlayer
@onready var audio_stream_player: AudioStreamPlayer = $AudioStreamPlayer
var data:Dictionary
var text_ratio_tween:Tween
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
set_event_data("event_01")
@ -28,5 +31,30 @@ func set_event_data(id:String):
var new_btn=EVENT_CHOICE_BUTTON.instantiate()
choice_add_pos.add_child(new_btn)
new_btn.set_data(i)
new_btn.click.connect(choice_click)
animation_player.play("open")
func choice_click(event_data:Dictionary):
for i in event_data["triger"]:
match i["type"]:
"change_event":
set_event_data(i["data"])
"change_texture":
event_texture.texture=Global.get_texture(i["data"])
pass
"end":
hide()
"music":
audio_stream_player.stream=load(i["data"])
audio_stream_player.play()
pass
pass
pass
pass

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=10 format=3 uid="uid://b3hw4w5shpyu0"]
[gd_scene load_steps=13 format=3 uid="uid://b3hw4w5shpyu0"]
[ext_resource type="Script" path="res://scene/event.gd" id="1_cpmb4"]
[ext_resource type="Texture2D" uid="uid://ctfm87nw7xemy" path="res://res/ui/ui_020_event/tuceng1.png" id="1_u31m8"]
@ -11,16 +11,53 @@
[sub_resource type="ShaderMaterial" id="ShaderMaterial_2da64"]
shader = ExtResource("2_l482b")
shader_parameter/power = 0.7
shader_parameter/up = 0.1
shader_parameter/down = 0.1
shader_parameter/left = 0.988
shader_parameter/power = 0.8
shader_parameter/up = 0.0
shader_parameter/down = 0.0
shader_parameter/left = 1.0
shader_parameter/right = 0.0
shader_parameter/up_clip = 0.0
shader_parameter/down_clip = 0.0
shader_parameter/left_clip = 0.0
shader_parameter/right_clip = 0.0
[sub_resource type="Animation" id="Animation_e8sku"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("MarginContainer:modulate")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Color(0.454524, 0.454524, 0.454524, 1)]
}
[sub_resource type="Animation" id="Animation_vvm5c"]
resource_name = "open"
length = 0.5
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("MarginContainer:modulate")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.5),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Color(0.454524, 0.454524, 0.454524, 1), Color(1, 1, 1, 1)]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_526vg"]
_data = {
"RESET": SubResource("Animation_e8sku"),
"open": SubResource("Animation_vvm5c")
}
[node name="event" type="Control"]
layout_mode = 3
anchors_preset = 15
@ -42,6 +79,7 @@ expand_mode = 1
stretch_mode = 6
[node name="MarginContainer" type="MarginContainer" parent="."]
modulate = Color(0.454524, 0.454524, 0.454524, 1)
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
@ -64,7 +102,7 @@ layout_mode = 2
size_flags_horizontal = 10
texture = ExtResource("3_xsoi1")
expand_mode = 3
stretch_mode = 6
stretch_mode = 4
[node name="NinePatchRect" type="NinePatchRect" parent="MarginContainer"]
layout_mode = 2
@ -107,7 +145,7 @@ layout_mode = 1
anchors_preset = -1
anchor_left = 0.0322052
anchor_top = 0.127872
anchor_right = 0.425764
anchor_right = 0.465065
anchor_bottom = 1.0
metadata/_edit_use_anchors_ = true
@ -141,3 +179,11 @@ size_flags_horizontal = 4
[node name="event_choice_button3" parent="MarginContainer/NinePatchRect/VBoxContainer/VBoxContainer/choice_add_pos" instance=ExtResource("7_o3va1")]
layout_mode = 2
size_flags_horizontal = 4
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
libraries = {
"": SubResource("AnimationLibrary_526vg")
}
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
bus = &"Effect"

View File

@ -1,5 +1,5 @@
extends NinePatchRect
signal click
signal click(event_data:Dictionary)
var data:Dictionary
@onready var label: Label = $Label
@ -20,5 +20,5 @@ func _process(delta: float) -> void:
func _on_tool_button_pressed() -> void:
click.emit()
click.emit(data)
pass # Replace with function body.

11
scene/save_and_load.gd Normal file
View File

@ -0,0 +1,11 @@
extends Control
# 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

View File

@ -1,6 +1,7 @@
[gd_scene load_steps=7 format=3 uid="uid://ln0ri824gh2c"]
[gd_scene load_steps=8 format=3 uid="uid://ln0ri824gh2c"]
[ext_resource type="Texture2D" uid="uid://cuvwrwhll8tk6" path="res://res/ui/ui_024_save_and_load/tuceng457.png" id="1_0vq46"]
[ext_resource type="Script" path="res://scene/save_and_load.gd" id="1_db4b7"]
[ext_resource type="Texture2D" uid="uid://6gaiu7avwkot" path="res://res/ui/ui_024_save_and_load/tuceng341.png" id="2_q3e74"]
[ext_resource type="PackedScene" uid="uid://3gy704lvqpgt" path="res://scene/save_and_load_mono.tscn" id="3_exjxy"]
[ext_resource type="Texture2D" uid="uid://dmg8l7qw8qrum" path="res://res/ui/ui_024_save_and_load/tuceng338.png" id="3_nty4b"]
@ -20,6 +21,7 @@ anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_db4b7")
[node name="back" type="TextureRect" parent="."]
layout_mode = 1

View File

@ -0,0 +1,17 @@
extends NinePatchRect
var need_save:bool=true
func _ready() -> void:
if need_save:
$TextureRect3.show()
else:
$TextureRect3.hide()
func _on_save_pressed() -> void:
pass # Replace with function body.
func _on_load_pressed() -> void:
pass # Replace with function body.

View File

@ -1,7 +1,8 @@
[gd_scene load_steps=7 format=3 uid="uid://3gy704lvqpgt"]
[gd_scene load_steps=8 format=3 uid="uid://3gy704lvqpgt"]
[ext_resource type="Texture2D" uid="uid://dkbafbthkd1dn" path="res://res/ui/ui_024_save_and_load/tuceng343.png" id="1_hv83j"]
[ext_resource type="Texture2D" uid="uid://dvlqfyhb3xys2" path="res://res/ui/ui_024_save_and_load/tuceng342.png" id="2_2efqg"]
[ext_resource type="Script" path="res://scene/save_and_load_mono.gd" id="2_cc78r"]
[ext_resource type="Texture2D" uid="uid://bjnmy6ia0bk4h" path="res://res/ui/ui_024_save_and_load/tuceng346.png" id="3_k0rp4"]
[ext_resource type="PackedScene" uid="uid://bdlo2wn4qnygv" path="res://scene/tool/tool_button.tscn" id="4_i5nwn"]
[ext_resource type="Texture2D" uid="uid://5rcik6ljiv0r" path="res://res/ui/ui_024_save_and_load/tuceng344.png" id="5_l2xar"]
@ -16,6 +17,7 @@ patch_margin_left = 16
patch_margin_top = 14
patch_margin_right = 12
patch_margin_bottom = 14
script = ExtResource("2_cc78r")
[node name="TextureRect" type="TextureRect" parent="."]
show_behind_parent = true
@ -134,7 +136,7 @@ horizontal_alignment = 1
vertical_alignment = 1
metadata/_edit_use_anchors_ = true
[node name="ToolButton" parent="TextureRect3" instance=ExtResource("4_i5nwn")]
[node name="save" parent="TextureRect3" instance=ExtResource("4_i5nwn")]
layout_mode = 1
[node name="TextureRect4" type="TextureRect" parent="."]
@ -162,5 +164,8 @@ horizontal_alignment = 1
vertical_alignment = 1
metadata/_edit_use_anchors_ = true
[node name="ToolButton" parent="TextureRect4" instance=ExtResource("4_i5nwn")]
[node name="load" parent="TextureRect4" instance=ExtResource("4_i5nwn")]
layout_mode = 1
[connection signal="pressed" from="TextureRect3/save" to="." method="_on_save_pressed"]
[connection signal="pressed" from="TextureRect4/load" to="." method="_on_load_pressed"]

View File

@ -19,9 +19,7 @@ var data:Dictionary={
"eschatological":[
],
"continue":{
}
}
var now_selected_script:String="history"
var now_selected_script_id:String
@ -63,7 +61,7 @@ func side_btn_clicked(ind:int):
%script_name.text=now_select_array[ind]["name"]
%script_introduction.text=now_select_array[ind]["introduction"]
now_selected_script_id=btn.id
print(btn.id)
pass
func get_global_script_data():
var glbdt=Global.get_all_script_data()

BIN
test/audio/attack_0.wav Normal file

Binary file not shown.

View File

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://cv3d1k2ismkln"
path="res://.godot/imported/attack_0.wav-4edcd5a080eaa423e80c7eb2f95c053a.sample"
[deps]
source_file="res://test/audio/attack_0.wav"
dest_files=["res://.godot/imported/attack_0.wav-4edcd5a080eaa423e80c7eb2f95c053a.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0

BIN
test/texture/tsubaki_1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 879 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://da4mwbefqkahf"
path="res://.godot/imported/tsubaki_1.png-97dabc23892d56dc49647f215f5e681d.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://test/texture/tsubaki_1.png"
dest_files=["res://.godot/imported/tsubaki_1.png-97dabc23892d56dc49647f215f5e681d.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1