P24-02: 操作と通知の全受入
This commit is contained in:
@@ -158,8 +158,18 @@ func get_event_rows() -> Array[Dictionary]:
|
||||
var stream: Variant = _runtime.get("domain_events")
|
||||
if stream == null or not stream.has_method("recent_events"):
|
||||
return rows
|
||||
var seen_ids: Dictionary = {}
|
||||
for event: SimulationDomainEvent in stream.recent_events():
|
||||
rows.append(event.to_dictionary())
|
||||
var dict: Dictionary = event.to_dictionary()
|
||||
var eid: String = String(dict.get("event_id", ""))
|
||||
if not eid.is_empty():
|
||||
if seen_ids.has(eid):
|
||||
continue
|
||||
seen_ids[eid] = true
|
||||
rows.append(dict)
|
||||
# Bound to recent 256 entries in strict sequence
|
||||
if rows.size() > 256:
|
||||
rows = rows.slice(rows.size() - 256)
|
||||
return rows
|
||||
|
||||
|
||||
@@ -201,9 +211,12 @@ func _select_row(index: int) -> void:
|
||||
var row: Dictionary = _rows[index]
|
||||
_selected_event_id = String(row["event_id"])
|
||||
var presentation := get_event_presentation(row)
|
||||
_details.text = "%s\n%s\n対象(現在の名称):%s" % [
|
||||
var detail_text := "%s\n%s\n対象(現在の名称):%s" % [
|
||||
presentation[&"time"], presentation[&"title"], presentation[&"targets"],
|
||||
]
|
||||
if not String(presentation.get(&"extra", "")).is_empty():
|
||||
detail_text += "\n" + String(presentation[&"extra"])
|
||||
_details.text = detail_text
|
||||
_details.tooltip_text = presentation[&"supplement"]
|
||||
|
||||
|
||||
@@ -225,13 +238,30 @@ func get_event_presentation(row: Dictionary) -> Dictionary:
|
||||
names.append(resolved)
|
||||
if unknown_count > 0:
|
||||
names.append("名称を確認できない対象(%d件)" % unknown_count)
|
||||
|
||||
var title_text := String(EVENT_NAMES.get(StringName(row.get("event_type", "")), "未識別の記録"))
|
||||
var extras: Array[String] = []
|
||||
|
||||
# Check for amount / gold / cost
|
||||
var payload: Dictionary = row.get("payload", {}) if row.get("payload") is Dictionary else {}
|
||||
var amount_val: Variant = row.get("amount", payload.get("amount", row.get("gold", payload.get("gold", null))))
|
||||
if amount_val != null and (amount_val is int or amount_val is float) and int(amount_val) != 0:
|
||||
extras.append("金額:G%+d" % int(amount_val) if int(amount_val) < 0 else "金額:G%d" % int(amount_val))
|
||||
|
||||
# Check for reason
|
||||
var reason_val: Variant = row.get("reason", payload.get("reason", row.get("error", payload.get("error", ""))))
|
||||
if not String(reason_val).is_empty():
|
||||
extras.append("理由:%s" % String(reason_val))
|
||||
|
||||
return {
|
||||
&"title": String(EVENT_NAMES.get(StringName(row.get("event_type", "")), "未識別の記録")),
|
||||
&"title": title_text,
|
||||
&"time": _format_minute(int(row.get("absolute_minute", 0))),
|
||||
&"targets": "、".join(names) if not names.is_empty() else "対象の指定なし",
|
||||
&"supplement": "補足情報\n記録:%s\n種別:%s\n対象:%s\n発行元:%s" % [
|
||||
&"extra": " ".join(extras),
|
||||
&"supplement": "補足情報\n記録:%s\n種別:%s\n対象:%s\n発行元:%s%s" % [
|
||||
row.get("event_id", ""), row.get("event_type", ""),
|
||||
"、".join(raw_ids), row.get("source_service", ""),
|
||||
"\n" + "\n".join(extras) if not extras.is_empty() else "",
|
||||
],
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user