private void StartRecording() { if (_recordingRoutine == 0) { UnityObjectUtil.StartDestroyQueue(); _recordingRoutine = Runnable.Run(RecordingHandler()); } }
private void OnEnable() { UnityObjectUtil.StartDestroyQueue(); if (m_StatusText != null) { m_StatusText.text = "READY"; } }
public void StartRecording() { Debug.Log("StartRecording"); if (_recordingRoutine == 0) { UnityObjectUtil.StartDestroyQueue(); _recordingRoutine = Runnable.Run(RecordingHandler()); } }
// private void OnGetToken(AuthenticationToken authenticationToken, string customData) // { // _authenticationToken = authenticationToken; // Log.Debug("SpeechListener.OnGetToken()", "created: {0} | time to expiration: {1} minutes | token: {2}", _authenticationToken.Created, _authenticationToken.TimeUntilExpiration, _authenticationToken.Token); // } private void StartRecording() { Log.Debug("SpeechListener.StartRecording()", "called", new object[] {}); if (_recordingRoutine == 0) { UnityObjectUtil.StartDestroyQueue(); _recordingRoutine = Runnable.Run(RecordingHandler()); } }
public void StartRecording() { Invoke("StopRecording", 5.0f); if (_recordingRoutine == 0) { UnityObjectUtil.StartDestroyQueue(); _recordingRoutine = Runnable.Run(RecordingHandler()); } }
private void StartRecording() { //If there isn't a recording co-routine running if (m_RecordingRoutine == 0) { UnityObjectUtil.StartDestroyQueue(); m_RecordingRoutine = Runnable.Run(RecordingHandler()); } }
public void startstt() { Active = true; if (_recordingRoutine == 0) { UnityObjectUtil.StartDestroyQueue(); _recordingRoutine = Runnable.Run(RecordingHandler()); } }
/* * StartRecording() method * Start recording if not already started */ private void StartRecording() { // If not already recording if (recordingRoutine == 0) { UnityObjectUtil.StartDestroyQueue(); recordingRoutine = Runnable.Run(RecordingHandler()); } }
public void StartRecording() { if (_recordingRoutine == 0) { UnityObjectUtil.StartDestroyQueue(); _recordingRoutine = Runnable.Run(RecordingHandler()); onListening.Invoke(); } }
public void StartRecording() { _inBoop.Play(); IsRecording = true; if (_recordingRoutine == 0) { UnityObjectUtil.StartDestroyQueue(); _recordingRoutine = Runnable.Run(RecordingHandler()); } }
public void StartRecording() { // Active = true; if (m_RecordingRoutine == 0) { UnityObjectUtil.StartDestroyQueue(); m_RecordingRoutine = Runnable.Run(RecordingHandler2()); IAAPlayer.localPlayer.CmdSetWatsonRotateCube(netId, true); } }
public UITweener FindTweener() { UITweener twn = UnityObjectUtil.FindObject <UITweener>(); if (twn != null) { twn.method = UITweener.Method.EaseInOut; twn.style = UITweener.Style.Once; } return(twn); }
private void StartRecording() { temp.text = "Listening to you..."; if (m_RecordingRoutine == 0) { UnityObjectUtil.StartDestroyQueue(); m_RecordingRoutine = Runnable.Run(RecordingHandler()); } showUtterance = false; Debug.Log("Set showUtterance to false in start recording"); }
/// <summary> /// publicに変えました /// </summary> public void StartRecording() { LogSystem.InstallDefaultReactors(); Runnable.Run(CreateService()); if (_recordingRoutine == 0) { UnityObjectUtil.StartDestroyQueue(); _recordingRoutine = Runnable.Run(RecordingHandler()); } }
private void StopRecording() { if (m_RecordingRoutine != 0) { Microphone.End(m_MicrophoneID); Runnable.Stop(m_RecordingRoutine); m_RecordingRoutine = 0; m_ActivateOutput.SendData(new BooleanData(false)); if (m_StatusText != null) { m_StatusText.text = "STOPPED"; } if (micIsRecording != null) { micIsRecording(false); } if (m_PlaybackRecording && m_Playback.Count > 0) { AudioClip combined = AudioClipUtil.Combine(m_Playback.ToArray()); if (combined != null) { AudioSource source = GetComponentInChildren <AudioSource>(); if (source != null) { // destroy any previous audio clip.. if (source.clip != null) { UnityObjectUtil.DestroyUnityObject(source.clip); } source.spatialBlend = 0.0f; // 2D sound source.loop = false; // do not loop source.clip = combined; // clip source.Play(); } else { Log.Warning("MicrophoneWidget", "Failed to find AudioSource."); } } foreach (var clip in m_Playback) { UnityObjectUtil.DestroyUnityObject(clip); } m_Playback.Clear(); } } }
private void StartRecording() { //temp.text += " Called start recording "; if (m_RecordingRoutine == 0) { //temp.text += " Recording Routine len is 0 - calling recording handler "; UnityObjectUtil.StartDestroyQueue(); m_RecordingRoutine = Runnable.Run(RecordingHandler()); } showUtterance = true; //temp.text += "outside if"; Debug.Log("Set showUtterance to false in start recording"); }
private void StartRecording() { if (m_RecordingRoutine == 0) { UnityObjectUtil.StartDestroyQueue(); m_RecordingRoutine = Runnable.Run(RecordingHandler()); m_ActivateOutput.SendData(new BooleanData(true)); if (m_StatusText != null) { m_StatusText.text = "RECORDING"; } } }
public void StartRecording(AiGlobals.ActionLang lang) { // https://cloud.ibm.com/docs/speech-to-text?topic=speech-to-text-models lastTranscription = "no transcription"; switch (lang) { case AiGlobals.ActionLang.enUS: _recognizeModel = "en-US_BroadbandModel"; break; case AiGlobals.ActionLang.enGB: _recognizeModel = "en-GB_BroadbandModel"; break; case AiGlobals.ActionLang.deDE: _recognizeModel = "de-DE_BroadbandModel"; break; case AiGlobals.ActionLang.esES: _recognizeModel = "es-ES_BroadbandModel"; break; case AiGlobals.ActionLang.frFR: _recognizeModel = "fr-FR_BroadbandModel"; break; case AiGlobals.ActionLang.zhCN: _recognizeModel = "zh-CN_BroadbandModel"; break; case AiGlobals.ActionLang.koKR: _recognizeModel = "ko-KR_BroadbandModel"; break; default: _recognizeModel = "en-US_BroadbandModel"; break; } Active = true; if (_recordingRoutine == 0) { UnityObjectUtil.StartDestroyQueue(); _recordingRoutine = Runnable.Run(RecordingHandler()); } }
// ui loops public virtual void playUIMusicLoop() { if (!GameConfigs.isUIRunning) { return; } foreach (GameDataSound sound in GetSounds(GameDataActionKeys.music_ui_loop)) { bool handled = false; foreach (GameObjectAudio objectAudio in UnityObjectUtil.FindObjects <GameObjectAudio>()) { if (objectAudio.type == GameDataActionKeys.music_ui_loop) { lastUILoop = currentUILoop; currentUILoop = objectAudio.gameObject; handled = true; } } if (!handled) { lastUILoop = currentUILoop; currentUILoop = AudioSystem.Instance.PrepareFromResources( sound.type, sound.code, true, 0f); } break; } if (currentUILoop != null) { currentUILoop.GetComponent <AudioSource>().FadeIn( (float)GameProfiles.Current.GetAudioMusicVolume(), 1.7f); } }
private void DestroyMesh() { UnityObjectUtil.Destroy(ref _mesh); }
/** **/ using UnityEngine; using System.Collections; using IBM.Watson.DeveloperCloud.Logging; using IBM.Watson.DeveloperCloud.Services.SpeechToText.v1; using IBM.Watson.DeveloperCloud.Utilities; using IBM.Watson.DeveloperCloud.DataTypes; using System.Collections.Generic; using UnityEngine.UI; using IBM.Watson.DeveloperCloud.Services.TextToSpeech.v1; using IBM.Watson.DeveloperCloud.Connection; using System; public class ExampleStreaming : MonoBehaviour { // STT - BURNER CREDS - DELETE AFTER RECORDING private string _username_STT = ""; private string _password_STT = ""; private string _url_STT = "https://stream.watsonplatform.net/speech-to-text/api"; public Text ResultsField; private int _recordingRoutine = 0; private string _microphoneID = null; private AudioClip _recording = null; private int _recordingBufferSize = 1; private int _recordingHZ = 22050; private SpeechToText _speechToText; // TEXT TO SPEECH - BURNER CREDENTIALS FOR PUBLIC DEMO I WILL DELETE AFTER RECORDING private string _username_TTS = ""; private string _password_TTS = ""; private string _url_TTS = "https://stream.watsonplatform.net/text-to-speech/api"; TextToSpeech _textToSpeech; //string _testString = "<speak version=\"1.0\"><say-as interpret-as=\"letters\">I'm sorry</say-as>. <prosody pitch=\"150Hz\">This is Text to Speech!</prosody><express-as type=\"GoodNews\">I'm sorry. This is Text to Speech!</express-as></speak>"; /// TEST STRINGS OK // Pitch Shifting //string _testString = "<speak version=\"1.0\"><prosody pitch=\"150Hz\">This is Text to Speech!</prosody></speak>"; //string _testString = "<speak version=\"1.0\"><prosody pitch=\"250Hz\">This is Text to Speech!</prosody></speak>"; //string _testString = "<speak version=\"1.0\"><prosody pitch=\"350Hz\">This is Text to Speech!</prosody></speak>"; //string _testString = "<speak version=\"1.0\"><prosody pitch=\"350Hz\">hi</prosody></speak>"; // Good news and sorrow and uncertainty - ref https://console.bluemix.net/docs/services/text-to-speech/SSML-expressive.html#expressive // <express-as type="GoodNews">This is Text to Speech!</express-as> string _testString = "<speak version=\"1.0\"><express-as type=\"GoodNews\">Hello! Good News! Text to Speech is Working!</express-as></speak>"; //string _testString = "<speak version=\"1.0\"><express-as type=\"Apology\">I am terribly sorry for the quality of service you have received.</express-as></speak>"; //string _testString = "<speak version=\"1.0\"><express-as type=\"Uncertainty\">Can you please explain it again? I am not sure I understand.</express-as></speak>"; //string _testString = "<speak version=\"1.0\"><prosody pitch=\\\"350Hz\\\"><express-as type=\"Uncertainty\">Can you please explain it again? I am confused and I'm not sure I understand.</express-as></prosody></speak>"; string _createdCustomizationId; CustomVoiceUpdate _customVoiceUpdate; string _customizationName = "unity-example-customization"; string _customizationLanguage = "en-US"; string _customizationDescription = "A text to speech voice customization created within Unity."; string _testWord = "Watson"; private bool _synthesizeTested = false; private bool _getVoicesTested = false; private bool _getVoiceTested = false; private bool _getPronuciationTested = false; private bool _getCustomizationsTested = false; private bool _createCustomizationTested = false; private bool _deleteCustomizationTested = false; private bool _getCustomizationTested = false; private bool _updateCustomizationTested = false; private bool _getCustomizationWordsTested = false; private bool _addCustomizationWordsTested = false; private bool _deleteCustomizationWordTested = false; private bool _getCustomizationWordTested = false; void Start() { LogSystem.InstallDefaultReactors(); // Create credential and instantiate service Credentials credentials_STT = new Credentials(_username_STT, _password_STT, _url_STT); Credentials credentials_TTS = new Credentials(_username_TTS, _password_TTS, _url_TTS); _speechToText = new SpeechToText(credentials_STT); _textToSpeech = new TextToSpeech(credentials_TTS); Active = true; StartRecording(); Runnable.Run(Examples()); } public bool Active { get { return _speechToText.IsListening; } set { if (value && !_speechToText.IsListening) { _speechToText.DetectSilence = true; _speechToText.EnableWordConfidence = true; _speechToText.EnableTimestamps = true; _speechToText.SilenceThreshold = 0.01f; _speechToText.MaxAlternatives = 0; _speechToText.EnableInterimResults = true; _speechToText.OnError = OnError; _speechToText.InactivityTimeout = -1; _speechToText.ProfanityFilter = false; _speechToText.SmartFormatting = true; _speechToText.SpeakerLabels = false; _speechToText.WordAlternativesThreshold = null; _speechToText.StartListening(OnRecognize, OnRecognizeSpeaker); } else if (!value && _speechToText.IsListening) { _speechToText.StopListening(); } } } private void StartRecording() { if (_recordingRoutine == 0) { UnityObjectUtil.StartDestroyQueue(); _recordingRoutine = Runnable.Run(RecordingHandler()); } } private void StopRecording() { if (_recordingRoutine != 0) { Microphone.End(_microphoneID); Runnable.Stop(_recordingRoutine); _recordingRoutine = 0; } } private void OnError(string error) { Active = false; Log.Debug("ExampleStreaming.OnError()", "Error! {0}", error); } private IEnumerator RecordingHandler() { Log.Debug("ExampleStreaming.RecordingHandler()", "devices: {0}", Microphone.devices); _recording = Microphone.Start(_microphoneID, true, _recordingBufferSize, _recordingHZ); yield return null; // let _recordingRoutine get set.. if (_recording == null) { StopRecording(); yield break; } bool bFirstBlock = true; int midPoint = _recording.samples / 2; float[] samples = null; while (_recordingRoutine != 0 && _recording != null) { int writePos = Microphone.GetPosition(_microphoneID); if (writePos > _recording.samples || !Microphone.IsRecording(_microphoneID)) { Log.Error("ExampleStreaming.RecordingHandler()", "Microphone disconnected."); StopRecording(); yield break; } if ((bFirstBlock && writePos >= midPoint) || (!bFirstBlock && writePos < midPoint)) { // front block is recorded, make a RecordClip and pass it onto our callback. samples = new float[midPoint]; _recording.GetData(samples, bFirstBlock ? 0 : midPoint); AudioData record = new AudioData(); record.MaxLevel = Mathf.Max(Mathf.Abs(Mathf.Min(samples)), Mathf.Max(samples)); record.Clip = AudioClip.Create("Recording", midPoint, _recording.channels, _recordingHZ, false); record.Clip.SetData(samples, 0); _speechToText.OnListen(record); bFirstBlock = !bFirstBlock; } else { // calculate the number of samples remaining until we ready for a block of audio, // and wait that amount of time it will take to record. int remaining = bFirstBlock ? (midPoint - writePos) : (_recording.samples - writePos); float timeRemaining = (float)remaining / (float)_recordingHZ; yield return new WaitForSeconds(timeRemaining); } } yield break; } private void OnRecognize(SpeechRecognitionEvent result,Dictionary<string, object> customData) { if (result != null && result.results.Length > 0) { foreach (var res in result.results) { foreach (var alt in res.alternatives) { string text = string.Format("{0} ({1}, {2:0.00})\n", alt.transcript, res.final ? "Final" : "Interim", alt.confidence); Log.Debug("ExampleStreaming.OnRecognize()", text); ResultsField.text = text; if (alt.transcript.Contains("inhabitants") && ResultsField.text.Contains("Final")) // needs to be final or ECHO happens { _testString = "<speak version=\"1.0\"><express-as type=\"GoodNews\">The original inhabitants of Gippsland, the Kurnai Aboriginal people, have lived in this region for 20,000 years. </express-as></speak>"; Runnable.Run(Examples()); } if (alt.transcript.Contains("immigration") && ResultsField.text.Contains("Final")) // needs to be final or ECHO happens { _testString = "<speak version=\"1.0\"><prosody pitch=\\\"350Hz\\\"><express-as type=\"GoodNews\">Oh The next big immigration wave was the selectors who moved in from 1875 onwards to set up small dairy farms all over Gippsland, but mainly in the Strzelecki ranges of west and south Gippsland</express-as></prosody></speak>"; Runnable.Run(Examples()); } // Cannot ECHO the trigger condition (or be ready for loop if (alt.transcript.Contains("happy") && ResultsField.text.Contains("Final")) // needs to be final or ECHO happens { _testString = "<speak version=\"1.0\"><prosody pitch=\\\"250Hz\\\"><express-as type=\"GoodNews\">It is so glad to hear that!</express-as></prosody></speak>"; Runnable.Run(Examples()); } // Cannot ECHO the trigger condition (or be ready for loop } if (res.keywords_result != null && res.keywords_result.keyword != null) { foreach (var keyword in res.keywords_result.keyword) { Log.Debug("ExampleStreaming.OnRecognize()", "keyword: {0}, confidence: {1}, start time: {2}, end time: {3}", keyword.normalized_text, keyword.confidence, keyword.start_time, keyword.end_time); } } if (res.word_alternatives != null) { foreach (var wordAlternative in res.word_alternatives) { Log.Debug("ExampleStreaming.OnRecognize()", "Word alternatives found. Start time: {0} | EndTime: {1}", wordAlternative.start_time, wordAlternative.end_time); foreach (var alternative in wordAlternative.alternatives) Log.Debug("ExampleStreaming.OnRecognize()", "\t word: {0} | confidence: {1}", alternative.word, alternative.confidence); } } } } } private void OnRecognizeSpeaker(SpeakerRecognitionEvent result,Dictionary<string, object> customData) { //throw new NotImplementedException(); if (result != null) { foreach (SpeakerLabelsResult labelResult in result.speaker_labels) { Log.Debug("ExampleStreaming.OnRecognize()", string.Format("speaker result: {0} | confidence: {3} | from: {1} | to: {2}", labelResult.speaker, labelResult.from, labelResult.to, labelResult.confidence)); } } } // TTS CODE private IEnumerator Examples() { // Synthesize Log.Debug("ExampleTextToSpeech.Examples()", "Attempting synthesize."); _textToSpeech.Voice = VoiceType.en_US_Allison; _textToSpeech.ToSpeech(HandleToSpeechCallback, OnFail, _testString, true); while (!_synthesizeTested) yield return null; // Get Voices Log.Debug("ExampleTextToSpeech.Examples()", "Attempting to get voices."); _textToSpeech.GetVoices(OnGetVoices, OnFail); while (!_getVoicesTested) yield return null; // Get Voice Log.Debug("ExampleTextToSpeech.Examples()", "Attempting to get voice {0}.", VoiceType.en_US_Allison); _textToSpeech.GetVoice(OnGetVoice, OnFail, VoiceType.en_US_Allison); while (!_getVoiceTested) yield return null; // Get Pronunciation Log.Debug("ExampleTextToSpeech.Examples()", "Attempting to get pronunciation of {0}", _testWord); _textToSpeech.GetPronunciation(OnGetPronunciation, OnFail, _testWord, VoiceType.en_US_Allison); while (!_getPronuciationTested) yield return null; // Get Customizations // Log.Debug("ExampleTextToSpeech.Examples()", "Attempting to get a list of customizations"); // _textToSpeech.GetCustomizations(OnGetCustomizations, OnFail); // while (!_getCustomizationsTested) // yield return null; // Create Customization // Log.Debug("ExampleTextToSpeech.Examples()", "Attempting to create a customization"); // _textToSpeech.CreateCustomization(OnCreateCustomization, OnFail, _customizationName, _customizationLanguage, _customizationDescription); // while (!_createCustomizationTested) // yield return null; // Get Customization // Log.Debug("ExampleTextToSpeech.Examples()", "Attempting to get a customization"); // if (!_textToSpeech.GetCustomization(OnGetCustomization, OnFail, _createdCustomizationId)) // Log.Debug("ExampleTextToSpeech.Examples()", "Failed to get custom voice model!"); // while (!_getCustomizationTested) // yield return null; // Update Customization // Log.Debug("ExampleTextToSpeech.Examples()", "Attempting to update a customization"); // Word[] wordsToUpdateCustomization = // { // new Word() // { // word = "hello", // translation = "hullo" // }, // new Word() // { // word = "goodbye", // translation = "gbye" // }, // new Word() // { // word = "hi", // translation = "ohioooo" // } // }; // _customVoiceUpdate = new CustomVoiceUpdate() // { // words = wordsToUpdateCustomization, // description = "My updated description", // name = "My updated name" // }; if (!_textToSpeech.UpdateCustomization(OnUpdateCustomization, OnFail, _createdCustomizationId, _customVoiceUpdate)) Log.Debug("ExampleTextToSpeech.Examples()", "Failed to update customization!"); while (!_updateCustomizationTested) yield return null; // Get Customization Words // Log.Debug("ExampleTextToSpeech.Examples()", "Attempting to get a customization's words"); // if (!_textToSpeech.GetCustomizationWords(OnGetCustomizationWords, OnFail, _createdCustomizationId)) // Log.Debug("ExampleTextToSpeech.GetCustomizationWords()", "Failed to get {0} words!", _createdCustomizationId); // while (!_getCustomizationWordsTested) // yield return null; // Add Customization Words // Log.Debug("ExampleTextToSpeech.Examples()", "Attempting to add words to a customization"); // Word[] wordArrayToAddToCustomization = // { // new Word() // { // word = "bananna", // translation = "arange" // }, // new Word() // { // word = "orange", // translation = "gbye" // }, // new Word() // { // word = "tomato", // translation = "tomahto" // } // }; // Words wordsToAddToCustomization = new Words() // { // words = wordArrayToAddToCustomization // }; // if (!_textToSpeech.AddCustomizationWords(OnAddCustomizationWords, OnFail, _createdCustomizationId, wordsToAddToCustomization)) // Log.Debug("ExampleTextToSpeech.AddCustomizationWords()", "Failed to add words to {0}!", _createdCustomizationId); // while (!_addCustomizationWordsTested) // yield return null; // Get Customization Word // Log.Debug("ExampleTextToSpeech.Examples()", "Attempting to get the translation of a custom voice model's word."); // string customIdentifierWord = wordsToUpdateCustomization[0].word; // if (!_textToSpeech.GetCustomizationWord(OnGetCustomizationWord, OnFail, _createdCustomizationId, customIdentifierWord)) // Log.Debug("ExampleTextToSpeech.GetCustomizationWord()", "Failed to get the translation of {0} from {1}!", customIdentifierWord, _createdCustomizationId); // while (!_getCustomizationWordTested) // yield return null; // Delete Customization Word Log.Debug("ExampleTextToSpeech.Examples()", "Attempting to delete customization word from custom voice model."); string wordToDelete = "goodbye"; if (!_textToSpeech.DeleteCustomizationWord(OnDeleteCustomizationWord, OnFail, _createdCustomizationId, wordToDelete)) Log.Debug("ExampleTextToSpeech.DeleteCustomizationWord()", "Failed to delete {0} from {1}!", wordToDelete, _createdCustomizationId); while (!_deleteCustomizationWordTested) yield return null; // Delete Customization Log.Debug("ExampleTextToSpeech.Examples()", "Attempting to delete a customization"); if (!_textToSpeech.DeleteCustomization(OnDeleteCustomization, OnFail, _createdCustomizationId)) Log.Debug("ExampleTextToSpeech.DeleteCustomization()", "Failed to delete custom voice model!"); while (!_deleteCustomizationTested) yield return null; Log.Debug("ExampleTextToSpeech.Examples()", "Text to Speech examples complete."); } void HandleToSpeechCallback(AudioClip clip, Dictionary<string, object> customData = null) { PlayClip(clip); } private void PlayClip(AudioClip clip) { if (Application.isPlaying && clip != null) { GameObject audioObject = new GameObject("AudioObject"); AudioSource source = audioObject.AddComponent<AudioSource>(); source.spatialBlend = 0.0f; source.loop = false; source.clip = clip; source.Play(); Destroy(audioObject, clip.length); _synthesizeTested = true; } } private void OnGetVoices(Voices voices, Dictionary<string, object> customData = null) { Log.Debug("ExampleTextToSpeech.OnGetVoices()", "Text to Speech - Get voices response: {0}", customData["json"].ToString()); _getVoicesTested = true; } private void OnGetVoice(Voice voice, Dictionary<string, object> customData = null) { Log.Debug("ExampleTextToSpeech.OnGetVoice()", "Text to Speech - Get voice response: {0}", customData["json"].ToString()); _getVoiceTested = true; } private void OnGetPronunciation(Pronunciation pronunciation, Dictionary<string, object> customData = null) { Log.Debug("ExampleTextToSpeech.OnGetPronunciation()", "Text to Speech - Get pronunciation response: {0}", customData["json"].ToString()); _getPronuciationTested = true; } // private void OnGetCustomizations(Customizations customizations, Dictionary<string, object> customData = null) // { // Log.Debug("ExampleTextToSpeech.OnGetCustomizations()", "Text to Speech - Get customizations response: {0}", customData["json"].ToString()); // _getCustomizationsTested = true; // } // private void OnCreateCustomization(CustomizationID customizationID, Dictionary<string, object> customData = null) // { // Log.Debug("ExampleTextToSpeech.OnCreateCustomization()", "Text to Speech - Create customization response: {0}", customData["json"].ToString()); // _createdCustomizationId = customizationID.customization_id; // _createCustomizationTested = true; // } private void OnDeleteCustomization(bool success, Dictionary<string, object> customData = null) { Log.Debug("ExampleTextToSpeech.OnDeleteCustomization()", "Text to Speech - Delete customization response: {0}", customData["json"].ToString()); _createdCustomizationId = null; _deleteCustomizationTested = true; } // private void OnGetCustomization(Customization customization, Dictionary<string, object> customData = null) // { // Log.Debug("ExampleTextToSpeech.OnGetCustomization()", "Text to Speech - Get customization response: {0}", customData["json"].ToString()); // _getCustomizationTested = true; // } private void OnUpdateCustomization(bool success, Dictionary<string, object> customData = null) { Log.Debug("ExampleTextToSpeech.OnUpdateCustomization()", "Text to Speech - Update customization response: {0}", customData["json"].ToString()); _updateCustomizationTested = true; } // private void OnGetCustomizationWords(Words words, Dictionary<string, object> customData = null) // { // Log.Debug("ExampleTextToSpeech.OnGetCustomizationWords()", "Text to Speech - Get customization words response: {0}", customData["json"].ToString()); // _getCustomizationWordsTested = true; // } private void OnAddCustomizationWords(bool success, Dictionary<string, object> customData = null) { Log.Debug("ExampleTextToSpeech.OnAddCustomizationWords()", "Text to Speech - Add customization words response: {0}", customData["json"].ToString()); _addCustomizationWordsTested = true; } private void OnDeleteCustomizationWord(bool success, Dictionary<string, object> customData = null) { Log.Debug("ExampleTextToSpeech.OnDeleteCustomizationWord()", "Text to Speech - Delete customization word response: {0}", customData["json"].ToString()); _deleteCustomizationWordTested = true; } private void OnGetCustomizationWord(Translation translation, Dictionary<string, object> customData = null) { Log.Debug("ExampleTextToSpeech.OnGetCustomizationWord()", "Text to Speech - Get customization word response: {0}", customData["json"].ToString()); _getCustomizationWordTested = true; } private void OnFail(RESTConnector.Error error, Dictionary<string, object> customData) { Log.Error("ExampleTextToSpeech.OnFail()", "Error received: {0}", error.ToString()); } }
// Use this for initialization void Start() { UnityObjectUtil.StartDestroyQueue(); }
IEnumerator LoadDataCo() { LogUtil.Log("Load GameLevels: LoadDataCo"); LogUtil.Log("Load GameLevels: LoadDataCo 2"); if (listGridRoot != null) { foreach (Transform item in listGridRoot.transform) { Destroy(item.gameObject); } LogUtil.Log("Load GameLevels: LoadDataCo 3"); List <GameLevel> levels = GameLevels.Instance.GetAll();//GetByWorldId("world-original"); LogUtil.Log("Load GameLevels: levels.Count: " + levels.Count); double panelCount = Math.Floor((double)(levels.Count / 20)); LogUtil.Log("Load GameLevels: panelCount: " + panelCount); for (int k = 0; k < (int)panelCount; k++) { GameObject itemSet = NGUITools.AddChild(listGridRoot, listItemSetPrefab); itemSet.name = "LevelSet" + k; UIGrid listSetGrid = itemSet.transform.Find("LevelContainer").GetComponent <UIGrid>(); GameObject listSetGridObject = listSetGrid.gameObject; for (int y = (k * 20); y < ((20) * (k + 1)); y++) { GameObject item = NGUITools.AddChild(listSetGridObject, listItemPrefab); item.name = "LevelItem" + y; item.transform.Find("LabelWorld").GetComponent <UILabel>().text = (y + 1).ToString(); //levels[y].name; item.transform.Find("ButtonPlayLevel").GetComponent <UIImageButton>().name = "ButtonPlayLevel$" + (k + 1).ToString() + "-" + (y + 1).ToString(); ///levels[y].name; // TODO find stars/skulls // TODO find play // TODO find lock } listSetGrid.Reposition(); } foreach (UIGrid grid in UnityObjectUtil.FindObjects <UIGrid>()) { //yield return new WaitForEndOfFrame(); grid.Reposition(); //yield return new WaitForEndOfFrame(); } yield return(new WaitForEndOfFrame()); listGridRoot.GetComponent <UIGrid>().Reposition(); yield return(new WaitForEndOfFrame()); } }