Merge branch 'programming'

This commit is contained in:
Nadine Ganz 2026-05-22 15:50:24 +02:00
commit 526b0cbb9b
15 changed files with 1174 additions and 765 deletions

Binary file not shown.

View File

@ -180,9 +180,6 @@ Tree("05_Tutorial") {
BTC.SetVoiceName("it-IT-FabiolaNeural") BTC.SetVoiceName("it-IT-FabiolaNeural")
BTC.SynthesizeText("Cosa ti piace di più? Spaghetti, pizza o risotto?") BTC.SynthesizeText("Cosa ti piace di più? Spaghetti, pizza o risotto?")
BTC.SpeechOutputEnded() BTC.SpeechOutputEnded()
BTC.SetSpeechRecognitionLanguage("de-DE")
BTC.SetVoiceName("de-DE-SeraphinaMultilingualNeural")
BTC.Show("GO.HINTS.SpeakHint") BTC.Show("GO.HINTS.SpeakHint")
BTC.AddPossbileSpeechIntent("Zugabteil-Tutorial-U-15") BTC.AddPossbileSpeechIntent("Zugabteil-Tutorial-U-15")
@ -199,6 +196,8 @@ Tree("05_Tutorial") {
// -- Selector 1: Intent erkannt // -- Selector 1: Intent erkannt
Composite(Sequence) { Composite(Sequence) {
BTC.SpeechIntentRecognized() BTC.SpeechIntentRecognized()
BTC.SetSpeechRecognitionLanguage("de-DE")
BTC.SetVoiceName("de-DE-SeraphinaMultilingualNeural")
// Intent erkannt // Intent erkannt
Composite(Race) { Composite(Race) {
@ -239,6 +238,9 @@ Tree("05_Tutorial") {
BTC.Show("GO.HANDMENU.Option3Button") BTC.Show("GO.HANDMENU.Option3Button")
} }
BTC.SetSpeechRecognitionLanguage("de-DE")
BTC.SetVoiceName("de-DE-SeraphinaMultilingualNeural")
Composite(Race) { Composite(Race) {
Composite(Sequence) { Composite(Sequence) {
// Spaghetti // Spaghetti
@ -290,6 +292,8 @@ Tree("05_Tutorial") {
BTC.AbortSpeechEventListener() BTC.AbortSpeechEventListener()
BTC.StopSpeechIntentRecognition() BTC.StopSpeechIntentRecognition()
BTC.ClearPossbileSpeechIntents() BTC.ClearPossbileSpeechIntents()
BTC.SetSpeechRecognitionLanguage("de-DE")
BTC.SetVoiceName("de-DE-SeraphinaMultilingualNeural")
Composite(Sequence) { Composite(Sequence) {
Composite(Marathon) { Composite(Marathon) {

View File

@ -11,8 +11,19 @@
BTC.SetBool("error") BTC.SetBool("error")
} }
Composite(Sequence) { Composite(Selector) {
RunTree("26_Castello_Castelli_di_Bellinzona_Intro") Composite(Sequence) {
// Check KI Chat
BTC.CheckEntryLevel(2)
BTC.SetBool("InitOffeneFragen")
BTC.Run("MediaPlayer.VIDEOS.CastelliBotoffeneF_FIdle02")
BTC.ResetEntryLevel(2)
RunTree("26_Castello_Castelli_di_Bellinzona_Castelli_Bot_offene_Fragen")
}
Composite(Sequence) {
RunTree("26_Castello_Castelli_di_Bellinzona_Intro")
}
} }
} }
@ -281,65 +292,7 @@ Tree("26_Castello_Castelli_di_Bellinzona_Intro") {
} }
} }
// --- Castelli di Bellinzona - Outro --- RunTree("26_Castello_Castelli_di_Bellinzona_Outro")
Composite(Marathon) {
BTC.Hide("GO.HINTS.SpeechErrorHint")
BTC.Hide("MediaPlayer.VIDEOS.ChatbotBurgenFidle_12")
BTC.Hide("MediaPlayer.VIDEOS.CastelliBotoffeneF_FIdle02")
BTC.Hide("MediaPlayer.VIDEOS.CastelliBotoffeneF_FIdle04")
BTC.Hide("MediaPlayer.VIDEOS.CastelliBotInterak_FIdle02")
}
BTC.Run("MediaPlayer.VIDEOS.OutroF1")
BTC.Run("MediaPlayer.VIDEOS.OutroFidle2")
BTC.AddPossbileSpeechIntent("Castelli_di_Bellinzona-Outro-U-2a")
BTC.StartSpeechIntentRecognition()
BTC.Show("GO.HINTS.SpeakHint")
Composite(Race) {
// -- Race 1: User sagt etwas
Composite(Sequence) {
BTC.UserStartedSpeechInput()
BTC.Hide("GO.HINTS.SpeakHint")
Composite(Selector) {
// -- Selector 1: Intent erkannt
Composite(Sequence) {
BTC.SpeechIntentRecognized()
BTC.ClearPossbileSpeechIntents()
}
// -- Selector 2: Intent nicht erkannt
Composite(Sequence) {
BTC.ClearPossbileSpeechIntents()
}
}
}
// -- Race 2: User sagt nichts
Composite(Sequence) {
BTC.Wait(5)
BTC.CompareUserSpeechInputStarted(false)
BTC.AbortSpeechEventListener()
BTC.StopSpeechIntentRecognition()
BTC.ClearPossbileSpeechIntents()
BTC.Hide("GO.HINTS.SpeakHint")
}
}
BTC.Hide("MediaPlayer.VIDEOS.OutroFidle2")
Composite(Marathon) {
BTC.Run("MediaPlayer.VIDEOS.OutroF3")
Composite(Sequence) {
BTC.Wait(2.5)
BTC.FadeOut("FadeScene.XRInteractionHandsSetup.Black")
}
}
BTC.SetStoryAVisited()
BTC.Run("LoadScene.NEXT.10SBB")
} }
} }
@ -636,6 +589,7 @@ Tree("26_Castello_Castelli_di_Bellinzona_Chatbot_Burgen_Entscheidung_Offene_Frag
BTC.CompareIntentID("Castelli_di_Bellinzona-Chatbot_Burgen-U-12b") BTC.CompareIntentID("Castelli_di_Bellinzona-Chatbot_Burgen-U-12b")
BTC.ClearPossbileSpeechIntents() BTC.ClearPossbileSpeechIntents()
// Go to Outro // Go to Outro
RunTree("26_Castello_Castelli_di_Bellinzona_Outro")
} }
} }
} }
@ -671,6 +625,7 @@ Tree("26_Castello_Castelli_di_Bellinzona_Chatbot_Burgen_Entscheidung_Offene_Frag
BTC.Hide("GO.GO.Option2Button") BTC.Hide("GO.GO.Option2Button")
BTC.Hide("GO.GO.SpeechOptions") BTC.Hide("GO.GO.SpeechOptions")
// Go To Outro // Go To Outro
RunTree("26_Castello_Castelli_di_Bellinzona_Outro")
} }
} }
} }
@ -708,6 +663,7 @@ Tree("26_Castello_Castelli_di_Bellinzona_Castelli_Bot_offene_Fragen") {
BTC.Show("GO.Canvaspanoramatafelslideshow.SlideshowChatbot") BTC.Show("GO.Canvaspanoramatafelslideshow.SlideshowChatbot")
} }
BTC.Show("GO.HINTS.StandUpHint") BTC.Show("GO.HINTS.StandUpHint")
BTC.Hide("MediaPlayer.VIDEOS.CastelliBotoffeneF_FIdle02")
} }
Composite(Marathon) { Composite(Marathon) {
@ -748,6 +704,7 @@ Tree("26_Castello_Castelli_di_Bellinzona_Castelli_Bot_offene_Fragen") {
BTC.Wait(10) BTC.Wait(10)
BTC.CompareBool("UserStartetBot", false) BTC.CompareBool("UserStartetBot", false)
BTC.AbortEventListener("NamedPokeEvent.INTERACTABLES.ChatbotButton") BTC.AbortEventListener("NamedPokeEvent.INTERACTABLES.ChatbotButton")
RunTree("26_Castello_Castelli_di_Bellinzona_Outro")
} }
} }
} }
@ -770,5 +727,71 @@ Tree("26_Castello_Castelli_di_Bellinzona_Castelli_Bot_Interaktion") {
BTC.ChatbotConversationEnded() BTC.ChatbotConversationEnded()
BTC.SpeechOutputEnded() BTC.SpeechOutputEnded()
BTC.Run("Timeline.TIMELINES.TimelineCastelloCh_atbot_End") BTC.Run("Timeline.TIMELINES.TimelineCastelloCh_atbot_End")
RunTree("26_Castello_Castelli_di_Bellinzona_Outro")
}
}
Tree("26_Castello_Castelli_di_Bellinzona_Outro") {
// --- Castelli di Bellinzona - Outro ---
Composite(Sequence) {
Composite(Marathon) {
BTC.Hide("GO.HINTS.SpeechErrorHint")
BTC.Hide("MediaPlayer.VIDEOS.ChatbotBurgenFidle_12")
BTC.Hide("MediaPlayer.VIDEOS.CastelliBotoffeneF_FIdle02")
BTC.Hide("MediaPlayer.VIDEOS.CastelliBotoffeneF_FIdle04")
BTC.Hide("MediaPlayer.VIDEOS.CastelliBotInterak_FIdle02")
}
BTC.Run("MediaPlayer.VIDEOS.OutroF1")
BTC.Run("MediaPlayer.VIDEOS.OutroFidle2")
BTC.AddPossbileSpeechIntent("Castelli_di_Bellinzona-Outro-U-2a")
BTC.StartSpeechIntentRecognition()
BTC.Show("GO.HINTS.SpeakHint")
Composite(Race) {
// -- Race 1: User sagt etwas
Composite(Sequence) {
BTC.UserStartedSpeechInput()
BTC.Hide("GO.HINTS.SpeakHint")
Composite(Selector) {
// -- Selector 1: Intent erkannt
Composite(Sequence) {
BTC.SpeechIntentRecognized()
BTC.ClearPossbileSpeechIntents()
}
// -- Selector 2: Intent nicht erkannt
Composite(Sequence) {
BTC.ClearPossbileSpeechIntents()
}
}
}
// -- Race 2: User sagt nichts
Composite(Sequence) {
BTC.Wait(5)
BTC.CompareUserSpeechInputStarted(false)
BTC.AbortSpeechEventListener()
BTC.StopSpeechIntentRecognition()
BTC.ClearPossbileSpeechIntents()
BTC.Hide("GO.HINTS.SpeakHint")
}
}
BTC.Hide("MediaPlayer.VIDEOS.OutroFidle2")
Composite(Marathon) {
BTC.Run("MediaPlayer.VIDEOS.OutroF3")
Composite(Sequence) {
BTC.Wait(2.5)
BTC.FadeOut("FadeScene.XRInteractionHandsSetup.Black")
}
}
BTC.SetStoryAVisited()
BTC.Run("LoadScene.NEXT.10SBB")
} }
} }

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 8f4c1440ae5ec414dbc7d3a5c54dda6b
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1035,7 +1035,7 @@ public class BTC : MonoBehaviour {
string languageCode = "it-IT"; string languageCode = "it-IT";
string instructions = "Rispondi sempre in italiano. Rispondi in lingua colloquiale al livelli di competenza A2 di quadro comune europeo di riferimento per la conoscenza delle lingue."; string instructions = "Rispondi sempre in italiano. Rispondi in lingua colloquiale al livelli di competenza A2 di quadro comune europeo di riferimento per la conoscenza delle lingue.";
string context = "Sei un essere onnisciente che risponde esclusivamente a domande sulla cultura e la storia del Cantone Ticino e dei Castelli di Bellinzona. Parla <Ciao, cosa vuoi sapere? Sono unintelligenza artificiale>. Rispondi sempre nel modo più conciso possibile. Suddividi le domande in passaggi più piccoli e sviluppale. Chiedi se hanno capito tutto. La conversazione ha inizio."; string context = "Sei un essere onnisciente che risponde esclusivamente a domande sulla cultura e la storia del Cantone Ticino e dei Castelli di Bellinzona. Parla <Ciao, cosa vuoi sapere? Sono unintelligenza artificiale>. Rispondi sempre nel modo più conciso possibile. Suddividi le domande in passaggi più piccoli e sviluppale. Chiedi se hanno capito tutto. La conversazione ha inizio.";
int maxRoundTrips = 5; int maxRoundTrips = 10;
float maxSilenceBeforeTimeOut = 10; float maxSilenceBeforeTimeOut = 10;
string outroText = $"Grazie mille, la conversazione è finita."; string outroText = $"Grazie mille, la conversazione è finita.";

View File

@ -1 +1 @@
2025-08-04T16:03:18.8396148Z 2026-05-21T15:25:17.3240080Z

File diff suppressed because it is too large Load Diff

View File

@ -7,6 +7,7 @@ public static class EntryLevel
/* Entry Levels: /* Entry Levels:
* 0: Minigame SBB * 0: Minigame SBB
* 1: Minigame Grotto * 1: Minigame Grotto
* 1: KI-Chat Castello
*/ */
public static bool[] entries = new bool[2]; public static bool[] entries = new bool[3];
} }

