继续更新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

@@ -1,2 +0,0 @@
# Normalize EOL for all files that Git considers text files.
* text=auto eol=lf

View File

@@ -1,16 +0,0 @@
# Godot-specific files
.import/
.godot/
.mono/
export.cfg
export_presets.cfg
android
# System-specific files
.DS_Store
Thumbs.db
# IDE-specific files
.vscode/
.idea/
.cursor/

View File

@@ -82,7 +82,7 @@ func _load_from_preset_list():
for file_path in music_files_list:
if ResourceLoader.exists(file_path):
music_files.append(file_path)
print("预设加载音乐: ", file_path.get_file())
#print("预设加载音乐: ", file_path.get_file())
else:
print("音乐文件不存在: ", file_path)
@@ -181,7 +181,7 @@ func set_volume(volume: float):
current_volume = clamp(volume, 0.0, 1.0)
if not is_muted:
audio_player.volume_db = linear_to_db(current_volume)
print("背景音乐音量设置为: ", current_volume)
#print("背景音乐音量设置为: ", current_volume)
func get_volume() -> float:
"""获取当前音量"""

View File

@@ -47,7 +47,7 @@ func _on_request_completed(result, response_code, headers, body):
for header in headers:
if header.to_lower().begins_with("content-type:"):
content_type = header.substr(13).strip_edges().to_lower()
print("HTTPTextureRect: 内容类型: ", content_type)
#print("HTTPTextureRect: 内容类型: ", content_type)
break
# 创建图像
@@ -82,7 +82,7 @@ func _on_request_completed(result, response_code, headers, body):
# 创建纹理并应用
var texture = ImageTexture.create_from_image(image)
self.texture = texture
print("HTTPTextureRect: 图像加载成功,尺寸: ", image.get_width(), "x", image.get_height())
#print("HTTPTextureRect: 图像加载成功,尺寸: ", image.get_width(), "x", image.get_height())
loading_finished.emit(true)
# 加载QQ头像的便捷方法

View File

@@ -1,12 +0,0 @@
{
"精准采集-镰刀": {"花费":100,"描述":"可以在收获作物时必定掉落该作物的种子","类型":"作物道具","道具图片":"res://assets/道具图片/紫水晶镰刀.webp"},
"时运-镰刀": {"花费":100,"描述":"可以在收获作物时掉落更多的作物的收获物","类型":"作物道具","道具图片":"res://assets/道具图片/红宝石镰刀.webp"},
"农家肥": {"花费":100,"描述":"施肥道具可以在30分钟内2倍速作物生长","类型":"作物道具","道具图片":"res://assets/道具图片/农家肥.webp"},
"金坷垃": {"花费":100,"描述":"施肥道具可以在5分钟内5倍速作物的生长","类型":"作物道具","道具图片":"res://assets/道具图片/金坷垃2.webp"},
"水壶": {"花费":100,"描述":"(浇水道具)直接让作物生长进度+1%","类型":"作物道具","道具图片":"res://assets/道具图片/铁质洒水壶.webp"},
"水桶": {"花费":100,"描述":"(浇水道具)让作物生长进度+2%","类型":"作物道具","道具图片":"res://assets/道具图片/木质水桶2.webp"},
"杀虫剂": {"花费":100,"描述":"杀虫,暂时没什么用","类型":"作物道具","道具图片":"res://assets/道具图片/杀虫剂.webp"},
"除草剂": {"花费":100,"描述":"除草","类型":"作物道具","道具图片":"res://assets/道具图片/除草剂.webp"},
"生长素": {"花费":100,"描述":"时运可以10分钟内3倍速作物生长而且作物生长速度+3%","类型":"作物道具","道具图片":"res://assets/道具图片/生长素.webp"},
"铲子": {"花费":100,"描述":"铲除作物","类型":"作物道具","道具图片":"res://assets/道具图片/附魔铁铲.webp"}
}

View File

@@ -1,87 +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": "钻石剑"
}
}

View File

