對話動作已於 2023 年 6 月 13 日淘汰。詳情請參閱「
對話動作已淘汰」。
ConditionalEvent
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
YAML 表示法 |
condition: string
transitionToScene: string
handler:
object (EventHandler ) |
欄位 |
condition |
string
必要欄位。用來觸發這個事件的篩選條件。如果條件評估為 true,就會觸發相關聯的 handler 。支援下列變數參照:$session - 如要參照工作階段儲存空間中的資料。$user - 參照使用者儲存空間中的資料。支援下列布林運算子 (含範例):&& - session.params.counter > 0 && session.params.counter < 100 || - session.params.foo == "John" || session.params.counter == "Adam" ! - !(session.params.counter == 5) 支援下列比較:== 、!= 、< 、> 、<= 、>= 支援下列清單和字串運算子 (含範例):in - "西瓜紅"session.params.fruitList size 至 size(session.params.fruitList) > 2 substring 至session.params.fullName.contains("John")
|
transitionToScene |
string
選用設定。相關條件經評估為 true 時,對話應跳到的目的地場景。目前場景的狀態會在轉場時刪除。
|
handler |
object (EventHandler )
選用設定。將相關條件評估為 true 時觸發的事件處理常式。轉換至目的地場景之前應執行。適合用來產生回應事件的提示。
|
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2024-08-22 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2024-08-22 (世界標準時間)。"],[[["YAML is used to represent events that are triggered based on a true condition."],["Events can be triggered based on conditions using variables like `$session` and `$user`, boolean operators, and comparisons."],["Optionally, you can define a destination scene for the conversation to jump to when the condition is true."],["Event handlers can be defined to execute before transitioning to a new scene, allowing for the generation of prompts."]]],[]]