public void AfterChatbotFinishes(AgentResponse ar) { AgentResponse agentResponse = ar; agentsController.myNLU.GiveTextToUnderstand(agentsController.GetCurrentAgent(), agentResponse.responseText); watsonSpeaker.SetTone(agentsController.GetCurrentAgent()); watsonSpeaker.SetTextOCEANForCurrentText(agentResponse.responseTextOCEAN); watsonSpeaker.SpeakText(agentsController.GetCurrentAgent(), agentResponse.responseText); }
private void AnimShowPassLate() { agentsController.GetCurrentAgent().SetAnimation(2); }
public override AgentResponse DecodeResponse(EntityIntent ei) { // get textOCEAN from agent textOCEAN = agentsController.GetCurrentAgent().DetermineTextOCEAN(); AgentResponse agentResponse = new AgentResponse("EMPTY"); agentResponse.responseTextOCEAN = textOCEAN; print("decoding: " + ei.Intent + " * " + textOCEAN); switch (ei.Intent) { case "ProductList": // 01 currentStateNo = 1; if (currentlyOrdering == CurrentlyOrdering.BURGER) { agentResponse.responseText = GetFastFoodText(textOCEAN, 2); } else if (currentlyOrdering == CurrentlyOrdering.DRINK) { agentResponse.responseText = GetFastFoodText(textOCEAN, 3); } else if (currentlyOrdering == CurrentlyOrdering.SIDE) { agentResponse.responseText = GetFastFoodText(textOCEAN, 4); } break; case "BurgerList": // 02 currentStateNo = 2; agentResponse.responseText = GetFastFoodText(textOCEAN, 2); break; case "DrinkList": // 03 currentStateNo = 3; agentResponse.responseText = GetFastFoodText(textOCEAN, 3); break; case "SideList": // 04 currentStateNo = 4; agentResponse.responseText = GetFastFoodText(textOCEAN, 4); break; case "WantProduct": // 05 - 06 - 07 productId = GetProductId(ei.Entity); if (productId != -1) { if (currentStateNo == 9) { currentStateNo = 9; agentResponse.responseText = GetFastFoodText(textOCEAN, 10); agentResponse.responseText = agentResponse.responseText.Replace("%product", "" + productNames[productId]); } else { if (productId == 0 || productId == 1 || productId == 2 || productId == 3) { // this is a burger // check if it is in menu menuId = CheckProducInMenu(productId); if (menuId != -1) { currentStateNo = 5; agentResponse.responseText = GetFastFoodText(textOCEAN, 5); agentResponse.responseText = agentResponse.responseText.Replace("%menu", menuNames[menuId]); agentResponse.responseText = agentResponse.responseText.Replace("%price", "" + menuPrices[menuId]); } else { currentStateNo = 6; AddProductToOrder(productId, false); // it is not in menu, so add it agentResponse.responseText = GetFastFoodText(textOCEAN, 6); currentlyOrdering = CurrentlyOrdering.DRINK; } } else if (productId == 4 || productId == 5 || productId == 6) { // this is a drink askedIfLarge = true; agentResponse.responseText = GetFastFoodText(textOCEAN, 8); currentlyOrdering = CurrentlyOrdering.SIDE; } else { // this ia a side meal currentlyOrdering = CurrentlyOrdering.BURGER; } } } else { // we do not sell this. currentStateNo = 7; agentResponse.responseText = GetFastFoodText(textOCEAN, 7); agentResponse.responseText = agentResponse.responseText.Replace("%product", ei.Entity); } break; case "Yes": if (currentStateNo == 5) { currentStateNo = 8; agentResponse.responseText = GetFastFoodText(textOCEAN, 8); agentResponse.responseText = agentResponse.responseText.Replace("%price", "" + (menuPrices[menuId] + 2f)); } else if (currentStateNo == 8) // make selection large! { currentStateNo = 9; agentResponse.responseText = GetFastFoodText(textOCEAN, 9); AddMenuToOrder(menuId, true); } else { agentResponse.responseText = "Yes to what?"; } break; case "No": if (currentStateNo == 8) { currentStateNo = 9; agentResponse.responseText = GetFastFoodText(textOCEAN, 9); AddMenuToOrder(menuId, false); } else if (currentStateNo == 9) { currentStateNo = 11; agentResponse.responseText = GetFastFoodText(textOCEAN, 11); agentResponse.responseText = agentResponse.responseText.Replace("%price", "" + totalPrice); } break; case "CreditCard": // play credit animation currentStateNo = 12; agentResponse.responseText = GetFastFoodText(textOCEAN, 12); break; case "Cash": // play cash animation currentStateNo = 12; agentResponse.responseText = GetFastFoodText(textOCEAN, 12); break; default: agentResponse.responseText = "ERROR! " + ei.Intent; break; } return(agentResponse); }