@@ -389,9 +389,6 @@ func _input(event):
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED)
else:
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN)
elif key_code == KEY_F12:
# 截图
print("截图功能暂未实现")
#=======================脚本基础方法=======================
@@ -491,10 +488,10 @@ func _handle_visit_player_response(data):
pet_bag_panel.update_pet_bag_ui()
# 初始化巡逻宠物(访问模式)
print("[访问模式] 准备初始化巡逻宠物,数据量: ", patrol_pets.size())
#print("[访问模式] 准备初始化巡逻宠物,数据量: ", patrol_pets.size())
for i in range(patrol_pets.size()):
var pet_data = patrol_pets[i]
print("[访问模式] 巡逻宠物", i, ": ", pet_data.get("pet_name", "未知"), " ID:", pet_data.get("pet_id", "无ID"))
#print("[访问模式] 巡逻宠物", i, ": ", pet_data.get("pet_name", "未知"), " ID:", pet_data.get("pet_id", "无ID"))
if has_method("init_patrol_pets"):
init_patrol_pets()
@@ -510,19 +507,12 @@ func _handle_visit_player_response(data):
# 更新智慧树显示
_update_wisdom_tree_display(target_wisdom_config)
else:
print("智慧树配置不是Dictionary类型", typeof(target_wisdom_config))
else:
print("目标玩家没有智慧树配置或配置为空")
# 隐藏排行榜面板
if player_ranking_panel:
player_ranking_panel.hide()
Toast.show("正在访问 " + target_player_data.get("玩家昵称", "未知") + " 的农场", Color.CYAN)
else:
Toast.show("访问失败:" + message, Color.RED)
print("访问玩家失败:", message)
# 处理返回自己农场响应
func _handle_return_my_farm_response(data):
@@ -583,10 +573,10 @@ func _handle_return_my_farm_response(data):
pet_bag_panel.update_pet_bag_ui()
# 初始化巡逻宠物(返回自己农场)
print("[返回农场] 准备初始化巡逻宠物,数据量: ", patrol_pets.size())
#print("[返回农场] 准备初始化巡逻宠物,数据量: ", patrol_pets.size())
for i in range(patrol_pets.size()):
var pet_data = patrol_pets[i]
print("[返回农场] 巡逻宠物", i, ": ", pet_data.get("pet_name", "未知"), " ID:", pet_data.get("pet_id", "无ID"))
#print("[返回农场] 巡逻宠物", i, ": ", pet_data.get("pet_name", "未知"), " ID:", pet_data.get("pet_id", "无ID"))
if has_method("init_patrol_pets"):
init_patrol_pets()
@@ -604,18 +594,12 @@ func _handle_return_my_farm_response(data):
update_wisdom_tree_display()
Toast.show("已返回自己的农场", Color.GREEN)
else:
Toast.show("返回农场失败:" + message, Color.RED)
print("返回农场失败:", message)
#访客模式下返回我的农场
func _on_return_my_farm_button_pressed() -> void:
# 如果当前处于访问模式,返回自己的农场
if is_visiting_mode:
return_to_my_farm()
else:
# 如果不在访问模式,这个按钮可能用于其他功能或者不做任何操作
print("当前已在自己的农场")
# 返回自己的农场
func return_to_my_farm():
@@ -626,13 +610,11 @@ func return_to_my_farm():
if tcp_network_manager_panel and tcp_network_manager_panel.has_method("sendReturnMyFarm"):
var success = tcp_network_manager_panel.sendReturnMyFarm()
if success:
print("已发送返回自己农场的请求")
#print("已发送返回自己农场的请求")
pass
else:
Toast.show("网络未连接,无法返回农场", Color.RED)
print("发送返回农场请求失败,网络未连接")
else:
Toast.show("网络管理器不可用", Color.RED)
print("网络管理器不可用")
#print("发送返回农场请求失败,网络未连接")
#==========================玩家排行榜+访问模式处理============================
@@ -665,9 +647,7 @@ func _on_item_selected(index):
# 游戏小提示相关变量
var game_tips_config = {} # 服务端游戏小提示配置
var current_tip_index = 0 # 当前小提示索引(用于顺序模式)
#OS
#DisplayServer
#获取游戏提示
func _random_small_game_tips() -> String:
# 默认游戏小提示(作为备用)
const default_game_tips = [
@@ -751,21 +731,20 @@ func handle_login_success(player_data: Dictionary):
# 立即请求在线人数
if tcp_network_manager_panel and tcp_network_manager_panel.is_connected_to_server():
tcp_network_manager_panel.sendGetOnlinePlayers()
print("登录成功后请求在线人数更新")
#print("登录成功后请求在线人数更新")
# 登录成功后请求宠物配置数据
if tcp_network_manager_panel and tcp_network_manager_panel.has_method("sendGetPetConfig"):
if tcp_network_manager_panel.sendGetPetConfig():
print("登录成功后请求宠物配置数据")
else:
print("登录成功后请求宠物配置数据失败")
#print("登录成功后请求宠物配置数据")
pass
# 登录成功后请求游戏小提示配置数据
if tcp_network_manager_panel and tcp_network_manager_panel.has_method("sendGetGameTipsConfig"):
if tcp_network_manager_panel.sendGetGameTipsConfig():
print("登录成功后请求游戏小提示配置数据")
else:
print("登录成功后请求游戏小提示配置数据失败")
#print("登录成功后请求游戏小提示配置数据")
pass
# 其他登录成功后的初始化逻辑可以在这里添加
start_game = true
@@ -1868,9 +1847,7 @@ func _check_loading_stuck(progress: int):
# 如果进度没有变化
if progress == last_progress_value:
var stuck_time = current_time - last_progress_time
if stuck_time > 5.0: # 5秒没有进度变化
print("⚠ 加载卡顿检测: 在 %d%% 停留了 %.1f" % [progress, stuck_time])
pass
else:
# 进度有变化,更新记录
last_progress_value = progress
@@ -2031,10 +2008,7 @@ func _handle_daily_check_in_response(response: Dictionary) -> void:
# 显示签到结果通知
var success = response.get("success", false)
if success:
var rewards = response.get("rewards", {})
var consecutive_days = response.get("consecutive_days", 1)
var message = "签到成功!连续签到 %d" % consecutive_days
Toast.show(message, Color.GREEN)
pass
else:
var error_message = response.get("message", "签到失败")
Toast.show(error_message, Color.RED)
@@ -2313,7 +2287,8 @@ func _request_online_players():
if tcp_network_manager_panel and tcp_network_manager_panel.is_connected_to_server():
var success = tcp_network_manager_panel.sendGetOnlinePlayers()
if success:
print("已发送在线人数请求")
#print("已发送在线人数请求")
pass
else:
print("发送在线人数请求失败")
_update_online_players_display(0, false, false)
@@ -2443,13 +2418,8 @@ func _handle_global_broadcast_message(data: Dictionary):
# 处理全服大喇叭发送响应
func _handle_global_broadcast_response(data: Dictionary):
var success = data.get("success", false)
var message = data.get("message", "")
pass
if success:
Toast.show("大喇叭消息发送成功", Color.GREEN, 2.0, 1.0)
else:
Toast.show("大喇叭消息发送失败:" + message, Color.RED, 3.0, 1.0)
# 处理全服大喇叭历史消息响应
func _handle_broadcast_history_response(data: Dictionary):
@@ -3247,8 +3217,8 @@ func _create_single_patrol_pet(pet_data: Dictionary, position_index: int):
# 获取宠物图片路径
func _get_pet_image_path(pet_type: String) -> String:
print("[调试] 获取宠物图片路径,宠物类型: " + pet_type)
print("[调试] 服务器pet_config大小: " + str(pet_config.size()))
#print("[调试] 获取宠物图片路径,宠物类型: " + pet_type)
#print("[调试] 服务器pet_config大小: " + str(pet_config.size()))
# 类型映射表
var type_mapping = {
@@ -3298,8 +3268,8 @@ func update_patrol_pets(patrol_pets_data: Array):
# 清除现有巡逻宠物
clear_patrol_pets()
print("[update_patrol_pets] 开始更新巡逻宠物,输入数据量: ", patrol_pets_data.size())
print("[update_patrol_pets] 当前访问模式: ", is_visiting_mode)
#print("[update_patrol_pets] 开始更新巡逻宠物,输入数据量: ", patrol_pets_data.size())
#print("[update_patrol_pets] 当前访问模式: ", is_visiting_mode)
# 限制最多4个巡逻宠物
var max_pets = min(patrol_pets_data.size(), 4)
@@ -3307,7 +3277,7 @@ func update_patrol_pets(patrol_pets_data: Array):
# 为每个巡逻宠物创建实例
for i in range(max_pets):
var pet_data = patrol_pets_data[i]
print("[update_patrol_pets] 处理宠物", i, ": ", pet_data.get("pet_name", "未知") if pet_data else "空数据")
#print("[update_patrol_pets] 处理宠物", i, ": ", pet_data.get("pet_name", "未知") if pet_data else "空数据")
if pet_data and pet_data.has("pet_id"):
_create_single_patrol_pet(pet_data, i)
else:

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=113 format=3 uid="uid://dgh61dttaas5a"]
[gd_scene load_steps=110 format=3 uid="uid://dgh61dttaas5a"]
[ext_resource type="Script" uid="uid://2pt11sfcaxf7" path="res://MainGame.gd" id="1_v3yaj"]
[ext_resource type="Texture2D" uid="uid://du2pyiojliasy" path="res://assets/游戏UI/经验球.webp" id="2_6jgly"]
@@ -45,19 +45,18 @@
[ext_resource type="Texture2D" uid="uid://2sdfbvf1isif" path="res://icon.svg" id="31_uc6q1"]
[ext_resource type="Script" uid="uid://doo34ll0yb078" path="res://Script/SmallPanel/PetInformPanel.gd" id="31_vygm6"]
[ext_resource type="PackedScene" uid="uid://byxhjyyaahs6q" path="res://Scene/BigPanel/SpecialFarmPanel.tscn" id="31_ww70k"]
[ext_resource type="Script" uid="uid://bakeq8tm6r4j4" path="res://Script/SmallPanel/GlobalServerBroadcastPanel.gd" id="34_k1sw4"]
[ext_resource type="Script" uid="uid://dobao5y5s2dij" path="res://Script/SmallPanel/ScareCrowPanel.gd" id="35_6ylhg"]
[ext_resource type="Texture2D" uid="uid://d06uaoowmcvxj" path="res://assets/稻草人图片/稻草人2.webp" id="36_jyxgm"]
[ext_resource type="Texture2D" uid="uid://cbe0f8ex17csy" path="res://assets/稻草人图片/稻草人3.webp" id="37_6ylhg"]
[ext_resource type="PackedScene" uid="uid://djh8bnauphg8v" path="res://Scene/SmallPanel/GlobalServerBroadcastPanel.tscn" id="37_rawle"]
[ext_resource type="PackedScene" uid="uid://ibl5wbbw3pwc" path="res://CopyItems/item_button.tscn" id="39_cdkxt"]
[ext_resource type="Script" uid="uid://dwf28j01ckg3y" path="res://Script/SmallPanel/WisdomTreePanel.gd" id="39_np7ck"]
[ext_resource type="Script" uid="uid://b185o1hjnlrv5" path="res://Script/SmallPanel/CropInformPanel.gd" id="41_iluto"]
[ext_resource type="Texture2D" uid="uid://3ff2lnbc0op7" path="res://assets/稻草人图片/稻草人1.webp" id="43_6rkns"]
[ext_resource type="Script" uid="uid://dsmmxivba06ab" path="res://Script/Dialog/BatchSellPopup.gd" id="44_av1bx"]
[ext_resource type="Script" uid="uid://bkel88rscubov" path="res://Script/SmallPanel/TodayDivinationPanel.gd" id="44_mw3xw"]
[ext_resource type="FontFile" uid="uid://b81msdfp2ym2g" path="res://assets/字体/MapleMono-NF-CN-BoldItalic.ttf" id="45_vexnj"]
[ext_resource type="Texture2D" uid="uid://cbdm5e6s8bf6l" path="res://assets/智慧树图片/智慧树4.webp" id="45_xvovi"]
[ext_resource type="Script" uid="uid://cha0uw4ra1trr" path="res://Script/Dialog/AddProduct2StorePopup.gd" id="46_8d602"]
[ext_resource type="PackedScene" uid="uid://yc4ag7vxsrfv" path="res://Scene/SmallPanel/TodayDivinationPanel.tscn" id="47_rawle"]
[ext_resource type="Texture2D" uid="uid://dilipbs0lncpd" path="res://assets/草地图片/草地10.webp" id="48_2i8fe"]
[ext_resource type="Texture2D" uid="uid://du34yctd8bd8m" path="res://assets/灌木丛图片/灌木丛1.webp" id="49_xjiif"]
[ext_resource type="Texture2D" uid="uid://dk4yl4ghmxaa2" path="res://assets/天气系统图片/雪花.webp" id="53_4ka7t"]
@@ -124,16 +123,6 @@ corner_detail = 20
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_2i8fe"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_k1sw4"]
bg_color = Color(0.6, 0.6, 0.6, 0.984314)
border_width_left = 10
border_width_top = 10
border_width_right = 10
border_width_bottom = 10
corner_detail = 20
shadow_size = 20
shadow_offset = Vector2(5, 5)
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_jyxgm"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_np7ck"]
@@ -155,13 +144,6 @@ border_width_right = 15
border_width_bottom = 15
corner_detail = 20
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_bpbm8"]
border_width_left = 15
border_width_top = 15
border_width_right = 15
border_width_bottom = 15
corner_detail = 20
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_t4s8j"]
border_width_left = 15
border_width_top = 15
@@ -930,6 +912,7 @@ visible = false
[node name="LoadProgressPanel" parent="UI/SmallPanel" instance=ExtResource("27_vygm6")]
[node name="AccountSettingPanel" parent="UI/SmallPanel" instance=ExtResource("26_uc6q1")]
visible = false
offset_left = 219.0
offset_top = 45.0
offset_right = 1130.0
@@ -1099,80 +1082,7 @@ offset_bottom = 8.0
theme_override_font_sizes/font_size = 30
text = "刷新"
[node name="GlobalServerBroadcastPanel" type="Panel" parent="UI/SmallPanel"]
visible = false
offset_left = 322.0
offset_right = 985.0
offset_bottom = 721.0
theme_override_styles/panel = SubResource("StyleBoxFlat_k1sw4")
script = ExtResource("34_k1sw4")
[node name="Title" type="Label" parent="UI/SmallPanel/GlobalServerBroadcastPanel"]
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.821789, 0.821789, 0.821789, 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="UI/SmallPanel/GlobalServerBroadcastPanel"]
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="UI/SmallPanel/GlobalServerBroadcastPanel"]
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="UI/SmallPanel/GlobalServerBroadcastPanel/HBox"]
layout_mode = 2
size_flags_horizontal = 3
[node name="SendMessageButton" type="Button" parent="UI/SmallPanel/GlobalServerBroadcastPanel/HBox"]
layout_mode = 2
theme_override_font_sizes/font_size = 30
text = " 发送 "
[node name="QuitButton" type="Button" parent="UI/SmallPanel/GlobalServerBroadcastPanel"]
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="UI/SmallPanel/GlobalServerBroadcastPanel"]
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 = "查看更多"
[node name="GlobalServerBroadcastPanel" parent="UI/SmallPanel" instance=ExtResource("37_rawle")]
[node name="ScareCrowPanel" type="Panel" parent="UI/SmallPanel"]
visible = false
@@ -1688,68 +1598,8 @@ size_flags_vertical = 10
theme_override_font_sizes/font_size = 30
text = "放入小卖部"
[node name="TodayDivinationPanel" type="PanelContainer" parent="UI/SmallPanel"]
[node name="TodayDivinationPanel" parent="UI/SmallPanel" instance=ExtResource("47_rawle")]
visible = false
offset_left = 345.0
offset_right = 1050.0
offset_bottom = 713.0
theme_override_styles/panel = SubResource("StyleBoxFlat_bpbm8")
script = ExtResource("44_mw3xw")
[node name="VBox" type="VBoxContainer" parent="UI/SmallPanel/TodayDivinationPanel"]
layout_mode = 2
[node name="Title" type="Label" parent="UI/SmallPanel/TodayDivinationPanel/VBox"]
layout_mode = 2
size_flags_vertical = 0
theme_override_colors/font_color = Color(0.807843, 1, 0, 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="UI/SmallPanel/TodayDivinationPanel/VBox"]
layout_mode = 2
size_flags_vertical = 3
[node name="Contents" type="RichTextLabel" parent="UI/SmallPanel/TodayDivinationPanel/VBox/Scroll"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
theme_override_fonts/normal_font = ExtResource("45_vexnj")
theme_override_fonts/mono_font = ExtResource("45_vexnj")
theme_override_fonts/italics_font = ExtResource("45_vexnj")
theme_override_fonts/bold_italics_font = ExtResource("45_vexnj")
theme_override_fonts/bold_font = ExtResource("45_vexnj")
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="UI/SmallPanel/TodayDivinationPanel/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="UI/SmallPanel/TodayDivinationPanel/VBox"]
custom_minimum_size = Vector2(300, 0)
layout_mode = 2
size_flags_horizontal = 4
theme_override_font_sizes/font_size = 35
text = "结束占卜"
[node name="PetLadderListPanel" type="Panel" parent="UI/SmallPanel"]
visible = false

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 = "🚪 返回农场 🏡"

View File

@@ -644,7 +644,7 @@ func _load_stock_data():
if file:
var json_string = file.get_as_text()
file.close()
print("读取到的JSON数据", json_string)
#print("读取到的JSON数据", json_string)
var json = JSON.new()
var parse_result = json.parse(json_string)
@@ -653,7 +653,7 @@ func _load_stock_data():
crop_stock_data = data.get("stock", {})
last_refresh_date = data.get("last_refresh_date", "")
print("库存数据加载成功,库存条目数:", crop_stock_data.size())
print("加载的库存数据:", crop_stock_data)
#print("加载的库存数据:", crop_stock_data)
print("上次刷新日期:", last_refresh_date)
# 如果库存数据为空,重新生成
@@ -678,7 +678,7 @@ func _save_stock_data():
}
print("准备保存库存数据到:", stock_file_path)
print("保存的数据:", data)
#print("保存的数据:", data)
var file = FileAccess.open(stock_file_path, FileAccess.WRITE)
if file:
@@ -710,7 +710,7 @@ func _generate_initial_stock():
var stock_amount = _get_stock_amount_by_quality(crop["品质"])
crop_stock_data[crop_name] = stock_amount
generated_count += 1
print("生成库存:", crop_name, " - ", crop["品质"], " - ", stock_amount, "")
#print("生成库存:", crop_name, " - ", crop["品质"], " - ", stock_amount, "个")
# 设置当前日期为刷新日期
last_refresh_date = _get_current_date()
@@ -760,7 +760,7 @@ func _check_daily_refresh():
# 每日刷新库存
func _refresh_daily_stock():
_generate_initial_stock()
Toast.show("种子商店库存已刷新!", Color.GREEN, 3.0, 1.0)
#Toast.show("种子商店库存已刷新!", Color.GREEN, 3.0, 1.0)
# 获取作物当前库存
func _get_crop_stock(crop_name: String) -> int:

