如何在问答游戏中用不同的语音重复问题

How To Repeat A Question in A Quiz Game With Different Speech

我正在尝试创建一个提问游戏,然后播放一个简短的音频文件。我想让用户能够再次播放音频文件,但没有语音。我该怎么做?

这是我提出问题并播放文件的更新:

action (UpdateGame) {
  description (Evaluate user's answer and updates the game state.)
  type (UpdateTransaction)
  collect {
    input (state) {
      type (State)
      min (Required) max (One)
    }

    input (fileToPlay) {
      description (Create the playlist to play)
      type (audioPlayer.AudioInfo)
      min (Optional) max (One)
      default-init {
        intent {
          goal: fileAudioInfo
        } 
      }
      hidden
    }

    computed-input (play) {
      description (Ask the client to play our sound.)
      type (audioPlayer.Result)
      compute {
        intent {
          goal: audioPlayer.PlayAudio
          value: $expr(fileToPlay)
        }
      }
      hidden
    }

    input (answer){
      type (Answer)
      min (Required) max (One)
      default-init {
        intent {
          goal: ChooseAnswer
        } 
      }
    }
  } 

  output (State)
}

我的 State 对象如下所示:

structure (State) {
  description (Holds the game state.)
  features {
    transaction
    transient
  }

  property (game) {
    type (Game)
    min (Required) max (One)
    visibility (Private)
  }

  property (currentQuestion) {
    type (Question)
    min (Required) max (One)
    visibility (Private)
  }

  property (restartQuestion){
    type (RestartQuestion)
    min (Required) max (Many)
    visibility (Private)
  }

  property (completed) {
    type (core.Boolean)
    min (Optional) max (One)
    visibility (Private)
  }

  property (change) {
    type (core.Boolean)
    min (Optional) max (One)
    visibility (Private)
  }

  property (say) {
    type (core.Text)
    min (Optional) max (One)
    description(Should the introductory be read or not?)
  }

  property (display) {
    type (core.Text)
    min (Required) max (One)
    description(Should the introductory be read or not?)
    visibility (Private)
  }
}

我有一个 ReplayAudio 操作,如下所示:

action (ReplayAudio) {
  description (__DESCRIPTION__)
  type (UpdateTransaction)
  collect {
    input (state) {
      type (State)
      min (Required) max (One)
      default-init {
        intent {
          goal: ReplayAudio
        } 
      }
      validate {
        replan{
          intent{
            goal: UpdateGame
            value: State {
              currentQuestion: $expr(state.currentQuestion)
              display: $expr(state.display)
              game: $expr(state.game)
              restartQuestion: $expr(state.restartQuestion)
            }
          }
        }
      }
    }
  }
  output (State)
}

所以我试图省略 say 字段。问题是,当我在 UpdateGame 中再次设置 say 字段时,它保持空白,我永远无法重置它。

为什么要删除 say 字段,导致它永远不会再次更新?

我认为您可以将 say 的值重新分配给 " "(只有 space 的空字符串),这相当于没有语音。