12. 实体手写便条与打印文档投递 (GiveHandnoteToPlayer)
本子系统封装了游戏原生的 PreBuiltItemHelper.CreateHandnote 与 CreatePaperWithText,允许 NPC 在剧情对话或结算时向玩家投递可收纳进背包、可随时点击展开阅读的实体手写便条或打印纸张(如 CyberpunkMercV 第 4 幕投递的《V 的加密便条》)。
四个核心 SDK 方法
| 方法签名 | 返回值 | 说明 |
|---|---|---|
CreateHandnoteItem(string title, string body, string signature, int fontIndex = 0) | GameItem | 创建一张带有标题、正文、手写署名与指定手写字体(fontIndex: 0..2)的便条物品实例。 |
CreatePaperNoteItem(string title, string body) | GameItem | 创建一张标准打印文档纸张物品实例。 |
SpawnItemOnCounterOrStore(GameItem item, bool isStolen = false, bool isContraband = false) | bool | 若当前柜台前有顾客,则将物品直接滑出到柜台桌面上;否则自动存入玩家店铺后仓网格(GraphUtils.EmporiumTryAdd)。 |
GiveHandnoteToPlayer(string title, string body, string signature, int fontIndex = 0) | bool | 一步完成手写便条创建与柜台/后仓投递。 |
代码示例:投递带全息电话号码的加密手写便条
csharp
NpcFrameworkSdk.GiveHandnoteToPlayer(
title: NpcFrameworkSdk.T("V 的加密便条", "V's Encrypted Note"),
body: NpcFrameworkSdk.T(
"铁子,大恩不言谢。帮我引开那帮企业特勤狗,算我欠你一条命。
我的私人全息通讯号是:2077077
以后店里缺硬货或者想出手大件,随时通过店内电话打给我。",
"Preem work covering for me against those corpo hounds, choom. I owe you my life.
My private holophone number is: 2077077
Whenever you need high-end loot or want to move big gear, ring me on the store phone."),
signature: "V (Vincent)",
fontIndex: 1
);