View File

@@ -530,7 +530,7 @@ func _get_crop_harvest_texture(crop_name: String) -> Texture2D:
if ResourceLoader.exists(harvest_texture_path):
var texture = load(harvest_texture_path)
if texture:
print("仓库加载作物收获物图片:", crop_name)
#print("仓库加载作物收获物图片:", crop_name)
return texture
# 如果没有找到,使用默认的收获物图片

View File

@@ -252,7 +252,7 @@ func _update_button_item_image(button: Button, item_name: String):
# CropImage是Sprite2D直接设置texture属性
item_image.texture = texture
item_image.visible = true
print("道具商店更新道具图片:", item_name)
#print("道具商店更新道具图片:", item_name)
else:
# 如果没有图片,隐藏图片节点
item_image.visible = false

View File

@@ -128,10 +128,10 @@ func _update_button_pet_image(button: Button, pet_name: String):
if pet_config.has(pet_name):
var pet_info = pet_config[pet_name]
var scene_path = pet_info.get("pet_image", "") # 使用服务器数据的pet_image字段
print("宠物背包 ", pet_name, " 的图片路径:", scene_path)
#print("宠物背包 ", pet_name, " 的图片路径:", scene_path)
if scene_path != "" and ResourceLoader.exists(scene_path):
print("宠物背包开始加载宠物场景:", scene_path)
#print("宠物背包开始加载宠物场景:", scene_path)
# 加载宠物场景并获取PetImage的纹理
var pet_scene = load(scene_path)
if pet_scene:
@@ -145,7 +145,7 @@ func _update_button_pet_image(button: Button, pet_name: String):
var frame_count = pet_instance.sprite_frames.get_frame_count(default_animation)
if frame_count > 0:
texture = pet_instance.sprite_frames.get_frame_texture(default_animation, 0)
print("宠物背包成功获取宠物纹理:", pet_name)
#print("宠物背包成功获取宠物纹理:", pet_name)
else:
print("宠物背包场景没有动画:", pet_name)
else:
@@ -155,8 +155,7 @@ func _update_button_pet_image(button: Button, pet_name: String):
print("宠物背包无法加载宠物场景:", scene_path)
else:
print("宠物背包图片路径无效或文件不存在:", scene_path)
else:
print("宠物背包配置中没有找到:", pet_name)
# 设置图片
if texture:
@@ -165,26 +164,10 @@ func _update_button_pet_image(button: Button, pet_name: String):
pet_image.scale = Vector2(10, 10)
# 确保图片居中显示
pet_image.centered = true
print("宠物背包成功设置宠物图片:", pet_name)
#print("宠物背包成功设置宠物图片:", pet_name)
else:
pet_image.visible = false
print("宠物背包无法获取宠物图片:", pet_name)
# 加载宠物配置数据
func _load_pet_config() -> Dictionary:
var file = FileAccess.open("res://Data/pet_data.json", FileAccess.READ)
if file == null:
return {}
var json = JSON.new()
var json_string = file.get_as_text()
file.close()
var parse_result = json.parse(json_string)
if parse_result != OK:
return {}
return json.data
# 计算宠物年龄(以天为单位)
func _calculate_pet_age(birthday: String) -> int:

