private Interaction DrawInteractionField(string name, Story nextStory, Interaction.InteractionType type) { GUILayout.BeginHorizontal(); GUILayout.Label("Interaction:"); name = EditorGUILayout.TextField(name); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); bool isInterrupt = (type == Interaction.InteractionType.Interrupt); GUILayout.Label("Interrupt?"); isInterrupt = EditorGUILayout.Toggle(isInterrupt); GUILayout.EndHorizontal(); if (name != null && name != "") { return(new Interaction(name, nextStory, isInterrupt ? Interaction.InteractionType.Interrupt : Interaction.InteractionType.Continue)); } else { return(null); } }
private void DrawAllInteractionFields() { List <Interaction> newInteractions = new List <Interaction>(); if (story.interactions != null) { foreach (Interaction interaction in story.interactions) { string name = interaction.name; Story nextStory = interaction.nextStory; Interaction.InteractionType type = interaction.type; Interaction newInteraction = DrawInteractionField(name, nextStory, type); if (newInteraction != null) { newInteractions.Add(newInteraction); } } } Interaction newBlankInteraction = DrawInteractionField(null, null, Interaction.InteractionType.Continue); if (newBlankInteraction != null) { newInteractions.Add(newBlankInteraction); } story.UpdateInteractions(newInteractions); }
public async Task RemoveInteractionAsync(User user, Announcement announcement, Interaction.InteractionType interactionType) { Interaction interaction = await InteractionRepository.FindAsync(announcement, user, interactionType); if (interaction == null) { return; } InteractionRepository.RemoveUserInteraction(interaction); }
public async Task <Interaction> FindAsync(Announcement announcement, User user, Interaction.InteractionType interactionType) { return(await context.Interaction.SingleOrDefaultAsync(ui => ui.Announcement.Equals(announcement) && ui.User.Equals(user) && ui.Type.Equals(interactionType))); }
public async Task <Interaction> AddInteractionAsync(User user, Announcement announcement, Interaction.InteractionType interactionType) { if (announcement.User.Equals(user)) { return(null); } var existInteraction = await InteractionRepository.FindAsync(announcement, user, interactionType); if (existInteraction != null) { return(existInteraction); } Interaction interaction = new Interaction { User = user, Announcement = announcement, Type = interactionType }; await InteractionRepository.AddInteractionAsync(interaction); await unitOfWork.CompleteAsync(); var base_url = "http://recommendation-service:7878"; var request = new HttpRequestMessage(HttpMethod.Get, $"{base_url}/{user.Id}"); var client = ClientFactory.CreateClient(); _ = client.SendAsync(request); return(interaction); }