View File

@ -48,6 +48,12 @@ public class LevelManager : MonoBehaviour
// This method is called when a button is clicked, and loads the given scene by name // This method is called when a button is clicked, and loads the given scene by name
public void OnClickLoadLevel(string sceneName) public void OnClickLoadLevel(string sceneName)
{ {
if (sceneName == "2.6-Castello-KI")
{
EntryLevel.entries[2] = true;
sceneName = "2.6-Castello";
}
StartCoroutine(LoadAsyncScene(sceneName)); StartCoroutine(LoadAsyncScene(sceneName));
} }

View File

@ -0,0 +1,8 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public static class SessionGUID
{
public static string identifier;
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6b63e9ca65aed434fbdb188cd20d61da
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -252,6 +252,7 @@ public class IntentRecognitionService : MonoBehaviour
IntentRecogntionTrackingItem newIntentRecogntionTrackingItem = new IntentRecogntionTrackingItem() IntentRecogntionTrackingItem newIntentRecogntionTrackingItem = new IntentRecogntionTrackingItem()
{ {
SessionID = vaim.SessionUID,
UserInput = pendingRequestDataModel.InputText, UserInput = pendingRequestDataModel.InputText,
Intent = reply Intent = reply
}; };

View File

@ -144,7 +144,10 @@ public class SpeechRecognitionService : MonoBehaviour
void OnEnable() void OnEnable()
{ {
this.initialize(this.initialRecognitionLanguageCode); if (this.speechConfig == null)
{
this.initialize(this.initialRecognitionLanguageCode);
}
} }
void Update() void Update()
@ -286,7 +289,7 @@ public class SpeechRecognitionService : MonoBehaviour
this.speechConfig.SpeechRecognitionLanguage = languageCode; this.speechConfig.SpeechRecognitionLanguage = languageCode;
string micName = (Microphone.devices != null && Microphone.devices.Length > 0) ? Microphone.devices[0] : "<none>"; string micName = (Microphone.devices != null && Microphone.devices.Length > 0) ? Microphone.devices[0] : "<none>";
this.logIfInDebugMode($"SpeechRecognitionService initialized using microphone: {micName}"); this.logIfInDebugMode($"SpeechRecognitionService initialized using microphone: {micName} and languageCode {languageCode}");
this.SpeechRecognitionState = ESpeechRecognitionState.Ready; this.SpeechRecognitionState = ESpeechRecognitionState.Ready;
} }