View File

@@ -59,12 +59,11 @@ func update_pet_store_ui():
child.queue_free()
print("更新宠物商店UI宠物种类", pet_config.size())
print("宠物配置数据:", pet_config)
# 为每个宠物配置创建按钮
for pet_name in pet_config.keys():
var pet_info = pet_config[pet_name]
print("处理宠物:", pet_name, ",数据:", pet_info)
#print("处理宠物:", pet_name, ",数据:", pet_info)
# 适配扁平化数据格式
var can_buy = pet_info.get("can_purchase", false)
@@ -93,7 +92,7 @@ func update_pet_store_ui():
button.pressed.connect(func(): _on_store_pet_selected(pet_name, pet_cost, pet_desc))
store_grid.add_child(button)
print("已添加宠物按钮:", pet_name)
#print("已添加宠物按钮:", pet_name)
# 检查玩家是否已拥有某种宠物
func _check_pet_owned(pet_name: String) -> bool:
@@ -157,10 +156,10 @@ func _update_button_pet_image(button: Button, pet_name: String):
if pet_config.has(pet_name):
var pet_info = pet_config[pet_name]
var scene_path = pet_info.get("pet_image", "")
print("宠物 ", pet_name, " 的图片路径:", scene_path)
#print("宠物 ", pet_name, " 的图片路径:", scene_path)
if scene_path != "" and ResourceLoader.exists(scene_path):
print("开始加载宠物场景:", scene_path)
#print("开始加载宠物场景:", scene_path)
# 加载宠物场景并获取PetImage的纹理
var pet_scene = load(scene_path)
if pet_scene:
@@ -175,7 +174,7 @@ func _update_button_pet_image(button: Button, pet_name: String):
var frame_count = pet_image_node.sprite_frames.get_frame_count(default_animation)
if frame_count > 0:
texture = pet_image_node.sprite_frames.get_frame_texture(default_animation, 0)
print("成功获取宠物纹理:", pet_name)
#print("成功获取宠物纹理:", pet_name)
else:
print("宠物场景没有动画:", pet_name)
else:
@@ -195,7 +194,7 @@ func _update_button_pet_image(button: Button, pet_name: String):
pet_image.scale = Vector2(10, 10)
# 确保图片居中显示
pet_image.centered = true
print("成功设置宠物图片:", pet_name)
#print("成功设置宠物图片:", pet_name)
else:
# 如果无法获取图片,隐藏图片节点但保留按钮
pet_image.visible = false

