Files
mtgodot-poc/project/ui/quest_log.gd
T
shenandClaude Sonnet 5 47baf6c0c6 Metin2 game client (P0–P11) + mobile asset pipeline
Networked client on the existing Godot 4.7 + libgr2 renderer:
- net: m2dev wire protocol (libsodium KX + XChaCha20), auth/select/game
  phases, EntityStore world model, ~all GC/CG headers. char create/delete,
  private shop / mall / cube, SHOP_GC_START_EX, guild, party (+ CG_PARTY_SET_STATE),
  quests, dragon soul, refine, safebox, exchange.
- UI: in-game windows migrated 1:1 from the reference uiscript/root .py —
  char status (/stat), inventory+equipment, select-item ([SELECT_ITEM] quest
  token), system-option + game-option + ESC system menu, private-shop 39-grid,
  party info board, shop tabs, atlas, minimap, quickbar, chat, …
- EterGrnLib polish: GR2 material blend/two-sided, LOD crossfade, motion-event
  dispatch, contact shadow, ray-AABB picking, weapon grip pre-transform.

Portable asset IO (A1) — all extension/libgr2/formats/mtproto reads routed
through godot::FileAccess (res:// PCK works on iOS/Android); standalone-lib
*_path() kept for the non-Godot CTests. AssetResolver + PropertyRegistry
switched to a baked index (bake_asset_index.gd) instead of std::filesystem.

Mobile builds: build-{android,ios}.sh, export-android.sh, pack-assets.sh,
gen-debug-keystore.sh. Assets ship as a zip mounted at runtime by
project/asset_pack.gd (adb push now; HTTP download is a drop-in later).

ctest 10/10, 34 GDScript suites, macOS/iOS/Android all build.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013EJxkHiNKS4kybHS3XKyAJ
2026-08-31 20:02:12 +09:00

91 lines
2.7 KiB
GDScript

# QuestLog (P7) —— 任务日志窗:GC_QUEST_INFO 的条目列表。
#
# var ql := preload("res://ui/quest_log.gd").new()
# add_child(ql)
# ql.setup(m2client, canvas_parent)
# ql.toggle() # J 键
#
# 每条: 图标(占位) + 标题 + counter「名: 值」 + clock「名: 值」。
# `quest_info` 信号来时刷新。空标题的条目视为「已完成 / 移除」。
extends Node
var client: Node
var _root: Control
var _list: VBoxContainer
func setup(m2client: Node, parent: Node) -> void:
client = m2client
_build(parent)
if client.has_signal("quest_info"):
client.quest_info.connect(func(_i): refresh())
func is_open() -> bool:
return _root != null and _root.visible
func toggle() -> void:
_root.visible = not _root.visible
if _root.visible:
refresh()
func refresh() -> void:
if not is_open() or client == null:
return
for c in _list.get_children():
c.queue_free()
var quests: Array = client.get_quests()
if quests.is_empty():
var e := Label.new()
e.text = "(无进行中的任务)"
e.add_theme_font_size_override("font_size", 12)
_list.add_child(e)
return
for q in quests:
if String(q.get("title", "")).strip_edges() == "":
continue
var box := VBoxContainer.new()
box.add_theme_constant_override("separation", 1)
var t := Label.new()
t.text = "◆ " + String(q.get("title", ""))
t.add_theme_font_size_override("font_size", 13)
box.add_child(t)
var cn := String(q.get("counter_name", ""))
if cn != "":
var cl := Label.new()
cl.text = " %s: %d" % [cn, int(q.get("counter_value", 0))]
cl.add_theme_font_size_override("font_size", 11)
cl.modulate = Color(0.8, 0.85, 0.7)
box.add_child(cl)
var kn := String(q.get("clock_name", ""))
if kn != "":
var kl := Label.new()
kl.text = " %s: %d" % [kn, int(q.get("clock_value", 0))]
kl.add_theme_font_size_override("font_size", 11)
kl.modulate = Color(0.7, 0.8, 0.9)
box.add_child(kl)
_list.add_child(box)
func _build(parent: Node) -> void:
_root = Control.new()
_root.set_anchors_preset(Control.PRESET_TOP_RIGHT)
_root.position = Vector2(-320, 60)
_root.size = Vector2(300, 360)
_root.visible = false
_root.set_meta("is_titlebar", true)
parent.add_child(_root)
var panel := Panel.new()
panel.set_anchors_preset(Control.PRESET_FULL_RECT)
var sb := StyleBoxFlat.new()
sb.bg_color = Color(0.07, 0.08, 0.1, 0.95)
sb.set_corner_radius_all(4)
panel.add_theme_stylebox_override("panel", sb)
_root.add_child(panel)
var title := Label.new()
title.text = "任务日志"
title.position = Vector2(12, 8)
_root.add_child(title)
_list = VBoxContainer.new()
_list.position = Vector2(12, 34)
_list.custom_minimum_size = Vector2(276, 0)
_list.add_theme_constant_override("separation", 8)
_root.add_child(_list)