Files
mtgodot-poc/project/ui/love_ui.gd
T
shenleiandClaude Code 8092ff44e2 装备校验链/快捷栏/公会/好友情侣/交易仓库五项差距修复(增量 129)
- 装备校验:can_equip 按 CanEquipNow→FindEquipCell→EquipItem 精确重排,
  新增 find_equip_cell() 1:1 复刻(RING/UNIQUE 占用翻转、COSTUME/BELT/DS),
  帝国 antiflag 降级为 tooltip 提示,LIMIT_PCBANG/REAL_TIME* 语义与倒计时文案
- 快捷栏:死亡全槽禁用+激活守卫、变身(affect 220)技能置灰、
  物品槽失配置灰(服务器回收/换武器后刷新)
- 公会:GUILD_AUTH_* 权限位门控踢人/公告/技能升级,/gskillup、
  被宣战应答弹窗(/war·/nowar)、资金存取行(40250 服务端已禁用仍保留 1:1)
- 好友/情侣:messenger 三固定组(好友/公会/情侣),lover_login/logout/
  near/far/divorce 命令事件→在线/在身边状态与离婚隐藏
- 交易/仓库:ExchangeState.last_notice(ALREADY/LESS_GOLD)结束浮层提示;
  仓库改密 /safebox_change_password 三段输入;关窗补 /safebox_close·/mall_close;
  仓库金钱经核实 40250 无 wire 协议,UI 定界只读
- app_flow:重连时 guild_marks_ready 重复连接加 is_connected 守卫
- 相机 look_at 零向量守卫(首帧/传送落点)
- 测试:equip/love/guild 断言更新,79 项中 78 绿(game_camera_test 为
  HEAD 既有失败);真服冒烟 LIVE_SMOKE PASS(192.168.21.203 全链路)
- docs/CLIENT-GAP.md 同步增量 129

Co-Authored-By: Claude Code <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018kUFvQGYusuY3dkfGitmAe
2026-09-07 21:43:30 +09:00

75 lines
2.4 KiB
GDScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# LoveUI — GC_LOVER_INFO / GC_LOVE_POINT_UPDATE 的常驻情侣状态。
extends Node
var client: Node
var _root: Panel
var _name: Label
var _bar: ProgressBar
var _mobile_mode := false
func setup(m2client: Node, parent: Node) -> void:
client = m2client
_build(parent)
if client.has_signal("lover_changed"):
client.lover_changed.connect(func(_lover: Dictionary): refresh())
refresh()
func refresh() -> void:
if client == null or not client.has_method("get_lover"):
return
var lover: Dictionary = client.get_lover()
var valid := bool(lover.get("valid", false))
# lover_divorceCHAT_TYPE_COMMAND)→ store 清空 LoverInfo → valid=false 自动隐藏。
_root.visible = valid and not _mobile_mode
if not valid:
return
# 上/下线与靠近/远离由服务器 lover_login/logout/near/far 命令驱动
#marriage.cpp;原版 affectShower 只在“靠近”时亮心形)。
var online := bool(lover.get("online", false))
var near := bool(lover.get("near", false))
var state := "(在身边)" if near else "(在线)" if online else "(离线)"
_name.text = "♥ " + String(lover.get("name", "")) + state
_name.modulate = Color(1.0, 0.6, 0.72) if near else Color(1.0, 0.72, 0.82)
_bar.value = clampi(int(lover.get("love_point", 0)), 0, 100)
_bar.tooltip_text = "爱意值:%d%%" % int(_bar.value)
func get_mobile_window() -> Control:
return _root
func set_mobile_mode(enabled: bool) -> void:
_mobile_mode = enabled
if enabled and _root:
_root.visible = false
func toggle() -> void:
if _root:
var valid := false
if client and client.has_method("get_lover"):
valid = bool(client.get_lover().get("valid", false))
_root.visible = valid and not _root.visible
func _build(parent: Node) -> void:
_root = Panel.new()
_root.name = "LoveStatus"
_root.set_anchors_preset(Control.PRESET_TOP_RIGHT)
_root.position = Vector2(-238, 28)
_root.size = Vector2(220, 48)
var bg := StyleBoxFlat.new()
bg.bg_color = Color(0.14, 0.05, 0.10, 0.88)
bg.border_color = Color(0.95, 0.35, 0.55, 0.9)
bg.set_border_width_all(1)
bg.set_corner_radius_all(5)
_root.add_theme_stylebox_override("panel", bg)
parent.add_child(_root)
_name = Label.new()
_name.position = Vector2(9, 5)
_name.add_theme_font_size_override("font_size", 13)
_name.modulate = Color(1.0, 0.72, 0.82)
_root.add_child(_name)
_bar = ProgressBar.new()
_bar.position = Vector2(9, 27)
_bar.size = Vector2(202, 13)
_bar.max_value = 100
_bar.show_percentage = false
_root.add_child(_bar)