SusInteractPrompt

单条交互提示——按键徽标 + 文本;点击 / 键盘触发 OnInteract。
包
SusGame · HUD(商业)
属性
| 名称 | 类型 | 默认值 | |
|---|---|---|---|
Key | Prop<string> | "E" | |
Text | Prop<string> | "Interact" | |
Visible | Prop<bool> | true | |
BindAction | Prop<string> | (string)null |
插槽
没有插槽。
事件
| 名称 | 字段 | 载荷 |
|---|---|---|
Interact | OnInteract | — |
样式钩子
USS 类契约 — 无需改 C# 即可覆盖外观。状态通过这些类切换:
sus-interact-promptsus-interact-prompt__keysus-interact-prompt__textsus-interact-prompt--hidden
用法
csharp
var prompt = new SusInteractPrompt();
prompt.Key.Value = "E";
prompt.Text.Value = "Open door";
prompt.Visible.Value = true;
prompt.OnInteract += () => { /* use / open */ };xml
<template>
<sus:SusInteractPrompt :Key="Key.Value"
:Text="Label.Value"
:Visible="Show.Value"
@interact="OnInteract" />
</template>
<script>
public Prop<string> Key = new("E");
public Prop<string> Label = new("Open door");
public Prop<bool> Show = new(true);
void OnInteract() { /* … */ }
</script>| Prop / API | Role |
|---|---|
Key | 徽标文本(默认 E) |
Text | 操作文本(渲染为 — {Text}) |
Visible | 切换 --hidden(display: none) |
OnInteract | 点击或键盘激活 |
备注
- 可见时键盘处理器接受
E/ Space / Enter(徽标Key只是显示;激活按键在组件内固定)。 - 通过
SetPrompts/AddPrompt在 SusPromptBar 中承载多条提示。