View File

@ -4,6 +4,7 @@ using UnityEngine;
public class IntentRecogntionTrackingItem public class IntentRecogntionTrackingItem
{ {
public string SessionID;
public string UserInput; public string UserInput;
public string Intent; public string Intent;
} }

View File

@ -66,6 +66,8 @@ public class ViaggioAIManager : MonoBehaviour
#endregion #endregion
public string SessionUID { get; private set; }
#region ViaggioAIState #region ViaggioAIState
private EViaggioAIState _viaggioAIState = EViaggioAIState.Idle; private EViaggioAIState _viaggioAIState = EViaggioAIState.Idle;
@ -111,6 +113,19 @@ public class ViaggioAIManager : MonoBehaviour
return; return;
} }
Instance = this; Instance = this;
// Check if SessionGUID is already set, if not generate a new one
if (string.IsNullOrEmpty(SessionGUID.identifier))
{
SessionGUID.identifier = System.Guid.NewGuid().ToString();
this.LogIfInDebugMode($"Session UID generated: {SessionGUID.identifier}");
}
else
{
this.LogIfInDebugMode($"Session UID already exists: {SessionGUID.identifier}");
}
this.SessionUID = SessionGUID.identifier;
} }
void OnEnable() void OnEnable()
@ -144,6 +159,7 @@ public class ViaggioAIManager : MonoBehaviour
public void SetSpeechRecognitionLanguage(string languageCode) public void SetSpeechRecognitionLanguage(string languageCode)
{ {
this.LogIfInDebugMode($"ViaggioAIManager: Set speech language to {languageCode}");
this.SpeechRecognitionService.SetRecognitionLanguage(languageCode); this.SpeechRecognitionService.SetRecognitionLanguage(languageCode);
} }