Exemplo n.º 1
0
        public async Task CetusTimeIntent(IDialogContext context, LuisResult result)
        {
            var response = context.MakeMessage();

            var worldState = CurrentWorldState;

            var card = new HeroCard()
            {
                Title  = string.Format("It's {0} on the Plains.", worldState.cetusCycle.isDay ? "daytime" : "night"),
                Images = new List <CardImage>()
                {
                    new CardImage(worldState.cetusCycle.isDay ? "https://i.imgur.com/kllwm5a.jpg" : "https://i.imgur.com/UNgWSQe.jpg")
                },
                Buttons = new List <CardAction>()
                {
                    new CardAction(ActionTypes.ImBack, "Set Alarm", value: "SET_ALARM"),
                }
            };

            var message = context.MakeMessage();

            message.Attachments = new List <Attachment>()
            {
                card.ToAttachment()
            };

            var spoken = string.Empty;

            spoken = string.Format(Resources.ResourceManager.GetString("PlainsTimeSSML"),
                                   worldState.cetusCycle.isDay ? "daytime" : "night",
                                   worldState.cetusCycle.isDay ? "set" : "rise",
                                   Utils.TimeRemaining(worldState.cetusCycle.expiry)
                                   );

            message.Speak = SSMLHelper.Speak(spoken);

            //response.Text = spoken;

            //response.InputHint = InputHints.ExpectingInput;

            message.InputHint = InputHints.AcceptingInput;


            await context.PostAsync(message);

            context.Done <object>(null);
            //context.Wait(MessageReceived);
        }
Exemplo n.º 2
0
        public async Task SortieIntent(IDialogContext context, LuisResult result)
        {
            var           response = context.MakeMessage();
            List <String> parts    = new List <string>();

            parts.Add(String.Format(Utils.RandomSSML("SortieFactionSSML"), CurrentWorldState.sortie.faction));
            parts.Add(String.Format(Utils.RandomSSML("SortieTimeSSML"), Utils.TimeRemaining(CurrentWorldState.sortie.expiry)));
            foreach (Variant variant in CurrentWorldState.sortie.variants)
            {
                parts.Add(String.Format(Utils.RandomSSML("SortieMissionSSML"),
                                        SSMLHelper.SayAs("ordinal", CurrentWorldState.sortie.variants.IndexOf(variant)),
                                        Utils.Article(variant.missionType),
                                        Utils.Article(variant.modifier),
                                        variant.missionType,
                                        variant.modifier
                                        ));
            }
            response.Text = Utils.RandomSSML("SortieSSML");

            response.InputHint = InputHints.ExpectingInput;
            await context.PostAsync(response);

            //context.Wait(MessageReceived);
        }
Exemplo n.º 3
0
 public static string SayAs(string interpretAs, int text)
 {
     return(SSMLHelper.SayAs(interpretAs, text.ToString()));
 }