/** * Creates and returns the visual and spoken response with shouldEndSession flag * * @param title * title for the companion application home card * @param output * output content for speech and companion application home card * @param shouldEndSession * should the session be closed * @return SpeechletResponse spoken and visual response for the given input */ private SpeechletResponse BuildSpeechletResponse(string title, string output, bool shouldEndSession) { // Create the Simple card content. var card = new SimpleCard { Title = "Unidesk Dishwasher", //Subtitle = "Unidesk Dishwasher - Sub Title", Content = $"Unidesk Diskwasher - {output}" }; // Create the plain text output. var speech = new PlainTextOutputSpeech { Text = output }; // Create the speechlet response. var response = new SpeechletResponse { ShouldEndSession = shouldEndSession, OutputSpeech = speech, Card = card }; return(response); }
public ResponseAttributes() { ShouldEndSession = true; OutputSpeech = new OutputSpeechAttributes(); Card = new SimpleCard(); Reprompt = new RepromptAttributes(); }
private (string, SimpleCard) createAlexaResponse(List <Results> gameCombis, List <Users> gamePlayers) { StringBuilder callSb = new StringBuilder(); StringBuilder cardSb = new StringBuilder(); for (int i = 0; i < gameCombis.Count / 2; i++) { callSb.Append(string.Format(CALL_COAT, i + 1)); callSb.Append(string.Format(CALL_PAIR, gamePlayers.Where(usr => usr.id == gameCombis[2 * i].user1).FirstOrDefault().name_kana, gamePlayers.Where(usr => usr.id == gameCombis[2 * i].user2).FirstOrDefault().name_kana)); callSb.Append(string.Format(CALL_VIRSUS, i)); callSb.Append(string.Format(CALL_PAIR, gamePlayers.Where(usr => usr.id == gameCombis[2 * i + 1].user1).FirstOrDefault().name_kana, gamePlayers.Where(usr => usr.id == gameCombis[2 * i + 1].user2).FirstOrDefault().name_kana)); callSb.Append(" 。 "); cardSb.Append(string.Format(CARD_ROW, i + 1, gamePlayers.Where(usr => usr.id == gameCombis[2 * i].user1).FirstOrDefault().name, gamePlayers.Where(usr => usr.id == gameCombis[2 * i].user2).FirstOrDefault().name)); cardSb.Append("\n"); cardSb.Append(string.Format(CARD_ROW, i + 1, gamePlayers.Where(usr => usr.id == gameCombis[2 * i + 1].user1).FirstOrDefault().name, gamePlayers.Where(usr => usr.id == gameCombis[2 * i + 1].user2).FirstOrDefault().name)); cardSb.Append("\n"); } var card = new SimpleCard() { Title = "ペア決め", Content = cardSb.ToString(), }; return(callSb.ToString(), card); }
public void TestDeck_SortCards_ShouldPass() { var shufledCards = new Queue <SimpleCard>(fullDeck); shufledCards.Shuffle(); var deck = new CardsCollection(); foreach (var card in shufledCards) { deck.Add(card); } System.Console.WriteLine(); var sortedDeck = deck.OrderBy(x => x); SimpleCard checkCard = null; foreach (var item in sortedDeck) { checkCard = item as SimpleCard; break; } SimpleCard firstCard = new SimpleCard(CardType.Two, Suit.Clubs); bool areSame = checkCard.Equals(firstCard); Assert.IsTrue(areSame); }
/// <summary> /// build the speech response /// </summary> /// <param name="title"></param> /// <param name="output"></param> /// <param name="reprompt"></param> /// <param name="shouldEndSession"></param> /// <returns>void</returns private void BuildSpeechResponse(string title, string speechOutput, string reprompt, bool shouldEndSession) { if (title != string.Empty) { // Create the Simple card content. SimpleCard card = new SimpleCard(); card.Title = title; card.Content = reprompt; skillResponse.Response.Card = card; } // create the speech response IOutputSpeech speechMessage = new PlainTextOutputSpeech(); (speechMessage as PlainTextOutputSpeech).Text = speechOutput; if (reprompt != string.Empty) { PlainTextOutputSpeech speech = new PlainTextOutputSpeech(); speech.Text = reprompt; skillResponse.Response.Reprompt = new Reprompt(); skillResponse.Response.Reprompt.OutputSpeech = speech; } skillResponse.Response.OutputSpeech = speechMessage; skillResponse.Response.ShouldEndSession = shouldEndSession; }
private SpeechletResponse BuildSpeechletResponse(string title, string output, bool shouldEndSession, LaunchRequest launchRequest, IntentRequest intentRequest, Session session) { _logService.LogRequest(intentRequest, session, output); // Create the Simple card content. SimpleCard card = new SimpleCard(); card.Title = title; card.Content = output; SsmlOutputSpeech ssml = new SsmlOutputSpeech() { Ssml = "<speak>" + output + " </speak>" }; // Create the speechlet response. SpeechletResponse response = new SpeechletResponse() { ShouldEndSession = shouldEndSession, OutputSpeech = ssml, Card = card }; //response.Card = card; return(response); }
/** * Creates and returns the visual and spoken response with shouldEndSession flag * * @param title * title for the companion application home card * @param output * output content for speech and companion application home card * @param shouldEndSession * should the session be closed * @return SpeechletResponse spoken and visual response for the given input */ private SpeechletResponse BuildSpeechletResponse(string title, string output, bool shouldEndSession) { // Create the Simple card content. var consentCard = new AskForPermissionsConsentCard(); consentCard.PermissionType = PermissionType.CountryAndPostalCode; SimpleCard card = new SimpleCard(); card.Title = String.Format("SessionSpeechlet - {0}", title); card.Subtitle = String.Format("SessionSpeechlet - Sub Title"); card.Content = String.Format("SessionSpeechlet - {0}", output); // Create the plain text output. PlainTextOutputSpeech speech = new PlainTextOutputSpeech(); speech.Text = output; // Create the speechlet response. SpeechletResponse response = new SpeechletResponse(); response.ShouldEndSession = shouldEndSession; response.OutputSpeech = speech; response.Card = card; return(response); }
private async Task <SpeechletResponse> BuildSpeechletResponse(string title, string output, bool shouldEndSession) { // Create the Simple card content. SimpleCard card = new SimpleCard(); card.Title = String.Format("SessionSpeechlet - {0}", title); card.Subtitle = String.Format("SessionSpeechlet - Sub Title"); card.Content = String.Format("SessionSpeechlet - {0}", output); // Create the plain text output. //PlainTextOutputSpeech speech = new PlainTextOutputSpeech(); SsmlOutputSpeech speech = new SsmlOutputSpeech(); speech.Ssml = string.Format("<speak>{0}</speak>", output); // Create the speechlet response. SpeechletResponse response = new SpeechletResponse(); response.ShouldEndSession = shouldEndSession; response.OutputSpeech = speech; response.Card = card; return(response); }
/** * Creates and returns the visual and spoken response with shouldEndSession flag * * @param title * title for the companion application home card * @param output * output content for speech and companion application home card * @param shouldEndSession * should the session be closed * @return SpeechletResponse spoken and visual response for the given input */ private SpeechletResponse BuildSpeechletResponse(string title, string output, string reprompt_out, bool shouldEndSession) { // Create the Simple card content. SimpleCard card = new SimpleCard(); card.Title = String.Format(title); card.Subtitle = String.Format("Star Citizen"); card.Content = String.Format(output); // Create the plain text output. PlainTextOutputSpeech speech = new PlainTextOutputSpeech(); speech.Text = output; PlainTextOutputSpeech reprompt_speech = new PlainTextOutputSpeech(); reprompt_speech.Text = reprompt_out; // Create the speechlet response. SpeechletResponse response = new SpeechletResponse(); response.ShouldEndSession = shouldEndSession; response.OutputSpeech = speech; response.Card = card; //if (!shouldEndSession) //{ response.Reprompt.OutputSpeech = reprompt_speech; // return response; //} return(response); }
protected SpeechletResponse BuildSpeechletResponse(string title, string output, bool shouldEndSession) { // Create the Simple card content. var card = new SimpleCard { Title = String.Format("SessionSpeechlet - {0}", title), Content = String.Format("SessionSpeechlet - {0}", output) }; // Create the plain text output. var speech = new PlainTextOutputSpeech { Text = output }; // Create the speechlet response. var response = new SpeechletResponse { ShouldEndSession = shouldEndSession, OutputSpeech = speech, Card = card }; return(response); }
private SpeechletResponse BuildSpeechletResponse(string title, string output, bool shouldEndSession, LaunchRequest launchRequest, IntentRequest intentRequest, Session session) { _logService.LogRequest(launchRequest, session, output); _logService.LogRequest(intentRequest, session, output); // Create the Simple card content. SimpleCard card = new SimpleCard() { Title = title, Content = output }; // Create the plain text output. SsmlOutputSpeech speech = new SsmlOutputSpeech(); speech.Ssml = "<speak>" + output + " </speak>"; // Create the speechlet response. SpeechletResponse response = new SpeechletResponse(); response.ShouldEndSession = shouldEndSession; response.OutputSpeech = speech; if (String.IsNullOrWhiteSpace(output)) { //response.Card = card; } return(response); }
public static SpeechletResponse CompileResponse(string output) { //var response = new SpeechletResponse //{ // OutputSpeech = new PlainTextOutputSpeech { Text = output }, // ShouldEndSession = true //}; //return response; var card = new SimpleCard { Title = "Home Tips" }; var textInfo = new CultureInfo("en-US", false).TextInfo; card.Content = textInfo.ToTitleCase(output); // Create the plain text output. var speech = new PlainTextOutputSpeech { Text = output }; // Create the speechlet response. var response = new SpeechletResponse { ShouldEndSession = true, OutputSpeech = speech, Card = card }; return(response); }
/// <summary> /// Create the basic response to the user /// </summary> /// <param name="title">Title of the card displayed on the mobile device</param> /// <param name="cardText">Text for the card</param> /// <param name="outputText">Spoken text to the user</param> /// <param name="repromptText">Spoken text to the user if they don't respond promptly</param> /// <param name="shouldEndSession">Whether this response finishes the session / game</param> /// <returns>Core response</returns> private static Response CreateCoreResponse( string title, string cardText, string outputText, string repromptText, bool shouldEndSession = false) { var card = new SimpleCard { Title = title, Content = cardText }; return(new Response() { Card = card, OutputSpeech = new PlainTextOutputSpeech() { Text = outputText }, Reprompt = new Reprompt() { OutputSpeech = new PlainTextOutputSpeech { Text = repromptText } }, ShouldEndSession = shouldEndSession }); }
private SpeechletResponse BuildSpeechletResponse(string title, string output, bool shouldEndSession) { // Create the Simple card content. SimpleCard card = new SimpleCard(); card.Title = title; TextInfo textInfo = new CultureInfo("en-GB", false).TextInfo; card.Content = textInfo.ToTitleCase(output); // Create the plain text output. PlainTextOutputSpeech speech = new PlainTextOutputSpeech(); speech.Text = output; // Create the speechlet response. SpeechletResponse response = new SpeechletResponse(); response.ShouldEndSession = shouldEndSession; response.OutputSpeech = speech; response.Card = card; Reprompt reprompt = new Reprompt() { OutputSpeech = speech }; response.Reprompt = reprompt; return(response); }
public void Creates_Valid_SimpleCard() { var actual = new SimpleCard { Title = ExampleTitle, Content = ExampleBodyText }; Assert.True(Utility.CompareJson(actual, "SimpleCard.json")); }
public static void SaveCardLocal(SimpleCard simpleCard) { ApplicationDataContainer localSettings = ApplicationData.Current.LocalSettings; localSettings.Values[simpleCard.Id + ".id"] = simpleCard.Id; localSettings.Values[simpleCard.Id + ".name"] = simpleCard.Name; localSettings.Values[simpleCard.Id + ".image"] = simpleCard.ImageUri; }
public void DisplayAsFocus(SimpleCard simpleCard) { System.Diagnostics.Debug.WriteLine("Displaying as focus card"); CardsDisplayed.Clear(); CardsDisplayed.Add(simpleCard); TitleText = simpleCard.Name; contentTitle.Text = simpleCard.Name; }
public static SpeechletResponse BuildSpeechletResponse(SimpleIntentResponse simpleIntentResponse, bool shouldEndSession) { SpeechletResponse response = new SpeechletResponse(); response.ShouldEndSession = shouldEndSession; // Create the speechlet response from SimpleIntentResponse. // If there's an ssmlString use that as the spoken reply // If ssmlString is empty, speak cardText if (simpleIntentResponse.ssmlString != "") { SsmlOutputSpeech speech = new SsmlOutputSpeech(); speech.Ssml = simpleIntentResponse.ssmlString; response.OutputSpeech = speech; } else { PlainTextOutputSpeech speech = new PlainTextOutputSpeech(); speech.Text = simpleIntentResponse.cardText; response.OutputSpeech = speech; } // if images are passed, then assume a standard card is wanted // images should be stored in the ~/Images/ folder and follow these requirements // JPEG or PNG supported, no larger than 2MB // 720x480 - small size recommendation // 1200x800 - large size recommendation if (simpleIntentResponse.smallImage != "" && simpleIntentResponse.largeImage != "") { StandardCard card = new StandardCard(); card.Title = AlexaConstants.AppName; card.Text = simpleIntentResponse.cardText; // The trailing slash after the image name is required because we're serving off the image through a Web API controller and // don't want to change the default web project settings card.Image = new Image() { LargeImageUrl = "https://" + System.Web.HttpContext.Current.Request.Url.Host + "/api/alexaimages/" + simpleIntentResponse.largeImage + "/", SmallImageUrl = "https://" + System.Web.HttpContext.Current.Request.Url.Host + "/api/alexaimages/" + simpleIntentResponse.smallImage + "/", }; response.Card = card; } else { SimpleCard card = new SimpleCard(); card.Title = AlexaConstants.AppName; card.Content = simpleIntentResponse.cardText; response.Card = card; } return(response); }
public static SkillResponse TellWithCard(IOutputSpeech speechResponse, string title, string content, Session sessionAttributes) { SimpleCard card = new SimpleCard(); card.Content = content; card.Title = title; return(BuildResponse(speechResponse, true, sessionAttributes, null, card)); }
public static SkillResponse AskWithCard(IOutputSpeech speechResponse, string title, string content, Reprompt reprompt, Session sessionAttributes) { SimpleCard card = new SimpleCard(); card.Content = content; card.Title = title; return(BuildResponse(speechResponse, false, sessionAttributes, reprompt, card)); }
public static CrunchResponse TellWithCard(IOutputSpeech speechResponse, string title, string content) { SimpleCard card = new SimpleCard(); card.Content = content; card.Title = title; return(BuildResponse(speechResponse, true, null, null, card)); }
public void MessageActivityWithAlexaCardDirectiveAttachmentsConverted() { var skillRequest = SkillRequestHelper.CreateIntentRequest(); var mapper = new AlexaRequestMapper(); var activity = Activity.CreateMessageActivity() as Activity; activity.Text = "Hello world"; var hintDirective = new HintDirective("hint text"); var displayDirective = new DisplayRenderTemplateDirective() { Template = new BodyTemplate1() { BackgroundImage = new TemplateImage() { ContentDescription = "Test", Sources = new List <ImageSource>() { new ImageSource() { Url = "https://via.placeholder.com/576.png/09f/fff", } } }, Content = new TemplateContent() { Primary = new TemplateText() { Text = "Test", Type = "PlainText" } }, Title = "Test title", } }; var simpleCard = new SimpleCard() { Title = "This is a simple card", Content = "This is the simple card content" }; activity.Attachments.Add(hintDirective.ToAttachment()); activity.Attachments.Add(displayDirective.ToAttachment()); activity.Attachments.Add(simpleCard.ToAttachment()); var skillResponse = ExecuteActivityToResponse(mapper, new MergedActivityResult { MergedActivity = activity }, skillRequest); VerifyCardAttachmentAndDirectiveResponse(skillResponse, simpleCard, new List <IDirective>() { hintDirective, displayDirective }); }
public void HasSimpleCardPositiveCheck() { var assertCard = new SimpleCard { Content = "test" }; var response = ResponseBuilder.Empty(); response.Response.Card = assertCard; var simpleCard = response.HasCard <SimpleCard>(); }
public void HasCardPositiveCheck() { var assertCard = new SimpleCard(); var response = ResponseBuilder.Empty(); response.Response.Card = assertCard; var card = response.HasCard(); Assert.NotNull(card); Assert.Equal(assertCard, card); }
/// <summary> /// Add a card to the deck list. /// </summary> /// <param name="card">The card.</param> /// <exception cref="System.ArgumentException"></exception> /// <exception cref="System.ArgumentNullException"></exception> internal void Add(SimpleCard card) { if (cards.ContainsKey(card)) { cards[card] += 1; } else { cards.Add(card, 1); } Count++; }
public void ReceiveObject(MonoBehaviour obj) { SimpleCard card = obj.GetComponent <SimpleCard>(); if (card == null) { return; } Debug.Log("PlayerSelection.ReceivedCard", card); PreparationMain.Instance.MoveCardToPlayerSelection(card); card.state = new Movable(card); }
public static ObservableCollection <SimpleCard> LoadAllCardsLocal() { ObservableCollection <SimpleCard> cardsLoaded = new ObservableCollection <SimpleCard>(); foreach (Guid id in Ids) { SimpleCard cardLoaded = LoadCardLocal(id); if (!cardLoaded.Name.Equals("errorCard")) { cardsLoaded.Add(LoadCardLocal(id)); } } return(cardsLoaded); }
/// <summary> /// Create a simple permanent minion card. /// </summary> /// <param name="cardId">The card id.</param> /// <param name="name">The card name.</param> /// <param name="text">The card text.</param> /// <param name="manaCost">The mana cost of the card.</param> /// <param name="cardSet">The set the card belongs to.</param> /// <param name="heroClass">The hero class the card belongs to.</param> /// <param name="rarity">The card rarity.</param> /// <returns>A new simple card.</returns> internal static SimpleCard MakePermanentCard( string cardId, string name, string text, int manaCost, Enums.CardSet cardSet, Enums.HeroClass heroClass, Enums.CardRarity rarity) { SimpleCard make = new SimpleCard(cardId, name, text, manaCost, cardSet, Enums.CardType.Minion, heroClass, rarity); make.MinionType = Enums.MinionType.Permanent; return(make); }
/// <summary> /// Create a new simple spell card with a specified spell type. /// </summary> /// <param name="cardId">The card id.</param> /// <param name="name">The card name.</param> /// <param name="text">The card text.</param> /// <param name="manaCost">The mana cost of the card.</param> /// <param name="cardSet">The set the card belongs to.</param> /// <param name="heroClass">The hero class the card belongs to.</param> /// <param name="rarity">The card rarity.</param> /// <param name="spellType">The type of the sepll.</param> /// <returns>A new simple card.</returns> internal static SimpleCard MakeSpellCard( string cardId, string name, string text, int manaCost, Enums.CardSet cardSet, Enums.HeroClass heroClass, Enums.CardRarity rarity, Enums.SpellType spellType) { SimpleCard make = new SimpleCard(cardId, name, text, manaCost, cardSet, Enums.CardType.Spell, heroClass, rarity); make.SpellType = spellType; return(make); }
protected override void Init() { base.Init(); /* Cerco un file di configurazione dei tracking devices nel fileSystem, * se lo trovo carico i tracking devices contenuti */ /* Tracking Devices HardCoded */ for (int i = 0; i < 4; i++) { ITrackingDevice trackingDevice = new SimpleCard(i); AddTrackingDevice(trackingDevice); } }
public void Test_CheckThreeKindHand_ShouldPass() { var card1 = new SimpleCard(CardType.Ace, Suit.Clubs); var card2 = new SimpleCard(CardType.Ace, Suit.Diamonds); var card3 = new SimpleCard(CardType.Ace, Suit.Hearts); var card4 = new SimpleCard(CardType.Eight, Suit.Spades); var card5 = new SimpleCard(CardType.Nine, Suit.Diamonds); var hand = new Hand(); hand.Add(card1); hand.Add(card2); hand.Add(card3); hand.Add(card4); hand.Add(card5); var sortedHand = hand.Sort(); var firstHand = new HandEvaluator(sortedHand); var result = firstHand.EvaluateHand(); Assert.AreEqual(HandStrength.ThreeKind, result); }
public void Test_CheckHighCardHand_ShouldPass() { var card1 = new SimpleCard(CardType.Three, Suit.Clubs); var card2 = new SimpleCard(CardType.Two, Suit.Diamonds); var card3 = new SimpleCard(CardType.Seven, Suit.Hearts); var card4 = new SimpleCard(CardType.Five, Suit.Spades); var card5 = new SimpleCard(CardType.Nine, Suit.Diamonds); var hand = new Hand(); hand.Add(card1); hand.Add(card2); hand.Add(card3); hand.Add(card4); hand.Add(card5); var sortedHand = hand.Sort(); var firstHand = new HandEvaluator(sortedHand); firstHand.EvaluateHand(); bool highCard = firstHand.HandValue.HighCard.Equals((int)card5.Type); Assert.IsTrue(highCard); }
public void AddCard(SimpleCard card) { throw new NotImplementedException(); }
public void TestDeck_SortCards_ShouldPass() { var shufledCards = new Queue<SimpleCard>(fullDeck); shufledCards.Shuffle(); var deck = new CardsCollection(); foreach (var card in shufledCards) { deck.Add(card); } System.Console.WriteLine(); var sortedDeck = deck.OrderBy(x => x); SimpleCard checkCard = null; foreach (var item in sortedDeck) { checkCard = item as SimpleCard; break; } SimpleCard firstCard = new SimpleCard(CardType.Two, Suit.Clubs); bool areSame = checkCard.Equals(firstCard); Assert.IsTrue(areSame); }