10.1下午
This commit is contained in:
parent
0e13605b4c
commit
b5f8a1d451
@ -20,3 +20,10 @@ func play_effect(value):
|
||||
func _on_bgm_finished() -> void:
|
||||
%BGM.play()
|
||||
pass # Replace with function body.
|
||||
func set_BGM_volume(value:float):
|
||||
AudioServer.set_bus_volume_db(1,linear_to_db(value))
|
||||
|
||||
pass
|
||||
func set_effect_volume(value:float):
|
||||
AudioServer.set_bus_volume_db(2,linear_to_db(value))
|
||||
pass
|
||||
|
@ -54,24 +54,100 @@ func add_character_embellich_data(character_id:String,embellish_name:String,data
|
||||
embellish_name:data
|
||||
}
|
||||
save_character_embellish_data()
|
||||
|
||||
|
||||
|
||||
|
||||
var system_config_data_path:String="user://config.data"
|
||||
#加载配置文件
|
||||
func load_config():
|
||||
var f=FileAccess.open(system_config_data_path,FileAccess.READ)
|
||||
if f!=null:
|
||||
system_config_data=f.get_var()
|
||||
else:
|
||||
f=FileAccess.open(system_config_data_path,FileAccess.WRITE)
|
||||
f.store_var(system_config_data)
|
||||
Bgm.set_BGM_volume(system_config_data["BGM_volume"])
|
||||
Bgm.set_effect_volume(system_config_data["effect_volume"])
|
||||
#存储配置文件
|
||||
func save_config():
|
||||
var f=FileAccess.open(system_config_data_path,FileAccess.WRITE)
|
||||
f.store_var(system_config_data)
|
||||
#更改BGM音量
|
||||
func change_BGM_volume(value:float):
|
||||
Bgm.set_BGM_volume(value)
|
||||
system_config_data["BGM_volume"]=value
|
||||
save_config()
|
||||
pass
|
||||
|
||||
#更改音效音量
|
||||
func change_effect_volume(value:float):
|
||||
Bgm.set_effect_volume(value)
|
||||
system_config_data["effect_volume"]=value
|
||||
save_config()
|
||||
pass
|
||||
func get_BGM_volume():
|
||||
return system_config_data["BGM_volume"]
|
||||
pass
|
||||
func get_effect_volume():
|
||||
return system_config_data["effect_volume"]
|
||||
var system_config_data:Dictionary={
|
||||
|
||||
#BGM音量
|
||||
"BGM_volume":0.7,
|
||||
#音效音量
|
||||
"effect_volume":0.7,
|
||||
}
|
||||
|
||||
#局外游戏数据文件目录
|
||||
var system_game_data_path:String="user://system_game.data"
|
||||
#局外游戏数据
|
||||
var system_game_data:Dictionary={
|
||||
"unlock_character":["test_character_01","test_character_02"],
|
||||
#全局物品
|
||||
"item":[]
|
||||
|
||||
"item":[],
|
||||
"jifen":100,
|
||||
"jinqian":100,
|
||||
"zuanshi":100,
|
||||
"tili":100,
|
||||
}
|
||||
|
||||
|
||||
|
||||
#获取系统全局物品
|
||||
func get_all_item_system_data():
|
||||
|
||||
pass
|
||||
#货币变更信号
|
||||
signal system_currency_changed
|
||||
#获取货币,0积分,1金钱,2钻石,3体力
|
||||
func get_currency_system(ind:int):
|
||||
match ind:
|
||||
0:
|
||||
return system_game_data["jifen"]
|
||||
1:
|
||||
return system_game_data["jinqian"]
|
||||
2:
|
||||
return system_game_data["zuanshi"]
|
||||
3:
|
||||
return system_game_data["tili"]
|
||||
#更改货币数据
|
||||
func set_currency_system(ind:int,value):
|
||||
match ind:
|
||||
0:
|
||||
system_game_data["jifen"]=value
|
||||
1:
|
||||
system_game_data["jinqian"]=value
|
||||
2:
|
||||
system_game_data["zuanshi"]=value
|
||||
3:
|
||||
system_game_data["tili"]=value
|
||||
system_currency_changed.emit()
|
||||
save_system_game_data()
|
||||
pass
|
||||
#加载局外游戏数据文件
|
||||
func load_system_game_data():
|
||||
var f=FileAccess.open(system_game_data_path,FileAccess.READ)
|
||||
if f!=null:
|
||||
system_game_data=f.get_var()
|
||||
else:
|
||||
f=FileAccess.open(system_game_data_path,FileAccess.WRITE)
|
||||
f.store_var(system_game_data)
|
||||
#存储局外游戏数据
|
||||
func save_system_game_data():
|
||||
var f=FileAccess.open(system_game_data_path,FileAccess.WRITE)
|
||||
f.store_var(system_game_data)
|
||||
#获取当前游戏内所有物品
|
||||
func get_all_item_game_data()->Array:
|
||||
return now_game_data["item"].duplicate(true)
|
||||
@ -235,7 +311,7 @@ func add_sill_card_from_bag_to_character(ind:int):
|
||||
func get_now_character_skill():
|
||||
var character_data=now_game_data["character_data"]
|
||||
return CharacterTool.get_character_skill_all(character_data)
|
||||
##当前数据
|
||||
##当前局内数据
|
||||
var now_game_data:Dictionary={
|
||||
"character_data":{
|
||||
|
||||
@ -254,7 +330,31 @@ var now_game_data:Dictionary={
|
||||
"move_ability":1,
|
||||
"time_unix":0,
|
||||
"card_in_bag":["card_03","card_03","card_02","card_02","card_01","card_01","card_01","card_01"]
|
||||
|
||||
}
|
||||
#游戏内货币改变信号
|
||||
signal game_currency_changed
|
||||
#获取游戏内的“货币”,0:生命,1金钱,2精神
|
||||
func get_currency_game(ind:int):
|
||||
match ind:
|
||||
0:
|
||||
return now_game_data["health"]
|
||||
1:
|
||||
return now_game_data["gold"]
|
||||
2:
|
||||
return now_game_data["spirit"]
|
||||
func set_currency_game(ind:int,value):
|
||||
match ind:
|
||||
0:
|
||||
now_game_data["health"]=value
|
||||
1:
|
||||
now_game_data["gold"]=value
|
||||
2:
|
||||
now_game_data["spirit"]=value
|
||||
game_currency_changed.emit()
|
||||
#更改
|
||||
func change_currency_game(ind:int,change):
|
||||
set_currency_game(ind,get_currency_game(ind)+change)
|
||||
#当前战斗场景
|
||||
var now_fight_scene:FightScene
|
||||
#向卡组中添加卡牌
|
||||
@ -347,7 +447,8 @@ var triger:Dictionary={
|
||||
"increase_health":func (data):now_game_data.health-=data,
|
||||
"end_event":func(data):now_game_flow.event_panel.hide(),
|
||||
"flow_time":func (data):flow_time(data),
|
||||
"fight":func (data):fight(data)
|
||||
"fight":func (data):fight(data),
|
||||
"add_currency":func (data):change_currency_game(data["ind"],data["value"])
|
||||
}
|
||||
#使用事件触发器
|
||||
func call_triger(triger_type:String,data):
|
||||
@ -360,16 +461,14 @@ var condition_triger:Dictionary={
|
||||
"date_limit":func (data:Dictionary):return TimeTool.is_in_date(data,get_time_dictionary()),
|
||||
"time_limit":func (data:Dictionary):return TimeTool.is_in_time(data,get_time_dictionary()),
|
||||
"rand":func (data:Dictionary):return get_rand(data["scene_id"],data["touch_id"],data["index"],data["condition"]),
|
||||
|
||||
"currency_more_than": func (data:Dictionary) :return get_currency_game(data["ind"])>=data["value"]
|
||||
}
|
||||
#使用条件触发器
|
||||
func call_condition_triger(triger_type:String,data):
|
||||
if condition_triger.has(triger_type):
|
||||
return condition_triger[triger_type].call(data)
|
||||
else:
|
||||
return null
|
||||
|
||||
pass
|
||||
return false
|
||||
#记录随机的场景上一次结果,如果时间不变则直接取上一次结果
|
||||
var condition_triger_randi_dic:Dictionary={
|
||||
"scene_id":{
|
||||
@ -462,6 +561,8 @@ func _ready() -> void:
|
||||
load_npc_data()
|
||||
load_character_emblish_data()
|
||||
load_item_data()
|
||||
load_config()
|
||||
load_system_game_data()
|
||||
#加载当前图片数据
|
||||
func load_texture_data():
|
||||
var file=FileAccess.open(texture_json_path,FileAccess.READ)
|
||||
|
@ -89,4 +89,61 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"event_04":{
|
||||
"name":"测试事件4",
|
||||
"texture":"test_scene",
|
||||
"text":"这是一个测试货币系统的事件",
|
||||
"choice":[
|
||||
{
|
||||
"name":"添加金钱*100",
|
||||
"triger":[{
|
||||
"type":"add_currency",
|
||||
"data":{
|
||||
"ind":1,
|
||||
"value":100
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name":"减少金钱*100",
|
||||
"condition":[
|
||||
{
|
||||
"type":"currency_more_than",
|
||||
"data":{
|
||||
"ind":1,
|
||||
"value":100,
|
||||
}
|
||||
}
|
||||
],
|
||||
"triger":[{
|
||||
"type":"add_currency",
|
||||
"data":{
|
||||
"ind":1,
|
||||
"value":-100
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name":"减少精神*100",
|
||||
"triger":[{
|
||||
"type":"add_currency",
|
||||
"data":{
|
||||
"ind":2,
|
||||
"value":-100
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name":"结束",
|
||||
"triger":[{
|
||||
"type":"end_event",
|
||||
"data":""
|
||||
},
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
}
|
||||
|
@ -15,7 +15,11 @@
|
||||
{
|
||||
"name":"战斗测试",
|
||||
"event":"event_03"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name":"货币测试",
|
||||
"event":"event_04"
|
||||
},
|
||||
],
|
||||
"linked_scene":[{
|
||||
"name":"测试场景2",
|
||||
|
38
scene/config.gd
Normal file
38
scene/config.gd
Normal file
@ -0,0 +1,38 @@
|
||||
extends Control
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
var bgm=Global.get_BGM_volume()
|
||||
%BGM_bar.value=bgm
|
||||
%BGM_slider.value=bgm
|
||||
var effect=Global.get_effect_volume()
|
||||
%effect_bar.value=effect
|
||||
%effect_slider.value=effect
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
pass
|
||||
|
||||
|
||||
func _on_bgm_slider_value_changed(value: float) -> void:
|
||||
%BGM_bar.value=value
|
||||
Global.change_BGM_volume(value)
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
func _on_effect_slider_value_changed(value: float) -> void:
|
||||
%effect_bar.value=value
|
||||
Global.change_effect_volume(value)
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
func _on_back_pressed() -> void:
|
||||
get_parent().change_open(false)
|
||||
pass # Replace with function body.
|
@ -1,12 +1,15 @@
|
||||
[gd_scene load_steps=10 format=3 uid="uid://bp04hbeued2uo"]
|
||||
[gd_scene load_steps=18 format=3 uid="uid://bp04hbeued2uo"]
|
||||
|
||||
[ext_resource type="Script" path="res://scene/config.gd" id="1_56x8p"]
|
||||
[ext_resource type="Texture2D" uid="uid://bh88xd3lon1u8" path="res://res/ui/ui_032_config/tuceng2.png" id="1_nt8m8"]
|
||||
[ext_resource type="Texture2D" uid="uid://by2e6nigywyqk" path="res://res/ui/ui_032_config/juxing1.png" id="2_eru1r"]
|
||||
[ext_resource type="Texture2D" uid="uid://das3bb65stovo" path="res://res/ui/ui_032_config/tuceng224.png" id="3_5qmfo"]
|
||||
[ext_resource type="Texture2D" uid="uid://f84p0bedyunr" path="res://res/ui/ui_032_config/juxing10.png" id="3_sby74"]
|
||||
[ext_resource type="Texture2D" uid="uid://bdauhvr6hkkh3" path="res://res/ui/ui_032_config/yinyueshezhi.png" id="4_4yr4v"]
|
||||
[ext_resource type="PackedScene" uid="uid://bdlo2wn4qnygv" path="res://scene/tool/tool_button.tscn" id="4_47pkd"]
|
||||
[ext_resource type="Texture2D" uid="uid://chalvyxh7l664" path="res://res/ui/ui_032_config/juxing13.png" id="5_cbpkm"]
|
||||
[ext_resource type="Texture2D" uid="uid://dkkuwlm4hkptf" path="res://res/ui/ui_032_config/juxing13_1.png" id="6_idxm5"]
|
||||
[ext_resource type="Texture2D" uid="uid://do21b46okydwi" path="res://res/ui/ui_032_config/juxing11.png" id="6_tb3vp"]
|
||||
[ext_resource type="Texture2D" uid="uid://djsbkisal4x7u" path="res://res/ui/ui_032_config/yinxiaoshezhi.png" id="8_uluv4"]
|
||||
|
||||
[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_ilajt"]
|
||||
texture = ExtResource("2_eru1r")
|
||||
@ -16,12 +19,29 @@ texture_margin_right = 60.2331
|
||||
texture_margin_bottom = 58.4615
|
||||
region_rect = Rect2(0, 0, 1780, 960)
|
||||
|
||||
[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_5hcr3"]
|
||||
texture = ExtResource("5_cbpkm")
|
||||
texture_margin_left = 26.0
|
||||
texture_margin_top = 20.9091
|
||||
texture_margin_right = 22.0
|
||||
texture_margin_bottom = 20.9091
|
||||
[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_7hm7c"]
|
||||
texture = ExtResource("6_tb3vp")
|
||||
texture_margin_left = 32.2454
|
||||
texture_margin_top = 39.2553
|
||||
texture_margin_right = 31.194
|
||||
texture_margin_bottom = 41.3583
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_7evfr"]
|
||||
offsets = PackedFloat32Array(0, 0.626087, 0.669565)
|
||||
colors = PackedColorArray(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0)
|
||||
|
||||
[sub_resource type="GradientTexture2D" id="GradientTexture2D_2yvwx"]
|
||||
gradient = SubResource("Gradient_7evfr")
|
||||
width = 128
|
||||
height = 128
|
||||
fill = 1
|
||||
fill_from = Vector2(0.5, 0.5)
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_xqvab"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_daqh4"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_pl3ie"]
|
||||
|
||||
[node name="Config" type="Control"]
|
||||
layout_mode = 3
|
||||
@ -30,6 +50,7 @@ anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_56x8p")
|
||||
|
||||
[node name="back" type="TextureRect" parent="."]
|
||||
layout_mode = 1
|
||||
@ -70,6 +91,7 @@ theme_override_constants/margin_bottom = 65
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/Panel/MarginContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 80
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/Panel/MarginContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
@ -95,10 +117,112 @@ metadata/_edit_use_anchors_ = true
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer/Panel/MarginContainer/VBoxContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="HScrollBar" type="HScrollBar" parent="MarginContainer/Panel/MarginContainer/VBoxContainer/VBoxContainer/HBoxContainer"]
|
||||
[node name="Panel" type="Panel" parent="MarginContainer/Panel/MarginContainer/VBoxContainer/VBoxContainer/HBoxContainer"]
|
||||
custom_minimum_size = Vector2(0, 80)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
theme_override_styles/scroll = SubResource("StyleBoxTexture_5hcr3")
|
||||
theme_override_styles/panel = SubResource("StyleBoxTexture_7hm7c")
|
||||
|
||||
[node name="BGM_bar" type="TextureProgressBar" parent="MarginContainer/Panel/MarginContainer/VBoxContainer/VBoxContainer/HBoxContainer/Panel"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(0, 60)
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
size_flags_horizontal = 3
|
||||
max_value = 1.0
|
||||
step = 0.01
|
||||
nine_patch_stretch = true
|
||||
texture_progress = ExtResource("6_idxm5")
|
||||
|
||||
[node name="BGM_slider" type="HSlider" parent="MarginContainer/Panel/MarginContainer/VBoxContainer/VBoxContainer/HBoxContainer/Panel"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 1
|
||||
anchors_preset = -1
|
||||
anchor_left = -0.0175121
|
||||
anchor_top = -0.3
|
||||
anchor_right = 1.01027
|
||||
anchor_bottom = 1.3
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_override_icons/grabber = SubResource("GradientTexture2D_2yvwx")
|
||||
theme_override_icons/grabber_highlight = SubResource("GradientTexture2D_2yvwx")
|
||||
theme_override_icons/grabber_disabled = SubResource("GradientTexture2D_2yvwx")
|
||||
theme_override_styles/slider = SubResource("StyleBoxEmpty_xqvab")
|
||||
theme_override_styles/grabber_area = SubResource("StyleBoxEmpty_daqh4")
|
||||
theme_override_styles/grabber_area_highlight = SubResource("StyleBoxEmpty_pl3ie")
|
||||
max_value = 1.0
|
||||
step = 0.01
|
||||
ticks_on_borders = true
|
||||
|
||||
[node name="VBoxContainer2" type="VBoxContainer" parent="MarginContainer/Panel/MarginContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 78
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="MarginContainer/Panel/MarginContainer/VBoxContainer/VBoxContainer2"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 0
|
||||
texture = ExtResource("3_sby74")
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="MarginContainer/Panel/MarginContainer/VBoxContainer/VBoxContainer2/TextureRect"]
|
||||
layout_mode = 1
|
||||
anchors_preset = -1
|
||||
anchor_left = 0.0759494
|
||||
anchor_top = 0.183099
|
||||
anchor_right = 0.68038
|
||||
anchor_bottom = 0.873239
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
texture = ExtResource("8_uluv4")
|
||||
metadata/_edit_use_anchors_ = true
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer/Panel/MarginContainer/VBoxContainer/VBoxContainer2"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Panel" type="Panel" parent="MarginContainer/Panel/MarginContainer/VBoxContainer/VBoxContainer2/HBoxContainer"]
|
||||
custom_minimum_size = Vector2(0, 80)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
theme_override_styles/panel = SubResource("StyleBoxTexture_7hm7c")
|
||||
|
||||
[node name="effect_bar" type="TextureProgressBar" parent="MarginContainer/Panel/MarginContainer/VBoxContainer/VBoxContainer2/HBoxContainer/Panel"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(0, 60)
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
size_flags_horizontal = 3
|
||||
max_value = 1.0
|
||||
step = 0.01
|
||||
nine_patch_stretch = true
|
||||
texture_progress = ExtResource("6_idxm5")
|
||||
|
||||
[node name="effect_slider" type="HSlider" parent="MarginContainer/Panel/MarginContainer/VBoxContainer/VBoxContainer2/HBoxContainer/Panel"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 1
|
||||
anchors_preset = -1
|
||||
anchor_left = -0.0175121
|
||||
anchor_top = -0.3
|
||||
anchor_right = 1.01027
|
||||
anchor_bottom = 1.3
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_override_icons/grabber = SubResource("GradientTexture2D_2yvwx")
|
||||
theme_override_icons/grabber_highlight = SubResource("GradientTexture2D_2yvwx")
|
||||
theme_override_icons/grabber_disabled = SubResource("GradientTexture2D_2yvwx")
|
||||
theme_override_styles/slider = SubResource("StyleBoxEmpty_xqvab")
|
||||
theme_override_styles/grabber_area = SubResource("StyleBoxEmpty_daqh4")
|
||||
theme_override_styles/grabber_area_highlight = SubResource("StyleBoxEmpty_pl3ie")
|
||||
max_value = 1.0
|
||||
step = 0.01
|
||||
ticks_on_borders = true
|
||||
metadata/_edit_use_anchors_ = true
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="."]
|
||||
layout_mode = 1
|
||||
@ -110,5 +234,9 @@ offset_bottom = 40.0
|
||||
grow_horizontal = 0
|
||||
texture = ExtResource("3_5qmfo")
|
||||
|
||||
[node name="ToolButton" parent="TextureRect" instance=ExtResource("4_47pkd")]
|
||||
[node name="back" parent="TextureRect" instance=ExtResource("4_47pkd")]
|
||||
layout_mode = 1
|
||||
|
||||
[connection signal="value_changed" from="MarginContainer/Panel/MarginContainer/VBoxContainer/VBoxContainer/HBoxContainer/Panel/BGM_slider" to="." method="_on_bgm_slider_value_changed"]
|
||||
[connection signal="value_changed" from="MarginContainer/Panel/MarginContainer/VBoxContainer/VBoxContainer2/HBoxContainer/Panel/effect_slider" to="." method="_on_effect_slider_value_changed"]
|
||||
[connection signal="pressed" from="TextureRect/back" to="." method="_on_back_pressed"]
|
||||
|
@ -8,10 +8,10 @@ const EVENT_CHOICE_BUTTON = preload("res://scene/event_choice_button.tscn")
|
||||
@onready var audio_stream_player: AudioStreamPlayer = $AudioStreamPlayer
|
||||
|
||||
var data:Dictionary
|
||||
var choice_data:Array=[]
|
||||
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")
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
@ -27,11 +27,20 @@ func set_event_data(id:String):
|
||||
event_intro.text=data["text"]
|
||||
event_name.text=data["name"]
|
||||
var choice_data=data["choice"]
|
||||
self.choice_data=choice_data.duplicate(true)
|
||||
for i in choice_data:
|
||||
var enable:bool=true
|
||||
if i.has("condition"):
|
||||
var condition_data:Array=i["condition"]
|
||||
for j in condition_data:
|
||||
enable=enable and Global.call_condition_triger(j["type"],j["data"])
|
||||
pass
|
||||
print(enable)
|
||||
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)
|
||||
new_btn.set_disable(not enable)
|
||||
animation_player.play("open")
|
||||
func choice_click(event_data:Dictionary):
|
||||
if not event_data.has("triger"):
|
||||
@ -42,7 +51,7 @@ func choice_click(event_data:Dictionary):
|
||||
|
||||
Global.call_triger(i["type"],i["data"])
|
||||
pass
|
||||
|
||||
change_choice(self.choice_data)
|
||||
pass
|
||||
func change_texture(texture_id:String):
|
||||
event_texture.texture=Global.get_texture(texture_id)
|
||||
@ -52,9 +61,17 @@ func change_text(text:String):
|
||||
func change_choice(choice_data:Array):
|
||||
for i in choice_add_pos.get_children():
|
||||
i.queue_free()
|
||||
self.choice_data=choice_data.duplicate(true)
|
||||
for i in choice_data:
|
||||
var enable:bool=true
|
||||
if i.has("condition"):
|
||||
var condition_data:Array=i["condition"]
|
||||
for j in condition_data:
|
||||
enable=enable and Global.call_condition_triger(j["type"],j["data"])
|
||||
print(enable)
|
||||
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)
|
||||
new_btn.set_disable(not enable)
|
||||
pass
|
||||
|
@ -22,3 +22,6 @@ func _process(delta: float) -> void:
|
||||
func _on_tool_button_pressed() -> void:
|
||||
click.emit(data)
|
||||
pass # Replace with function body.
|
||||
|
||||
func set_disable(is_disable:bool):
|
||||
%ToolButton.disable(is_disable)
|
||||
|
@ -28,6 +28,7 @@ horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="ToolButton" parent="." instance=ExtResource("2_wanh2")]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 1
|
||||
|
||||
[connection signal="pressed" from="ToolButton" to="." method="_on_tool_button_pressed"]
|
||||
|
@ -129,7 +129,17 @@ func reset():
|
||||
user.queue_free()
|
||||
user=null
|
||||
|
||||
func win():
|
||||
|
||||
SceneManager.change_scene_to("res://scene/game_flow.tscn")
|
||||
|
||||
|
||||
pass
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
func _on_debug_win_pressed() -> void:
|
||||
win()
|
||||
pass # Replace with function body.
|
||||
|
@ -99,6 +99,22 @@ vertical_alignment = 1
|
||||
[node name="ToolButton" parent="Label" instance=ExtResource("5_cxbtq")]
|
||||
layout_mode = 1
|
||||
|
||||
[node name="Label2" type="Label" parent="."]
|
||||
layout_mode = 0
|
||||
offset_right = 239.0
|
||||
offset_bottom = 80.0
|
||||
text = "添加卡牌"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="debug_win" parent="Label2" instance=ExtResource("5_cxbtq")]
|
||||
layout_mode = 1
|
||||
anchors_preset = -1
|
||||
anchor_left = 1.0
|
||||
anchor_right = 2.0
|
||||
text = "获胜"
|
||||
metadata/_edit_use_anchors_ = true
|
||||
|
||||
[node name="release_mark" type="Control" parent="."]
|
||||
layout_mode = 1
|
||||
anchor_left = 0.04375
|
||||
@ -119,3 +135,4 @@ metadata/_edit_use_anchors_ = true
|
||||
|
||||
[connection signal="pressed" from="end_select/end_select" to="." method="_on_end_select_pressed"]
|
||||
[connection signal="pressed" from="Label/ToolButton" to="." method="_on_tool_button_pressed"]
|
||||
[connection signal="pressed" from="Label2/debug_win" to="." method="_on_debug_win_pressed"]
|
||||
|
@ -25,6 +25,8 @@ func _ready() -> void:
|
||||
var character_data=Global.get_now_character_data()
|
||||
character_texture.texture=Global.get_texture(CharacterTool.get_head(character_data))
|
||||
character_name.text=CharacterTool.get_character_name(character_data)
|
||||
update_game_currency()
|
||||
Global.game_currency_changed.connect(update_game_currency)
|
||||
func set_scene(id:String):
|
||||
scene_data=Global.get_scene_data(id)
|
||||
back.texture=Global.get_texture(scene_data["texture"])
|
||||
@ -105,3 +107,8 @@ func _on_head_btn_pressed() -> void:
|
||||
%basic_mes.init_from_data()
|
||||
%basic_mes.show()
|
||||
pass # Replace with function body.
|
||||
|
||||
func update_game_currency():
|
||||
%jinqian.text=str(Global.get_currency_game(1))
|
||||
%shengming.text=str(Global.get_currency_game(0))
|
||||
%jingshen.text=str(Global.get_currency_game(2))
|
||||
|
@ -226,7 +226,8 @@ theme_override_font_sizes/font_size = 27
|
||||
text = "金钱:"
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="Label3" type="Label" parent="hbox/TextureRect2/vbox/HBoxContainer/HBoxContainer"]
|
||||
[node name="jinqian" type="Label" parent="hbox/TextureRect2/vbox/HBoxContainer/HBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 1
|
||||
@ -249,7 +250,8 @@ theme_override_font_sizes/font_size = 27
|
||||
text = "生命:"
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="Label3" type="Label" parent="hbox/TextureRect2/vbox/HBoxContainer2/HBoxContainer"]
|
||||
[node name="shengming" type="Label" parent="hbox/TextureRect2/vbox/HBoxContainer2/HBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 1
|
||||
@ -268,7 +270,8 @@ theme_override_font_sizes/font_size = 27
|
||||
text = "精神:"
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="Label3" type="Label" parent="hbox/TextureRect2/vbox/HBoxContainer2/HBoxContainer2"]
|
||||
[node name="jingshen" type="Label" parent="hbox/TextureRect2/vbox/HBoxContainer2/HBoxContainer2"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 1
|
||||
|
@ -3,8 +3,16 @@ extends Control
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
update_currency()
|
||||
Global.system_currency_changed.connect(update_currency)
|
||||
pass # Replace with function body.
|
||||
|
||||
func update_currency():
|
||||
%jifen.text=str(Global.get_currency_system(0))
|
||||
%jinqian.text=str(Global.get_currency_system(1))
|
||||
%zuanshi.text=str(Global.get_currency_system(2))
|
||||
%tili.text=str(Global.get_currency_system(3))
|
||||
pass
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
@ -29,3 +37,8 @@ func _on_zhaomu_pressed() -> void:
|
||||
func _on_character_btn_pressed() -> void:
|
||||
%bag_card_drawer.change_open(true)
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
func _on_config_btn_pressed() -> void:
|
||||
%config_drawer.change_open(true)
|
||||
pass # Replace with function body.
|
||||
|
@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=38 format=3 uid="uid://bbsr3gcxo3lcl"]
|
||||
[gd_scene load_steps=39 format=3 uid="uid://bbsr3gcxo3lcl"]
|
||||
|
||||
[ext_resource type="Script" path="res://scene/main.gd" id="1_aevx8"]
|
||||
[ext_resource type="Texture2D" uid="uid://bchvegwghynrm" path="res://res/ui/ui_002_main/tuceng1.png" id="1_q2tgu"]
|
||||
@ -36,6 +36,7 @@
|
||||
[ext_resource type="PackedScene" uid="uid://33lcg23hy4mi" path="res://scene/select.tscn" id="34_wkvs0"]
|
||||
[ext_resource type="PackedScene" uid="uid://batc5tlfgbqm5" path="res://scene/banner.tscn" id="35_qckx8"]
|
||||
[ext_resource type="PackedScene" uid="uid://cgl1vcdusqroq" path="res://scene/character_bag.tscn" id="36_2e8de"]
|
||||
[ext_resource type="PackedScene" uid="uid://bp04hbeued2uo" path="res://scene/config.tscn" id="37_h7uva"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_1b8r4"]
|
||||
|
||||
@ -90,7 +91,7 @@ size_flags_vertical = 4
|
||||
texture = ExtResource("2_revac")
|
||||
stretch_mode = 5
|
||||
|
||||
[node name="ToolButton" parent="MarginContainer/HBoxContainer/VBoxContainer/HBoxContainer/Button" instance=ExtResource("17_37v8w")]
|
||||
[node name="config_btn" parent="MarginContainer/HBoxContainer/VBoxContainer/HBoxContainer/Button" instance=ExtResource("17_37v8w")]
|
||||
layout_mode = 1
|
||||
|
||||
[node name="Button2" type="Button" parent="MarginContainer/HBoxContainer/VBoxContainer/HBoxContainer"]
|
||||
@ -218,7 +219,8 @@ texture = ExtResource("5_7swrf")
|
||||
expand_mode = 3
|
||||
stretch_mode = 5
|
||||
|
||||
[node name="Label" type="Label" parent="MarginContainer/HBoxContainer/VBoxContainer2/HBoxContainer/Control/HBoxContainer"]
|
||||
[node name="jifen" type="Label" parent="MarginContainer/HBoxContainer/VBoxContainer2/HBoxContainer/Control/HBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 2
|
||||
theme_override_font_sizes/font_size = 34
|
||||
@ -257,7 +259,8 @@ texture = ExtResource("7_c8lco")
|
||||
expand_mode = 3
|
||||
stretch_mode = 5
|
||||
|
||||
[node name="Label" type="Label" parent="MarginContainer/HBoxContainer/VBoxContainer2/HBoxContainer/Control2/HBoxContainer"]
|
||||
[node name="jinqian" type="Label" parent="MarginContainer/HBoxContainer/VBoxContainer2/HBoxContainer/Control2/HBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 34
|
||||
text = "9999"
|
||||
@ -295,7 +298,8 @@ texture = ExtResource("9_kn8kn")
|
||||
expand_mode = 3
|
||||
stretch_mode = 5
|
||||
|
||||
[node name="Label" type="Label" parent="MarginContainer/HBoxContainer/VBoxContainer2/HBoxContainer/Control3/HBoxContainer"]
|
||||
[node name="zuanshi" type="Label" parent="MarginContainer/HBoxContainer/VBoxContainer2/HBoxContainer/Control3/HBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 0
|
||||
theme_override_font_sizes/font_size = 34
|
||||
@ -332,7 +336,8 @@ texture = ExtResource("11_6dt7p")
|
||||
expand_mode = 3
|
||||
stretch_mode = 5
|
||||
|
||||
[node name="Label" type="Label" parent="MarginContainer/HBoxContainer/VBoxContainer2/HBoxContainer/Control4/HBoxContainer"]
|
||||
[node name="tili" type="Label" parent="MarginContainer/HBoxContainer/VBoxContainer2/HBoxContainer/Control4/HBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 34
|
||||
text = "9999"
|
||||
@ -664,6 +669,27 @@ rag = 1.0
|
||||
[node name="Control" parent="bag_card_drawer" instance=ExtResource("36_2e8de")]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="config_drawer" type="Container" parent="."]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
mouse_filter = 2
|
||||
script = ExtResource("33_2nl8b")
|
||||
button_model = 3
|
||||
animation_time = 0.3
|
||||
disable_button = true
|
||||
animation_model = 8
|
||||
is_open = false
|
||||
rag = 1.0
|
||||
|
||||
[node name="Config" parent="config_drawer" instance=ExtResource("37_h7uva")]
|
||||
layout_mode = 2
|
||||
|
||||
[connection signal="pressed" from="MarginContainer/HBoxContainer/VBoxContainer/HBoxContainer/Button/config_btn" to="." method="_on_config_btn_pressed"]
|
||||
[connection signal="pressed" from="MarginContainer/HBoxContainer/VBoxContainer2/VBoxContainer/HBoxContainer/TextureRect/new_story" to="." method="_on_new_story_pressed"]
|
||||
[connection signal="pressed" from="MarginContainer/HBoxContainer/VBoxContainer2/VBoxContainer/HBoxContainer2/TextureRect/character_btn" to="." method="_on_character_btn_pressed"]
|
||||
[connection signal="pressed" from="MarginContainer/HBoxContainer/VBoxContainer2/VBoxContainer/HBoxContainer2/TextureRect2/zhaomu" to="." method="_on_zhaomu_pressed"]
|
||||
|
@ -3,8 +3,8 @@ extends Control
|
||||
var target = null:
|
||||
set(value):
|
||||
target = value
|
||||
var tween = get_tree().create_tween()
|
||||
tween.set_loops()
|
||||
var tween = create_tween()
|
||||
#tween.set_loops()
|
||||
tween.tween_property($TextureRect2, "global_position", target.global_position + Vector2(-90, target.size.y/2 - 42/2), 0.1)
|
||||
tween.parallel()
|
||||
tween.tween_property($TextureRect3, "global_position", target.global_position + Vector2(target.size.x+90, target.size.y/2 - 42/2), 0.1)
|
||||
|
@ -32,3 +32,9 @@ grow_vertical = 2
|
||||
[node name="ToolButton" parent="." instance=ExtResource("3_g0onc")]
|
||||
layout_mode = 0
|
||||
anchors_preset = 0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
offset_right = 8.0
|
||||
offset_bottom = 8.0
|
||||
grow_horizontal = 1
|
||||
grow_vertical = 1
|
||||
|
Loading…
Reference in New Issue
Block a user