View File

@@ -9,19 +9,24 @@ var TETRIS = preload('res://Scene/SmallGame/Tetris.tscn').instantiate()
func _on_game_button_pressed() -> void:
self.add_child(_2048_GAME)
pass # Replace with function body.
pass
func _on_push_box_button_pressed() -> void:
self.add_child(PUSH_BOX)
pass # Replace with function body.
pass
func _on_snake_game_button_pressed() -> void:
self.add_child(SNAKE_GAME)
pass # Replace with function body.
pass
func _on_tetris_button_pressed() -> void:
self.add_child(TETRIS)
pass # Replace with function body.
pass
func _on_quit_button_pressed() -> void:
self.hide()
pass

View File

@@ -17,6 +17,8 @@ extends Panel
@onready var accept_dialog: AcceptDialog = $'../../DiaLog/AcceptDialog'
@onready var tcp_network_manager_panel: Panel = $'../../BigPanel/TCPNetworkManagerPanel'
@onready var http_texture_rect: HTTPTextureRect = $VBox1/HBox1/HTTPTextureRect
# 存储待执行的操作类型
var pending_action = ""
@@ -188,11 +190,14 @@ func _refresh_player_info():
user_password_input.text = main_game.user_password if main_game.user_password != "" else ""
# 优先从 login_data 获取数据,如果没有则从 data 获取
var player_data = main_game.login_data #if main_game.login_data.size() > 0 else main_game.data
var player_data = main_game.login_data
player_name_input.text = player_data.get("玩家昵称", "")
farm_name_input.text = player_data.get("农场名称", "")
personal_profile_input.text = player_data.get("个人简介", "")
# 尝试加载玩家头像(使用用户名/QQ号加载头像而不是显示名
if user_name_input.text.is_valid_int():
http_texture_rect.load_from_url("http://q1.qlogo.cn/g?b=qq&nk=" + user_name_input.text + "&s=100")
#显示消息提示

