public GUIDialogStateAction(DialogueStateActionDTO dto) { Id = dto.Id; CurrentState = dto.CurrentState; NextState = dto.NextState; Meaning = dto.GetMeaningName().ToString(); Style = dto.GetStylesName().ToString(); Utterance = dto.Utterance; }
//: this(Name.BuildName(dto.CurrentState), Name.BuildName(dto.Meaning), Name.BuildName(dto.Styles), Name.BuildName(dto.NextState)) //private DialogStateAction(Name currentState, Name meaning, Name style, Name nextState) : // base(Name.BuildName(DIALOG_ACTION_NAME, currentState, meaning, style, nextState), Name.NIL_SYMBOL, new ConditionSet()){} /// <summary> /// Creates a new instance of a dialogue action from the corresponding DTO /// </summary> public DialogStateAction(DialogueStateActionDTO dto) { this.Id = dto.Id == Guid.Empty?Guid.NewGuid() : dto.Id; this.CurrentState = Name.BuildName(dto.CurrentState); this.Meanings = dto.Meaning.Select(s => (Name) s).ToArray(); this.Styles = dto.Style.Select(s => (Name) s).ToArray(); this.NextState = Name.BuildName(dto.NextState); this.Utterance = dto.Utterance; }
public AddOrEditDialogueActionForm(MainForm form, bool isPlayerDialogue, Guid dialogId) : this(form,isPlayerDialogue) { buttonAddOrUpdate.Text = "Update"; _dialogueStateActionToEdit = form.CurrentAsset.GetDialogActionById( isPlayerDialogue ? IntegratedAuthoringToolAsset.PLAYER : IntegratedAuthoringToolAsset.AGENT, dialogId); textBoxCurrentState.Text = _dialogueStateActionToEdit.CurrentState; textBoxNextState.Text = _dialogueStateActionToEdit.NextState; textBoxMeaning.Text = _dialogueStateActionToEdit.Meaning.Length == 0 ? string.Empty : _dialogueStateActionToEdit.Meaning.Aggregate((s, s1) => s + ", " + s1); textBoxStyle.Text = _dialogueStateActionToEdit.Style.Length == 0 ? string.Empty : _dialogueStateActionToEdit.Style.Aggregate((s, s1) => s + ", " + s1); textBoxUtterance.Text = _dialogueStateActionToEdit.Utterance; }
private void buttonAddOrUpdate_Click(object sender, EventArgs e) { try { var newDialogueAction = new DialogueStateActionDTO { CurrentState = textBoxCurrentState.Text, NextState = textBoxNextState.Text, Meaning = textBoxMeaning.Text.Split(',').Where(s => !string.IsNullOrEmpty(s)).ToArray(), Style = textBoxStyle.Text.Split(',').Where(s => !string.IsNullOrEmpty(s)).ToArray(), Utterance = textBoxUtterance.Text }; if (_dialogueStateActionToEdit == null) { if (_isPlayerDialogue) { _iatAsset.AddPlayerDialogAction(newDialogueAction); } else { _iatAsset.AddAgentDialogAction(newDialogueAction); } } else { if (_isPlayerDialogue) { _iatAsset.EditPlayerDialogAction(_dialogueStateActionToEdit, newDialogueAction); } else { _iatAsset.EditAgentDialogAction(_dialogueStateActionToEdit, newDialogueAction); } } _parentForm.SetModified(); this.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public static string GenerateFileKey(DialogueStateActionDTO dto) { return $"{dto.CurrentState}#{dto.NextState}#{JoinStringArray(dto.Meaning)}({JoinStringArray(dto.Style)})".ToUpperInvariant(); }