79 lines
2.4 KiB
C#
Executable File
79 lines
2.4 KiB
C#
Executable File
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using Microsoft.CognitiveServices.Speech.Intent;
|
|
using UnityEngine;
|
|
|
|
public class AIServicesEvents : MonoBehaviour
|
|
{
|
|
public delegate void IntentRecognizedAction(IntentRecognitionResult intent);
|
|
public static event IntentRecognizedAction OnIntentRecognized;
|
|
public static void SendIntentRecognized(IntentRecognitionResult intent)
|
|
{
|
|
if (OnIntentRecognized != null)
|
|
OnIntentRecognized(intent);
|
|
}
|
|
|
|
public delegate void TextToAIAction(string textToSend);
|
|
public static event TextToAIAction OnTextToAI;
|
|
public static void SendTextToAI(string textToSend)
|
|
{
|
|
if (OnTextToAI != null)
|
|
OnTextToAI(textToSend);
|
|
}
|
|
|
|
public delegate void ReadTextAction(string text);
|
|
public static event ReadTextAction OnReadText;
|
|
public static void SendReadText(string text)
|
|
{
|
|
if (OnReadText != null)
|
|
OnReadText(text);
|
|
}
|
|
|
|
|
|
public delegate void StartReadAction();
|
|
public static event StartReadAction OnStartRead;
|
|
public static void SendStartRead()
|
|
{
|
|
if (OnStartRead != null)
|
|
OnStartRead();
|
|
}
|
|
|
|
public delegate void EndReadAction();
|
|
public static event EndReadAction OnEndRead;
|
|
public static void SendEndRead()
|
|
{
|
|
if (OnEndRead != null)
|
|
OnEndRead();
|
|
}
|
|
|
|
public delegate void AudioClipGeneratedAction(AudioClip clip);
|
|
public static event AudioClipGeneratedAction OnAudioClipGenerated;
|
|
public static void SendAudioClipGenerated(AudioClip clip)
|
|
{
|
|
if (OnAudioClipGenerated != null)
|
|
OnAudioClipGenerated(clip);
|
|
}
|
|
|
|
public delegate void SpeechEndedAction();
|
|
public static event SpeechEndedAction OnSpeechEnded;
|
|
public static void SendSpeechEnded()
|
|
{
|
|
if (OnSpeechEnded != null)
|
|
OnSpeechEnded();
|
|
}
|
|
|
|
public delegate void ToggleSpeechRecognitionAction(bool isOn);
|
|
public static event ToggleSpeechRecognitionAction OnToggleSpeechRecognition;
|
|
public static void SendToggleSpeechRecognition(bool isOn)
|
|
{
|
|
if (OnToggleSpeechRecognition != null)
|
|
OnToggleSpeechRecognition(isOn);
|
|
}
|
|
|
|
internal static void SendReadText(object welcomeText)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
}
|