优化项目架构
This commit is contained in:
177
SproutFarm-Frontend/GUI/CheckUpdatePanel.gd
Normal file
177
SproutFarm-Frontend/GUI/CheckUpdatePanel.gd
Normal file
@@ -0,0 +1,177 @@
|
||||
extends Control
|
||||
|
||||
# 简化版更新检测器
|
||||
# 适用于萌芽农场游戏
|
||||
|
||||
# 配置
|
||||
const GAME_ID = "mengyafarm"
|
||||
const SERVER_URL = "https://app.shumengya.top"
|
||||
const CURRENT_VERSION = GlobalVariables.client_version
|
||||
|
||||
# 更新信息
|
||||
var has_update = false
|
||||
var latest_version = ""
|
||||
|
||||
func _ready():
|
||||
# 初始化时隐藏面板
|
||||
self.hide()
|
||||
|
||||
# 游戏启动时自动检查更新
|
||||
call_deferred("check_for_updates")
|
||||
|
||||
func check_for_updates():
|
||||
|
||||
var http_request = HTTPRequest.new()
|
||||
add_child(http_request)
|
||||
|
||||
# 连接请求完成信号
|
||||
http_request.request_completed.connect(_on_update_check_completed)
|
||||
|
||||
# 发送请求
|
||||
var url = SERVER_URL + "/api/simple/check-version/" + GAME_ID + "?current_version=" + CURRENT_VERSION
|
||||
var error = http_request.request(url)
|
||||
|
||||
if error != OK:
|
||||
print("网络请求失败: ", error)
|
||||
|
||||
func _on_update_check_completed(result: int, response_code: int, headers: PackedStringArray, body: PackedByteArray):
|
||||
if response_code != 200:
|
||||
print("服务器响应错误: ", response_code)
|
||||
return
|
||||
|
||||
# 解析JSON
|
||||
var json = JSON.new()
|
||||
var parse_result = json.parse(body.get_string_from_utf8())
|
||||
|
||||
if parse_result != OK:
|
||||
print("解析响应失败")
|
||||
return
|
||||
|
||||
var data = json.data
|
||||
|
||||
if "error" in data:
|
||||
print("服务器错误: ", data.error)
|
||||
return
|
||||
|
||||
# 检查是否有更新
|
||||
has_update = data.get("has_update", false)
|
||||
latest_version = data.get("latest_version", "")
|
||||
|
||||
if has_update:
|
||||
print("发现新版本: ", latest_version)
|
||||
show_update_panel()
|
||||
else:
|
||||
print("已是最新版本")
|
||||
|
||||
func show_update_panel():
|
||||
"""显示更新面板"""
|
||||
self.show() # 直接显示当前面板
|
||||
|
||||
func download_update():
|
||||
"""下载更新"""
|
||||
var platform = get_platform_name()
|
||||
var download_url = SERVER_URL + "/download/" + GAME_ID + "/" + platform.to_lower()
|
||||
|
||||
print("下载链接: ", download_url)
|
||||
|
||||
# 打开下载页面
|
||||
var error = OS.shell_open(download_url)
|
||||
if error != OK:
|
||||
# 复制到剪贴板作为备选方案
|
||||
DisplayServer.clipboard_set(download_url)
|
||||
show_message("无法打开浏览器,下载链接已复制到剪贴板")
|
||||
|
||||
func get_platform_name() -> String:
|
||||
"""获取平台名称"""
|
||||
var os_name = OS.get_name()
|
||||
match os_name:
|
||||
"Windows":
|
||||
return "Windows"
|
||||
"Android":
|
||||
return "Android"
|
||||
"macOS":
|
||||
return "macOS"
|
||||
"Linux":
|
||||
return "Linux"
|
||||
_:
|
||||
return "Windows"
|
||||
|
||||
func show_message(text: String):
|
||||
"""显示消息提示"""
|
||||
var dialog = AcceptDialog.new()
|
||||
add_child(dialog)
|
||||
dialog.dialog_text = text
|
||||
dialog.popup_centered()
|
||||
|
||||
# 3秒后自动关闭
|
||||
await get_tree().create_timer(3.0).timeout
|
||||
if is_instance_valid(dialog):
|
||||
dialog.queue_free()
|
||||
|
||||
# 手动检查更新的公共方法
|
||||
func manual_check_update():
|
||||
"""手动检查更新"""
|
||||
check_for_updates()
|
||||
|
||||
# 直接跳转到相应平台下载链接
|
||||
func _on_download_button_pressed() -> void:
|
||||
"""下载按钮点击事件"""
|
||||
if not has_update:
|
||||
show_message("当前已是最新版本")
|
||||
return
|
||||
|
||||
var platform = get_platform_name()
|
||||
var download_url = SERVER_URL + "/download/" + GAME_ID + "/" + platform.to_lower()
|
||||
|
||||
print("下载链接: ", download_url)
|
||||
|
||||
# 打开下载页面
|
||||
var error = OS.shell_open(download_url)
|
||||
if error != OK:
|
||||
# 复制到剪贴板作为备选方案
|
||||
DisplayServer.clipboard_set(download_url)
|
||||
show_message("无法打开浏览器,下载链接已复制到剪贴板")
|
||||
else:
|
||||
show_message("正在打开下载页面...")
|
||||
|
||||
|
||||
# 关闭更新面板
|
||||
func _on_close_button_pressed() -> void:
|
||||
"""关闭按钮点击事件"""
|
||||
self.hide()
|
||||
|
||||
# 稍后提醒按钮
|
||||
func _on_later_button_pressed() -> void:
|
||||
"""稍后提醒按钮点击事件"""
|
||||
print("用户选择稍后更新")
|
||||
self.hide()
|
||||
|
||||
# 检查更新按钮
|
||||
func _on_check_update_button_pressed() -> void:
|
||||
"""检查更新按钮点击事件"""
|
||||
check_for_updates()
|
||||
|
||||
# 获取更新信息的公共方法
|
||||
func get_update_info() -> Dictionary:
|
||||
"""获取更新信息"""
|
||||
return {
|
||||
"has_update": has_update,
|
||||
"current_version": CURRENT_VERSION,
|
||||
"latest_version": latest_version,
|
||||
"game_id": GAME_ID
|
||||
}
|
||||
|
||||
# 获取当前版本
|
||||
func get_current_version() -> String:
|
||||
"""获取当前版本"""
|
||||
return CURRENT_VERSION
|
||||
|
||||
# 获取最新版本
|
||||
func get_latest_version() -> String:
|
||||
"""获取最新版本"""
|
||||
return latest_version
|
||||
|
||||
# 是否有更新
|
||||
func is_update_available() -> bool:
|
||||
"""是否有更新可用"""
|
||||
return has_update
|
||||
1
SproutFarm-Frontend/GUI/CheckUpdatePanel.gd.uid
Normal file
1
SproutFarm-Frontend/GUI/CheckUpdatePanel.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://ciwjx67wjubdy
|
||||
10
SproutFarm-Frontend/GUI/GameAboutPanel.gd
Normal file
10
SproutFarm-Frontend/GUI/GameAboutPanel.gd
Normal file
@@ -0,0 +1,10 @@
|
||||
extends Panel
|
||||
|
||||
func _ready() -> void:
|
||||
self.show()
|
||||
pass
|
||||
|
||||
|
||||
func _on_quit_button_pressed() -> void:
|
||||
self.hide()
|
||||
pass
|
||||
1
SproutFarm-Frontend/GUI/GameAboutPanel.gd.uid
Normal file
1
SproutFarm-Frontend/GUI/GameAboutPanel.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://bob7a4vhw4nl3
|
||||
203
SproutFarm-Frontend/GUI/GameSettingPanel.gd
Normal file
203
SproutFarm-Frontend/GUI/GameSettingPanel.gd
Normal file
@@ -0,0 +1,203 @@
|
||||
extends Panel
|
||||
#游戏设置面板
|
||||
|
||||
# UI组件引用
|
||||
@onready var background_music_h_slider: HSlider = $Scroll/Panel/BackgroundMusicHSlider
|
||||
@onready var weather_system_check: CheckButton = $Scroll/Panel/WeatherSystemCheck
|
||||
@onready var quit_button: Button = $QuitButton
|
||||
@onready var sure_button: Button = $SureButton
|
||||
@onready var refresh_button: Button = $RefreshButton
|
||||
|
||||
# 引用主游戏和其他组件
|
||||
@onready var main_game = get_node("/root/main")
|
||||
@onready var tcp_network_manager_panel: Panel = get_node("/root/main/UI/BigPanel/TCPNetworkManagerPanel")
|
||||
|
||||
# 游戏设置数据
|
||||
var game_settings: Dictionary = {
|
||||
"背景音乐音量": 1.0,
|
||||
"天气显示": true
|
||||
}
|
||||
|
||||
# 临时设置数据(用户修改但未确认的设置)
|
||||
var temp_settings: Dictionary = {}
|
||||
|
||||
func _ready() -> void:
|
||||
self.hide()
|
||||
|
||||
# 连接信号
|
||||
quit_button.pressed.connect(_on_quit_button_pressed)
|
||||
sure_button.pressed.connect(_on_sure_button_pressed)
|
||||
refresh_button.pressed.connect(_on_refresh_button_pressed)
|
||||
|
||||
# 设置音量滑块范围为0-1
|
||||
background_music_h_slider.min_value = 0.0
|
||||
background_music_h_slider.max_value = 1.0
|
||||
background_music_h_slider.step = 0.01
|
||||
background_music_h_slider.value_changed.connect(_on_background_music_h_slider_value_changed)
|
||||
weather_system_check.toggled.connect(_on_weather_system_check_toggled)
|
||||
|
||||
# 初始化设置值
|
||||
_load_settings_from_global()
|
||||
|
||||
# 当面板可见性改变时
|
||||
visibility_changed.connect(_on_visibility_changed)
|
||||
|
||||
func _on_visibility_changed():
|
||||
"""面板可见性改变时的处理"""
|
||||
if visible:
|
||||
# 面板显示时,刷新设置值
|
||||
_load_settings_from_global()
|
||||
_update_ui_from_settings()
|
||||
|
||||
# 禁用缩放功能
|
||||
GlobalVariables.isZoomDisabled = true
|
||||
else:
|
||||
# 面板隐藏时,恢复缩放功能
|
||||
GlobalVariables.isZoomDisabled = false
|
||||
|
||||
func _load_settings_from_global():
|
||||
"""从全局变量和玩家数据加载设置"""
|
||||
# 从GlobalVariables加载默认设置
|
||||
game_settings["背景音乐音量"] = GlobalVariables.BackgroundMusicVolume
|
||||
game_settings["天气显示"] = not GlobalVariables.DisableWeatherDisplay
|
||||
|
||||
# 如果主游戏已登录,尝试从玩家数据加载设置
|
||||
if main_game and main_game.login_data and main_game.login_data.has("游戏设置"):
|
||||
var player_settings = main_game.login_data["游戏设置"]
|
||||
if player_settings.has("背景音乐音量"):
|
||||
game_settings["背景音乐音量"] = player_settings["背景音乐音量"]
|
||||
if player_settings.has("天气显示"):
|
||||
game_settings["天气显示"] = player_settings["天气显示"]
|
||||
|
||||
# 初始化临时设置
|
||||
temp_settings = game_settings.duplicate()
|
||||
|
||||
func _update_ui_from_settings():
|
||||
"""根据设置数据更新UI"""
|
||||
# 更新音量滑块
|
||||
background_music_h_slider.value = temp_settings["背景音乐音量"]
|
||||
|
||||
# 更新天气显示复选框(注意:复选框表示"关闭天气显示")
|
||||
weather_system_check.button_pressed = not temp_settings["天气显示"]
|
||||
|
||||
func _apply_settings_immediately():
|
||||
"""立即应用设置(不保存到服务端)"""
|
||||
# 应用背景音乐音量设置
|
||||
_apply_music_volume_setting()
|
||||
|
||||
# 应用天气显示设置
|
||||
_apply_weather_display_setting()
|
||||
|
||||
func _save_settings_to_server():
|
||||
"""保存设置到服务端"""
|
||||
# 更新正式设置
|
||||
game_settings = temp_settings.duplicate()
|
||||
|
||||
# 应用设置
|
||||
_apply_settings_immediately()
|
||||
|
||||
# 如果已登录,保存到玩家数据并同步到服务端
|
||||
if main_game and main_game.login_data:
|
||||
main_game.login_data["游戏设置"] = game_settings.duplicate()
|
||||
|
||||
# 发送设置到服务端保存
|
||||
if tcp_network_manager_panel and tcp_network_manager_panel.has_method("is_connected_to_server") and tcp_network_manager_panel.is_connected_to_server():
|
||||
_send_settings_to_server()
|
||||
|
||||
func _apply_music_volume_setting():
|
||||
"""应用背景音乐音量设置"""
|
||||
var bgm_player = main_game.get_node_or_null("GameBGMPlayer")
|
||||
if bgm_player and bgm_player.has_method("set_volume"):
|
||||
bgm_player.set_volume(temp_settings["背景音乐音量"])
|
||||
|
||||
func _apply_weather_display_setting():
|
||||
"""应用天气显示设置"""
|
||||
var weather_system = main_game.get_node_or_null("WeatherSystem")
|
||||
if weather_system and weather_system.has_method("set_weather_display_enabled"):
|
||||
weather_system.set_weather_display_enabled(temp_settings["天气显示"])
|
||||
|
||||
func _send_settings_to_server():
|
||||
"""发送设置到服务端保存"""
|
||||
if tcp_network_manager_panel and tcp_network_manager_panel.has_method("send_message"):
|
||||
var message = {
|
||||
"type": "save_game_settings",
|
||||
"settings": game_settings,
|
||||
"timestamp": Time.get_unix_time_from_system()
|
||||
}
|
||||
|
||||
if tcp_network_manager_panel.send_message(message):
|
||||
print("游戏设置已发送到服务端保存")
|
||||
else:
|
||||
print("发送游戏设置到服务端失败")
|
||||
|
||||
func _on_quit_button_pressed() -> void:
|
||||
"""关闭设置面板"""
|
||||
self.hide()
|
||||
|
||||
func _on_background_music_h_slider_value_changed(value: float) -> void:
|
||||
"""背景音乐音量滑块值改变"""
|
||||
temp_settings["背景音乐音量"] = value
|
||||
# 立即应用音量设置(不保存到服务端)
|
||||
_apply_music_volume_setting()
|
||||
|
||||
# 显示当前音量百分比
|
||||
var volume_percent = int(value * 100)
|
||||
|
||||
func _on_weather_system_check_toggled(toggled_on: bool) -> void:
|
||||
"""天气系统复选框切换"""
|
||||
# 复选框表示"关闭天气显示",所以需要取反
|
||||
temp_settings["天气显示"] = not toggled_on
|
||||
# 立即应用天气设置(不保存到服务端)
|
||||
_apply_weather_display_setting()
|
||||
|
||||
# 显示提示
|
||||
var status_text = "已开启" if temp_settings["天气显示"] else "已关闭"
|
||||
Toast.show("天气显示" + status_text, Color.YELLOW)
|
||||
|
||||
#确认修改设置按钮,点击这个才会发送数据到服务端
|
||||
func _on_sure_button_pressed() -> void:
|
||||
"""确认修改设置"""
|
||||
_save_settings_to_server()
|
||||
Toast.show("设置已保存!", Color.GREEN)
|
||||
|
||||
#刷新设置面板,从服务端加载游戏设置数据
|
||||
func _on_refresh_button_pressed() -> void:
|
||||
"""刷新设置"""
|
||||
_load_settings_from_global()
|
||||
_update_ui_from_settings()
|
||||
_apply_settings_immediately()
|
||||
Toast.show("设置已刷新!", Color.CYAN)
|
||||
|
||||
# 移除原来的自动保存方法,避免循环调用
|
||||
func _on_background_music_h_slider_drag_ended(value_changed: bool) -> void:
|
||||
"""背景音乐音量滑块拖拽结束(保留以兼容场景连接)"""
|
||||
# 不再自动保存,只显示提示
|
||||
if value_changed:
|
||||
var volume_percent = int(background_music_h_slider.value * 100)
|
||||
|
||||
# 公共方法,供外部调用
|
||||
func refresh_settings():
|
||||
"""刷新设置(从服务端或本地重新加载)"""
|
||||
_load_settings_from_global()
|
||||
_update_ui_from_settings()
|
||||
_apply_settings_immediately()
|
||||
|
||||
func get_current_settings() -> Dictionary:
|
||||
"""获取当前设置"""
|
||||
return game_settings.duplicate()
|
||||
|
||||
func apply_settings_from_server(server_settings: Dictionary):
|
||||
"""应用从服务端接收到的设置(避免循环调用)"""
|
||||
if server_settings.has("背景音乐音量"):
|
||||
game_settings["背景音乐音量"] = server_settings["背景音乐音量"]
|
||||
temp_settings["背景音乐音量"] = server_settings["背景音乐音量"]
|
||||
if server_settings.has("天气显示"):
|
||||
game_settings["天气显示"] = server_settings["天气显示"]
|
||||
temp_settings["天气显示"] = server_settings["天气显示"]
|
||||
|
||||
# 只更新UI,不再触发保存
|
||||
if visible:
|
||||
_update_ui_from_settings()
|
||||
_apply_settings_immediately()
|
||||
|
||||
print("已应用来自服务端的游戏设置")
|
||||
1
SproutFarm-Frontend/GUI/GameSettingPanel.gd.uid
Normal file
1
SproutFarm-Frontend/GUI/GameSettingPanel.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://ct7rhywlql4y4
|
||||
163
SproutFarm-Frontend/GUI/GameSettingPanel.tscn
Normal file
163
SproutFarm-Frontend/GUI/GameSettingPanel.tscn
Normal file
@@ -0,0 +1,163 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://dos15dmc1b6bt"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://ct7rhywlql4y4" path="res://GUI/GameSettingPanel.gd" id="1_0c52c"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_0c52c"]
|
||||
border_width_left = 10
|
||||
border_width_top = 10
|
||||
border_width_right = 10
|
||||
border_width_bottom = 10
|
||||
corner_radius_top_left = 20
|
||||
corner_radius_top_right = 20
|
||||
corner_radius_bottom_right = 20
|
||||
corner_radius_bottom_left = 20
|
||||
corner_detail = 20
|
||||
shadow_size = 20
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_7muhe"]
|
||||
bg_color = Color(0.454524, 0.454524, 0.454524, 1)
|
||||
corner_radius_top_left = 10
|
||||
corner_radius_top_right = 10
|
||||
corner_radius_bottom_right = 10
|
||||
corner_radius_bottom_left = 10
|
||||
corner_detail = 20
|
||||
|
||||
[node name="GameSettingPanel" type="Panel"]
|
||||
offset_left = 151.0
|
||||
offset_top = 74.0
|
||||
offset_right = 1549.0
|
||||
offset_bottom = 794.0
|
||||
scale = Vector2(0.8, 0.8)
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_0c52c")
|
||||
script = ExtResource("1_0c52c")
|
||||
|
||||
[node name="Title" type="Label" parent="."]
|
||||
layout_mode = 0
|
||||
offset_top = 9.0
|
||||
offset_right = 1398.0
|
||||
offset_bottom = 97.0
|
||||
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 = 55
|
||||
text = "游戏设置"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="QuitButton" type="Button" parent="."]
|
||||
custom_minimum_size = Vector2(60, 60)
|
||||
layout_mode = 0
|
||||
offset_left = 1305.0
|
||||
offset_top = 17.5
|
||||
offset_right = 1378.0
|
||||
offset_bottom = 97.5
|
||||
theme_override_font_sizes/font_size = 35
|
||||
theme_override_styles/normal = SubResource("StyleBoxFlat_7muhe")
|
||||
text = "X"
|
||||
|
||||
[node name="LinkButton" type="LinkButton" parent="."]
|
||||
visible = false
|
||||
layout_mode = 0
|
||||
offset_left = 15.0
|
||||
offset_top = 17.0
|
||||
offset_right = 79.0
|
||||
offset_bottom = 57.0
|
||||
text = "打开网页"
|
||||
uri = "http://192.168.1.110:19132/site/python"
|
||||
|
||||
[node name="Scroll" type="ScrollContainer" parent="."]
|
||||
layout_mode = 0
|
||||
offset_left = 9.0
|
||||
offset_top = 100.0
|
||||
offset_right = 1389.0
|
||||
offset_bottom = 709.0
|
||||
|
||||
[node name="Panel" type="Panel" parent="Scroll"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="BackgroundMusicLabel" type="Label" parent="Scroll/Panel"]
|
||||
layout_mode = 2
|
||||
offset_left = -1.52588e-05
|
||||
offset_right = 245.0
|
||||
offset_bottom = 49.0
|
||||
theme_override_font_sizes/font_size = 35
|
||||
text = "背景音乐音量:"
|
||||
|
||||
[node name="BackgroundMusicHSlider" type="HSlider" parent="Scroll/Panel"]
|
||||
layout_mode = 2
|
||||
offset_left = 245.0
|
||||
offset_right = 574.0
|
||||
offset_bottom = 49.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 1
|
||||
|
||||
[node name="WeatherSystemLabel" type="Label" parent="Scroll/Panel"]
|
||||
layout_mode = 2
|
||||
offset_left = -0.249969
|
||||
offset_top = 48.75
|
||||
offset_right = 209.75
|
||||
offset_bottom = 97.75
|
||||
theme_override_font_sizes/font_size = 35
|
||||
text = "关闭天气显示:"
|
||||
|
||||
[node name="WeatherSystemCheck" type="CheckButton" parent="Scroll/Panel"]
|
||||
layout_mode = 2
|
||||
offset_left = 244.75
|
||||
offset_top = 48.75
|
||||
offset_right = 288.75
|
||||
offset_bottom = 72.75
|
||||
scale = Vector2(2, 2)
|
||||
theme_override_font_sizes/font_size = 100
|
||||
|
||||
[node name="HBox" type="HBoxContainer" parent="Scroll/Panel"]
|
||||
visible = false
|
||||
layout_mode = 0
|
||||
offset_top = 97.0
|
||||
offset_right = 853.0
|
||||
offset_bottom = 154.0
|
||||
|
||||
[node name="ChangeServer" type="Label" parent="Scroll/Panel/HBox"]
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 35
|
||||
text = "切换服务器"
|
||||
|
||||
[node name="IPInput" type="LineEdit" parent="Scroll/Panel/HBox"]
|
||||
custom_minimum_size = Vector2(400, 0)
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 35
|
||||
placeholder_text = "请输入服务器IP地址"
|
||||
|
||||
[node name="PortInput" type="LineEdit" parent="Scroll/Panel/HBox"]
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 35
|
||||
placeholder_text = "端口"
|
||||
alignment = 1
|
||||
|
||||
[node name="ChangeButton" type="Button" parent="Scroll/Panel/HBox"]
|
||||
custom_minimum_size = Vector2(120, 0)
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 35
|
||||
text = "切换"
|
||||
|
||||
[node name="SureButton" type="Button" parent="."]
|
||||
layout_mode = 0
|
||||
offset_left = 647.5
|
||||
offset_top = 635.0
|
||||
offset_right = 815.5
|
||||
offset_bottom = 698.0
|
||||
theme_override_font_sizes/font_size = 40
|
||||
text = "确认修改"
|
||||
|
||||
[node name="RefreshButton" type="Button" parent="."]
|
||||
layout_mode = 0
|
||||
offset_left = 27.5001
|
||||
offset_top = 25.0001
|
||||
offset_right = 195.5
|
||||
offset_bottom = 88.0001
|
||||
theme_override_font_sizes/font_size = 40
|
||||
text = "刷新"
|
||||
159
SproutFarm-Frontend/GUI/GameUpdatePanel.gd
Normal file
159
SproutFarm-Frontend/GUI/GameUpdatePanel.gd
Normal file
@@ -0,0 +1,159 @@
|
||||
extends Panel
|
||||
|
||||
@onready var contents: RichTextLabel = $Scroll/Contents #更新内容
|
||||
@onready var refresh_button: Button = $RefreshButton #刷新按钮
|
||||
|
||||
# HTTP请求节点
|
||||
var http_request: HTTPRequest
|
||||
|
||||
# API配置
|
||||
const API_URL = "http://47.108.90.0:5003/api/game/mengyafarm/updates"
|
||||
|
||||
func _ready() -> void:
|
||||
self.hide()
|
||||
|
||||
# 创建HTTPRequest节点
|
||||
http_request = HTTPRequest.new()
|
||||
add_child(http_request)
|
||||
|
||||
# 连接HTTP请求完成信号
|
||||
http_request.request_completed.connect(_on_request_completed)
|
||||
|
||||
# 连接刷新按钮信号
|
||||
refresh_button.pressed.connect(_on_refresh_button_pressed)
|
||||
|
||||
# 初始加载更新数据
|
||||
load_updates()
|
||||
|
||||
func _on_quit_button_pressed() -> void:
|
||||
HidePanel()
|
||||
|
||||
func _on_refresh_button_pressed() -> void:
|
||||
load_updates()
|
||||
|
||||
func load_updates() -> void:
|
||||
# 禁用刷新按钮,防止重复请求
|
||||
refresh_button.disabled = true
|
||||
refresh_button.text = "刷新中..."
|
||||
|
||||
# 显示加载中
|
||||
contents.text = "[center][color=yellow]正在加载更新信息...[/color][/center]"
|
||||
|
||||
# 发起HTTP请求
|
||||
var error = http_request.request(API_URL)
|
||||
if error != OK:
|
||||
_show_error("网络请求失败,错误代码: " + str(error))
|
||||
|
||||
func _on_request_completed(result: int, response_code: int, headers: PackedStringArray, body: PackedByteArray) -> void:
|
||||
# 恢复刷新按钮
|
||||
refresh_button.disabled = false
|
||||
refresh_button.text = "刷新"
|
||||
|
||||
# 检查请求结果
|
||||
if result != HTTPRequest.RESULT_SUCCESS:
|
||||
_show_error("网络连接失败")
|
||||
return
|
||||
|
||||
if response_code != 200:
|
||||
_show_error("服务器响应错误 (HTTP " + str(response_code) + ")")
|
||||
return
|
||||
|
||||
# 解析JSON数据
|
||||
var json_text = body.get_string_from_utf8()
|
||||
if json_text.is_empty():
|
||||
_show_error("服务器返回空数据")
|
||||
return
|
||||
|
||||
var json = JSON.new()
|
||||
var parse_result = json.parse(json_text)
|
||||
|
||||
if parse_result != OK:
|
||||
_show_error("数据解析失败")
|
||||
return
|
||||
|
||||
var data = json.data
|
||||
if not data.has("updates"):
|
||||
_show_error("数据格式错误")
|
||||
return
|
||||
|
||||
# 显示更新内容
|
||||
display_updates(data.updates)
|
||||
|
||||
func _show_error(error_message: String) -> void:
|
||||
refresh_button.disabled = false
|
||||
refresh_button.text = "刷新"
|
||||
contents.text = "[center][color=red]" + error_message + "\n\n请检查网络连接或稍后重试[/color][/center]"
|
||||
|
||||
func display_updates(updates: Array) -> void:
|
||||
if updates.is_empty():
|
||||
contents.text = "[center][color=gray]暂无更新信息[/color][/center]"
|
||||
return
|
||||
|
||||
var update_text = ""
|
||||
|
||||
for i in range(updates.size()):
|
||||
var update = updates[i]
|
||||
|
||||
# 检查必要字段
|
||||
if not update.has("title") or not update.has("version") or not update.has("content"):
|
||||
continue
|
||||
|
||||
# 更新标题
|
||||
update_text += "[color=cyan][font_size=22][b]" + str(update.title) + "[/b][/font_size][/color]\n"
|
||||
|
||||
# 版本和时间信息
|
||||
update_text += "[color=green]版本: " + str(update.version) + "[/color]"
|
||||
|
||||
if update.has("timestamp"):
|
||||
var formatted_time = _format_time(str(update.timestamp))
|
||||
update_text += " [color=gray]时间: " + formatted_time + "[/color]"
|
||||
|
||||
if update.has("game_name"):
|
||||
update_text += " [color=gray]游戏: " + str(update.game_name) + "[/color]"
|
||||
|
||||
update_text += "\n\n"
|
||||
|
||||
# 更新内容
|
||||
var content = str(update.content)
|
||||
# 处理换行符
|
||||
content = content.replace("\\r\\n", "\n").replace("\\n", "\n")
|
||||
# 高亮特殊符号
|
||||
#content = content.replace("✓", "[color=green]✓[/color]")
|
||||
|
||||
update_text += "[color=white]" + content + "[/color]\n"
|
||||
|
||||
# 添加分隔线(除了最后一个更新)
|
||||
if i < updates.size() - 1:
|
||||
update_text += "\n[color=gray]" + "─".repeat(60) + "[/color]\n\n"
|
||||
|
||||
contents.text = update_text
|
||||
|
||||
# 简单的时间格式化
|
||||
func _format_time(timestamp: String) -> String:
|
||||
var parts = timestamp.split(" ")
|
||||
if parts.size() >= 2:
|
||||
var date_parts = parts[0].split("-")
|
||||
var time_parts = parts[1].split(":")
|
||||
|
||||
if date_parts.size() >= 3 and time_parts.size() >= 2:
|
||||
return date_parts[1] + "月" + date_parts[2] + "日 " + time_parts[0] + ":" + time_parts[1]
|
||||
|
||||
return timestamp
|
||||
|
||||
# 显示面板时自动刷新
|
||||
func ShowPanel() -> void:
|
||||
self.show()
|
||||
load_updates()
|
||||
|
||||
# 隐藏面板时取消正在进行的请求
|
||||
func HidePanel() -> void:
|
||||
self.hide()
|
||||
if http_request and http_request.get_http_client_status() != HTTPClient.STATUS_DISCONNECTED:
|
||||
http_request.cancel_request()
|
||||
|
||||
# 恢复按钮状态
|
||||
if refresh_button:
|
||||
refresh_button.disabled = false
|
||||
refresh_button.text = "刷新"
|
||||
|
||||
|
||||
1
SproutFarm-Frontend/GUI/GameUpdatePanel.gd.uid
Normal file
1
SproutFarm-Frontend/GUI/GameUpdatePanel.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://kj7v1uxk2i6h
|
||||
43
SproutFarm-Frontend/GUI/MainMenuPanel.gd
Normal file
43
SproutFarm-Frontend/GUI/MainMenuPanel.gd
Normal file
@@ -0,0 +1,43 @@
|
||||
extends Control
|
||||
#各种面板
|
||||
@onready var game_about_panel: Panel = $GameAboutPanel
|
||||
@onready var game_update_panel: Panel = $GameUpdatePanel
|
||||
#@onready var game_setting_panel: Panel = $GameSettingPanel
|
||||
|
||||
@onready var game_version_label: Label = $GUI/GameVersionLabel
|
||||
|
||||
@export var smy :TextureRect
|
||||
|
||||
func _ready():
|
||||
game_version_label.text = "版本号:"+GlobalVariables.client_version
|
||||
pass
|
||||
|
||||
func SetGameVersionLabel(version :String):
|
||||
game_version_label.text = version
|
||||
pass
|
||||
|
||||
#开始游戏
|
||||
func _on_start_game_button_pressed() -> void:
|
||||
await get_tree().process_frame
|
||||
get_tree().change_scene_to_file('res://MainGame.tscn')
|
||||
pass
|
||||
|
||||
#游戏设置
|
||||
func _on_game_setting_button_pressed() -> void:
|
||||
#game_setting_panel.show()
|
||||
pass
|
||||
|
||||
#游戏更新
|
||||
func _on_game_update_button_pressed() -> void:
|
||||
game_update_panel.ShowPanel( )
|
||||
pass
|
||||
|
||||
#游戏关于
|
||||
func _on_game_about_button_pressed() -> void:
|
||||
game_about_panel.show()
|
||||
pass
|
||||
|
||||
#游戏结束
|
||||
func _on_exit_button_pressed() -> void:
|
||||
get_tree().quit()
|
||||
pass
|
||||
1
SproutFarm-Frontend/GUI/MainMenuPanel.gd.uid
Normal file
1
SproutFarm-Frontend/GUI/MainMenuPanel.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://badqjgdfhg7vt
|
||||
394
SproutFarm-Frontend/GUI/MainMenuPanel.tscn
Normal file
394
SproutFarm-Frontend/GUI/MainMenuPanel.tscn
Normal file
@@ -0,0 +1,394 @@
|
||||
[gd_scene load_steps=12 format=3 uid="uid://bypjb28h4ntdr"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://badqjgdfhg7vt" path="res://GUI/MainMenuPanel.gd" id="1_wpehy"]
|
||||
[ext_resource type="Texture2D" uid="uid://ddcmrh50o1y0q" path="res://assets/菜单UI/背景1.webp" id="2_eghpk"]
|
||||
[ext_resource type="Texture2D" uid="uid://h8tto256aww4" path="res://assets/菜单Logo/logo1.webp" id="3_eghpk"]
|
||||
[ext_resource type="Script" uid="uid://bob7a4vhw4nl3" path="res://GUI/GameAboutPanel.gd" id="3_y0inj"]
|
||||
[ext_resource type="Texture2D" uid="uid://dgdootc5bny5q" path="res://assets/菜单UI/QQ群.webp" id="4_eghpk"]
|
||||
[ext_resource type="Script" uid="uid://kj7v1uxk2i6h" path="res://GUI/GameUpdatePanel.gd" id="4_fys16"]
|
||||
[ext_resource type="Texture2D" uid="uid://ccav04woielxa" path="res://assets/菜单UI/柚小青装饰品.webp" id="5_6jmhb"]
|
||||
[ext_resource type="Texture2D" uid="uid://be4fa6qo525y1" path="res://assets/菜单UI/灵创招新群.png" id="5_m77al"]
|
||||
[ext_resource type="Script" uid="uid://ciwjx67wjubdy" path="res://GUI/CheckUpdatePanel.gd" id="9_6jmhb"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_eghpk"]
|
||||
border_width_left = 10
|
||||
border_width_top = 10
|
||||
border_width_right = 10
|
||||
border_width_bottom = 10
|
||||
corner_radius_top_left = 20
|
||||
corner_radius_top_right = 20
|
||||
corner_radius_bottom_right = 20
|
||||
corner_radius_bottom_left = 20
|
||||
corner_detail = 20
|
||||
shadow_size = 20
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_6jmhb"]
|
||||
border_width_left = 10
|
||||
border_width_top = 10
|
||||
border_width_right = 10
|
||||
border_width_bottom = 10
|
||||
corner_radius_top_left = 20
|
||||
corner_radius_top_right = 20
|
||||
corner_radius_bottom_right = 20
|
||||
corner_radius_bottom_left = 20
|
||||
corner_detail = 20
|
||||
shadow_size = 20
|
||||
|
||||
[node name="MainMenuPanel" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_right = -2.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_wpehy")
|
||||
|
||||
[node name="Background" type="TextureRect" parent="."]
|
||||
self_modulate = Color(1, 1, 1, 0.34902)
|
||||
layout_mode = 0
|
||||
offset_left = -131.0
|
||||
offset_top = -24.0
|
||||
offset_right = 1568.0
|
||||
offset_bottom = 734.0
|
||||
texture = ExtResource("2_eghpk")
|
||||
|
||||
[node name="GUI" type="Control" parent="."]
|
||||
anchors_preset = 0
|
||||
offset_right = 40.0
|
||||
offset_bottom = 40.0
|
||||
|
||||
[node name="GameLogo" type="TextureRect" parent="GUI"]
|
||||
layout_mode = 0
|
||||
offset_left = 450.0
|
||||
offset_top = -24.0
|
||||
offset_right = 1730.0
|
||||
offset_bottom = 696.0
|
||||
scale = Vector2(0.4, 0.4)
|
||||
texture = ExtResource("3_eghpk")
|
||||
stretch_mode = 2
|
||||
|
||||
[node name="RichTextLabel" type="RichTextLabel" parent="GUI"]
|
||||
visible = false
|
||||
layout_mode = 0
|
||||
offset_right = 1398.0
|
||||
offset_bottom = 88.0
|
||||
theme_override_font_sizes/normal_font_size = 40
|
||||
bbcode_enabled = true
|
||||
text = "萌芽农场"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="GameVersionLabel" type="Label" parent="GUI"]
|
||||
layout_mode = 0
|
||||
offset_top = 676.0
|
||||
offset_right = 188.0
|
||||
offset_bottom = 718.0
|
||||
theme_override_font_sizes/font_size = 30
|
||||
text = "版本号:v1.0"
|
||||
|
||||
[node name="GameVersionLabel2" type="Label" parent="GUI"]
|
||||
layout_mode = 0
|
||||
offset_left = 575.0
|
||||
offset_top = 676.0
|
||||
offset_right = 875.0
|
||||
offset_bottom = 718.0
|
||||
theme_override_font_sizes/font_size = 30
|
||||
text = "学习项目"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="Developer" type="RichTextLabel" parent="GUI"]
|
||||
layout_mode = 0
|
||||
offset_left = 1194.0
|
||||
offset_top = 676.0
|
||||
offset_right = 1398.0
|
||||
offset_bottom = 718.0
|
||||
theme_override_font_sizes/normal_font_size = 30
|
||||
bbcode_enabled = true
|
||||
text = "[rainbow freq=1 sat=2 val=100]By-树萌芽[/rainbow]"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="AddGroupLabel" type="Label" parent="GUI"]
|
||||
visible = false
|
||||
self_modulate = Color(1, 1, 0, 1)
|
||||
layout_mode = 0
|
||||
offset_left = 896.0
|
||||
offset_top = 205.0
|
||||
offset_right = 1226.0
|
||||
offset_bottom = 247.0
|
||||
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 = 0
|
||||
theme_override_font_sizes/font_size = 30
|
||||
text = "加群获取最新开发动态!"
|
||||
|
||||
[node name="QQGroupImage" type="TextureRect" parent="GUI/AddGroupLabel"]
|
||||
visible = false
|
||||
layout_mode = 0
|
||||
offset_left = 17.0
|
||||
offset_top = 43.0
|
||||
offset_right = 952.0
|
||||
offset_bottom = 1229.0
|
||||
scale = Vector2(0.3, 0.3)
|
||||
texture = ExtResource("4_eghpk")
|
||||
|
||||
[node name="QQGroupImage2" type="TextureRect" parent="GUI/AddGroupLabel"]
|
||||
visible = false
|
||||
layout_mode = 0
|
||||
offset_left = -832.0
|
||||
offset_right = 103.0
|
||||
offset_bottom = 1186.0
|
||||
scale = Vector2(0.3, 0.3)
|
||||
texture = ExtResource("5_m77al")
|
||||
|
||||
[node name="YouXiaoQing" type="TextureRect" parent="GUI/AddGroupLabel"]
|
||||
visible = false
|
||||
layout_mode = 0
|
||||
offset_left = 298.0
|
||||
offset_top = 82.0
|
||||
offset_right = 1233.0
|
||||
offset_bottom = 1268.0
|
||||
scale = Vector2(0.14, 0.14)
|
||||
texture = ExtResource("5_6jmhb")
|
||||
|
||||
[node name="RichTextLabel" type="RichTextLabel" parent="GUI/AddGroupLabel"]
|
||||
visible = false
|
||||
self_modulate = Color(0.580392, 1, 0, 1)
|
||||
layout_mode = 0
|
||||
offset_left = -896.0
|
||||
offset_top = -47.0
|
||||
offset_right = -420.0
|
||||
offset_bottom = -7.0
|
||||
theme_override_colors/font_shadow_color = Color(0, 0, 0, 1)
|
||||
theme_override_constants/outline_size = 15
|
||||
theme_override_constants/shadow_offset_y = 0
|
||||
theme_override_constants/shadow_offset_x = 0
|
||||
theme_override_constants/shadow_outline_size = 0
|
||||
theme_override_font_sizes/bold_italics_font_size = 0
|
||||
theme_override_font_sizes/italics_font_size = 0
|
||||
theme_override_font_sizes/mono_font_size = 0
|
||||
theme_override_font_sizes/normal_font_size = 30
|
||||
theme_override_font_sizes/bold_font_size = 0
|
||||
bbcode_enabled = true
|
||||
text = "欢迎了解灵创新媒实验室"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="VBox" type="VBoxContainer" parent="."]
|
||||
layout_mode = 0
|
||||
offset_top = 248.0
|
||||
offset_right = 1398.0
|
||||
offset_bottom = 720.0
|
||||
|
||||
[node name="StartGameButton" type="Button" parent="VBox"]
|
||||
custom_minimum_size = Vector2(168, 63)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
theme_override_font_sizes/font_size = 40
|
||||
text = "开始游戏"
|
||||
|
||||
[node name="GameSettingButton" type="Button" parent="VBox"]
|
||||
visible = false
|
||||
custom_minimum_size = Vector2(168, 63)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
theme_override_font_sizes/font_size = 40
|
||||
text = "设置"
|
||||
|
||||
[node name="GameUpdateButton" type="Button" parent="VBox"]
|
||||
custom_minimum_size = Vector2(168, 63)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
theme_override_font_sizes/font_size = 40
|
||||
text = "更新"
|
||||
|
||||
[node name="GameAboutButton" type="Button" parent="VBox"]
|
||||
custom_minimum_size = Vector2(168, 63)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
theme_override_font_sizes/font_size = 40
|
||||
text = "关于"
|
||||
|
||||
[node name="ExitButton" type="Button" parent="VBox"]
|
||||
custom_minimum_size = Vector2(168, 63)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
theme_override_font_sizes/font_size = 40
|
||||
text = "退出游戏"
|
||||
|
||||
[node name="GameAboutPanel" type="Panel" parent="."]
|
||||
visible = false
|
||||
layout_mode = 0
|
||||
offset_left = 138.0
|
||||
offset_top = 80.0
|
||||
offset_right = 1536.0
|
||||
offset_bottom = 800.0
|
||||
scale = Vector2(0.8, 0.8)
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_eghpk")
|
||||
script = ExtResource("3_y0inj")
|
||||
|
||||
[node name="Title" type="Label" parent="GameAboutPanel"]
|
||||
layout_mode = 0
|
||||
offset_right = 1398.0
|
||||
offset_bottom = 80.0
|
||||
theme_override_colors/font_color = Color(0.780392, 1, 0.905882, 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 = 5
|
||||
theme_override_constants/shadow_offset_y = 5
|
||||
theme_override_constants/outline_size = 20
|
||||
theme_override_constants/shadow_outline_size = 20
|
||||
theme_override_font_sizes/font_size = 45
|
||||
text = "关于"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="QuitButton" type="Button" parent="GameAboutPanel"]
|
||||
custom_minimum_size = Vector2(60, 60)
|
||||
layout_mode = 0
|
||||
offset_left = 1305.0
|
||||
offset_top = 17.5
|
||||
offset_right = 1380.0
|
||||
offset_bottom = 97.5
|
||||
theme_override_font_sizes/font_size = 35
|
||||
text = "X"
|
||||
|
||||
[node name="Scroll" type="ScrollContainer" parent="GameAboutPanel"]
|
||||
layout_mode = 0
|
||||
offset_left = 15.0
|
||||
offset_top = 80.0
|
||||
offset_right = 3428.0
|
||||
offset_bottom = 1636.0
|
||||
scale = Vector2(0.4, 0.4)
|
||||
|
||||
[node name="Contents" type="RichTextLabel" parent="GameAboutPanel/Scroll"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
theme_override_colors/font_outline_color = Color(0, 0, 0, 1)
|
||||
theme_override_colors/font_shadow_color = Color(0, 0, 0, 1)
|
||||
theme_override_constants/outline_size = 30
|
||||
theme_override_constants/shadow_outline_size = 10
|
||||
theme_override_font_sizes/normal_font_size = 70
|
||||
bbcode_enabled = true
|
||||
text = "玩法介绍:
|
||||
1.版本要匹配,服务器版本一直在更新,请及时下载最新版客户端,否者无法登录游戏
|
||||
2.游戏目前适配Windows和安卓平台,未来也会适配Linux桌面版,IOS应该会有吧...?
|
||||
3.电脑Windows平台按住wsad或者方向键可以移动视角,鼠标滚轮可以缩放视角;安卓则为拖动和双指缩放
|
||||
3.注册账号一定一定要用QQ号,目前游戏的所有登录服务都是围绕着腾讯QQ来验证,注册时会向您输入的QQ号对应的QQ邮箱发送一封注册邮件。
|
||||
4.不要一上来就把钱用完了(比如某某人一上来就十连抽),可以去偷别人的菜
|
||||
5.玩家排行榜有一些特殊农场,可以直接搜索访问: 杂交农场(666) 花卉农场(520) 稻香(111) 小麦谷(222) 访问有惊喜
|
||||
6.全服大喇叭也有一些小彩蛋
|
||||
7.记得在小卖部向其他玩家出售你不需要的东西
|
||||
8.玩家太多无法找到你的好友的农场?试试直接搜索QQ号
|
||||
9.如果有条件尽量还是玩电脑版吧,毕竟电脑版优化是最好的,手机版或多或少有些问题(
|
||||
|
||||
致谢名单:
|
||||
程序牛马:(作物处理+抠图)
|
||||
虚空领主:(美术+抠图)
|
||||
豆包:(万能的美术)
|
||||
ChatGPT:(超级美术)"
|
||||
|
||||
[node name="GameUpdatePanel" type="Panel" parent="."]
|
||||
visible = false
|
||||
layout_mode = 0
|
||||
offset_left = 138.0
|
||||
offset_top = 80.0
|
||||
offset_right = 1536.0
|
||||
offset_bottom = 800.0
|
||||
scale = Vector2(0.8, 0.8)
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_6jmhb")
|
||||
script = ExtResource("4_fys16")
|
||||
|
||||
[node name="Scroll" type="ScrollContainer" parent="GameUpdatePanel"]
|
||||
layout_mode = 0
|
||||
offset_left = 15.0
|
||||
offset_top = 80.0
|
||||
offset_right = 1384.0
|
||||
offset_bottom = 705.0
|
||||
|
||||
[node name="Contents" type="RichTextLabel" parent="GameUpdatePanel/Scroll"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
bbcode_enabled = true
|
||||
|
||||
[node name="Title" type="Label" parent="GameUpdatePanel"]
|
||||
layout_mode = 0
|
||||
offset_right = 1398.0
|
||||
offset_bottom = 80.0
|
||||
theme_override_font_sizes/font_size = 45
|
||||
text = "游戏更新"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="QuitButton" type="Button" parent="GameUpdatePanel"]
|
||||
custom_minimum_size = Vector2(60, 60)
|
||||
layout_mode = 0
|
||||
offset_left = 1320.0
|
||||
offset_top = 17.5
|
||||
offset_right = 1380.0
|
||||
offset_bottom = 77.5
|
||||
theme_override_font_sizes/font_size = 35
|
||||
text = "X"
|
||||
|
||||
[node name="RefreshButton" type="Button" parent="GameUpdatePanel"]
|
||||
custom_minimum_size = Vector2(60, 60)
|
||||
layout_mode = 0
|
||||
offset_left = 15.0
|
||||
offset_top = 17.5
|
||||
offset_right = 93.0
|
||||
offset_bottom = 77.5
|
||||
theme_override_font_sizes/font_size = 35
|
||||
text = "刷新"
|
||||
|
||||
[node name="CheckUpdatePanel" type="Panel" parent="."]
|
||||
visible = false
|
||||
layout_mode = 0
|
||||
offset_left = 260.0
|
||||
offset_top = 53.0
|
||||
offset_right = 1150.0
|
||||
offset_bottom = 596.0
|
||||
script = ExtResource("9_6jmhb")
|
||||
|
||||
[node name="Title" type="Label" parent="CheckUpdatePanel"]
|
||||
layout_mode = 0
|
||||
offset_right = 890.0
|
||||
offset_bottom = 89.0
|
||||
theme_override_colors/font_color = Color(0, 1, 0, 1)
|
||||
theme_override_font_sizes/font_size = 40
|
||||
text = "检测到新版本!"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="DownloadButton" type="Button" parent="CheckUpdatePanel"]
|
||||
layout_mode = 0
|
||||
offset_top = 480.0
|
||||
offset_right = 890.0
|
||||
offset_bottom = 543.0
|
||||
theme_override_font_sizes/font_size = 40
|
||||
text = "下载新版本"
|
||||
|
||||
[node name="Contents" type="Label" parent="CheckUpdatePanel"]
|
||||
layout_mode = 0
|
||||
offset_top = 133.0
|
||||
offset_right = 890.0
|
||||
offset_bottom = 480.0
|
||||
theme_override_font_sizes/font_size = 30
|
||||
text = "服务端一直在更新,使用旧版本客户端无法与最新版服务端兼容,
|
||||
请及时下载最新版,点击下方链接跳转到浏览器下载最新版,
|
||||
或者加入QQ群在群文件中下载最新开发版"
|
||||
|
||||
[connection signal="pressed" from="VBox/StartGameButton" to="." method="_on_start_game_button_pressed"]
|
||||
[connection signal="pressed" from="VBox/GameSettingButton" to="." method="_on_game_setting_button_pressed"]
|
||||
[connection signal="pressed" from="VBox/GameUpdateButton" to="." method="_on_game_update_button_pressed"]
|
||||
[connection signal="pressed" from="VBox/GameAboutButton" to="." method="_on_game_about_button_pressed"]
|
||||
[connection signal="pressed" from="VBox/ExitButton" to="." method="_on_exit_button_pressed"]
|
||||
[connection signal="pressed" from="GameAboutPanel/QuitButton" to="GameAboutPanel" method="_on_quit_button_pressed"]
|
||||
[connection signal="pressed" from="GameUpdatePanel/QuitButton" to="GameUpdatePanel" method="_on_quit_button_pressed"]
|
||||
[connection signal="pressed" from="CheckUpdatePanel/DownloadButton" to="CheckUpdatePanel" method="_on_download_button_pressed"]
|
||||
87
SproutFarm-Frontend/GUI/PlayerRankingItem.tscn
Normal file
87
SproutFarm-Frontend/GUI/PlayerRankingItem.tscn
Normal file
@@ -0,0 +1,87 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://crd28qnymob7"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://dsln1w1aqgf1k" path="res://assets/游戏UI/玩家默认头像.webp" id="1_sgoxp"]
|
||||
[ext_resource type="Script" uid="uid://0d2j5m6j2ema" path="res://Components/HTTPTextureRect.gd" id="2_ky0k8"]
|
||||
|
||||
[node name="PlayerRankingItem" type="VBoxContainer"]
|
||||
offset_right = 1152.0
|
||||
offset_bottom = 82.0
|
||||
|
||||
[node name="HBox" type="HBoxContainer" parent="."]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="SerialNumber" type="Label" parent="HBox"]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 30
|
||||
text = "1."
|
||||
|
||||
[node name="PlayerAvatar" type="TextureRect" parent="HBox"]
|
||||
layout_mode = 2
|
||||
texture = ExtResource("1_sgoxp")
|
||||
expand_mode = 3
|
||||
script = ExtResource("2_ky0k8")
|
||||
metadata/_custom_type_script = "uid://0d2j5m6j2ema"
|
||||
|
||||
[node name="PlayerName" type="Label" parent="HBox"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
theme_override_font_sizes/font_size = 30
|
||||
text = "树萌芽"
|
||||
|
||||
[node name="PlayerMoney" type="Label" parent="HBox"]
|
||||
modulate = Color(1, 1, 0, 1)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
theme_override_font_sizes/font_size = 30
|
||||
text = "钱币:999"
|
||||
|
||||
[node name="SeedNum" type="Label" parent="HBox"]
|
||||
modulate = Color(0, 1, 0, 1)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
theme_override_font_sizes/font_size = 30
|
||||
text = "种子数:999"
|
||||
|
||||
[node name="PlayerLevel" type="Label" parent="HBox"]
|
||||
modulate = Color(0, 1, 1, 1)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
theme_override_font_sizes/font_size = 30
|
||||
text = "等级:999"
|
||||
|
||||
[node name="VisitButton" type="Button" parent="HBox"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
theme_override_font_sizes/font_size = 30
|
||||
text = "访问"
|
||||
|
||||
[node name="HBox2" type="HBoxContainer" parent="."]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="LastLoginTime" type="Label" parent="HBox2"]
|
||||
modulate = Color(0.811765, 1, 0.811765, 1)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
theme_override_font_sizes/font_size = 20
|
||||
text = "最后在线:2025年12时09分35秒"
|
||||
|
||||
[node name="OnlineTime" type="Label" parent="HBox2"]
|
||||
modulate = Color(0.784314, 0.733333, 0.521569, 1)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
theme_override_font_sizes/font_size = 20
|
||||
text = "累计在线时长:99时60分60秒"
|
||||
|
||||
[node name="IsOnlineTime" type="Label" parent="HBox2"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
theme_override_font_sizes/font_size = 20
|
||||
text = "正在检测中..."
|
||||
|
||||
[node name="LikeNum" type="Label" parent="HBox2"]
|
||||
modulate = Color(1, 0.611765, 1, 1)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
theme_override_font_sizes/font_size = 20
|
||||
text = "点赞数:999"
|
||||
Reference in New Issue
Block a user