protected override void OnAssetDataLoaded(IntegratedAuthoringToolAsset asset) { textBoxScenarioName.Text = asset.ScenarioName; textBoxScenarioDescription.Text = asset.ScenarioDescription; _characterSources = new BindingListView <CharacterSourceDTO>(asset.GetAllCharacterSources().ToList()); _wmSource = asset.GetWorldModelSource(); dataGridViewCharacters.DataSource = _characterSources; _dialogs = new BindingListView <DialogueStateActionDTO>(new List <DialogueStateActionDTO>()); dataGridViewDialogueActions.DataSource = _dialogs; if (_wmSource != null) { if (_wmSource.Source != "") { pathTextBoxWorldModel.Text = _wmSource.Source; LoadWorldModelForm(); } } //ResetSimulator richTextBoxChat.Clear(); buttonContinue.Enabled = false; textBoxTick.Text = ""; RefreshDialogs(); }
/// <summary> /// Get CrewMember reply to player dialogue during a post-race event /// </summary> internal DialogueStateActionDTO SendPostRaceEvent(IntegratedAuthoringToolAsset iat, DialogueStateActionDTO selected, Team team, List <string> subjects) { if (selected == null) { return(null); } var nextState = selected.NextState; var dialogueOptions = iat.GetDialogueActionsByState(nextState).ToList(); //get dialogue if (dialogueOptions.Any()) { //select reply var selectedReply = dialogueOptions.OrderBy(o => Guid.NewGuid()).First(); PostRaceFeedback(selected.NextState, team, subjects); var styleSplit = selectedReply.Style.Split('_').Where(sp => !string.IsNullOrEmpty(sp)).ToList(); if (styleSplit.Any(s => s != WellFormedNames.Name.NIL_STRING)) { styleSplit.ForEach(s => PostRaceFeedback(s, team, subjects)); } return(selectedReply); } return(null); }
public MultiCharacterAgentController(SingleCharacterDemo.ScenarioData scenarioData, RolePlayCharacterAsset rpc, IntegratedAuthoringToolAsset iat, UnityBodyImplement archetype, Transform anchor, DialogController dialogCrt) { m_scenarioData = scenarioData; m_iat = iat; m_rpc = rpc; m_dialogController = dialogCrt; _body = GameObject.Instantiate(archetype); UnityEngine.Random.InitState((int)System.DateTime.Now.Ticks); var r = UnityEngine.Random.Range(0, 600); _body.GetComponentInChildren <Animator>().Play(0, -1, r); _body.tag = rpc.CharacterName.ToString(); just_talked = false; lastAction = null; var t = _body.transform; t.SetParent(anchor, false); t.localPosition = Vector3.zero; t.localRotation = Quaternion.identity; t.localScale = Vector3.one; HeadLookController head = _body.GetComponentInChildren <HeadLookController>(); head._target = GameObject.FindGameObjectWithTag("MainCamera"); m_dialogController.SetCharacterLabel(m_rpc.CharacterName.ToString()); // m_rpc.Perceive(new Name[] { EventHelper.PropertyChange("DialogueState(Player)", "Start", "world") }); lastDialog = new DialogueStateActionDTO(); }
private void openToolStripMenuItem_Click(object sender, EventArgs e) { var ofd = new OpenFileDialog(); if (ofd.ShowDialog() == DialogResult.OK) { try { _iatAsset = IntegratedAuthoringToolAsset.LoadFromFile(ofd.FileName); if (_iatAsset.ErrorOnLoad != null) { MessageBox.Show(_iatAsset.ErrorOnLoad, Resources.ErrorDialogTitle, MessageBoxButtons.OK, MessageBoxIcon.Error); } foreach (var character in _iatAsset.GetAllCharacters()) { if (character.ErrorOnLoad != null) { MessageBox.Show("Error when loading character '" + character.CharacterName + "': " + character.ErrorOnLoad, Resources.ErrorDialogTitle, MessageBoxButtons.OK, MessageBoxIcon.Error); } } _saveFileName = ofd.FileName; Reset(false); } catch (Exception ex) { MessageBox.Show(ex.Message + "-" + ex.StackTrace, Resources.ErrorDialogTitle, MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
/// <summary> /// Check if the location provided contains an existing game /// </summary> public bool CheckIfGameExists(string storageLocation, string gameName, out IntegratedAuthoringToolAsset iat) { if (Directory.Exists(Path.Combine(storageLocation, gameName))) { var files = Directory.GetFiles(Path.Combine(storageLocation, gameName), "*.iat"); foreach (var file in files) { try { var game = IntegratedAuthoringToolAsset.LoadFromFile(file); if (game != null && string.Equals(game.ScenarioName, gameName, StringComparison.CurrentCultureIgnoreCase)) { iat = game; return(true); } } //do not want loading errors to result in exceptions, so catch all catch { iat = null; return(false); } } } iat = null; return(false); }
// Use this for initialization void Start() { // Loading Storage json with the Rules, files must be in the Streaming Assets Folder var storagetPath = Application.streamingAssetsPath + "/MultiCharacterv4.0/multicharstorage.json"; var storage = AssetStorage.FromJson(File.ReadAllText(storagetPath)); //Loading Scenario information with data regarding characters and dialogue var iatPath = Application.streamingAssetsPath + "/MultiCharacterv4.0/scenario.json"; _iat = IntegratedAuthoringToolAsset.FromJson(File.ReadAllText(iatPath), storage); var currentState = IATConsts.INITIAL_DIALOGUE_STATE; // Getting a list of all the Characters _rpcList = _iat.Characters.ToList(); //Saving the World Model _worldModel = _iat.WorldModel; ChooseCharacterMenu(); }
public ScenarioData(string path, string tts) { ScenarioPath = path; TTSFolder = tts; _iat = IntegratedAuthoringToolAsset.LoadFromFile(ScenarioPath); }
/// <summary> /// Get recruit reaction to statement based on their rating of that skill /// </summary> internal string SendRecruitEvent(IntegratedAuthoringToolAsset iat, Skill skill) { string state; if (Skills[skill] >= 9) { state = "NPC_StronglyAgree"; } else if (Skills[skill] >= 7) { state = "NPC_Agree"; } else if (Skills[skill] >= 5) { state = "NPC_Neutral"; } else if (Skills[skill] >= 3) { state = "NPC_Disagree"; } else { state = "NPC_StronglyDisagree"; } var dialogueOptions = iat.GetDialogueActionsByState(state).ToList(); return(dialogueOptions.OrderBy(o => Guid.NewGuid()).First().Utterance); }
private static string HandleInstancesRequest(APIRequest req, ServerState serverState) { if (req.Method == HTTPMethod.GET) { var result = new List <int>(); for (int i = 1; i < HTTPFAtiMAServer.MAX_INSTANCES + 1; i++) { if (serverState.Scenarios[req.ScenarioName][i] != null) { result.Add(i); } } return(JsonConvert.SerializeObject(result)); } else if (req.Method == HTTPMethod.POST) { for (int i = 1; i < HTTPFAtiMAServer.MAX_INSTANCES + 1; i++) { if (serverState.Scenarios[req.ScenarioName][i] == null) { var scenarioJson = serverState.Scenarios[req.ScenarioName][0].ToJson(); serverState.Scenarios[req.ScenarioName][i] = IntegratedAuthoringToolAsset.FromJson(scenarioJson, serverState.Scenarios[req.ScenarioName][0].Assets); return(JsonConvert.SerializeObject(i)); } } } else if (req.Method == HTTPMethod.DELETE) { serverState.Scenarios[req.ScenarioName][req.ScenarioInstance] = null; return(JsonConvert.SerializeObject("Instance deleted.")); } return(APIErrors.ERROR_INVALID_HTTP_METHOD); }
/// <summary> /// Check to see if any events are about to be triggered /// </summary> internal void CurrentEventCheck(Team team, IntegratedAuthoringToolAsset iat) { var spacelessName = Name.NoSpaces(); //if the crew member is expecting to be selected if (LoadBelief(NPCBelief.ExpectedSelection) != null) { //if the crew member is not in a position if (team.Boat.GetCrewMemberPosition(this) == Position.Null) { //reduce opinion of the manager AddOrUpdateOpinion(team.ManagerName, -3); //send event on record that this happened var eventString = EventHelper.ActionStart("Player", "PostRace(NotPickedNotDone)", spacelessName); RolePlayCharacter.Perceive(eventString); eventString = EventHelper.ActionStart("Player", "MoodChange(-3)", spacelessName); RolePlayCharacter.Perceive(eventString); } //set their belief to 'null' UpdateSingleBelief(NPCBelief.ExpectedSelection); TickUpdate(0); } //if the crew member is expecting to be selecting in a particular position if (LoadBelief(NPCBelief.ExpectedPosition) != null) { var expected = LoadBelief(NPCBelief.ExpectedPosition); if (expected != null && team.Boat.Positions.Any(p => p.ToString() == expected)) { //if they are currently not in the position they expected to be in if (team.Boat.GetCrewMemberPosition(this).ToString() != expected) { //reduce opinion of the manager AddOrUpdateOpinion(team.ManagerName, -3); //send event on record that this happened var eventString = EventHelper.ActionStart("Player", "PostRace(PWNotDone)", spacelessName); RolePlayCharacter.Perceive(eventString); eventString = EventHelper.ActionStart("Player", "MoodChange(-3)", spacelessName); RolePlayCharacter.Perceive(eventString); } //set their belief to 'null' UpdateSingleBelief(NPCBelief.ExpectedPosition); TickUpdate(0); } } //if the crew member expects to be selected in a position after this current race, set them to instead be expecting to be selected for the current race if (LoadBelief(NPCBelief.ExpectedPositionAfter) != null) { var expected = LoadBelief(NPCBelief.ExpectedPositionAfter); if (expected != null) { UpdateSingleBelief(NPCBelief.ExpectedPositionAfter); UpdateSingleBelief(NPCBelief.ExpectedPosition, expected); TickUpdate(0); } } }
private static IntegratedAuthoringToolAsset Build_IAT_Asset() { var iat = new IntegratedAuthoringToolAsset() { ScenarioName = "Test", ScenarioDescription = "default" }; return(iat); }
public SuecaRolePlayCharacter(string agentType, string scenarioPath) { _randomNumberGenerator = new Random(System.Guid.NewGuid().GetHashCode()); _events = new List <SuecaEvent>(); AssetManager.Instance.Bridge = new AssetManagerBridge(); _iat = IntegratedAuthoringToolAsset.LoadFromFile(scenarioPath); eventsLock = new Object(); loadScenario(agentType); usedUtterances = new List <Utterance>(); Task.Run(() => { UpdateCoroutine(); }); }
public SuecaRolePlayCharacter(int nameId, string agentType, string scenarioPath, EmotionalSuecaPlayer esp) { _esp = esp; _agentName = "EMYS-" + nameId + "(" + agentType + ")"; _randomNumberGenerator = new Random(System.Guid.NewGuid().GetHashCode()); _events = new List <SuecaEvent>(); AssetManager.Instance.Bridge = new AssetManagerBridge(); _iat = IntegratedAuthoringToolAsset.LoadFromFile(scenarioPath); eventsLock = new Object(); LoadScenario(agentType); usedUtterances = new List <Utterance>(); Task.Run(() => { UpdateCoroutine(); }); }
private static string HandleScenariosRequest(APIRequest req, ServerState serverState) { if (req.Method == HTTPMethod.GET) { return(JsonConvert.SerializeObject(serverState.Scenarios.Keys)); } if (req.Method == HTTPMethod.POST) { if (!string.IsNullOrEmpty(req.RequestBody)) { IntegratedAuthoringToolAsset iat; try { var request = JsonConvert.DeserializeObject <CreateScenarioRequestDTO>(req.RequestBody); var assetStorage = AssetStorage.FromJson(request.Assets); iat = IntegratedAuthoringToolAsset.FromJson(request.Scenario, assetStorage); serverState.Scenarios[iat.ScenarioName.ToLower()] = new IntegratedAuthoringToolAsset[HTTPFAtiMAServer.MAX_INSTANCES + 1]; //original is kept at 0 and will be left unchanged serverState.Scenarios[iat.ScenarioName.ToLower()][0] = IntegratedAuthoringToolAsset.FromJson(request.Scenario, assetStorage); //instance of id 1 is automatically created serverState.Scenarios[iat.ScenarioName.ToLower()][1] = IntegratedAuthoringToolAsset.FromJson(request.Scenario, assetStorage); if (!string.IsNullOrEmpty(req.Key)) { serverState.ScenarioKeys[iat.ScenarioName.ToLower()] = req.Key; } } catch (Exception ex) { return(JsonConvert.SerializeObject(ex.Message)); } return(JsonConvert.SerializeObject("Scenario named '" + iat.ScenarioName + "' created containing " + "'" + iat.Characters.Count() + "' characters")); } else { return(JsonConvert.SerializeObject("Error: Empty body in a create scenario request!")); } } if (req.Method == HTTPMethod.DELETE) { serverState.Scenarios.TryRemove(req.ScenarioName, out var aux1); serverState.ScenarioKeys.TryRemove(req.ScenarioName, out var aux2); return(JsonConvert.SerializeObject("Scenario deleted.")); } return(APIErrors.ERROR_INVALID_HTTP_METHOD); }
// Use this for initialization private void Start() { AssetManager.Instance.Bridge = new AssetManagerBridge(); var streamingAssetsPath = Application.streamingAssetsPath; #if UNITY_EDITOR || UNITY_STANDALONE streamingAssetsPath = "file://" + streamingAssetsPath; #endif if (string.IsNullOrEmpty(IATScenario)) { Debug.LogError("Please specify an IAT scenario file!"); return; } iat = IntegratedAuthoringToolAsset.LoadFromFile(IATScenario); var characterSources = iat.GetAllCharacterSources().ToList(); //AGENT 1 agent1RPC = RolePlayCharacterAsset.LoadFromFile(characterSources[1].Source); agent1RPC.LoadAssociatedAssets(); iat.BindToRegistry(agent1RPC.DynamicPropertiesRegistry); //AGENT 2 agent2RPC = RolePlayCharacterAsset.LoadFromFile(characterSources[2].Source); agent2RPC.LoadAssociatedAssets(); iat.BindToRegistry(agent2RPC.DynamicPropertiesRegistry); //PLAYER playerRPC = RolePlayCharacterAsset.LoadFromFile(characterSources[0].Source); playerRPC.LoadAssociatedAssets(); iat.BindToRegistry(playerRPC.DynamicPropertiesRegistry); playerDialogues = DeterminePlayerDialogues(); UpdatePlayerDialogOptions(true); AgentUtterance.text = String.Empty; StartCoroutine(UpdateEmotionalState(1f)); StartCoroutine(DetermineAgentDialogue(0.2f)); NextPageButton.onClick.RemoveAllListeners(); NextPageButton.onClick.AddListener(() => OnNextPage()); PreviousPageButton.onClick.RemoveAllListeners(); PreviousPageButton.onClick.AddListener(() => OnPreviousPage()); RestartButton.onClick.RemoveAllListeners(); RestartButton.onClick.AddListener(() => RestartScene()); }
void LoadWebGL() { Debug.Log("Loading Web Gl Method"); Debug.Log("Loading Storage string"); storage = AssetStorage.FromJson(storageInfo); Debug.Log("Loading IAT string"); _iat = IntegratedAuthoringToolAsset.FromJson(scenarioInfo, storage); Debug.Log("Finished Loading Web-GL"); LoadedScenario(); }
/// <summary> /// Team constructor /// </summary> internal Team(IntegratedAuthoringToolAsset i, string storage, string name, string nation, Boat boat) { iat = i; storageLocation = Path.Combine(storage, name); Name = name; Nationality = nation; Boat = boat; crewMembers = new Dictionary <string, CrewMember>(); RetiredCrew = new Dictionary <string, CrewMember>(); Recruits = new Dictionary <string, CrewMember>(); LineUpHistory = new List <Boat>(); HistoricTimeOffset = new List <int>(); HistoricSessionNumber = new List <int>(); }
private void LoadScenario(SingleCharacterDemo.ScenarioData data) { ClearButtons(); _iat = data.IAT; _introPanel.SetActive(true); _introText.text = string.Format("<b>{0}</b>\n\n\n{1}", _iat.ScenarioName, _iat.ScenarioDescription); var characterSources = _iat.GetAllCharacterSources().ToList(); int CharacterCount = 0; foreach (var source in characterSources) { var rpc = RolePlayCharacterAsset.LoadFromFile(source.Source); rpc.LoadAssociatedAssets(); _iat.BindToRegistry(rpc.DynamicPropertiesRegistry); rpcList.Add(rpc); var body = m_bodies.FirstOrDefault(b => b.BodyName == rpc.BodyName); _agentController = new MultiCharacterAgentController(data, rpc, _iat, body.CharaterArchtype, m_characterAnchors[CharacterCount], m_dialogController); StopAllCoroutines(); _agentControllers.Add(_agentController); CharacterCount++; } AddButton("Back to Scenario Selection Menu", () => { _iat = null; LoadScenarioMenu(); }); foreach (var actor in rpcList) { foreach (var anotherActor in rpcList) { if (actor != anotherActor) { var changed = new[] { EventHelper.ActionEnd(anotherActor.CharacterName.ToString(), "Enters", "Room") }; actor.Perceive(changed); } } } RandomizeNext(); SetCamera(); }
internal ConfigStore(Platform platform = Platform.Windows) { Platform = platform; ConfigValues = new Dictionary <ConfigKey, float>(); var configText = Templates.ResourceManager.GetString("config"); var contractResolver = new PrivatePropertyResolver(); var settings = new JsonSerializerSettings { ContractResolver = contractResolver }; ConfigValues = JsonConvert.DeserializeObject <Dictionary <ConfigKey, float> >(configText, settings); foreach (var key in (ConfigKey[])Enum.GetValues(typeof(ConfigKey))) { if (!ConfigValues.ContainsKey(key)) { throw new Exception("Config key " + key + " not included in config!"); } } BoatTypes = new Dictionary <string, List <Position> >(); var boatText = Templates.ResourceManager.GetString("boat_config"); BoatTypes = JsonConvert.DeserializeObject <Dictionary <string, List <Position> > >(boatText); GameConfig = new GameConfig().GetConfig(); NameConfig = new NameConfig().GetConfig(); Avatar.Config = new AvatarGeneratorConfig().GetConfig(); AssetManager.Instance.Bridge = new TemplateBridge(); RolePlayCharacter = RolePlayCharacterAsset.LoadFromFile("template_rpc"); EmotionalAppraisal = EmotionalAppraisalAsset.LoadFromFile("template_ea"); EmotionalDecisionMaking = EmotionalDecisionMakingAsset.LoadFromFile("template_edm"); SocialImportance = SocialImportanceAsset.LoadFromFile("template_si"); IntegratedAuthoringTool = IntegratedAuthoringToolAsset.LoadFromFile("template_iat"); switch (Platform) { case Platform.Android: AssetManager.Instance.Bridge = new AndroidBaseBridge(); break; case Platform.iOS: AssetManager.Instance.Bridge = new IOSBaseBridge(); break; case Platform.Windows: AssetManager.Instance.Bridge = new BaseBridge(); break; } }
private IEnumerator LoadScenario(ScenarioData data) { ClearButtons(); _iat = data.IAT; _introPanel.SetActive(true); _introText.text = string.Format("<b>{0}</b>\n\n\n{1}", _iat.ScenarioName, _iat.ScenarioDescription); previousState = ""; var characterSources = _iat.GetAllCharacterSources().ToList(); var addedDialogs = new List <string>(); _wm = WorldModelAsset.LoadFromFile(_iat.GetWorldModelSource().Source); foreach (var source in characterSources) { var rpc = RolePlayCharacterAsset.LoadFromFile(source.Source); rpc.LoadAssociatedAssets(); if (rpc.CharacterName.ToString() == "Player") { Player = rpc; _iat.BindToRegistry(Player.DynamicPropertiesRegistry); continue; } _iat.BindToRegistry(rpc.DynamicPropertiesRegistry); AddButton(characterSources.Count <= 2 ? "Start" : rpc.CharacterName.ToString(), () => { Debug.Log("Interacted with the start button"); var body = m_bodies.FirstOrDefault(b => b.BodyName == rpc.BodyName); _agentController = new AgentControler(data, rpc, _iat, body.CharaterArchtype, m_characterAnchor, m_dialogController); StopAllCoroutines(); _agentController.storeFinalScore(_finalScore); _agentController.Start(this, VersionMenu); _agentController.startingTime = this.startingTime; InstantiateScore(); }); } if (m_scenarios.Length > 1) { AddButton("Back to Scenario Selection Menu", () => { _iat = null; LoadScenarioMenu(); }); } yield return(nextframe); }
private void Reset(bool newFile) { if (newFile) { this.Text = Resources.MainFormTitle; this._iatAsset = new IntegratedAuthoringToolAsset(); } else { this.Text = Resources.MainFormTitle + " - " + _saveFileName; } textBoxScenarioName.Text = _iatAsset.ScenarioName; _characterSources = new BindingListView <CharacterSourceDTO>(this._iatAsset.GetAllCharacterSources().ToList()); dataGridViewCharacters.DataSource = _characterSources; }
public ScenarioData(string path, string tts) { ScenarioPath = path; TTSFolder = tts; var auxPath = ""; if (Application.platform.ToString().Contains("OS")) { auxPath = path.Replace('\\', '/'); } else { auxPath = path; } _iat = IntegratedAuthoringToolAsset.LoadFromFile(auxPath); }
public void NextLevel() { CurrentLevel++; _feedbackScores.Clear(); GetFeedbackEvent?.Invoke(_feedbackScores, FeedbackLevel); if (_scenarios.Any(data => data.LevelId.Equals(CurrentLevel))) { CurrentScenario = _scenarios.First(data => data.LevelId.Equals(CurrentLevel)); } else { var validPaths = _allScenarioPaths.Where(p => p.Contains('#')).ToArray(); var prefixes = validPaths.Select(p => p.Substring(0, p.IndexOf('-', p.IndexOf('-') + 1) + 1)).ToList(); var character = new List <string> { "Positive", "Neutral", "Negative" }.OrderBy(dto => random.Next()).First(); var prefix = _isDemo ? _demoScenarioPrefix + _demoUtterance : prefixes.OrderBy(dto => random.Next()).First(); // MaxPoints currently hardcoded to 8 for random scenarios. // TODO Review validity/balance of MaxPoints = 8 CurrentScenario = new ScenarioData(CurrentLevel, _allScenarioPaths.Where(x => x.Contains(prefix)).ToArray(), character, 8, prefix); } if (CurrentScenario != null) { var index = random.Next(CurrentScenario.ScenarioPaths.Length); Debug.Log(CurrentScenario.ScenarioPaths[index]); string error; ScenarioCode = _isDemo ? _demoUtterance.Split('#')[0] : CurrentScenario.ScenarioPaths[index].Replace(CurrentScenario.Prefix, string.Empty).Split('#')[0]; _integratedAuthoringTool = IntegratedAuthoringToolAsset.LoadFromFile(Path.Combine("Scenarios", CurrentScenario.ScenarioPaths[index]), out error); if (!string.IsNullOrEmpty(error)) { Debug.LogError(error); } CurrentCharacter = RolePlayCharacterAsset.LoadFromFile(_integratedAuthoringTool.GetAllCharacterSources().First(c => c.Source.Contains(CurrentScenario.Character)).Source); CurrentCharacter.LoadAssociatedAssets(); _integratedAuthoringTool.BindToRegistry(CurrentCharacter.DynamicPropertiesRegistry); CurrentCharacter.BodyName = random.NextDouble() >= 0.5 ? "Male" : "Female"; } }
private void BakeAndSaveTTS(string path, string utterance, double rate, int pitch) { var bake = _selectedVoice.BakeTTS(utterance, rate, pitch); if (bake == null) { return; } if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } var hash = IntegratedAuthoringToolAsset.GenerateUtteranceId(utterance); var path2 = Path.Combine(path, hash.ToString()); using (var audioFile = File.Open(path2 + ".wav", FileMode.Create, FileAccess.Write)) { audioFile.Write(bake.waveStreamData, 0, bake.waveStreamData.Length); } using (var writer = new XmlTextWriter(path2 + ".xml", new UTF8Encoding(false))) { writer.Formatting = Formatting.Indented; writer.WriteStartDocument(); writer.WriteStartElement("LipSyncVisemes"); writer.WriteAttributeString("wavFile", hash + ".wav"); double time = 0; foreach (var v in bake.visemes) { if (v.viseme > Viseme.Silence) { writer.WriteStartElement("viseme"); writer.WriteAttributeString("type", ((sbyte)v.viseme).ToString()); writer.WriteAttributeString("time", time.ToString(CultureInfo.InvariantCulture)); writer.WriteAttributeString("duration", v.duration.ToString(CultureInfo.InvariantCulture)); writer.WriteEndElement(); } time += v.duration; } writer.WriteEndElement(); writer.WriteEndDocument(); } }
public void NextQuestionnaire() { // Pilot logic to set level id to match CurrentLevel divided by 5, as questionnaires occur every 5 levels. Needs changing if occurance rate of questionnaires change CurrentScenario = new ScenarioData(CurrentLevel / 5, _allScenarioPaths.Where(x => x.Contains("Questions")).ToArray(), "Neutral", 0, "Questionnaire"); string error; // Pilot logic to set different questionnaire depending on how many levels have been played. Needs changing if expected appearence of questionnaire changes ScenarioCode = (CurrentLevel < LevelMax && LevelMax > 0 ? 1 : 2).ToString(); _integratedAuthoringTool = IntegratedAuthoringToolAsset.LoadFromFile(Path.Combine("Scenarios", _allScenarioPaths.First(x => x.Contains("Questions" + ScenarioCode))), out error); if (!string.IsNullOrEmpty(error)) { Debug.LogError(error); } CurrentCharacter = RolePlayCharacterAsset.LoadFromFile(_integratedAuthoringTool.GetAllCharacterSources().First(c => c.Source.Contains("Neutral")).Source); CurrentCharacter.LoadAssociatedAssets(); _integratedAuthoringTool.BindToRegistry(CurrentCharacter.DynamicPropertiesRegistry); }
static void Main(string[] args) { var iat = IntegratedAuthoringToolAsset.LoadFromFile("../../../Examples/CiF-Tutorial/JobInterview.iat"); rpcList = new List <RolePlayCharacterAsset>(); foreach (var source in iat.GetAllCharacterSources()) { var rpc = RolePlayCharacterAsset.LoadFromFile(source.Source); //rpc.DynamicPropertiesRegistry.RegistDynamicProperty(Name.BuildName("Volition"),cif.VolitionPropertyCalculator); rpc.LoadAssociatedAssets(); iat.BindToRegistry(rpc.DynamicPropertiesRegistry); rpcList.Add(rpc); } foreach (var actor in rpcList) { foreach (var anotherActor in rpcList) { if (actor != anotherActor) { var changed = new[] { EventHelper.ActionEnd(anotherActor.CharacterName.ToString(), "Enters", "Room") }; actor.Perceive(changed); } } } foreach (var actor in rpcList) { if (actor.Decide().FirstOrDefault() != null) { Console.WriteLine(actor.CharacterName.ToString() + " decided to perform " + actor.Decide().FirstOrDefault().Name); } } Console.ReadKey(); }
// Use this for initialization void Start() { // AssetManager.Instance.Bridge = new AssetManagerBridge(); _iat = IntegratedAuthoringToolAsset.LoadFromString("{\r\n\t\"root\":\r\n\t\t{\r\n\t\t\t\"classId\": 0,\r\n\t\t\t\"ScenarioName\": \"Pepe Silvia\",\r\n\t\t\t\"Description\": \"A short conversation between the Player and a Character named Charlie. Charlie discovers that there is a major conspiracy within the company he works in. \",\r\n\t\t\t\"WorldModelSource\": \"PepeSilviaWorldModel.wmo\",\r\n\t\t\t\"CharacterSources\": [\"Charlie.rpc\", \"Player.rpc\"],\r\n\t\t\t\"Dialogues\": [\r\n\t\t\t\t{\r\n\t\t\t\t\t\"CurrentState\": \"Start\",\r\n\t\t\t\t\t\"NextState\": \"S1\",\r\n\t\t\t\t\t\"Meaning\": \"-\",\r\n\t\t\t\t\t\"Style\": \"-\",\r\n\t\t\t\t\t\"Utterance\": \"Hi how are you?\",\r\n\t\t\t\t\t\"UtteranceId\": \"TTS-51AADAEB0C97ED7BD252B14D88309F6B\"\r\n\t\t\t\t}, \r\n\t\t\t\t{\r\n\t\t\t\t\t\"CurrentState\": \"S2\",\r\n\t\t\t\t\t\"NextState\": \"S3\",\r\n\t\t\t\t\t\"Meaning\": \"-\",\r\n\t\t\t\t\t\"Style\": \"Neutral\",\r\n\t\t\t\t\t\"Utterance\": \"I\'m feeling okay-ish, I\'ve got something to tell you\",\r\n\t\t\t\t\t\"UtteranceId\": \"TTS-58C7E04BE265D8CC2D9A51D169C0C41B\"\r\n\t\t\t\t}, \r\n\t\t\t\t{\r\n\t\t\t\t\t\"CurrentState\": \"S3\",\r\n\t\t\t\t\t\"NextState\": \"S4\",\r\n\t\t\t\t\t\"Meaning\": \"-\",\r\n\t\t\t\t\t\"Style\": \"-\",\r\n\t\t\t\t\t\"Utterance\": \"What happened?\",\r\n\t\t\t\t\t\"UtteranceId\": \"TTS-9CBB8AB9BF567189876DC3F84F766DFD\"\r\n\t\t\t\t}, \r\n\t\t\t\t{\r\n\t\t\t\t\t\"CurrentState\": \"S4\",\r\n\t\t\t\t\t\"NextState\": \"S5\",\r\n\t\t\t\t\t\"Meaning\": \"-\",\r\n\t\t\t\t\t\"Style\": \"-\",\r\n\t\t\t\t\t\"Utterance\": \"I\'ve just stumbled unto a major conspiracy !\",\r\n\t\t\t\t\t\"UtteranceId\": \"TTS-2C10E0C6CD86488733DC9FB56095A896\"\r\n\t\t\t\t}, \r\n\t\t\t\t{\r\n\t\t\t\t\t\"CurrentState\": \"FeelingGreat\",\r\n\t\t\t\t\t\"NextState\": \"S6\",\r\n\t\t\t\t\t\"Meaning\": \"-\",\r\n\t\t\t\t\t\"Style\": \"-\",\r\n\t\t\t\t\t\"Utterance\": \"Oh thank god!\",\r\n\t\t\t\t\t\"UtteranceId\": \"TTS-A112F1A6A1C6F499EB83AC65CFBC61F2\"\r\n\t\t\t\t}, \r\n\t\t\t\t{\r\n\t\t\t\t\t\"CurrentState\": \"S2\",\r\n\t\t\t\t\t\"NextState\": \"S3\",\r\n\t\t\t\t\t\"Meaning\": \"-\",\r\n\t\t\t\t\t\"Style\": \"Depressed\",\r\n\t\t\t\t\t\"Utterance\": \"Not that great actually\",\r\n\t\t\t\t\t\"UtteranceId\": \"TTS-4A616F5A524EE7AAA5F8A495F2A2548F\"\r\n\t\t\t\t}, \r\n\t\t\t\t{\r\n\t\t\t\t\t\"CurrentState\": \"S1\",\r\n\t\t\t\t\t\"NextState\": \"S2\",\r\n\t\t\t\t\t\"Meaning\": \"Neutral\",\r\n\t\t\t\t\t\"Style\": \"-\",\r\n\t\t\t\t\t\"Utterance\": \"I\'m okay, how about you\",\r\n\t\t\t\t\t\"UtteranceId\": \"TTS-D45D0CAB5CB3A9C4EC782678AACC3846\"\r\n\t\t\t\t}, \r\n\t\t\t\t{\r\n\t\t\t\t\t\"CurrentState\": \"S1\",\r\n\t\t\t\t\t\"NextState\": \"S2\",\r\n\t\t\t\t\t\"Meaning\": \"Sad\",\r\n\t\t\t\t\t\"Style\": \"-\",\r\n\t\t\t\t\t\"Utterance\": \"I\'m really sad, how about you?\",\r\n\t\t\t\t\t\"UtteranceId\": \"TTS-9B384E09650832C1BF05F35C0D11D1AF\"\r\n\t\t\t\t}, \r\n\t\t\t\t{\r\n\t\t\t\t\t\"CurrentState\": \"S1\",\r\n\t\t\t\t\t\"NextState\": \"S2\",\r\n\t\t\t\t\t\"Meaning\": \"Happy\",\r\n\t\t\t\t\t\"Style\": \"-\",\r\n\t\t\t\t\t\"Utterance\": \"I\'m doing amazingly, how about you?\",\r\n\t\t\t\t\t\"UtteranceId\": \"TTS-D5D435EF2A8FE2F34D3DECD7BA9C7048\"\r\n\t\t\t\t}, \r\n\t\t\t\t{\r\n\t\t\t\t\t\"CurrentState\": \"Sad\",\r\n\t\t\t\t\t\"NextState\": \"S2\",\r\n\t\t\t\t\t\"Meaning\": \"-\",\r\n\t\t\t\t\t\"Style\": \"-\",\r\n\t\t\t\t\t\"Utterance\": \"I\'m feeling pretty bad aswell\",\r\n\t\t\t\t\t\"UtteranceId\": \"TTS-1AE6C0BC6D52FA7B7918E32948E30326\"\r\n\t\t\t\t}, \r\n\t\t\t\t{\r\n\t\t\t\t\t\"CurrentState\": \"S2\",\r\n\t\t\t\t\t\"NextState\": \"S3\",\r\n\t\t\t\t\t\"Meaning\": \"-\",\r\n\t\t\t\t\t\"Style\": \"Positive\",\r\n\t\t\t\t\t\"Utterance\": \"I\'m feeling great ! I\'ve got something to tell you!\",\r\n\t\t\t\t\t\"UtteranceId\": \"TTS-37E04E7AA23C7104DF9C248324A8DA01\"\r\n\t\t\t\t}]\r\n\t\t},\r\n\t\"types\": [\r\n\t\t{\r\n\t\t\t\"TypeId\": 0,\r\n\t\t\t\"ClassName\": \"IntegratedAuthoringTool.IntegratedAuthoringToolAsset, IntegratedAuthoringTool, Version=1.7.0.0, Culture=neutral, PublicKeyToken=null\"\r\n\t\t}]\r\n}"); /*Initialize the List * _rpcList = new List<RolePlayCharacterAsset>(); * * foreach (var characterSouce in _iat.GetAllCharacterSources()) * { * * var rpc = RolePlayCharacterAsset.LoadFromFile(characterSouce.Source); * * // RPC must load its "sub-assets" * rpc.LoadAssociatedAssets(); * * // Iat lets the RPC know all the existing Meta-Beliefs / Dynamic Properties * _iat.BindToRegistry(rpc.DynamicPropertiesRegistry); * * * // A debug message to make sure we are correctly loading the characters * Debug.Log("Loaded Character " + rpc.CharacterName); * * _rpcList.Add(rpc); * } * * * //Loading the WorldModel * if(_iat.m_worldModelSource.Source != "" && _iat.m_worldModelSource.Source != null) * _worldModel = WorldModel.WorldModelAsset.LoadFromFile(_iat.GetWorldModelSource().Source); * * UpdateFunction(); */ foreach (var d in _iat.GetAllDialogueActions()) { Debug.Log(" Dialogues " + d.Utterance); } }
public AgentControler(SingleCharacterDemo.ScenarioData scenarioData, RolePlayCharacterAsset rpc, IntegratedAuthoringToolAsset iat, UnityBodyImplement archetype, Transform anchor, DialogController dialogCrt) { m_scenarioData = scenarioData; m_iat = iat; m_rpc = rpc; m_dialogController = dialogCrt; _body = GameObject.Instantiate(archetype); just_talked = false; var t = _body.transform; t.SetParent(anchor, false); t.localPosition = Vector3.zero; t.localRotation = Quaternion.identity; t.localScale = Vector3.one; m_dialogController.SetCharacterLabel(m_rpc.CharacterName.ToString()); }
public AddOrEditDialogueActionForm(IntegratedAuthoringToolAsset asset, DialogueStateActionDTO dto) { InitializeComponent(); this.dto = dto; this.asset = asset; textBoxCurrentState.Value = (WellFormedNames.Name)dto.CurrentState; textBoxNextState.Value = (WellFormedNames.Name)dto.NextState; textBoxMeaning.Value = (WellFormedNames.Name)dto.Meaning; textBoxStyle.Value = (WellFormedNames.Name)dto.Style; textBoxUtterance.Text = dto.Utterance; //validators EditorTools.AllowOnlyGroundedLiteralOrNil(textBoxCurrentState); EditorTools.AllowOnlyGroundedLiteralOrNil(textBoxNextState); textBoxMeaning.AllowVariable = false; textBoxStyle.AllowVariable = false; }
public RPCInspectForm(IntegratedAuthoringToolAsset iatAsset, AssetStorage storage, string rpcName) { InitializeComponent(); EditorTools.AllowOnlyGroundedLiteralOrUniversal(wfNameActionLayer); wfNameActionLayer.Value = WellFormedNames.Name.UNIVERSAL_SYMBOL; this.iat = iatAsset; this.storage = storage; this.rpcName = rpcName; this.Text += " - " + rpcName; actions = new BindingListView <IAction>((IList)null); dataGridViewDecisions.DataSource = actions; EditorTools.HideColumns(dataGridViewDecisions, new[] { PropertyUtil.GetPropertyName <IAction>(a => a.Parameters) }); emotions = new BindingListView <EmotionDTO>((IList)null); dataGridActiveEmotions.DataSource = emotions; }
protected override void OnAssetDataLoaded(IntegratedAuthoringToolAsset asset) { textBoxScenarioName.Text = asset.ScenarioName; _characterSources = new BindingListView<CharacterSourceDTO>(asset.GetAllCharacterSources().ToList()); dataGridViewCharacters.DataSource = _characterSources; }