View File

@@ -81,9 +81,6 @@ func send_broadcast_message():
if success:
# 清空输入框
input_message.text = ""
Toast.show("消息发送成功", Color.GREEN, 2.0, 1.0)
else:
Toast.show("消息发送失败", Color.RED, 2.0, 1.0)
# 统一的消息处理函数
func _add_message_to_history(data: Dictionary):
@@ -241,9 +238,6 @@ func receive_history_messages(data: Dictionary):
# 保存到本地
save_chat_history()
Toast.show("历史消息加载完成,共%d条消息" % messages.size(), Color.GREEN, 2.0, 1.0)
else:
Toast.show("没有找到历史消息", Color.YELLOW, 2.0, 1.0)
# 保存聊天历史记录
func save_chat_history():
@@ -278,7 +272,7 @@ func clear_message_history():
# 获取最新消息用于主界面显示
func get_latest_message() -> String:
print("get_latest_message 被调用,消息历史大小: ", message_history.size())
#print("get_latest_message 被调用,消息历史大小: ", message_history.size())
if message_history.size() > 0:
# 确保消息按时间排序
message_history.sort_custom(func(a, b): return a.get("timestamp", 0) < b.get("timestamp", 0))
@@ -286,5 +280,5 @@ func get_latest_message() -> String:
var result = latest.get("display_name", "匿名") + ": " + latest.get("content", "")
print("返回最新消息: ", result)
return result
print("没有消息历史,返回'暂无消息'")
#print("没有消息历史,返回'暂无消息'")
return "暂无消息"

