public bool TrySelect(out InteractionNode node) { node = null; if (is_choice()) { if (this.choice_controller.GetConfirmed(out int chosen)) { node = choice_node.GetNextNodeForChoice(chosen); Hide(); return(true); } } else if (is_recipe()) { if (this.recipe_controller.GetConfirmed(out var chosen)) { node = recipe_node.GetNextNodeForChoiceAndMake(inventory, chosen); Hide(); return(true); } } else if (do_confirm) { node = dialogue_node.GetNextNode(); do_confirm = false; Hide(); return(true); } return(false); }
public void can_execute_a_preview() { var method = Mock <IMethod>(); var target = new MethodHost(); var parameter = new object(); methodFactory.Expect(x => x.CreateFrom(info)) .Return(method); var handlingNode = new InteractionNode( new ControlHost(), Mock <IRoutedMessageController>() ); handlingNode.RegisterHandler(Mock <IRoutedMessageHandler>()); handlingNode.MessageHandler.Stub(x => x.Unwrap()) .Return(target); attribute.Initialize(typeof(MethodHost), null, container); method.Stub(x => x.Info).Return(info); attribute.Execute(null, handlingNode, new[] { parameter }); method.AssertWasCalled(x => x.Invoke(target, parameter)); }
public void disableButton() { Message.GetComponent <Button>().interactable = false; Message.SetActive(false); Player.GetComponent <Walk>().canWalk = true; activeNode = null; }
public void can_execute_a_callback() { var method = Mock <IMethod>(); var target = new MethodHost(); var result = new object(); var handlingNode = new InteractionNode( new ControlHost(), Mock <IRoutedMessageController>() ); handlingNode.RegisterHandler(Mock <IRoutedMessageHandler>()); handlingNode.MessageHandler.Stub(x => x.Unwrap()) .Return(target); methodFactory.Expect(x => x.CreateFrom(info)) .Return(method); attribute.Initialize(typeof(MethodHost), null, container); method.Expect(x => x.Invoke(target, result)).Return(typeof(string)); method.Stub(x => x.Info).Return(typeof(object).GetMethod("ToString")); var outcome = new MessageProcessingOutcome(result, result.GetType(), false); attribute.Execute(null, handlingNode, outcome); }
public void can_execute_a_callback() { var method = Mock<IMethod>(); var target = new MethodHost(); var result = new object(); var handlingNode = new InteractionNode( new ControlHost(), Mock<IRoutedMessageController>() ); handlingNode.RegisterHandler(Mock<IRoutedMessageHandler>()); handlingNode.MessageHandler.Stub(x => x.Unwrap()) .Return(target); methodFactory.Expect(x => x.CreateFrom(info)) .Return(method); attribute.Initialize(typeof(MethodHost), null, container); method.Expect(x => x.Invoke(target, result)).Return(typeof(string)); method.Stub(x => x.Info).Return(typeof(object).GetMethod("ToString")); var outcome = new MessageProcessingOutcome(result, result.GetType(), false); attribute.Execute(null, handlingNode, outcome); }
public void can_handle_an_exception() { var method = Mock<IMethod>(); method.Stub(x => x.Info).Return(info); var target = new MethodHost(); var exception = new Exception(); var handlingNode = new InteractionNode( new ControlHost(), Mock<IRoutedMessageController>() ); handlingNode.RegisterHandler(Mock<IRoutedMessageHandler>()); handlingNode.MessageHandler.Stub(x => x.Unwrap()) .Return(target); methodFactory.Expect(x => x.CreateFrom(info)) .Return(method); attribute.Initialize(typeof(MethodHost), null, container); attribute.Handle(null, handlingNode, exception); method.AssertWasCalled(x => x.Invoke(target, exception)); }
public static new void CreateEditor(ContentControl document) { RodskaApp app = (RodskaApp)RodskaApp.Current; document.Content = null; ITypeFactory typeFactory = app.currentMainVM.GetTypeFactory(); MainWindow mainWindow = (MainWindow)app.MainWindow; if (mainWindow.CurrentDocument == null) { return; } InteractionLiteral interaction = (InteractionLiteral)mainWindow.CurrentDocument; InteractionViewModel interactionView = typeFactory.CreateInstanceWithParametersAndAutoCompletion <InteractionViewModel>(interaction); InteractionControl control = new InteractionControl(interactionView); control.interactionWorkspace.ViewModel = new NodeNetwork.ViewModels.NetworkViewModel(); InteractionNode node = new InteractionNode(interaction); control.interactionWorkspace.ViewModel.Nodes.Add(node); node.Name = interaction.Title; control.CurrentDocument = interaction; document.Content = control; }
protected override void given_the_context_of() { _controller = Mock<IRoutedMessageController>(); _parent = new StackPanel(); _element = new Button(); _parentNode = new InteractionNode(_parent, _controller); _node = new InteractionNode(_element, _controller); _parent.Children.Add(_element); }
protected override void given_the_context_of() { controller = Mock <IRoutedMessageController>(); parent = new StackPanel(); element = new Button(); element.Focus(); parentNode = new InteractionNode(parent, controller); node = new InteractionNode(element, controller); parent.Children.Add(element); }
public InteractionNode Select() { InteractionNode nextNode = null; if (choice_node != null) { nextNode = choice_node.GetNextNodeForChoice(valid_choices[current_choice]); } else { nextNode = dialogue_node.GetNextNode(); } Hide(); return(nextNode); }
void Start() { InteractionNode n0 = new InteractionNode("Have we met before?", "I don't know...have we!?!?!", 2); InteractionNode n1 = new InteractionNode(".............", "Just kidding, we've never met. I'm Gob -- you may recognize me from the cover of " + "Poof magazine. I'm a ~magician~", 0); InteractionNode n2 = new InteractionNode("Oh...right, hey, um, you!", "Just kidding, we've never met. I'm Gob -- you may recognize me from the cover of " + "Poof magazine. I'm a ~magician~", 0); InteractionNode n3 = new InteractionNode("How do you know Jon Hannity?", "We worked together for a while after college, but have sort of lost" + " touch since then. I hope I haven't made a huge mistake by coming here tonight...", 0); n0.Adj [0] = n1; n0.Adj [1] = n2; InteractionNode[] OriginalList = new InteractionNode[2]; OriginalList[0] = n0; OriginalList [1] = n3; Graph = new InteractionGraph(OriginalList); }
public bool FindUserInput(string clicked, GameObject ButtonContainer, Text JustText, GameObject NextButton) { for (int i = 0; i < CurrentList.Length; i++) { if (CurrentList [i].Question.Equals(clicked)) { // show answer ButtonContainer.SetActive(false); CurrentList [i].Asked = true; JustText.text = CurrentList [i].Answer; CurrentNode = CurrentList [i]; NextButton.SetActive(true); // wait until click next return(false); } } return(true); }
public InteractionGraph(InteractionNode curr, InteractionNode[] origList) { this.CurrentNode = curr; this.CurrentList = origList; this.OriginalList = origList; }
public void SetActiveNode(InteractionNode target) { activeNode = target; }