普特莫斯维基 (Purtmars Wikipedia 📖)

“Chemdah 开发者文档:自定义对话主题”的版本间的差异

来自Purtmars Wikipedia —— 普特莫斯维基
(建立内容为“{{:Chemdah 开发者文档目录}} = 对话主题 = 注册自定义对话主题需要分别实现 Theme 与 ThemeSettings 类,在本章文档中我们会从零…”的新页面)
 
第1行: 第1行:
 
{{:Chemdah 开发者文档目录}}
 
{{:Chemdah 开发者文档目录}}
 
= 对话主题 =
 
= 对话主题 =
注册自定义对话主题需要分别实现 Theme 与 ThemeSettings 类,在本章文档中我们会从零开始注册一个简单的聊天框对话主题。
+
注册自定义对话主题需要分别实现 Theme 与 ThemeSettings 类,在本章文档中我们会从零开始注册一个简单的聊天框对话主题。<br>
 +
 
 +
'''ink.ptms.chemdah.core.conversation.theme.Theme'''
 +
<syntaxhighlight lang="kotlin" line="line">
 +
/**
 +
* 注册到 ChemdahAPI 中
 +
*/
 +
fun register(name)
 +
 
 +
/**
 +
* 当配置文件被重载
 +
*/
 +
open fun reloadConfig()
 +
 
 +
/**
 +
* 是否支持告别
 +
* 即结束对话时使用 talk 语句创建没有回复的对话信息
 +
* 在原版 chat 对话模式中支持告别,而 chest 不支持(会被转换为 Holographic 信息)
 +
*/
 +
open fun allowFarewell()
 +
 
 +
/**
 +
* 重置会话时(即 begin 之前)
 +
* 在原版 chat 对话模式中用于归位玩家所选择的回复序号,而 chest 中没有使用
 +
*/
 +
open fun reset(session: Session): CompletableFuture<Void>
 +
 
 +
/**
 +
* 会话开始之前,在原版 chat 对话模式中用于播放音效特效等
 +
* 使用时必须返回 super.begin(session)
 +
*/
 +
open fun begin(session: Session): CompletableFuture<Void>
 +
 
 +
/**
 +
* 会话结束时,目前未被使用
 +
*/
 +
open fun end(session: Session): CompletableFuture<Void>
 +
 
 +
/**
 +
* 会话渲染时
 +
* @param canReply 是否可以回复
 +
*/
 +
abstract fun npcTalk(session: Session, message: List<String>, canReply: Boolean = true): CompletableFuture<Void>
 +
</syntaxhighlight>
 +
 
 +
= 实现 =
 +
 
 
<syntaxhighlight lang="kotlin" line="line">
 
<syntaxhighlight lang="kotlin" line="line">
 
class ThemeDemo : Theme<ThemeDemoSettings>() {
 
class ThemeDemo : Theme<ThemeDemoSettings>() {

2021年5月5日 (三) 23:34的版本

目录

对话主题

注册自定义对话主题需要分别实现 Theme 与 ThemeSettings 类,在本章文档中我们会从零开始注册一个简单的聊天框对话主题。

ink.ptms.chemdah.core.conversation.theme.Theme

/**
 * 注册到 ChemdahAPI 中
 */
fun register(name)

/**
 * 当配置文件被重载
 */
open fun reloadConfig()

/**
 * 是否支持告别
 * 即结束对话时使用 talk 语句创建没有回复的对话信息
 * 在原版 chat 对话模式中支持告别,而 chest 不支持(会被转换为 Holographic 信息)
 */
open fun allowFarewell()

/**
 * 重置会话时(即 begin 之前)
 * 在原版 chat 对话模式中用于归位玩家所选择的回复序号,而 chest 中没有使用
 */
open fun reset(session: Session): CompletableFuture

/**
 * 会话开始之前,在原版 chat 对话模式中用于播放音效特效等
 * 使用时必须返回 super.begin(session)
 */
open fun begin(session: Session): CompletableFuture

/**
 * 会话结束时,目前未被使用
 */
open fun end(session: Session): CompletableFuture

/**
 * 会话渲染时
 * @param canReply 是否可以回复
 */
abstract fun npcTalk(session: Session, message: List, canReply: Boolean = true): CompletableFuture

实现

class ThemeDemo : Theme() {

    override fun npcTalk(session: Session, message: List, canReply: Boolean): CompletableFuture {
        TODO("Not yet implemented")
    }
}

class ThemeDemoSettings(root: ConfigurationSection) : ThemeSettings(root) {

}