View File

@@ -88,10 +88,10 @@ func _get_pet_texture(pet_name: String) -> Texture2D:
if pet_config.has(pet_name):
var pet_info = pet_config[pet_name]
var scene_path = pet_info.get("pet_image", "") # 使用服务器数据的pet_image字段
print("宠物信息面板 ", pet_name, " 的图片路径:", scene_path)
#print("宠物信息面板 ", pet_name, " 的图片路径:", scene_path)
if scene_path != "" and ResourceLoader.exists(scene_path):
print("宠物信息面板开始加载宠物场景:", scene_path)
#print("宠物信息面板开始加载宠物场景:", scene_path)
var pet_scene = load(scene_path)
if pet_scene:
var pet_instance = pet_scene.instantiate()
@@ -103,7 +103,7 @@ func _get_pet_texture(pet_name: String) -> Texture2D:
var frame_count = pet_instance.sprite_frames.get_frame_count(default_animation)
if frame_count > 0:
var texture = pet_instance.sprite_frames.get_frame_texture(default_animation, 0)
print("宠物信息面板成功获取宠物纹理:", pet_name)
#print("宠物信息面板成功获取宠物纹理:", pet_name)
pet_instance.queue_free()
return texture
else:
@@ -119,22 +119,6 @@ func _get_pet_texture(pet_name: String) -> Texture2D:
print("宠物信息面板配置中没有找到:", pet_name)
return null
# 加载宠物配置数据
func _load_pet_config() -> Dictionary:
var file = FileAccess.open("res://Data/pet_data.json", FileAccess.READ)
if file == null:
return {}
var json = JSON.new()
var json_string = file.get_as_text()
file.close()
var parse_result = json.parse(json_string)
if parse_result != OK:
return {}
return json.data
# 设置宠物详细信息使用bbcode美化- 新格式
func _set_pet_detailed_info(pet_name: String, pet_data: Dictionary):
# 计算宠物年龄

