Toaster

interface Toaster : Variable

用于在界面上显示 Toast 提示信息的工具接口。

该接口继承自 Variable,通常在脚本中作为全局对象 toaster 存在。 它允许脚本在 UI 界面上弹出简短的浮层消息,用于通知用户或进行调试。 所有显示操作都会自动切换到主线程执行。

Author

M8Test, [email protected], https://m8test.com

Functions

Link copied to clipboard
abstract fun getGlobalName(): String

获取作为全局变量时的名称.

Link copied to clipboard
abstract fun getPublicType(): Type

获取 Variable 注入到脚本时需要显示的类型.

Link copied to clipboard
abstract fun isPrefixRequired(): Boolean

是否需要添加前缀, 每种编程语言添加的前缀不一样, 前缀可以通过 Language.getVariablePrefix 获取.

Link copied to clipboard
abstract fun isSuffixRequired(): Boolean

是否需要添加后缀, 每种编程语言添加的后缀不一样, 后缀可以通过 Language.getVariableSuffix 获取.

Link copied to clipboard
abstract fun showLong(coroutineScope: CoroutineScope, text: String): Deferred<Unit>

显示较长时间的 Toast 消息。

Link copied to clipboard
abstract fun showShort(coroutineScope: CoroutineScope, text: String): Deferred<Unit>

显示较短时间的 Toast 消息。