继续更新UI

This commit is contained in:
2025-09-24 15:06:30 +08:00
parent 26b856d74e
commit df57f3c5ec
59 changed files with 1415 additions and 2898 deletions

View File

@@ -3,13 +3,29 @@
[ext_resource type="Script" uid="uid://c0jfbtkh0mj5b" path="res://Script/BigPanel/DailyCheckInPanel.gd" id="1_fj7a7"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_217t6"]
bg_color = Color(0.9, 0.85, 0.7, 0.95)
border_width_left = 15
border_width_top = 15
border_width_right = 15
border_width_bottom = 15
border_color = Color(0.6, 0.4, 0.2, 1)
corner_radius_top_left = 10
corner_radius_top_right = 10
corner_radius_bottom_right = 10
corner_radius_bottom_left = 10
corner_detail = 20
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_4gvib"]
bg_color = Color(0.95, 0.9, 0.8, 0.8)
border_width_left = 5
border_width_top = 5
border_width_right = 5
border_width_bottom = 5
border_color = Color(0.7, 0.5, 0.3, 1)
corner_radius_top_left = 10
corner_radius_top_right = 10
corner_radius_bottom_right = 10
corner_radius_bottom_left = 10
[node name="DailyCheckInPanel" type="Panel"]
offset_left = 441.0
@@ -23,7 +39,7 @@ layout_mode = 0
offset_top = 20.0
offset_right = 600.0
offset_bottom = 69.0
theme_override_colors/font_color = Color(0.624759, 0.8051, 0.828302, 1)
theme_override_colors/font_color = Color(0.2, 0.6, 0.2, 1)
theme_override_colors/font_shadow_color = Color(0, 0, 0, 1)
theme_override_colors/font_outline_color = Color(0, 0, 0, 1)
theme_override_constants/shadow_offset_x = 3
@@ -31,7 +47,7 @@ theme_override_constants/shadow_offset_y = 3
theme_override_constants/outline_size = 10
theme_override_constants/shadow_outline_size = 10
theme_override_font_sizes/font_size = 35
text = "📅每日签到📅"
text = "🌾 每日签到 🌽"
horizontal_alignment = 1
[node name="Label" type="Label" parent="."]
@@ -40,6 +56,7 @@ offset_left = 23.0
offset_top = 360.0
offset_right = 585.0
offset_bottom = 409.0
theme_override_colors/font_color = Color(0.3, 0.5, 0.2, 1)
theme_override_colors/font_shadow_color = Color(0, 0, 0, 1)
theme_override_colors/font_outline_color = Color(0, 0, 0, 1)
theme_override_constants/shadow_offset_x = 2
@@ -48,30 +65,32 @@ theme_override_constants/outline_size = 15
theme_override_constants/shadow_outline_size = 10
theme_override_font_sizes/font_size = 30
theme_override_styles/normal = SubResource("StyleBoxFlat_4gvib")
text = "🎉签到奖励🎉"
text = "🎁今日签到收获🎁"
horizontal_alignment = 1
vertical_alignment = 1
[node name="QuitButton" type="Button" parent="."]
modulate = Color(1, 0, 0, 1)
custom_minimum_size = Vector2(57, 57)
layout_mode = 0
offset_left = 520.0
offset_top = 22.0
offset_right = 577.0
offset_bottom = 79.0
theme_override_colors/font_disabled_color = Color(1, 0, 0, 1)
theme_override_font_sizes/font_size = 35
text = "X"
[node name="DailyCheckInButton" type="Button" parent="."]
modulate = Color(1, 1, 0.52549, 1)
modulate = Color(0.7, 0.9, 0.5, 1)
custom_minimum_size = Vector2(150, 70)
layout_mode = 0
offset_left = 239.0
offset_top = 630.0
offset_right = 389.0
offset_bottom = 700.0
offset_left = 181.0
offset_top = 618.0
offset_right = 443.0
offset_bottom = 688.0
theme_override_font_sizes/font_size = 35
text = "签到"
text = "🌱 今日签到 🌱"
[node name="Scroll" type="ScrollContainer" parent="."]
layout_mode = 0
@@ -84,6 +103,13 @@ offset_bottom = 360.0
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
theme_override_colors/font_outline_color = Color(0, 0, 0, 1)
theme_override_constants/outline_size = 20
theme_override_font_sizes/bold_italics_font_size = 15
theme_override_font_sizes/italics_font_size = 15
theme_override_font_sizes/mono_font_size = 15
theme_override_font_sizes/normal_font_size = 15
theme_override_font_sizes/bold_font_size = 15
bbcode_enabled = true
threaded = true
@@ -95,7 +121,12 @@ offset_right = 577.0
offset_bottom = 630.0
theme_override_font_sizes/normal_font_size = 20
bbcode_enabled = true
text = "+500 经验+400 钱币,+5 普通-番茄种子,+1 传奇-火龙果种子 "
text = "🌟 +500 农场经验
💰 +400 金币
🍅 +5 普通番茄种子
🐉🍎 +1 传奇火龙果种子
🌾 额外收获:新鲜农产品!
🐄 农场动物好感度 +10"
horizontal_alignment = 1
[node name="ConfirmDialog" type="ConfirmationDialog" parent="."]

View File

@@ -3,26 +3,35 @@
[ext_resource type="Script" uid="uid://65e0rl31fx0i" path="res://Script/BigPanel/LuckyDrawPanel.gd" id="1_dcmen"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_ynokl"]
bg_color = Color(0.9, 0.85, 0.7, 0.95)
border_width_left = 15
border_width_top = 15
border_width_right = 15
border_width_bottom = 15
border_color = Color(0.6, 0.4, 0.2, 1)
corner_radius_top_left = 15
corner_radius_top_right = 15
corner_radius_bottom_right = 15
corner_radius_bottom_left = 15
corner_detail = 20
shadow_color = Color(0.3, 0.2, 0.1, 0.3)
shadow_size = 8
[node name="LuckyDrawPanel" type="Panel"]
offset_left = 373.0
offset_left = 149.0
offset_top = 1.0
offset_right = 1045.0
offset_right = 1230.0
offset_bottom = 721.0
theme_override_styles/panel = SubResource("StyleBoxFlat_ynokl")
script = ExtResource("1_dcmen")
[node name="Title" type="Label" parent="."]
layout_mode = 0
offset_left = 16.0
offset_top = 19.0
offset_right = 669.0
offset_right = 1062.0
offset_bottom = 78.0
theme_override_colors/font_color = Color(0.624759, 0.8051, 0.828302, 1)
theme_override_colors/font_color = Color(0.2, 0.6, 0.2, 1)
theme_override_colors/font_shadow_color = Color(0, 0, 0, 1)
theme_override_colors/font_outline_color = Color(0, 0, 0, 1)
theme_override_constants/shadow_offset_x = 3
@@ -30,28 +39,29 @@ theme_override_constants/shadow_offset_y = 3
theme_override_constants/outline_size = 10
theme_override_constants/shadow_outline_size = 10
theme_override_font_sizes/font_size = 35
text = "幸运抽奖"
text = "🎰 幸运抽奖 🎁"
horizontal_alignment = 1
vertical_alignment = 1
[node name="Label" type="Label" parent="."]
modulate = Color(0.642982, 0.510828, 1, 1)
modulate = Color(0.8, 0.6, 0.3, 1)
layout_mode = 0
offset_top = 419.0
offset_right = 671.0
offset_right = 1081.0
offset_bottom = 468.0
theme_override_font_sizes/font_size = 30
text = "🎉获得奖励🎉"
text = "🎁 抽奖获得奖励 🌾"
horizontal_alignment = 1
vertical_alignment = 1
[node name="QuitButton" type="Button" parent="."]
modulate = Color(1, 0, 0, 1)
custom_minimum_size = Vector2(57, 57)
layout_mode = 0
offset_left = 595.0
offset_top = 21.0
offset_right = 652.0
offset_bottom = 78.0
offset_left = 993.0
offset_top = 30.0
offset_right = 1050.0
offset_bottom = 87.0
theme_override_font_sizes/font_size = 35
text = "X"
@@ -59,20 +69,20 @@ text = "X"
layout_mode = 0
offset_left = 16.0
offset_top = 481.0
offset_right = 671.0
offset_right = 1062.0
offset_bottom = 633.0
theme_override_font_sizes/normal_font_size = 20
bbcode_enabled = true
text = "+500 经验,+400 币,+5 普通-番茄种子,+1 传奇-火龙果种子 "
text = "🌟 +500 农场经验,💰 +400 币,🍅 +5 优质番茄种子,🐉 +1 传奇火龙果种子,🚜 +2 农具强化石 "
horizontal_alignment = 1
[node name="Grid" type="GridContainer" parent="."]
layout_mode = 0
offset_left = 16.0
offset_top = 85.0
offset_right = 657.0
offset_right = 1062.0
offset_bottom = 419.0
columns = 5
columns = 8
[node name="RewardItem" type="RichTextLabel" parent="Grid"]
custom_minimum_size = Vector2(120, 120)
@@ -80,10 +90,12 @@ layout_mode = 2
theme_override_constants/outline_size = 15
theme_override_font_sizes/normal_font_size = 17
bbcode_enabled = true
text = "+50
+100经验
+4番茄种子
+3火龙果种子"
text = "💰 +50
🌟 +100农场经验
🍅 +4番茄种子
🐉 +3火龙果种子
🚜 +1农具"
fit_content = true
horizontal_alignment = 1
vertical_alignment = 1
threaded = true
@@ -92,7 +104,7 @@ threaded = true
layout_mode = 0
offset_left = -2.0
offset_top = 633.0
offset_right = 671.0
offset_right = 1081.0
offset_bottom = 703.0
alignment = 1
@@ -101,29 +113,34 @@ modulate = Color(0.623529, 1, 0.996078, 1)
custom_minimum_size = Vector2(150, 70)
layout_mode = 2
theme_override_font_sizes/font_size = 35
text = "五连抽"
text = "🌱 五连抽 🌱"
[node name="TenLuckyDrawButton" type="Button" parent="HBox"]
modulate = Color(0.690196, 1, 0.52549, 1)
custom_minimum_size = Vector2(150, 70)
layout_mode = 2
theme_override_font_sizes/font_size = 35
text = "十连抽"
text = "🌾 十连抽 🌾"
[node name="LuckyDrawButton" type="Button" parent="HBox"]
modulate = Color(1, 1, 0.52549, 1)
custom_minimum_size = Vector2(150, 70)
layout_mode = 2
theme_override_font_sizes/font_size = 35
text = "抽奖"
text = "🎰 单抽 🍀"
[node name="ConfirmDialog" type="ConfirmationDialog" parent="."]
title = "标题"
title = "🎰 农场幸运转盘 🌾"
initial_position = 3
size = Vector2i(450, 350)
current_screen = 0
ok_button_text = "🎲 确定抽奖"
dialog_text = "弹窗内容"
dialog_text = "🌱 欢迎来到萌芽农场的幸运转盘!
🎁 在这里您可以获得珍贵的农场奖励:
💰 金币、🌟 经验、🌾 种子、🚜 农具等
🍀 准备好开始您的幸运之旅了吗?"
dialog_autowrap = true
cancel_button_text = "❌ 取消"

View File

@@ -448,3 +448,4 @@ text = "X"
[connection signal="pressed" from="ScrollContainer/Grid/PushBox/PushBoxButton" to="." method="_on_push_box_button_pressed"]
[connection signal="pressed" from="ScrollContainer/Grid/SnakeGame/SnakeGameButton" to="." method="_on_snake_game_button_pressed"]
[connection signal="pressed" from="ScrollContainer/Grid/Tetris/TetrisButton" to="." method="_on_tetris_button_pressed"]
[connection signal="pressed" from="QuitButton" to="." method="_on_quit_button_pressed"]

View File

@@ -95,7 +95,6 @@ func _ready():
# 延迟一帧后设置演示数据,确保所有节点都已准备好
await get_tree().process_frame
#setup_farm_battle()
# 可以调用测试函数进行本地测试
#setup_test_battle()
@@ -139,8 +138,6 @@ func _process(delta):
#=====================本地测试函数===========================
# 本地测试对战函数 - 方便调试各种宠物属性
func setup_test_battle():
"""设置本地测试对战,可以快速测试各种宠物配置和属性"""
print("[测试] 开始设置本地测试对战")
# 清理现有战斗
clear_all_pets()
@@ -190,9 +187,6 @@ func setup_test_battle():
redman_pet.enable_damage_reflection_skill = true
redman_pet.damage_reflection_percentage = 0.8 # 反弹80%伤害
redman_pet.damage_reflection_cooldown = 5.0 # 5秒冷却
print("[测试] 烈焰鸟开启反弹伤害技能")
print("[测试] 本地测试对战设置完成,可以观察宠物战斗效果")
@@ -205,9 +199,7 @@ func setup_test_battle():
#=====================UI显示===========================
#更新时间显示
func update_time_display():
"""更新时间显示"""
var remaining_time: float
if current_battle_state == BattleState.BATTLING:
remaining_time = max_battle_time - battle_time
else:
@@ -234,7 +226,6 @@ func update_time_display():
#显示战斗结果
func show_battle_result(winner: String):
"""显示战斗结果"""
battle_end_panel.visible = true
var title_label = battle_end_panel.get_node("Title")
@@ -255,7 +246,6 @@ func show_battle_result(winner: String):
#生成战斗统计信息
func generate_battle_stats() -> String:
"""生成战斗统计信息"""
var stats = "战斗时间: %.1f\n\n" % battle_time
# MVP统计
@@ -291,7 +281,6 @@ func add_battle_log(message: String):
#返回农场按钮
func _on_return_farm_pressed():
"""返回农场按钮"""
# 清理战斗场景
clear_all_pets()
@@ -305,7 +294,6 @@ func _on_return_farm_pressed():
#获取战斗总结数据
func get_battle_summary() -> Dictionary:
"""获取战斗总结数据"""
return {
"battle_time": battle_time,
"damage_dealt": damage_dealt,
@@ -360,7 +348,6 @@ func _on_visibility_changed():
#开始战斗
func start_battle(team_a_data: Array, team_b_data: Array):
"""开始战斗"""
current_battle_state = BattleState.PREPARING
battle_time = 0.0
battle_log.clear()
@@ -383,7 +370,6 @@ func start_battle(team_a_data: Array, team_b_data: Array):
#生成队伍宠物
func spawn_team(team_data: Array, team_name: String, team_node: Node2D):
"""生成队伍宠物"""
var positions = get_team_positions(team_node)
for i in range(min(team_data.size(), positions.size())):
@@ -398,7 +384,6 @@ func spawn_team(team_data: Array, team_name: String, team_node: Node2D):
#获取队伍位置点
func get_team_positions(team_node: Node2D) -> Array[Vector2]:
"""获取队伍位置点"""
var positions: Array[Vector2] = []
for child in team_node.get_children():
if child is Marker2D:
@@ -407,7 +392,6 @@ func get_team_positions(team_node: Node2D) -> Array[Vector2]:
#生成单个宠物
func spawn_pet(pet_info: Dictionary, team: String, pos: Vector2) -> NewPetBase:
"""生成单个宠物"""
var pet_scene = preload("res://Scene/NewPet/NewPetBase.tscn")
var pet = pet_scene.instantiate()
@@ -456,7 +440,6 @@ func spawn_pet(pet_info: Dictionary, team: String, pos: Vector2) -> NewPetBase:
#应用服务器返回的宠物数据
func apply_server_pet_data(pet: NewPetBase, pet_data: Dictionary):
"""应用服务器返回的完整宠物数据"""
if pet_data.is_empty():
return
@@ -560,7 +543,6 @@ func apply_server_pet_data(pet: NewPetBase, pet_data: Dictionary):
#字符串转元素类型枚举
func string_to_element_type(element_string: String) -> NewPetBase.ElementType:
"""将字符串转换为元素类型枚举"""
match element_string.to_upper():
"FIRE":
return NewPetBase.ElementType.FIRE
@@ -579,7 +561,6 @@ func string_to_element_type(element_string: String) -> NewPetBase.ElementType:
#将配置应用到宠物上
func apply_pet_config(pet: NewPetBase, config: Dictionary):
"""将配置应用到宠物上"""
if not config.is_empty():
# 基本属性
if config.has("pet_name"):
@@ -671,7 +652,6 @@ func apply_pet_config(pet: NewPetBase, config: Dictionary):
#应用宠物外观图片
func apply_pet_image(pet: NewPetBase, image_path: String):
"""应用宠物外观图片"""
if image_path == "" or not ResourceLoader.exists(image_path):
return
@@ -711,9 +691,6 @@ func apply_pet_image(pet: NewPetBase, image_path: String):
pet.right_tool_image.show_behind_parent = new_right_tool.show_behind_parent
pet.right_tool_image.visible = true
# 外观应用成功
else:
pass # 静默处理错误
# 清理临时实例
temp_instance.queue_free()
@@ -738,7 +715,6 @@ var level_bonus_config = {
#应用等级缩放
func apply_level_scaling(pet: NewPetBase):
"""应用等级缩放"""
# 每级+2基本属性
var level_bonus = (pet.pet_level - 1) * 2.0
@@ -783,7 +759,6 @@ func apply_level_scaling(pet: NewPetBase):
#更新战斗状态
func update_battle_state():
"""更新战斗状态"""
# 先清理无效的宠物引用
cleanup_invalid_pet_references()
@@ -803,7 +778,6 @@ func update_battle_state():
#=================即时清理防止游戏卡死=====================
#清理无效的宠物引用
func cleanup_invalid_pet_references():
"""清理数组中的无效宠物引用"""
# 清理all_pets数组中的无效引用
var valid_all_pets: Array[NewPetBase] = []
for pet in all_pets:
@@ -825,8 +799,8 @@ func cleanup_invalid_pet_references():
valid_team_b_pets.append(pet)
team_b_pets = valid_team_b_pets
#清理死亡对象以优化性能
func cleanup_dead_objects():
"""清理死亡对象以优化性能"""
# 更严格的死亡宠物清理逻辑
var dead_pets = []
for pet in all_pets:
@@ -870,7 +844,6 @@ func cleanup_dead_objects():
#结束战斗
func end_battle(winner: String):
"""结束战斗"""
if current_battle_state == BattleState.ENDED:
return
@@ -923,7 +896,6 @@ func end_battle(winner: String):
#清理所有宠物
func clear_all_pets():
"""清理所有宠物"""
for pet in all_pets:
if is_instance_valid(pet):
pet.queue_free()
@@ -937,7 +909,6 @@ func clear_all_pets():
#清理所有召唤的仆从小弟
func clear_all_minions():
"""清理所有召唤的仆从小弟"""
# 获取所有pets组中的节点
var all_pets_in_group = get_tree().get_nodes_in_group("pets")
var minions_cleared = 0
@@ -959,7 +930,6 @@ func clear_all_minions():
#立即清理所有宠物
func clear_all_pets_immediately():
"""立即清理所有宠物(用于时间到时的平局处理)"""
for pet in all_pets:
if is_instance_valid(pet):
# 立即设置为死亡状态
@@ -990,14 +960,12 @@ func clear_all_pets_immediately():
#宠物死亡事件
func _on_pet_died(pet: NewPetBase):
"""宠物死亡事件"""
# 简化死亡处理,减少不必要的计算
if battle_log.size() < 30: # 限制死亡日志数量
add_battle_log("[color=red]%s 死亡[/color]" % pet.pet_name)
#宠物攻击事件
func _on_pet_attacked(attacker: NewPetBase, target: NewPetBase, damage: float):
"""宠物攻击事件"""
# 简化统计更新
damage_dealt[attacker.pet_id] = damage_dealt.get(attacker.pet_id, 0.0) + damage
damage_taken[target.pet_id] = damage_taken.get(target.pet_id, 0.0) + damage
@@ -1008,7 +976,6 @@ func _on_pet_attacked(attacker: NewPetBase, target: NewPetBase, damage: float):
#宠物技能使用事件
func _on_pet_skill_used(pet: NewPetBase, skill_name: String):
"""宠物技能使用事件"""
# 减少技能日志,只记录重要技能
if skill_name in ["狂暴模式", "自爆", "召唤小弟", "死亡重生"]:
add_battle_log("[color=cyan]%s:%s[/color]" % [pet.pet_name, skill_name])
@@ -1017,7 +984,6 @@ func _on_pet_skill_used(pet: NewPetBase, skill_name: String):
#================偷菜对战设置===========================
# 设置偷菜对战
func setup_steal_battle(attacker_pets: Array, defender_pets: Array, attacker_name: String, defender_name: String):
"""设置偷菜对战"""
print("[PetBattlePanel] 设置偷菜对战: 攻击者=%s, 防守者=%s" % [attacker_name, defender_name])
print("[PetBattlePanel] 攻击方宠物数量: %d, 防守方宠物数量: %d" % [attacker_pets.size(), defender_pets.size()])
@@ -1044,9 +1010,6 @@ func setup_steal_battle(attacker_pets: Array, defender_pets: Array, attacker_nam
# 限制出战宠物数量最多4个
var limited_attacker_pets = attacker_pets.slice(0, min(4, attacker_pets.size()))
var limited_defender_pets = defender_pets.slice(0, min(4, defender_pets.size()))
print("[PetBattlePanel] 限制后攻击方宠物数量: %d, 防守方宠物数量: %d" % [limited_attacker_pets.size(), limited_defender_pets.size()])
# 显示对战面板
show()
@@ -1079,8 +1042,6 @@ func setup_steal_battle(attacker_pets: Array, defender_pets: Array, attacker_nam
team_b_pets.append(pet)
all_pets.append(pet)
print("[PetBattlePanel] 对战设置完成,攻击方: %d只,防守方: %d" % [team_a_pets.size(), team_b_pets.size()])
# 添加战斗日志
add_battle_log("[color=yellow]偷菜对战开始![/color]")
add_battle_log("[color=cyan]%s VS %s[/color]" % [team_a_name, team_b_name])
@@ -1096,7 +1057,6 @@ func setup_steal_battle(attacker_pets: Array, defender_pets: Array, attacker_nam
#美化确认弹窗
func setup_confirm_dialog():
"""设置和美化确认弹窗"""
confirm_dialog.title = "辅助功能确认"
confirm_dialog.ok_button_text = "确认使用"
confirm_dialog.cancel_button_text = "取消"
@@ -1122,7 +1082,6 @@ func setup_confirm_dialog():
#更新辅助功能冷却计时器
func update_assist_cooldowns(delta: float):
"""更新辅助功能冷却计时器"""
# 更新冷却计时器
if heal_cooldown_timer > 0:
heal_cooldown_timer -= delta
@@ -1150,7 +1109,6 @@ func update_assist_cooldowns(delta: float):
#显示辅助功能确认弹窗
func show_assist_confirm(operation_type: String, description: String, effect: String):
"""显示辅助功能确认弹窗"""
current_assist_operation = operation_type
# 设置弹窗内容(纯文本格式)
@@ -1164,25 +1122,22 @@ func show_assist_confirm(operation_type: String, description: String, effect: St
#确认使用辅助功能
func _on_assist_confirmed():
"""确认使用辅助功能"""
match current_assist_operation:
"heal":
"heal": # 团队治疗
execute_team_heal()
"rage":
"rage": # 团队狂暴
execute_team_rage()
"shield":
"shield": # 团队护盾
execute_team_shield()
current_assist_operation = ""
#取消使用辅助功能
func _on_assist_canceled():
"""取消使用辅助功能"""
current_assist_operation = ""
#执行团队治疗
func execute_team_heal():
"""执行团队治疗功能"""
var healed_count = 0
# 只对teamAattacker队伍的宠物生效
for pet in all_pets:
@@ -1215,7 +1170,6 @@ func execute_team_heal():
#执行团队狂暴
func execute_team_rage():
"""执行团队狂暴功能"""
var raged_count = 0
# 只对teamAattacker队伍的宠物生效
for pet in all_pets:
@@ -1246,7 +1200,6 @@ func execute_team_rage():
#执行团队护盾
func execute_team_shield():
"""执行团队护盾功能"""
var shielded_count = 0
# 只对teamAattacker队伍的宠物生效
for pet in all_pets:

View File

@@ -266,39 +266,26 @@ var pet_configs: Dictionary = {
# 初始化函数
func _ready():
"""节点准备就绪时自动加载JSON配置"""
load_configs_from_json()
# 手动初始化配置的函数
func initialize_configs():
"""手动初始化宠物配置优先从JSON加载"""
if not load_configs_from_json():
print("JSON加载失败使用默认配置")
# 如果JSON加载失败保持使用代码中的默认配置
# 获取宠物配置的函数
# 根据宠物键值获取配置
func get_pet_config(pet_key: String) -> Dictionary:
"""根据宠物键值获取配置"""
if pet_configs.has(pet_key):
return pet_configs[pet_key]
else:
print("未找到宠物配置: ", pet_key, ",使用默认配置")
return get_default_config()
# 获取所有宠物配置键值的函数
# 获取所有宠物配置键值
func get_all_pet_keys() -> Array:
"""获取所有可用的宠物配置键值"""
return pet_configs.keys()
# 检查宠物配置是否存在的函数
# 检查宠物配置是否存在
func has_pet_config(pet_key: String) -> bool:
"""检查指定的宠物配置是否存在"""
return pet_configs.has(pet_key)
# 获取默认配置的函数
# 获取默认配置
func get_default_config() -> Dictionary:
"""获取默认宠物配置"""
return {
"pet_name": pet_name,
"pet_id": pet_id,
@@ -343,9 +330,8 @@ func get_default_config() -> Dictionary:
"right_weapon": right_weapon
}
# 字符串转换为ElementType枚举的函数
# 字符串转换为ElementType枚举
func string_to_element_type(element_str: String) -> ElementType:
"""将字符串转换为ElementType枚举"""
match element_str.to_upper():
"NONE":#没有元素类型
return ElementType.NONE
@@ -364,9 +350,8 @@ func string_to_element_type(element_str: String) -> ElementType:
_:
return ElementType.NONE
# 从JSON文件加载宠物配置的函数
# 从JSON文件加载宠物配置
func load_configs_from_json(file_path: String = "res://Scene/NewPet/Pet_data.json") -> bool:
"""从JSON文件加载宠物配置"""
if not FileAccess.file_exists(file_path):
print("宠物配置文件不存在: ", file_path)
return false

View File

@@ -1,81 +0,0 @@
{
"宠物仓库":{
"烈焰鸟": {
"pet_name": "树萌芽の烈焰鸟",
"pet_image":"res://Scene/NewPet/PetType/flying_bird.tscn",
"pet_id": "wea1212w12",
"pet_type": "烈焰鸟",
"pet_level": 1,
"pet_experience": 500,
"pet_temperament": "勇猛",
"pet_birthday": "2025-07-25",
"pet_hobby": "喜欢战斗和烈火",
"pet_introduction": "我爱吃虫子",
"max_health": 300.0,
"enable_health_regen": true,
"health_regen": 2.0,
"enable_shield_regen": true,
"max_shield": 150.0,
"shield_regen": 1.5,
"max_armor": 120.0,
"base_attack_damage": 40.0,
"crit_rate": 0.15,
"crit_damage": 2.0,
"armor_penetration": 10.0,
"enable_multi_projectile_skill": true,
"multi_projectile_delay": 2.0,
"enable_berserker_skill": true,
"berserker_bonus": 1.8,
"berserker_duration": 6.0,
"enable_self_destruct_skill": false,
"enable_summon_pet_skill": false,
"enable_death_respawn_skill": true,
"respawn_health_percentage": 0.4,
"move_speed": 180.0,
"dodge_rate": 0.08,
"element_type": "FIRE",
"element_damage_bonus": 75.0,
"left_weapon": "钻石剑",
"right_weapon": "钻石剑"
},
"大蓝虫": {
"pet_name": "树萌芽の大蓝虫",
"pet_image":"res://Scene/NewPet/PetType/big_beetle.tscn",
"pet_id": "dlc123123",
"pet_type": "大甲壳虫",
"pet_level": 8,
"pet_experience": 320,
"pet_temperament": "冷静",
"pet_birthday": "2023-06-20",
"pet_hobby": "喜欢和小甲壳虫玩",
"pet_introduction": "我是大蓝虫,不是大懒虫!",
"max_health": 180.0,
"enable_health_regen": true,
"health_regen": 1.2,
"enable_shield_regen": true,
"max_shield": 200.0,
"shield_regen": 2.5,
"max_armor": 80.0,
"base_attack_damage": 35.0,
"crit_rate": 0.12,
"crit_damage": 1.8,
"armor_penetration": 15.0,
"enable_multi_projectile_skill": true,
"multi_projectile_delay": 1.5,
"enable_berserker_skill": false,
"enable_self_destruct_skill": false,
"enable_summon_pet_skill": true,
"summon_count": 2,
"summon_scale": 0.15,
"enable_death_respawn_skill": false,
"move_speed": 120.0,
"dodge_rate": 0.12,
"element_type": "WATER",
"element_damage_bonus": 100.0,
"left_weapon": "钻石剑",
"right_weapon": "钻石剑"
}
},
"巡逻宠物":["wea1212w12"],
"出战宠物":["dlc123123"]
}

View File

@@ -1,165 +0,0 @@
{
"_id": {
"$oid": "687cf59b8e77ba00a7414bab"
},
"updated_at": {
"$date": "2025-07-20T22:13:38.521Z"
},
"烈焰鸟": {
"pet_name": "树萌芽の烈焰鸟",
"can_purchase": true,
"cost": 1000,
"pet_image": "res://Scene/NewPet/PetType/flying_bird.tscn",
"pet_id": "0001",
"pet_type": "烈焰鸟",
"pet_level": 1,
"pet_experience": 500,
"pet_temperament": "勇猛",
"pet_birthday": "2023-03-15",
"pet_hobby": "喜欢战斗和烈火",
"pet_introduction": "我爱吃虫子",
"max_health": 300,
"enable_health_regen": true,
"health_regen": 2,
"enable_shield_regen": true,
"max_shield": 150,
"shield_regen": 1.5,
"max_armor": 120,
"base_attack_damage": 40,
"crit_rate": 0.15,
"crit_damage": 2,
"armor_penetration": 10,
"enable_multi_projectile_skill": true,
"multi_projectile_delay": 2,
"enable_berserker_skill": true,
"berserker_bonus": 1.8,
"berserker_duration": 6,
"enable_self_destruct_skill": false,
"enable_summon_pet_skill": false,
"enable_death_respawn_skill": true,
"respawn_health_percentage": 0.4,
"move_speed": 180,
"dodge_rate": 0.08,
"element_type": "FIRE",
"element_damage_bonus": 75,
"left_weapon": "钻石剑",
"right_weapon": "钻石剑"
},
"大蓝虫": {
"pet_name": "树萌芽の大蓝虫",
"can_purchase": true,
"cost": 1000,
"pet_image": "res://Scene/NewPet/PetType/big_beetle.tscn",
"pet_id": "0002",
"pet_type": "大蓝虫",
"pet_level": 8,
"pet_experience": 320,
"pet_temperament": "冷静",
"pet_birthday": "2023-06-20",
"pet_hobby": "喜欢和小甲壳虫玩",
"pet_introduction": "我是大蓝虫,不是大懒虫!",
"max_health": 180,
"enable_health_regen": true,
"health_regen": 1.2,
"enable_shield_regen": true,
"max_shield": 200,
"shield_regen": 2.5,
"max_armor": 80,
"base_attack_damage": 35,
"crit_rate": 0.12,
"crit_damage": 1.8,
"armor_penetration": 15,
"enable_multi_projectile_skill": true,
"multi_projectile_delay": 1.5,
"enable_berserker_skill": false,
"enable_self_destruct_skill": false,
"enable_summon_pet_skill": true,
"summon_count": 2,
"summon_scale": 0.15,
"enable_death_respawn_skill": false,
"move_speed": 120,
"dodge_rate": 0.12,
"element_type": "WATER",
"element_damage_bonus": 100,
"left_weapon": "钻石剑",
"right_weapon": "钻石剑"
},
"小蓝虫": {
"pet_name": "树萌芽の小蓝虫",
"can_purchase": true,
"cost": 1000,
"pet_image": "res://Scene/NewPet/PetType/small_beetle.tscn",
"pet_id": "0002",
"pet_type": "小蓝虫",
"pet_level": 1,
"pet_experience": 0,
"pet_temperament": "冷静",
"pet_birthday": "2023-06-20",
"pet_hobby": "喜欢和大蓝虫玩",
"pet_introduction": "我是小蓝虫,不是小懒虫!",
"max_health": 90,
"enable_health_regen": true,
"health_regen": 1.2,
"enable_shield_regen": true,
"max_shield": 200,
"shield_regen": 2.5,
"max_armor": 80,
"base_attack_damage": 35,
"crit_rate": 0.12,
"crit_damage": 1.8,
"armor_penetration": 15,
"enable_multi_projectile_skill": true,
"multi_projectile_delay": 1.5,
"enable_berserker_skill": false,
"enable_self_destruct_skill": false,
"enable_summon_pet_skill": true,
"summon_count": 2,
"summon_scale": 0.15,
"enable_death_respawn_skill": false,
"move_speed": 120,
"dodge_rate": 0.12,
"element_type": "WATER",
"element_damage_bonus": 100,
"left_weapon": "钻石剑",
"right_weapon": "钻石剑"
},
"小蓝": {
"pet_name": "树萌芽の小蓝",
"can_purchase": true,
"cost": 1000,
"pet_image": "res://Scene/NewPet/PetType/small_blue.tscn",
"pet_id": "0002",
"pet_type": "小蓝",
"pet_level": 1,
"pet_experience": 0,
"pet_temperament": "冷静",
"pet_birthday": "2023-06-20",
"pet_hobby": "喜欢和小黄一起玩",
"pet_introduction": "我是小黄!",
"max_health": 120,
"enable_health_regen": true,
"health_regen": 1.2,
"enable_shield_regen": true,
"max_shield": 200,
"shield_regen": 2.5,
"max_armor": 80,
"base_attack_damage": 35,
"crit_rate": 0.12,
"crit_damage": 1.8,
"armor_penetration": 15,
"enable_multi_projectile_skill": true,
"multi_projectile_delay": 1.5,
"enable_berserker_skill": false,
"enable_self_destruct_skill": false,
"enable_summon_pet_skill": true,
"summon_count": 2,
"summon_scale": 0.15,
"enable_death_respawn_skill": false,
"move_speed": 120,
"dodge_rate": 0.12,
"element_type": "WATER",
"element_damage_bonus": 100,
"left_weapon": "钻石剑",
"right_weapon": "钻石剑"
}
}

View File

@@ -5,20 +5,24 @@
[ext_resource type="Script" uid="uid://0d2j5m6j2ema" path="res://Components/HTTPTextureRect.gd" id="3_wibl7"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_y1hsh"]
border_color = Color(2.98411e-06, 0.95982, 0.386903, 1)
bg_color = Color(0.9, 0.85, 0.7, 0.95)
border_width_left = 5
border_width_top = 5
border_width_right = 5
border_width_bottom = 5
border_color = Color(0.6, 0.4, 0.2, 1)
border_blend = true
corner_radius_top_left = 10
corner_radius_top_right = 10
corner_radius_bottom_right = 10
corner_radius_bottom_left = 10
corner_detail = 20
shadow_color = Color(0.3, 0.2, 0.1, 0.5)
shadow_size = 20
shadow_offset = Vector2(10, 10)
anti_aliasing = false
anti_aliasing_size = 5.0
[node name="AccountSettingPanel" type="Panel"]
visible = false
offset_left = 243.0
offset_top = 42.0
offset_right = 1154.0
@@ -27,7 +31,7 @@ theme_override_styles/panel = SubResource("StyleBoxFlat_y1hsh")
script = ExtResource("1_xfiot")
[node name="Title" type="RichTextLabel" parent="."]
modulate = Color(1, 0.745098, 0.54902, 1)
modulate = Color(0.2, 0.6, 0.2, 1)
layout_mode = 0
offset_left = 2.0
offset_right = 911.0
@@ -41,27 +45,31 @@ theme_override_constants/shadow_offset_x = 3
theme_override_constants/shadow_outline_size = 10
theme_override_font_sizes/normal_font_size = 40
bbcode_enabled = true
text = "玩家信息设置"
text = "🌾 萌芽农场 - 农场主信息 🚜"
horizontal_alignment = 1
threaded = true
[node name="QuitButton" type="Button" parent="."]
modulate = Color(0.984314, 0, 0, 1)
custom_minimum_size = Vector2(55, 55)
layout_mode = 0
offset_left = 854.0
offset_right = 911.0
offset_bottom = 57.0
offset_left = 833.0
offset_top = 19.0
offset_right = 890.0
offset_bottom = 76.0
theme_override_colors/font_disabled_color = Color(0, 0, 0, 1)
theme_override_font_sizes/font_size = 35
text = "X"
[node name="RefreshButton" type="Button" parent="."]
custom_minimum_size = Vector2(55, 55)
layout_mode = 0
offset_left = 2.0
offset_right = 80.0
offset_bottom = 57.0
offset_left = 25.0
offset_top = 19.0
offset_right = 160.0
offset_bottom = 76.0
theme_override_font_sizes/font_size = 35
text = "刷新"
text = "🔄 刷新"
[node name="VBox1" type="VBoxContainer" parent="."]
layout_mode = 0
@@ -86,7 +94,7 @@ columns = 2
[node name="User_Name" type="Label" parent="VBox1/Grid"]
layout_mode = 2
theme_override_font_sizes/font_size = 30
text = "账户:"
text = "🔑 农场账户:"
horizontal_alignment = 1
vertical_alignment = 1
@@ -99,7 +107,7 @@ vertical_alignment = 1
[node name="User_Password" type="Label" parent="VBox1/Grid"]
layout_mode = 2
theme_override_font_sizes/font_size = 30
text = "密码"
text = "🔒 农场密钥"
horizontal_alignment = 1
vertical_alignment = 1
@@ -107,40 +115,40 @@ vertical_alignment = 1
layout_mode = 2
size_flags_horizontal = 3
theme_override_font_sizes/font_size = 30
placeholder_text = "请输入密码"
placeholder_text = "请输入您的农场密钥"
[node name="Player_Name" type="Label" parent="VBox1/Grid"]
layout_mode = 2
theme_override_font_sizes/font_size = 30
text = "玩家昵称:"
text = "👨‍🌾 农场主昵称:"
[node name="Player_Name_Input" type="LineEdit" parent="VBox1/Grid"]
layout_mode = 2
size_flags_horizontal = 3
theme_override_font_sizes/font_size = 30
placeholder_text = "请输入玩家昵称"
placeholder_text = "请输入您的农场主昵称"
[node name="Farm_Name" type="Label" parent="VBox1/Grid"]
layout_mode = 2
theme_override_font_sizes/font_size = 30
text = "农场名"
text = "🏡 我的农场名:"
[node name="Farm_Name_Input" type="LineEdit" parent="VBox1/Grid"]
layout_mode = 2
size_flags_horizontal = 3
theme_override_font_sizes/font_size = 30
placeholder_text = "请输入农场名称"
placeholder_text = "为您的萌芽农场起个好听的名字"
[node name="Personal_Profile" type="Label" parent="VBox1/Grid"]
layout_mode = 2
theme_override_font_sizes/font_size = 30
text = "个人简介"
text = "📝 农场故事"
[node name="Personal_Profile_Input" type="LineEdit" parent="VBox1/Grid"]
layout_mode = 2
size_flags_horizontal = 3
theme_override_font_sizes/font_size = 30
placeholder_text = "请输入个人简介"
placeholder_text = "讲述您的农场故事和种植计划"
[node name="HBox2" type="HBoxContainer" parent="VBox1"]
layout_mode = 2
@@ -149,9 +157,9 @@ alignment = 1
[node name="Remove_Account_Btn" type="Button" parent="VBox1/HBox2"]
layout_mode = 2
theme_override_font_sizes/font_size = 30
text = "删除账号"
text = "❌ 注销农场"
[node name="Confirm_Btn" type="Button" parent="VBox1/HBox2"]
layout_mode = 2
theme_override_font_sizes/font_size = 30
text = "确认修改"
text = "✅ 保存信息"

View File

@@ -0,0 +1,95 @@
[gd_scene load_steps=3 format=3 uid="uid://djh8bnauphg8v"]
[ext_resource type="Script" uid="uid://bakeq8tm6r4j4" path="res://Script/SmallPanel/GlobalServerBroadcastPanel.gd" id="1_r7t0y"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_k1sw4"]
bg_color = Color(0.9, 0.85, 0.7, 0.95)
border_width_left = 10
border_width_top = 10
border_width_right = 10
border_width_bottom = 10
border_color = Color(0.6, 0.4, 0.2, 1)
corner_radius_top_left = 12
corner_radius_top_right = 12
corner_radius_bottom_right = 12
corner_radius_bottom_left = 12
corner_detail = 20
shadow_color = Color(0.3, 0.2, 0.1, 0.3)
shadow_size = 20
shadow_offset = Vector2(5, 5)
[node name="GlobalServerBroadcastPanel" type="Panel"]
offset_left = 322.0
offset_right = 985.0
offset_bottom = 721.0
theme_override_styles/panel = SubResource("StyleBoxFlat_k1sw4")
script = ExtResource("1_r7t0y")
[node name="Title" type="Label" parent="."]
layout_mode = 0
offset_left = 13.0
offset_top = 12.0
offset_right = 653.0
offset_bottom = 63.0
theme_override_colors/font_color = Color(0.2, 0.6, 0.2, 1)
theme_override_colors/font_shadow_color = Color(0, 0, 0, 1)
theme_override_colors/font_outline_color = Color(0, 0, 0, 1)
theme_override_constants/shadow_offset_x = 4
theme_override_constants/shadow_offset_y = 4
theme_override_constants/outline_size = 15
theme_override_constants/shadow_outline_size = 15
theme_override_font_sizes/font_size = 35
text = "📢 全服广播 📻"
horizontal_alignment = 1
vertical_alignment = 1
[node name="MessageContents" type="RichTextLabel" parent="."]
layout_mode = 0
offset_left = 10.0
offset_top = 72.0
offset_right = 653.0
offset_bottom = 642.0
theme_override_font_sizes/bold_italics_font_size = 15
theme_override_font_sizes/italics_font_size = 15
theme_override_font_sizes/mono_font_size = 15
theme_override_font_sizes/normal_font_size = 15
theme_override_font_sizes/bold_font_size = 15
bbcode_enabled = true
[node name="HBox" type="HBoxContainer" parent="."]
layout_mode = 0
offset_left = 8.0
offset_top = 649.0
offset_right = 653.0
offset_bottom = 709.0
[node name="InputMessage" type="LineEdit" parent="HBox"]
layout_mode = 2
size_flags_horizontal = 3
placeholder_text = "🌱 分享您的农场故事和心得..."
[node name="SendMessageButton" type="Button" parent="HBox"]
layout_mode = 2
theme_override_font_sizes/font_size = 30
text = "📤 发送消息"
[node name="QuitButton" type="Button" parent="."]
modulate = Color(1, 0, 0, 1)
custom_minimum_size = Vector2(50, 50)
layout_mode = 0
offset_left = 601.0
offset_top = 12.0
offset_right = 651.0
offset_bottom = 62.0
theme_override_font_sizes/font_size = 30
text = "X"
[node name="WatchMoreButton" type="Button" parent="."]
custom_minimum_size = Vector2(50, 50)
layout_mode = 0
offset_left = 13.0
offset_top = 12.0
offset_right = 141.0
offset_bottom = 62.0
theme_override_font_sizes/font_size = 30
text = "📜 查看更多"

View File

@@ -0,0 +1,91 @@
[gd_scene load_steps=4 format=3 uid="uid://yc4ag7vxsrfv"]
[ext_resource type="Script" uid="uid://bkel88rscubov" path="res://Script/SmallPanel/TodayDivinationPanel.gd" id="1_b6743"]
[ext_resource type="FontFile" uid="uid://b81msdfp2ym2g" path="res://assets/字体/MapleMono-NF-CN-BoldItalic.ttf" id="2_823yi"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_bpbm8"]
bg_color = Color(0.9, 0.85, 0.7, 0.95)
border_width_left = 15
border_width_top = 15
border_width_right = 15
border_width_bottom = 15
border_color = Color(0.6, 0.4, 0.2, 1)
corner_radius_top_left = 15
corner_radius_top_right = 15
corner_radius_bottom_right = 15
corner_radius_bottom_left = 15
corner_detail = 20
shadow_color = Color(0.3, 0.2, 0.1, 0.3)
shadow_size = 8
[node name="TodayDivinationPanel" type="PanelContainer"]
offset_left = 345.0
offset_right = 1050.0
offset_bottom = 713.0
theme_override_styles/panel = SubResource("StyleBoxFlat_bpbm8")
script = ExtResource("1_b6743")
[node name="VBox" type="VBoxContainer" parent="."]
layout_mode = 2
[node name="Title" type="Label" parent="VBox"]
layout_mode = 2
size_flags_vertical = 0
theme_override_colors/font_color = Color(0.2, 0.6, 0.2, 1)
theme_override_colors/font_shadow_color = Color(0, 0, 0, 1)
theme_override_colors/font_outline_color = Color(0, 0, 0, 1)
theme_override_constants/shadow_offset_x = 4
theme_override_constants/shadow_offset_y = 4
theme_override_constants/outline_size = 20
theme_override_constants/shadow_outline_size = 20
theme_override_font_sizes/font_size = 40
text = "🌾 今日占卜 🚜"
horizontal_alignment = 1
vertical_alignment = 1
[node name="Scroll" type="ScrollContainer" parent="VBox"]
layout_mode = 2
size_flags_vertical = 3
[node name="Contents" type="RichTextLabel" parent="VBox/Scroll"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
theme_override_fonts/normal_font = ExtResource("2_823yi")
theme_override_fonts/mono_font = ExtResource("2_823yi")
theme_override_fonts/italics_font = ExtResource("2_823yi")
theme_override_fonts/bold_italics_font = ExtResource("2_823yi")
theme_override_fonts/bold_font = ExtResource("2_823yi")
theme_override_font_sizes/bold_italics_font_size = 25
theme_override_font_sizes/italics_font_size = 25
theme_override_font_sizes/mono_font_size = 25
theme_override_font_sizes/normal_font_size = 25
theme_override_font_sizes/bold_font_size = 25
bbcode_enabled = true
text = "🌟 欢迎来到萌芽农场的神秘占卜屋!🌟
🔮 在这里,古老的农场智慧将为您揭示今日的农运:
🌱 作物生长运势
🐄 牲畜健康指数
💰 农场收益预测
🌤️ 天气变化提醒
🎯 种植建议指导
点击下方按钮,开启您的农场运势之旅!✨"
horizontal_alignment = 1
threaded = true
[node name="StartButton" type="Button" parent="VBox"]
custom_minimum_size = Vector2(300, 0)
layout_mode = 2
size_flags_horizontal = 4
theme_override_font_sizes/font_size = 35
text = "🌱 开启预测 🔮"
[node name="QuitButton" type="Button" parent="VBox"]
custom_minimum_size = Vector2(300, 0)
layout_mode = 2
size_flags_horizontal = 4
theme_override_font_sizes/font_size = 35
text = "🚪 返回农场 🏡"