View File

@@ -1 +0,0 @@
{"2048":{"best_score":2056,"current_score":2056,"games_played":4.0,"highest_tile":128.0,"total_moves":515.0},"global":{"last_played":"2025-08-26T19:02:30"},"pushbox":{"best_moves_per_level":{"1":4.0,"2.0":13.0},"current_level":1.0,"levels_completed":3.0,"max_level_reached":1.0,"total_moves":56.0}}

View File

@@ -1,91 +0,0 @@
"farm_name": "虚空农场",
"user_name": "2221023030",
"player_name": "虚空领主",
"user_password": "wangpeng666",
"last_login_time": "2025年06月09日12时38分55秒",
"total_login_time": "0时45分49秒",
"farm_name": "天帝阁",
"user_name": "2253536500",
"player_name": "小朋友不哭",
"user_password": "a1567923",
"last_login_time": "2025年06月10日09时10分35秒",
"total_login_time": "1时4分20秒",
"farm_name": "神经病院",
"user_name": "2427948832",
"player_name": "唐大伟",
"user_password": "mylc205823",
"last_login_time": "2025年06月29日23时35分03秒",
"total_login_time": "5时45分12秒",
"farm_name": "嘻嘻",
"user_name": "2634726358",
"player_name": "哈哈",
"user_password": "wxt20050712",
"last_login_time": "2025年05月25日19时22分59秒",
"total_login_time": "0时8分43秒",
"farm_name": "杨亮的家",
"user_name": "2671387804",
"player_name": "杨亮的主人",
"user_password": "woshiyangliang",
"last_login_time": "2025年05月25日21时45分45秒",
"total_login_time": "0时16分13秒",
"farm_name": "丿Dream丨天辰",
"user_name": "2809548669",
"player_name": "丿Dream丨天辰",
"user_password": "asd123456",
"last_login_time": "2025年05月25日22时06分21秒",
"total_login_time": "0时0分15秒",
"farm_name": "llsjjz的农村",
"user_name": "2968204579",
"player_name": "llsjjz",
"user_password": "llsjjz0920",
"last_login_time": "2025年06月13日18时57分26秒",
"total_login_time": "0时6分57秒",
"farm_name": "niuma",
"user_name": "2973419538",
"player_name": "niuma",
"user_password": "247896",
"last_login_time": "2025年06月19日09时27分49秒",
"total_login_time": "3时35分6秒",
"farm_name": "星露谷物语",
"user_name": "3275498742",
"player_name": "黎贤泽",
"user_password": "327549",
"last_login_time": "2025年06月13日12时45分01秒",
"total_login_time": "0时7分34秒",
"farm_name": "困困的鼠鼠",
"user_name": "3346964708",
"player_name": "OVO",
"user_password": "123456",
"last_login_time": "2025年06月29日22时48分26秒",
"total_login_time": "0时8分48秒",
"farm_name": "帅气大蟑螂",
"user_name": "3491961863",
"player_name": "帅气大蟑螂",
"user_password": "yyf198763",
"last_login_time": "2025年06月09日07时07分11秒",
"total_login_time": "0时3分43秒",
"farm_name": "yuqi的农场",
"user_name": "3961448694",
"player_name": "yuqi",
"user_password": "x123456",
"last_login_time": "2025年06月28日20时54分03秒",
"total_login_time": "0时35分48秒",
"farm_name": "joker xue",
"user_name": "839151204",
"player_name": "上上谦",
"user_password": "Asxx4522",
"last_login_time": "2025年06月08日22时26分51秒",
"total_login_time": "0时8分30秒",