准备发布正式版
This commit is contained in:
@@ -186,7 +186,6 @@ func _on_add_to_store_pressed():
|
||||
_on_cancel_add_to_store
|
||||
)
|
||||
else:
|
||||
Toast.show("添加商品功能暂未实现", Color.RED, 2.0, 1.0)
|
||||
print("错误:找不到AddProduct2StorePopup或相关方法")
|
||||
|
||||
# 确认添加到小卖部回调
|
||||
|
||||
@@ -62,9 +62,12 @@ var current_plant_index = 0
|
||||
var is_waiting_for_lot_selection = false
|
||||
var pending_plant_type = ""
|
||||
|
||||
#==================基础函数=====================
|
||||
func _ready():
|
||||
self.hide()
|
||||
|
||||
# 连接可见性改变信号
|
||||
visibility_changed.connect(_on_visibility_changed)
|
||||
# 连接按钮信号
|
||||
full_screen_plant_btn.pressed.connect(_on_full_screen_plant_pressed)
|
||||
one_row_plant_btn.pressed.connect(_on_one_row_plant_pressed)
|
||||
@@ -82,6 +85,7 @@ func _process(delta):
|
||||
if plant_timer >= PLANT_INTERVAL:
|
||||
plant_timer = 0.0
|
||||
_process_plant_queue()
|
||||
#==================基础函数=====================
|
||||
|
||||
|
||||
#=================================一键种植模式=========================================
|
||||
@@ -293,8 +297,6 @@ func _prepare_random_plant():
|
||||
|
||||
#=================================一键种植模式=========================================
|
||||
|
||||
|
||||
|
||||
# 开始地块选择模式
|
||||
func _start_lot_selection_mode(plant_type: String):
|
||||
is_waiting_for_lot_selection = true
|
||||
@@ -593,6 +595,8 @@ func stop_planting():
|
||||
Toast.show("一键种植已停止", Color.YELLOW)
|
||||
_finish_planting()
|
||||
|
||||
|
||||
#======================通用面板处理=====================
|
||||
#关闭一键种植面板
|
||||
func _on_quit_button_pressed() -> void:
|
||||
# 如果正在种植,先停止种植
|
||||
@@ -604,3 +608,13 @@ func _on_quit_button_pressed() -> void:
|
||||
return
|
||||
self.hide()
|
||||
pass
|
||||
|
||||
#面板显示切换处理
|
||||
func _on_visibility_changed():
|
||||
if visible:
|
||||
GlobalVariables.isZoomDisabled = true
|
||||
pass
|
||||
else:
|
||||
GlobalVariables.isZoomDisabled = false
|
||||
pass
|
||||
#======================通用面板处理=====================
|
||||
|
||||
@@ -57,6 +57,10 @@ func _ready():
|
||||
"5小时": five_hours
|
||||
}
|
||||
|
||||
|
||||
# 连接可见性改变信号
|
||||
visibility_changed.connect(_on_visibility_changed)
|
||||
|
||||
# 连接按钮信号
|
||||
for gift_name in button_mapping.keys():
|
||||
var button = button_mapping[gift_name]
|
||||
@@ -186,6 +190,18 @@ func handle_claim_online_gift_response(data: Dictionary):
|
||||
else:
|
||||
Toast.show(message, Color.RED)
|
||||
|
||||
|
||||
#================通用面板处理==================
|
||||
#关闭在线礼包面板
|
||||
func _on_quit_button_pressed() -> void:
|
||||
self.hide()
|
||||
|
||||
# 面板显示时的处理
|
||||
func _on_visibility_changed():
|
||||
if visible:
|
||||
GlobalVariables.isZoomDisabled = true
|
||||
pass
|
||||
else:
|
||||
GlobalVariables.isZoomDisabled = false
|
||||
pass
|
||||
#================通用面板处理==================
|
||||
|
||||
@@ -32,7 +32,6 @@ var current_pet_name: String = ""
|
||||
@onready var item_bag_panel: Panel = $'../../BigPanel/ItemBagPanel'
|
||||
@onready var pet_store_panel: Panel = $'../../BigPanel/PetStorePanel'
|
||||
@onready var pet_bag_panel: Panel = $'../../BigPanel/PetBagPanel'
|
||||
@onready var pet_fight_panel: Panel = $'../../BigPanel/PetFightPanel'
|
||||
|
||||
|
||||
|
||||
@@ -202,6 +201,8 @@ func _set_pet_detailed_info(pet_name: String, pet_data: Dictionary):
|
||||
info_text += "召唤技能:[color=cyan]已激活[/color] (数量: " + str(pet_data.get("summon_count", 0)) + ", 缩放: " + str(pet_data.get("summon_scale", 1.0)) + ")\n"
|
||||
if pet_data.get("enable_death_respawn_skill", false):
|
||||
info_text += "死亡重生:[color=purple]已激活[/color] (生命: " + str(pet_data.get("respawn_health_percentage", 0) * 100) + "%)\n"
|
||||
if pet_data.get("enable_damage_reflection_skill", false):
|
||||
info_text += "伤害反弹:[color=yellow]已激活[/color] (荆棘护甲)\n"
|
||||
info_text += "\n"
|
||||
|
||||
# 设置文本
|
||||
|
||||
123
Script/SmallPanel/TodayDivinationPanel.gd
Normal file
123
Script/SmallPanel/TodayDivinationPanel.gd
Normal file
@@ -0,0 +1,123 @@
|
||||
extends PanelContainer
|
||||
|
||||
@onready var start_button: Button = $VBox/StartButton #开始占卜
|
||||
@onready var quit_button: Button = $VBox/QuitButton #关闭面板
|
||||
@onready var contents: RichTextLabel = $VBox/Scroll/Contents #显示占卜内容 用bbcode美化一下
|
||||
|
||||
@onready var tcp_network_manager_panel: Panel = $'../../BigPanel/TCPNetworkManagerPanel'
|
||||
|
||||
# 占卜状态
|
||||
var is_divining: bool = false
|
||||
var today_divination_data: Dictionary = {}
|
||||
|
||||
func _ready() -> void:
|
||||
self.hide()
|
||||
visibility_changed.connect(_on_visibility_changed)
|
||||
# 连接按钮信号
|
||||
start_button.pressed.connect(_on_start_button_pressed)
|
||||
quit_button.pressed.connect(_on_quit_button_pressed)
|
||||
|
||||
#关闭面板
|
||||
func _on_quit_button_pressed() -> void:
|
||||
self.hide()
|
||||
|
||||
#开始占卜
|
||||
func _on_start_button_pressed() -> void:
|
||||
if is_divining:
|
||||
return
|
||||
|
||||
# 检查今日是否已经占卜过
|
||||
var today_date = Time.get_date_string_from_system()
|
||||
if today_divination_data.get("占卜日期", "") == today_date:
|
||||
Toast.show("今日已经占卜过了,明日再来吧!", Color.ORANGE)
|
||||
return
|
||||
|
||||
# 开始占卜
|
||||
is_divining = true
|
||||
start_button.disabled = true
|
||||
start_button.text = "占卜中..."
|
||||
|
||||
# 显示占卜进行中的内容
|
||||
contents.text = "[center][color=gold]正在为您占卜中...[/color]\n\n[color=cyan]天机不可泄露,请稍候...[/color][/center]"
|
||||
|
||||
# 3秒后显示占卜结果
|
||||
await get_tree().create_timer(3.0).timeout
|
||||
|
||||
# 发送占卜请求到服务器
|
||||
if tcp_network_manager_panel and tcp_network_manager_panel.has_method("sendDivinationRequest"):
|
||||
tcp_network_manager_panel.sendDivinationRequest()
|
||||
else:
|
||||
Toast.show("网络连接异常,无法进行占卜", Color.RED)
|
||||
_reset_divination_state()
|
||||
|
||||
# 处理占卜响应
|
||||
func handle_divination_response(success: bool, message: String, divination_data: Dictionary = {}):
|
||||
if success:
|
||||
# 更新本地占卜数据
|
||||
today_divination_data = divination_data.get("今日占卜对象", {})
|
||||
|
||||
# 显示占卜结果
|
||||
_display_divination_result(today_divination_data)
|
||||
|
||||
Toast.show("占卜完成!", Color.GREEN)
|
||||
else:
|
||||
contents.text = "[center][color=red]占卜失败:" + message + "[/color][/center]"
|
||||
Toast.show(message, Color.RED)
|
||||
|
||||
_reset_divination_state()
|
||||
|
||||
# 显示占卜结果
|
||||
func _display_divination_result(divination_data: Dictionary):
|
||||
var divination_date = divination_data.get("占卜日期", "")
|
||||
var divination_result = divination_data.get("占卜结果", "")
|
||||
var divination_level = divination_data.get("占卜等级", "")
|
||||
var divination_hexagram = divination_data.get("卦象", "")
|
||||
var divination_advice = divination_data.get("建议", "")
|
||||
|
||||
var result_text = "[center][color=gold]═══ 今日占卜结果 ═══[/color]\n\n"
|
||||
result_text += "[color=cyan]占卜日期:[/color]" + divination_date + "\n\n"
|
||||
result_text += "[color=yellow]占卜等级:[/color]" + divination_level + "\n\n"
|
||||
result_text += "[color=purple]卦象:[/color]" + divination_hexagram + "\n\n"
|
||||
result_text += "[color=blue]占卜结果:[/color]\n" + divination_result + "\n\n"
|
||||
result_text += "[color=green]建议:[/color]\n" + divination_advice + "\n\n"
|
||||
result_text += "[color=gold]═══════════════[/color][/center]"
|
||||
|
||||
contents.text = result_text
|
||||
|
||||
# 重置占卜状态
|
||||
func _reset_divination_state():
|
||||
is_divining = false
|
||||
start_button.disabled = false
|
||||
start_button.text = "开始占卜"
|
||||
|
||||
# 面板显示时的处理
|
||||
func _on_visibility_changed():
|
||||
if visible:
|
||||
# 面板显示时自动刷新数据
|
||||
_refresh_divination_data()
|
||||
GlobalVariables.isZoomDisabled = true
|
||||
else:
|
||||
GlobalVariables.isZoomDisabled = false
|
||||
|
||||
# 刷新占卜数据
|
||||
func _refresh_divination_data():
|
||||
# 从主游戏获取占卜数据
|
||||
var main_game = get_node("/root/main")
|
||||
if main_game and main_game.has_method("get_player_divination_data"):
|
||||
today_divination_data = main_game.get_player_divination_data()
|
||||
|
||||
# 检查今日是否已经占卜过
|
||||
var today_date = Time.get_date_string_from_system()
|
||||
if today_divination_data.get("占卜日期", "") == today_date:
|
||||
# 显示今日占卜结果
|
||||
_display_divination_result(today_divination_data)
|
||||
start_button.text = "今日已占卜"
|
||||
start_button.disabled = true
|
||||
else:
|
||||
# 显示默认内容
|
||||
contents.text = "[center][color=gold]═══ 今日占卜 ═══[/color]\n\n[color=cyan]点击下方按钮开始今日占卜\n\n占卜将为您揭示今日运势\n结合易经八卦为您指点迷津[/color]\n\n[color=orange]每日仅可占卜一次[/color][/center]"
|
||||
start_button.text = "开始占卜"
|
||||
start_button.disabled = false
|
||||
else:
|
||||
# 显示默认内容
|
||||
contents.text = "[center][color=gold]═══ 今日占卜 ═══[/color]\n\n[color=cyan]点击下方按钮开始今日占卜\n\n占卜将为您揭示今日运势\n结合易经八卦为您指点迷津[/color]\n\n[color=orange]每日仅可占卜一次[/color][/center]"
|
||||
1
Script/SmallPanel/TodayDivinationPanel.gd.uid
Normal file
1
Script/SmallPanel/TodayDivinationPanel.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://bkel88rscubov
|
||||
Reference in New Issue
Block a user