准备发布正式版

This commit is contained in:
2025-07-31 22:59:40 +08:00
parent 048600e95d
commit ea42a1563d
173 changed files with 3926 additions and 4295 deletions

View File

@@ -54,16 +54,7 @@ func _ready():
# 隐藏面板(初始默认隐藏)
self.hide()
# 面板显示时的处理
func _on_visibility_changed():
if visible:
# 面板显示时自动刷新数据
init_store()
GlobalVariables.isZoomDisabled = true
pass
else:
GlobalVariables.isZoomDisabled = false
pass
# 连接所有按钮信号
func _connect_buttons():
@@ -532,4 +523,15 @@ func _on_refresh_button_pressed() -> void:
#关闭种子商店面板
func _on_quit_button_pressed():
self.hide()
# 面板显示时的处理
func _on_visibility_changed():
if visible:
# 面板显示时自动刷新数据
init_store()
GlobalVariables.isZoomDisabled = true
pass
else:
GlobalVariables.isZoomDisabled = false
pass
#=========================面板通用处理=========================

View File

@@ -32,9 +32,8 @@ extends Panel
@onready var login_panel: PanelContainer = $'../LoginPanel'
# 作物图片缓存(复用主游戏的缓存系统
var crop_textures_cache : Dictionary = {}
var crop_frame_counts : Dictionary = {}
# 注意:作物图片现在使用主游戏的CropTextureManager缓存系统
# 不再需要本地缓存变量
# 当前过滤和排序设置
var current_filter_quality = ""
@@ -84,7 +83,7 @@ func set_pet_feeding_mode(feeding_mode: bool, pet_data: Dictionary = {}):
# 更新UI以反映当前模式
if is_pet_feeding_mode:
# 宠物喂食模式下,只显示有喂养效果的作物
var pet_name = pet_data.get("基本信息", {}).get("宠物名称", "未知宠物")
var pet_name = pet_data.get("pet_name", "未知宠物")
Toast.show("宠物喂食模式:选择要喂给 " + pet_name + " 的作物", Color.CYAN, 3.0, 1.0)
else:
# 普通模式
@@ -423,8 +422,8 @@ func _on_crop_feed_selected(crop_name: String, crop_count: int):
var feed_effects = crop_data.get("喂养效果", {})
# 获取宠物信息
var pet_name = current_pet_data.get("基本信息", {}).get("宠物名称", "未知宠物")
var pet_id = current_pet_data.get("基本信息", {}).get("宠物ID", "")
var pet_name = current_pet_data.get("pet_name", "未知宠物")
var pet_id = current_pet_data.get("pet_id", "")
if pet_id == "":
Toast.show("宠物ID无效", Color.RED, 2.0, 1.0)
@@ -511,7 +510,8 @@ func _send_feed_pet_request(crop_name: String, pet_id: String, feed_effects: Dic
# 获取作物的收获物图片(用于仓库显示)
func _get_crop_harvest_texture(crop_name: String) -> Texture2D:
# 尝试加载"收获物.webp"图片
# 使用作物键名(而不是成熟物名称)来构建图片路径
# crop_name 是作物的键名,如"可可豆"、"向日葵"等
var crop_path = "res://assets/作物/" + crop_name + "/"
var harvest_texture_path = crop_path + "收获物.webp"
@@ -521,8 +521,7 @@ func _get_crop_harvest_texture(crop_name: String) -> Texture2D:
print("仓库加载作物收获物图片:", crop_name)
return texture
# 如果都没有找到,使用默认的收获物图片
# 如果没有找到,使用默认的收获物图片
var default_harvest_path = "res://assets/作物/默认/收获物.webp"
if ResourceLoader.exists(default_harvest_path):
var texture = load(default_harvest_path)

View File

@@ -10,6 +10,9 @@ signal check_in_failed(error_message: String)
@onready var main_game = get_node("/root/main")
@onready var tcp_network_manager_panel: Panel = $'../TCPNetworkManagerPanel'
@onready var confirm_dialog: ConfirmationDialog = $ConfirmDialog #确认弹窗
var check_in_history: Dictionary = {}
var consecutive_days: int = 0
var has_checked_in_today: bool = false
@@ -35,7 +38,9 @@ func handle_daily_check_in_response(response: Dictionary) -> void:
consecutive_days = response.get("consecutive_days", 0)
has_checked_in_today = true
_show_reward_animation(rewards)
# 显示奖励内容
_show_reward_content(rewards)
_set_button_state(false, "已签到", Color(0.7, 0.7, 0.7, 1))
check_in_completed.emit(rewards)
@@ -86,17 +91,6 @@ func execute_check_in() -> void:
daily_check_in_button.disabled = false
daily_check_in_button.text = "签到"
func _show_reward_animation(rewards: Dictionary) -> void:
daily_check_in_reward.text = _format_reward_text(rewards)
daily_check_in_reward.show()
var tween = create_tween()
tween.parallel().tween_method(_animate_reward_display, 0.0, 1.0, 0.5)
func _animate_reward_display(progress: float) -> void:
daily_check_in_reward.modulate.a = progress
var scale = 0.8 + (0.2 * progress)
daily_check_in_reward.scale = Vector2(scale, scale)
func _format_reward_text(rewards: Dictionary) -> String:
var text = ""
@@ -162,6 +156,11 @@ func _get_rarity_color(rarity: String) -> String:
"传奇": return "#FF8C00"
_: return "#FFFFFF"
func _show_reward_content(rewards: Dictionary) -> void:
var reward_text = _format_reward_text(rewards)
daily_check_in_reward.text = reward_text
daily_check_in_reward.show()
func _update_display() -> void:
var history_text = "[center][color=#FFB6C1]📋 签到历史[/color][/center]\n"
@@ -194,6 +193,16 @@ func _on_quit_button_pressed() -> void:
self.hide()
func _on_daily_check_in_button_pressed() -> void:
# 显示确认弹窗
confirm_dialog.title = "每日签到确认"
confirm_dialog.dialog_text = "确定要进行今日签到吗?\n签到可获得金币、经验和种子奖励!"
confirm_dialog.popup_centered()
# 连接确认信号(如果还没连接的话)
if not confirm_dialog.confirmed.is_connected(_on_confirm_check_in):
confirm_dialog.confirmed.connect(_on_confirm_check_in)
func _on_confirm_check_in() -> void:
execute_check_in()
func _on_visibility_changed():

View File

@@ -371,8 +371,8 @@ func _show_pet_item_confirmation_dialog(item_name: String, item_count: int):
Toast.show("宠物数据丢失,请重新选择宠物", Color.RED, 2.0, 1.0)
return
var pet_name = current_pet_data.get("基本信息", {}).get("宠物名称", "未知宠物")
var pet_id = current_pet_data.get("基本信息", {}).get("宠物ID", "")
var pet_name = current_pet_data.get("pet_name", "未知宠物")
var pet_id = current_pet_data.get("pet_id", "")
# 获取道具信息
var item_config = _load_item_config()
@@ -514,4 +514,4 @@ func get_selected_item_name() -> String:
# 检查是否有道具被选择
func is_item_currently_selected() -> bool:
return is_item_selected
return is_item_selected

View File

@@ -567,3 +567,13 @@ func _set_status(label: Label, text: String, color: Color):
#面板显示与隐藏切换处理
func _on_visibility_changed():
GlobalVariables.isZoomDisabled = visible
#注册面板返回登录面板
func _on_register_2_login_button_pressed() -> void:
_switch_to_login_panel()
pass
#找回密码面板返回登录面板
func _on_forget_2_login_button_pressed() -> void:
_switch_to_login_panel()
pass

View File

@@ -10,6 +10,9 @@ signal draw_failed(error_message: String)
@onready var main_game = get_node("/root/main")
@onready var tcp_network_manager_panel: Panel = $'../TCPNetworkManagerPanel'
@onready var confirm_dialog: ConfirmationDialog = $ConfirmDialog #确认弹窗
var reward_templates: Array[RichTextLabel] = []
var current_rewards: Array = []
var seed_rewards: Dictionary = {}
@@ -212,10 +215,8 @@ func _perform_network_draw(draw_type: String) -> void:
func _show_waiting_animation() -> void:
_set_draw_buttons_enabled(false)
lucky_draw_reward.hide()
_play_anticipation_animation()
func handle_lucky_draw_response(response: Dictionary) -> void:
_stop_anticipation_animation()
_set_draw_buttons_enabled(true)
if response.get("success", false):
@@ -237,8 +238,7 @@ func _show_server_draw_results(rewards: Array, draw_type: String, cost: int) ->
lucky_draw_reward.text = result_text
lucky_draw_reward.show()
_play_result_animation()
func _format_server_draw_results(rewards: Array, draw_type: String, cost: int) -> String:
var type_names = {"single": "单抽", "five": "五连抽", "ten": "十连抽"}
@@ -338,40 +338,11 @@ func _format_package_content(content: Dictionary) -> String:
"seed": return "[color=#90EE90]🌱%sx%d[/color]" % [content.get("name", "种子"), amount]
_: return ""
func _play_anticipation_animation() -> void:
_stop_anticipation_animation()
anticipation_tween = create_tween()
anticipation_tween.set_loops()
for template in reward_templates:
if template.visible:
anticipation_tween.parallel().tween_method(
func(progress: float): _anticipation_flash(template, progress),
0.0, 1.0, 0.8
)
func _anticipation_flash(template: RichTextLabel, progress: float) -> void:
var flash_intensity = 1.0 + sin(progress * PI * 2) * 0.2
template.modulate = Color(flash_intensity, flash_intensity, flash_intensity, 1.0)
func _stop_anticipation_animation() -> void:
if anticipation_tween:
anticipation_tween.kill()
anticipation_tween = null
for template in reward_templates:
template.modulate = Color.WHITE
func _play_result_animation() -> void:
var tween = create_tween()
lucky_draw_reward.modulate.a = 0.0
lucky_draw_reward.scale = Vector2(0.8, 0.8)
tween.parallel().tween_property(lucky_draw_reward, "modulate:a", 1.0, 0.5)
tween.parallel().tween_property(lucky_draw_reward, "scale", Vector2(1.0, 1.0), 0.5)
tween.tween_callback(func(): lucky_draw_reward.modulate.a = 1.0)
func _show_error_message(message: String) -> void:
lucky_draw_reward.text = "[center][color=#FF6B6B]❌ %s[/color][/center]" % message
@@ -396,13 +367,33 @@ func _on_quit_button_pressed() -> void:
self.hide()
func _on_lucky_draw_button_pressed() -> void:
_perform_network_draw("single")
_show_draw_confirmation("single")
func _on_five_lucky_draw_button_pressed() -> void:
_perform_network_draw("five")
_show_draw_confirmation("five")
func _on_ten_lucky_draw_button_pressed() -> void:
_perform_network_draw("ten")
_show_draw_confirmation("ten")
func _show_draw_confirmation(draw_type: String) -> void:
var cost = draw_costs.get(draw_type, 800)
var type_names = {"single": "单抽", "five": "五连抽", "ten": "十连抽"}
var type_name = type_names.get(draw_type, draw_type)
confirm_dialog.title = "幸运抽奖确认"
confirm_dialog.dialog_text = "确定要进行%s吗?\n需要花费 %d 金币\n\n可能获得金币、经验、种子等奖励!" % [type_name, cost]
confirm_dialog.popup_centered()
# 保存当前抽奖类型
confirm_dialog.set_meta("draw_type", draw_type)
# 连接确认信号(如果还没连接的话)
if not confirm_dialog.confirmed.is_connected(_on_confirm_draw):
confirm_dialog.confirmed.connect(_on_confirm_draw)
func _on_confirm_draw() -> void:
var draw_type = confirm_dialog.get_meta("draw_type", "single")
_perform_network_draw(draw_type)
func _on_visibility_changed():
if visible:

View File

@@ -289,6 +289,7 @@ func _on_confirm_buy_pet(pet_name: String, pet_cost: int, dialog: AcceptDialog):
# 发送购买请求到服务器
_send_buy_pet_request(pet_name, pet_cost)
init_pet_store()
dialog.queue_free()
# 取消购买宠物
@@ -310,6 +311,7 @@ func _send_buy_pet_request(pet_name: String, pet_cost: int):
#=========================面板通用处理=========================
# 手动刷新宠物商店面板
#刷新按钮点击
func _on_refresh_button_pressed() -> void:
# 清空现有配置和请求状态,强制重新获取
pet_config = {}

View File

@@ -49,6 +49,8 @@ func _ready() -> void:
# 隐藏模板
player_info_template.visible = false
# 连接可见性改变信号
visibility_changed.connect(_on_visibility_changed)
# 连接按钮信号
refresh_button.pressed.connect(_on_refresh_button_pressed)
quit_button.pressed.connect(_on_quit_button_pressed)
@@ -265,6 +267,37 @@ func _on_visit_player_pressed(username):
else:
Toast.show("网络管理器不可用", Color.RED)
#搜索按钮点击 - 通过QQ号查询玩家
func _on_search_button_pressed():
var search_text = search_line_edit.text.strip_edges()
# 如果搜索框为空,清除搜索条件
if search_text == "":
current_search_qq = ""
Toast.show("已清除搜索条件", Color.YELLOW)
else:
# 验证输入是否为数字QQ号
if not search_text.is_valid_int():
Toast.show("请输入有效的QQ号纯数字", Color.RED)
return
current_search_qq = search_text
Toast.show("搜索QQ号" + search_text, Color.YELLOW)
# 重新请求排行榜
request_player_rankings()
#===================通用面板处理======================
# 面板显示时的处理
func _on_visibility_changed():
if visible:
GlobalVariables.isZoomDisabled = true
pass
else:
GlobalVariables.isZoomDisabled = false
pass
# 刷新按钮点击
func _on_refresh_button_pressed():
# 检查网络连接
@@ -299,22 +332,4 @@ func _on_quit_button_pressed():
self.hide()
#搜索按钮点击 - 通过QQ号查询玩家
func _on_search_button_pressed():
var search_text = search_line_edit.text.strip_edges()
# 如果搜索框为空,清除搜索条件
if search_text == "":
current_search_qq = ""
Toast.show("已清除搜索条件", Color.YELLOW)
else:
# 验证输入是否为数字QQ号
if not search_text.is_valid_int():
Toast.show("请输入有效的QQ号纯数字", Color.RED)
return
current_search_qq = search_text
Toast.show("搜索QQ号" + search_text, Color.YELLOW)
# 重新请求排行榜
request_player_rankings()
#===================通用面板处理======================