public AggregateOperationResult ProcessItems(ConversationAction actionsFilter) { this.CheckDisposed("ProcessItems"); Conversation conversation = Conversation.Load((MailboxSession)base.Session, this.ConversationId, ConversationActionItem.PropertiesToRequestInConversationLoad); return(this.ProcessItems(actionsFilter, conversation)); }
private List <Rect> GetConnectionPointsRects(ConversationAction conversationAction) { List <Rect> rects = new List <Rect>(); if (conversationAction.GetConnectionCount() > 0) { SerializedObject nodeSO = new SerializedObject(conversationAction); for (int i = 0; i < conversationAction.GetConnectionCount(); i++) { Rect rect = GetNodeRect(conversationAction); rect.x = rect.max.x; rect.y += i * 25; rect.y += 5; if (conversationAction.GetConnectionCount() == 1) { rect.y += 7; } rect.size = new Vector2(15, 15); rects.Add(rect); } } return(rects); }
//set inside each npc script public void SetShopSpeech() { conversationAction -= OldWomanText; conversationAction = ShopText; conversationAction -= UpgradeText; currentConvCheck = shopConv; }
public ActionTrigger(JSONNode triggerJSON) { switch (triggerJSON["type"]) { case "talk": type = TriggerType.Talk; break; case "look": type = TriggerType.Look; break; default: type = TriggerType.Collect; break; } var actionsJSON = triggerJSON["actions"]; if (actionsJSON == null) { actions = null; } else { actions = new ConversationAction[actionsJSON.Count]; for (int i = 0; i < actionsJSON.Count; i++) { ConversationAction action = new ConversationAction(actionsJSON[i]); actions[i] = action; } } }
//set inside each npc script public void SetOldWomanSpeech() { conversationAction = OldWomanText; conversationAction -= ShopText; conversationAction -= UpgradeText; currentConvCheck = oldWomanConv; }
//set inside each npc script public void SetUpgradeSpeech() { conversationAction -= OldWomanText; conversationAction -= ShopText; conversationAction = UpgradeText; currentConvCheck = upgradeConv; }
private void TryActions(ConversationAction[] actions, Transform actor) { if (actions == null) return; foreach (ConversationAction action in actions) { if (action != null && action.condition != null && action.condition.IsTrue(actor)) DoAction(action, actor); } }
/// <summary> /// Executes a conversation action. /// </summary> public void DoAction(ConversationAction action, Transform actor) { if (action != null) { Transform speaker = Tools.Select(action.speaker, this.transform); Transform listener = Tools.Select(action.listener, actor); bool skip = action.skipIfNoValidEntries && !DialogueManager.ConversationHasValidEntry(action.conversation, speaker, listener); if (!skip) DialogueManager.StartConversation(action.conversation, speaker, listener); } }
public ConversationActionNodeNotice(ConversationType conversationType, ConversationAction action, long conversationId, long userId, long?dialogUserId) { Action = action; ConversationType = conversationType; ConversationId = conversationId; UserId = userId; DialogUserId = dialogUserId; NoticeCode = Enums.NodeNoticeCode.ConversationAction; }
protected bool RaiseOnException(ConversationAction actionType, Exception e) { bool reThrow = true; if (OnException != null) { var eventArgs = new OnExceptionEventArgs(actionType, e); OnException(this, eventArgs); reThrow = eventArgs.ReThrow; } return(reThrow); }
/// <summary> /// Executes a conversation action. /// </summary> public void DoAction(ConversationAction action, Transform actor) { if (action != null) { Transform speaker = Tools.Select(action.speaker, this.transform); Transform listener = Tools.Select(action.listener, actor); bool skip = action.skipIfNoValidEntries && !DialogueManager.ConversationHasValidEntry(action.conversation, speaker, listener); if (!skip) { DialogueManager.StartConversation(action.conversation, speaker, listener); } } }
private Rect GetNodeRect(ConversationAction conversationAction) { SerializedObject nodeSO = new SerializedObject(conversationAction); SerializedProperty positionProperty = nodeSO.FindProperty("_uiPosition"); int height = 40; if (conversationAction.GetConnectionCount() > 1) { height = conversationAction.GetConnectionCount() * 25; } return(new Rect(positionProperty.vector2Value.x + _scrollPosition.x, positionProperty.vector2Value.y + _scrollPosition.y, 160, height)); }
public string Answer() { var CONF_NAME = Environment.GetEnvironmentVariable("CONF_NAME") ?? "CONF_NAME"; var talkAction = new TalkAction() { Text = "Please wait while we connect you to the conference" }; var conversationAction = new ConversationAction() { Name = CONF_NAME }; var ncco = new Ncco(talkAction, conversationAction); return(ncco.ToString()); }
/** * <summary>A constructor for an asset-based Conversation's dialogue option.</summary> * <param name = "_ID">An ID number unique to this instance of ButtonDialog within a Conversation</param> * <param name = "_label">The option's display text</param> * <param name = "_startEnabled">If True, the option will be enabled by default</param> * <param name = "_actionListAsset">The ActionListAsset to run when the option is chosen</param> * <param name = "_endsConversation">If True, the Conversation will end after the ActionListAsset has finished running</param> */ public ButtonDialog(int _ID, string _label, bool _startEnabled, ActionListAsset _actionListAsset, bool _endsConversation) { label = _label; icon = null; isOn = _startEnabled; isLocked = false; conversationAction = (_endsConversation) ? ConversationAction.Stop : ConversationAction.ReturnToConversation; assetFile = _actionListAsset; newConversation = null; dialogueOption = null; lineID = -1; ID = _ID; isEditing = false; }
private void EncloseWithExceptionManagement(ConversationAction actionType, ConvAction action) { try { action(); } catch (Exception e) { bool reThrow = RaiseOnException(actionType, e); if (reThrow) { throw new ConversationException( string.Format("Exception during persistent conversation {0}:{1}", actionType, e.Message), e); } } }
/** * <summary>A constructor for a scene-based Conversation's dialogue option.</summary> * <param name = "_ID">An ID number unique to this instance of ButtonDialog within a Conversation</param> * <param name = "_label">The option's display text</param> * <param name = "_startEnabled">If True, the option will be enabled by default</param> * <param name = "_dialogueOption">The DialogueOption to run when the option is chosen</param> * <param name = "_endsConversation">If True, the Conversation will end after the DialogueOption has finished running</param> */ public ButtonDialog(int _ID, string _label, bool _startEnabled, DialogueOption _dialogueOption, bool _endsConversation) { label = _label; icon = null; cursorIcon = new CursorIconBase(); isOn = _startEnabled; isLocked = false; conversationAction = (_endsConversation) ? ConversationAction.Stop : ConversationAction.ReturnToConversation; assetFile = null; newConversation = null; dialogueOption = _dialogueOption; lineID = -1; ID = _ID; }
/** * <summary>A constructor for a runtime-generated Conversation's dialogue option.</summary> * <param name = "_ID">An ID number unique to this instance of ButtonDialog within a Conversation</param> * <param name = "_label">The option's display text</param> * <param name = "_isOn">If True, the option will be enabled</param> */ public ButtonDialog(int _ID, string _label, bool _isOn) { label = _label; icon = null; cursorIcon = new CursorIconBase(); isOn = _isOn; isLocked = false; conversationAction = ConversationAction.Stop; assetFile = null; newConversation = null; dialogueOption = null; lineID = -1; ID = _ID; }
private Response OnAnswerConference() { var talkNcco = new TalkAction() { Text = "Hello. You will now be added to the conference call.", VoiceName = "Emma" }; var conferenceNcco = new ConversationAction() { Name = "conference-call" }; var ncco = new Ncco(talkNcco, conferenceNcco); return(ncco.ToString()); }
public void TestConversation() { var expectedJson = @"[{""name"":""vonage-conference-standard"",""musicOnHoldUrl"":[""https://example.com/music.mp3""],""startOnEnter"":""true"",""endOnExit"":""false"",""record"":""true"",""canSpeak"":[""6a4d6af0-55a6-4667-be90-8614e4c8e83c""],""canHear"":[""6a4d6af0-55a6-4667-be90-8614e4c8e83c""],""action"":""conversation""}]"; var conversationAction = new ConversationAction { Name = "vonage-conference-standard", MusicOnHoldUrl = new[] { "https://example.com/music.mp3" }, StartOnEnter = "true", EndOnExit = "false", Record = "true", CanSpeak = new[] { "6a4d6af0-55a6-4667-be90-8614e4c8e83c" }, CanHear = new[] { "6a4d6af0-55a6-4667-be90-8614e4c8e83c" } }; var ncco = new Ncco(conversationAction); Assert.Equal(expectedJson, ncco.ToString()); }
private void Delete(ConversationAction action) { if (_selectedActions.Contains(action)) { Selection.objects = new Object[] { action.parentConversation.gameObject }; } DestroyImmediate(action.gameObject); UpdateUISelection(); Repaint(); if (_selectedConversation != null) { EditorUtility.SetDirty(_selectedConversation); } AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); }
public IActionResult Answer() { var CONF_NAME = Environment.GetEnvironmentVariable("CONF_NAME") ?? "CONF_NAME"; var host = Request.Host.ToString(); //Uncomment the next line if using ngrok with --host-header option //host = Request.Headers["X-Original-Host"]; var sitebase = $"{Request.Scheme}://{host}"; var conversationAction = new ConversationAction() { Name = CONF_NAME, Record = "true", EventMethod = "POST", EventUrl = new string[] { $"{sitebase}/recordconversation/webhooks/recording" } }; var ncco = new Ncco(conversationAction); var json = ncco.ToString(); return(Ok(json)); }
private Response OnAnswerRecordConversation() { var talkAction = new TalkAction() { Text = "Thank you for calling. You will now be joined into the conference", VoiceName = "Kimberly" }; var conversationAction = new ConversationAction() { Name = "A_Conference", Record = "True", EventMethod = "POST", EventUrl = new [] { $"{SiteBase}/webhook/record" } }; var ncco = new Ncco(talkAction, conversationAction); return(ncco.ToString()); }
public void StartCaptions(ConversationAction action, int dialogueIndex) { if (dialogueIndex >= action.Conversations.Count) { for (int i = 0; i < action.InvolvedActors.Count; i++) { Actor actor = GameManager.Instance.Actors[action.InvolvedActors[i]].GetComponent <Actor>(); if (actor.CurAction is ConversationAction) { actor.ExecuteAction(actor.ActionIndex + 1); } else { actor.ResumeAction(); } } return; } AIDialogue dialogue = action.Conversations[dialogueIndex]; StartCoroutine(DelayedFunction(HideIndicator, dialogue.Delay - 0.1f)); int actorID = action.Conversations[dialogueIndex].SpeakerGOIndex; currentSpeaker = actorID; conversationIndex = dialogueIndex; currentAction = action; GameManager.Instance.Actors[actorID].GetComponent <Actor>().CaptionIndicator.SetActive(true); CaptionsPanel.SetActive(true); captionsText.text = dialogue.SpeakerText + ": " + dialogue.Dialogue; captionsText.maxVisibleCharacters = 0; LeanTween.value(captionsText.gameObject, (float x) => captionsText.maxVisibleCharacters = (int)x, 0, captionsText.text.Length, 1); StartCoroutine(DelayedFunction(RunNextCaption, dialogue.Delay)); GetComponentInChildren <CaptionsText>().Target = GameManager.Instance.Actors[actorID].transform; currentAction = action; }
/** * <summary>The default Constructor.</summary> * <param name = "idArray">An array of existing ID numbers, so that a unique ID number can be assigned</param> */ public ButtonDialog(int[] idArray) { label = ""; icon = null; isOn = true; isLocked = false; conversationAction = ConversationAction.ReturnToConversation; assetFile = null; newConversation = null; dialogueOption = null; lineID = -1; ID = 1; isEditing = false; // Update id based on array foreach (int _id in idArray) { if (ID == _id) { ID ++; } } }
/** * <summary>The default Constructor.</summary> * <param name = "idArray">An array of existing ID numbers, so that a unique ID number can be assigned</param> */ public ButtonDialog(int[] idArray) { label = ""; icon = null; isOn = true; isLocked = false; conversationAction = ConversationAction.ReturnToConversation; assetFile = null; newConversation = null; dialogueOption = null; lineID = -1; ID = 1; isEditing = false; // Update id based on array foreach (int _id in idArray) { if (ID == _id) { ID++; } } }
public ConversationDependancy(JSONNode dependancyJSON) { var jsonType = dependancyJSON["type"]; switch (jsonType) { case "player-has": type = DependancyType.PlayerHasItem; break; case "player-does-not-have": type = DependancyType.PlayerDoesNotHaveItem; break; default: Debug.LogError("Unknown dependancy type"); return; } var actionsJSON = dependancyJSON["actions"]; if (actionsJSON == null) { actions = null; } else { actions = new ConversationAction[actionsJSON.Count]; for (int i = 0; i < actionsJSON.Count; i++) { actions[i] = new ConversationAction(actionsJSON[i]); } } objects = ConversationLoader.JSONToStringArray(dependancyJSON, "objects"); }
public async void SendConverationActionNodeNoticeAsync(long userId, long?dialogUserId, long conversationId, ConversationType conversationType, ConversationAction conversationAction, List <long> nodesIds) { try { ConversationActionNodeNotice notice = new ConversationActionNodeNotice(conversationType, conversationAction, conversationId, userId, dialogUserId); await SendNoticeToNodesAsync(notice, nodesIds).ConfigureAwait(false); } catch (Exception ex) { Logger.WriteLog(ex); } }
public ConversationPathAttribute(string path, ConversationAction action) { Path = path ?? throw new ArgumentNullException(nameof(path)); Action = action; }
protected bool RaiseOnException(ConversationAction actionType, Exception e) { bool reThrow = true; if (OnException != null) { var eventArgs = new OnExceptionEventArgs(actionType, e); OnException(this, eventArgs); reThrow = eventArgs.ReThrow; } return reThrow; }
public ConversationAction(JSONNode actionJSON) { string JSONtype = actionJSON["action"]; switch (JSONtype) { case "remove-item": type = ActionType.RemoveItem; break; case "add-item": type = ActionType.AddItem; break; case "replace-responses": type = ActionType.ReplaceResponses; break; case "walk-to": type = ActionType.WalkTo; break; case "run-conversation": type = ActionType.RunConversation; break; case "set-flag": type = ActionType.SetFlag; break; case "say": type = ActionType.Say; break; default: type = ActionType.AddItem; break; } objects = ConversationLoader.JSONToStringArray(actionJSON, "objects"); var requirementsJSON = actionJSON["requirements"]; if (requirementsJSON == null) { requirements = null; } else { requirements = new ActionRequirement[requirementsJSON.Count]; for (int i = 0; i < requirementsJSON.Count; i++) { requirements[i] = new ActionRequirement(requirementsJSON[i]); } } var actionsJSON = actionJSON["actions"]; if (actionsJSON == null) { nextActions = null; } else { nextActions = new ConversationAction[actionsJSON.Count]; for (int i = 0; i < actionsJSON.Count; i++) { nextActions[i] = new ConversationAction(actionsJSON[i]); } } }
internal AggregateOperationResult ProcessItems(ConversationAction actionsFilter, Conversation conversation) { Util.ThrowOnNullArgument(conversation, "conversation"); EnumValidator.ThrowIfInvalid <ConversationAction>(actionsFilter, "actionsFilter"); if (!conversation.ConversationId.Equals(this.ConversationId)) { throw new ArgumentException("Conversation ID of passed conversation doesn't match with id of the action item"); } List <GroupOperationResult> list = new List <GroupOperationResult>(); if (!this.IsCorrectVersion()) { return(Folder.CreateAggregateOperationResult(list)); } ConversationAction conversationAction = this.EnabledActions & actionsFilter; if ((conversationAction & ConversationAction.AlwaysMoveOrDelete) != ConversationAction.None) { LocalizedException ex = null; try { this.ValidateTargetFolderId(this.TargetFolderId); } catch (ObjectNotFoundException ex2) { ex = ex2; } catch (InvalidFolderTypeException ex3) { ex = ex3; } if (ex != null) { list.Add(new GroupOperationResult(OperationResult.Failed, new StoreObjectId[0], ex)); conversationAction &= ~(ConversationAction.AlwaysMove | ConversationAction.AlwaysDelete); } } if ((conversationAction & ConversationAction.AlwaysClutterOrUnclutter) != ConversationAction.None) { MailboxSession mailboxSession = base.Session as MailboxSession; if (mailboxSession != null) { IConversationClutterProcessor conversationClutterProcessor = ConversationClutterProcessorFactory.Create(mailboxSession); if (conversationClutterProcessor != null) { this.processStats.UpdateCount = this.processStats.UpdateCount + (long)conversationClutterProcessor.Process(this.AlwaysClutterOrUnclutterValue.Value, conversation.ConversationTree, list); } } } if ((conversationAction & ConversationAction.AlwaysCategorize) != ConversationAction.None) { this.processStats.UpdateCount = this.processStats.UpdateCount + (long)this.UpdateItems(conversation.ConversationTree, list); } else if (this.ConversationActionLastCategorySet != null) { this.processStats.UpdateCount = this.processStats.UpdateCount + (long)this.UpdateItems(conversation.ConversationTree, list); } if ((conversationAction & ConversationAction.AlwaysMoveOrDelete) != ConversationAction.None) { this.processStats.MoveCount = (long)this.MoveItems(conversation.ConversationTree, list, false); } else if (this.ConversationActionLastMoveFolderId != null) { if (this.ConversationActionLastMoveFolderId.Length == 0) { this.processStats.UpdateCount = this.processStats.UpdateCount + (long)this.MoveItems(conversation.ConversationTree, list, true); } else { this.ConversationActionLastMoveFolderId = null; } } return(Folder.CreateAggregateOperationResult(list)); }
public async void SendConversationActionNoticeAsync(long userId, ConversationType conversationType, long conversationId, ConversationAction action) { try { List <long> usersIds = null; ConversationActionNotice notice = null; switch (conversationType) { case ConversationType.Dialog: { var users = await loadDialogsService.GetDialogUsersAsync(conversationId).ConfigureAwait(false); var secondUser = users.FirstOrDefault(opt => opt.Id != userId); usersIds = new List <long> { secondUser.Id.Value }; var dialogId = await loadDialogsService.GetMirrorDialogIdAsync(conversationId); notice = new ConversationActionNotice(dialogId, ConversationType.Dialog, userId, action); } break; case ConversationType.Chat: { usersIds = await loadChatsService.GetChatUsersIdAsync(conversationId); notice = new ConversationActionNotice(conversationId, ConversationType.Chat, userId, action); } break; case ConversationType.Channel: { usersIds = await loadChannelsService.GetChannelUsersIdAsync(conversationId); notice = new ConversationActionNotice(conversationId, ConversationType.Channel, null, action); } break; default: return; } usersIds.Remove(userId); var clientConnections = connectionsService.GetClientConnections(usersIds); await SendNoticeToClientsAsync(clientConnections, notice); } catch (Exception ex) { Logger.WriteLog(ex); } }
public OnExceptionEventArgs(ConversationAction action, Exception exception) { Action = action; Exception = exception; ReThrow = true; }
private void ConversationActionReceived(ConversationAction conversationAction) { conversationActionEvent.Invoke(conversationAction); //do stuff with camera? }