Exemplo n.º 1
0
        private static APLDocument GenerateRollDisplay(DiceRollerResult result)
        {
            //TODO: Get it to play <audio src="soundbank://soundlibrary/toys_games/board_games/board_games_08"/>
            var doc = new APLDocument(APLDocumentVersion.V1_1);

            Import.AlexaLayouts.Into(doc);
            new Import {
                Name    = "transitions",
                Version = "1.0.0",
                Source  = "https://rollcasterassets.s3-eu-west-1.amazonaws.com/apl_transitions.json"
            }
            .Into(doc);

            doc.MainTemplate = new Layout(new AlexaHeadline
            {
                BackgroundImageSource = "https://rollcasterassets.s3-eu-west-1.amazonaws.com/backg_shrunk.jpg",
                BackgroundBlur        = true,
                HeaderBackButton      = false,
                PrimaryText           = $"You rolled {result.Total}",
                SecondaryText         = string.Join(" + ", result.Dice.Select(d => d.ToString())),
                OnMount = new APLValue <IList <APLCommand> >(new APLCommand[]
                {
                    new CustomCommand("rollIn")
                })
            }).AsMain();
            return(doc);
        }
Exemplo n.º 2
0
        public static SkillResponse GetResponse(DiceRollerResult result, bool includeApl)
        {
            var response = $"You rolled {result.Total}";
            var ask      = ResponseBuilder.Ask(response, new Reprompt(reprompt));

            if (includeApl)
            {
                var doc = GenerateRollDisplay(result);
                ask.Response.Directives.Add(new RenderDocumentDirective {
                    Document = doc
                });
            }

            return(ask);
        }