Example #1
0
    private void OnDailyChallengeInitialized()
    {
        this.UpdateLootCrates();
        DailyChallenge instance = Singleton <DailyChallenge> .Instance;

        instance.OnDailyChallengeChanged = (Action)Delegate.Combine(instance.OnDailyChallengeChanged, new Action(this.UpdateLootCrates));
    }
Example #2
0
 private void Initialize(bool hasInternet)
 {
     this.checkingNetwork = false;
     if (!hasInternet)
     {
         return;
     }
     if (Singleton <DailyChallenge> .Instance.Initialized)
     {
         this.Refresh();
         DailyChallenge instance = Singleton <DailyChallenge> .Instance;
         instance.OnDailyChallengeChanged = (Action)Delegate.Combine(instance.OnDailyChallengeChanged, new Action(this.Refresh));
     }
     else
     {
         DailyChallenge instance2 = Singleton <DailyChallenge> .Instance;
         instance2.OnInitialize = (Action)Delegate.Combine(instance2.OnInitialize, new Action(this.Refresh));
         DailyChallenge instance3 = Singleton <DailyChallenge> .Instance;
         instance3.OnInitialize = (Action)Delegate.Combine(instance3.OnInitialize, new Action(delegate()
         {
             DailyChallenge instance4          = Singleton <DailyChallenge> .Instance;
             instance4.OnDailyChallengeChanged = (Action)Delegate.Combine(instance4.OnDailyChallengeChanged, new Action(this.Refresh));
         }));
     }
     this.initialized = true;
 }
Example #3
0
 private void Start()
 {
     if (!Singleton <DailyChallenge> .IsInstantiated())
     {
         return;
     }
     this.lootCrates = new GameObject("LootCrates").transform;
     this.lootCrates.transform.parent        = base.transform;
     this.lootCrates.transform.localPosition = Vector3.zero;
     this.lootCrates.transform.localScale    = Vector3.one;
     if (Singleton <DailyChallenge> .Instance.Initialized)
     {
         this.UpdateLootCrates();
         DailyChallenge instance = Singleton <DailyChallenge> .Instance;
         instance.OnDailyChallengeChanged = (Action)Delegate.Combine(instance.OnDailyChallengeChanged, new Action(this.UpdateLootCrates));
     }
     else
     {
         DailyChallenge instance2 = Singleton <DailyChallenge> .Instance;
         instance2.OnInitialize = (Action)Delegate.Combine(instance2.OnInitialize, new Action(delegate()
         {
             this.UpdateLootCrates();
             DailyChallenge instance3          = Singleton <DailyChallenge> .Instance;
             instance3.OnDailyChallengeChanged = (Action)Delegate.Combine(instance3.OnDailyChallengeChanged, new Action(this.UpdateLootCrates));
         }));
     }
 }
Example #4
0
 private void OnDestroy()
 {
     if (Singleton <DailyChallenge> .IsInstantiated())
     {
         DailyChallenge instance = Singleton <DailyChallenge> .Instance;
         instance.OnDailyChallengeChanged = (Action)Delegate.Remove(instance.OnDailyChallengeChanged, new Action(this.UpdateLootCrates));
     }
 }
Example #5
0
    private void Initialize()
    {
        if (!HatchManager.IsLoggedIn)
        {
            HatchManager.onLoginSuccess = (Action)Delegate.Combine(HatchManager.onLoginSuccess, new Action(this.Initialize));
            return;
        }
        this.initialized = true;
        DailyChallenge instance = Singleton <DailyChallenge> .Instance;

        instance.OnDailyChallengeChanged = (Action)Delegate.Combine(instance.OnDailyChallengeChanged, new Action(this.LoadImage));
        HatchManager.onLoginSuccess      = (Action)Delegate.Remove(HatchManager.onLoginSuccess, new Action(this.Initialize));
        this.LoadImage();
    }
Example #6
0
 private void OnDestroy()
 {
     if (Singleton <DailyChallenge> .IsInstantiated())
     {
         DailyChallenge instance = Singleton <DailyChallenge> .Instance;
         instance.OnDailyChallengeChanged = (Action)Delegate.Remove(instance.OnDailyChallengeChanged, new Action(this.UpdateLootCrates));
         DailyChallenge instance2 = Singleton <DailyChallenge> .Instance;
         instance2.OnInitialize = (Action)Delegate.Remove(instance2.OnInitialize, new Action(this.OnDailyChallengeInitialized));
     }
     if (Singleton <NetworkManager> .IsInstantiated())
     {
         Singleton <NetworkManager> .Instance.UnsubscribeFromResponse(new NetworkManager.OnCheckResponseDelegate(this.OnNetworkCheck));
     }
 }
    public void GenerateDailyChallenge()
    {
        int w0id, w1id, w2id;

        //inefficient, but simple
        do
        {
            w0id = UnityEngine.Random.Range(0, 21);
            w1id = UnityEngine.Random.Range(0, 21);
            w2id = UnityEngine.Random.Range(0, 21);
        } while ((w0id == w1id) || (w1id == w2id) || (w0id == w2id));
        DailyChallenge tmp = new DailyChallenge(new List <WorkoutSession>(new WorkoutSession[] { new WorkoutSession(w0id, 300), new WorkoutSession(w1id, 300), new WorkoutSession(w2id, 300) }));

        todaysChallenge = tmp;
    }
Example #8
0
 private void OnDestroy()
 {
     DailyChallengeLoader.instances.Remove(this.challengeIndex);
     DailyChallengeLoader.dailyMaterials.Remove(this.challengeIndex);
     if (Singleton <DailyChallenge> .IsInstantiated())
     {
         DailyChallenge instance = Singleton <DailyChallenge> .Instance;
         instance.OnInitialize = (Action)Delegate.Remove(instance.OnInitialize, new Action(this.Initialize));
         DailyChallenge instance2 = Singleton <DailyChallenge> .Instance;
         instance2.OnDailyChallengeChanged = (Action)Delegate.Remove(instance2.OnDailyChallengeChanged, new Action(this.LoadImage));
     }
     if (Singleton <NetworkManager> .IsInstantiated())
     {
         Singleton <NetworkManager> .Instance.UnsubscribeFromResponse(new NetworkManager.OnCheckResponseDelegate(this.OnNetworkCheck));
     }
 }
Example #9
0
 private void OnDestroy()
 {
     if (this.adReward != null)
     {
         this.adReward.Dispose();
     }
     if (Singleton <DailyChallenge> .IsInstantiated())
     {
         DailyChallenge instance = Singleton <DailyChallenge> .Instance;
         instance.OnInitialize = (Action)Delegate.Remove(instance.OnInitialize, new Action(this.Refresh));
         DailyChallenge instance2 = Singleton <DailyChallenge> .Instance;
         instance2.OnDailyChallengeChanged = (Action)Delegate.Remove(instance2.OnDailyChallengeChanged, new Action(this.Refresh));
     }
     if (Singleton <NetworkManager> .IsInstantiated())
     {
         Singleton <NetworkManager> .Instance.UnsubscribeFromResponse(new NetworkManager.OnCheckResponseDelegate(this.Initialize));
     }
 }
Example #10
0
        public async Task SaveDailyChallenge(DailyChallenge dailyChallenge)
        {
            dailyChallenge.PartitionKey = typeof(DailyChallenge).ToString();
            dailyChallenge.RowKey       = DateTime.Now.ToString("yyyyMMdd");
            if (dailyChallenge.entries == null)
            {
                dailyChallenge.entries = new List <DailyChallengeEntry>();
            }
            if (dailyChallenge.publishedTime == null)
            {
                dailyChallenge.publishedTime = DateTime.Now;
            }
            dailyChallenge.SerializedEntries         = JsonConvert.SerializeObject(dailyChallenge.entries);
            dailyChallenge.serializableCurrentStatus = dailyChallenge.currentStatus.ToString();
            TableOperation insertOrMergeOperation = TableOperation.InsertOrMerge(dailyChallenge);

            // Execute the operation.
            TableResult result = await cloudTable.ExecuteAsync(insertOrMergeOperation);
        }
Example #11
0
        public async Task <DailyChallenge> GetDailyChallenge()
        {
            string rowKey       = DateTime.Now.ToString("yyyyMMdd");
            string partitionKey = typeof(DailyChallenge).ToString();

            TableOperation retrieveOperation = TableOperation.Retrieve <DailyChallenge>(partitionKey, rowKey);
            TableResult    result            = await cloudTable.ExecuteAsync(retrieveOperation);

            DailyChallenge dailyChallenge = result.Result as DailyChallenge;

            if (dailyChallenge == null)
            {
                dailyChallenge = new DailyChallenge()
                {
                    RowKey        = rowKey,
                    PartitionKey  = partitionKey,
                    entries       = new List <DailyChallengeEntry>(),
                    publishedTime = DateTime.Now,
                    resultSet     = false
                };
                await SaveDailyChallenge(dailyChallenge);
            }
            if (dailyChallenge.entries == null)
            {
                if (dailyChallenge.SerializedEntries == null)
                {
                    dailyChallenge.entries = new List <DailyChallengeEntry>();
                }
                else
                {
                    dailyChallenge.entries = JsonConvert.DeserializeObject <List <DailyChallengeEntry> >(dailyChallenge.SerializedEntries);
                }
            }
            if (dailyChallenge.publishedTime == null)
            {
                dailyChallenge.publishedTime = DateTime.Now;
            }
            if (dailyChallenge.serializableCurrentStatus != null)
            {
                dailyChallenge.currentStatus = (DailyChallengeStatus)Enum.Parse(typeof(DailyChallengeStatus), dailyChallenge.serializableCurrentStatus);
            }
            return(dailyChallenge);
        }
Example #12
0
 private void OnNetworkCheck(bool hasInternet)
 {
     this.networkFailure  = (!hasInternet || !HatchManager.IsLoggedIn);
     this.checkingNetwork = false;
     this.loading         = false;
     this.loadingIndicator.SetActive(false);
     if (this.networkFailure)
     {
         this.UpdateLootCrates();
         return;
     }
     if (Singleton <DailyChallenge> .Instance.Initialized)
     {
         this.OnDailyChallengeInitialized();
     }
     else
     {
         DailyChallenge instance = Singleton <DailyChallenge> .Instance;
         instance.OnInitialize = (Action)Delegate.Combine(instance.OnInitialize, new Action(this.OnDailyChallengeInitialized));
     }
 }
Example #13
0
 private void OnNetworkCheck(bool hasInternet)
 {
     if (!hasInternet)
     {
         this.SetDisabled();
         return;
     }
     if (this.initialized)
     {
         this.LoadImage();
     }
     else if (Singleton <DailyChallenge> .Instance.Initialized)
     {
         this.Initialize();
     }
     else
     {
         this.SetDisabled();
         DailyChallenge instance = Singleton <DailyChallenge> .Instance;
         instance.OnInitialize = (Action)Delegate.Combine(instance.OnInitialize, new Action(this.Initialize));
     }
 }
Example #14
0
        public ActionResult <DailyChallenge> Create()
        {
            DailyChallenge[] dc1 = new DailyChallenge[7];
            DailyChallenge[] dc2 = new DailyChallenge[7];
            DailyChallenge[] dc3 = new DailyChallenge[7];

            for (int i = 0; i < 7; i++)
            {
                dc1[i] = new DailyChallenge();
                dc2[i] = new DailyChallenge();
                dc3[i] = new DailyChallenge();

                dc1[i].DayOfWeek = i.ToString();
                dc2[i].DayOfWeek = i.ToString();
                dc3[i].DayOfWeek = i.ToString();

                dc1[i].Description = "Play 1 game";
                dc1[i].Points      = 500;

                dc2[i].Description = "Score 1000 points in a game";
                dc2[i].Points      = 750;

                dc3[i].Description = "Play 1 multiplayer game";
                dc3[i].Points      = 1000;
            }

            for (int i = 0; i < 7; i++)
            {
                _dailyChallengeService.Create(dc1[i]);
                _dailyChallengeService.Create(dc2[i]);
                _dailyChallengeService.Create(dc3[i]);
            }

            return(Ok(new
            {
                result = "desafios criados"
            }));
        }
        public DailyChallenge Create(DailyChallenge challenge)
        {
            _challenges.InsertOne(challenge);

            return(challenge);
        }
Example #16
0
        private async Task <DialogTurnResult> ActStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken)
        {
            BingMapService mapService = new BingMapService(Configuration["BingMapsAPI"]);

            string             guessText = stepContext.Result.ToString();
            DailyChallengeInfo info      = await tableService.GetLatestInfo();

            if (guessText.ToLower().Contains("check results"))
            {
                DailyChallenge dailyChallenge = await tableService.GetDailyChallenge();

                await CheckResults(stepContext, cancellationToken, dailyChallenge, info);

                return(await stepContext.EndDialogAsync(cancellationToken));
            }
            else
            {
                TelemetryClient.TrackTrace("Checking for guess: " + guessText, Severity.Information, null);
                try
                {
                    DailyChallengeEntry entry = await mapService.GetLocationDetails(guessText, Logger);

                    if (entry == null)
                    {
                        var locationSplit = stepContext.Result.ToString().Split(' ');
                        if (locationSplit.Length > 1)
                        {
                            var searchText = guessText.Substring(guessText.IndexOf(' '));
                            entry = await mapService.GetLocationDetails(searchText, Logger);
                        }
                    }

                    if (entry == null)
                    {
                        await stepContext.Context.SendActivityAsync(MessageFactory.Text($"Sorry, bing maps couldn't identify the location '{stepContext.Result.ToString()}'. Please try again."), cancellationToken);

                        return(await stepContext.EndDialogAsync());
                    }
                    else
                    {
                        DailyChallenge dailyChallenge = await tableService.GetDailyChallenge();

                        if (dailyChallenge.entries != null)
                        {
                            var matchingEntries = dailyChallenge.entries.Where <DailyChallengeEntry>(e => e.imageResponse == entry.imageResponse);
                            if (matchingEntries.Count() > 0)
                            {
                                await stepContext.Context.SendActivityAsync(MessageFactory.Text($"Sorry, someone has beaten you to suggesting '{stepContext.Result.ToString()}'. Please try again."), cancellationToken);

                                // This line caused a bit of a meltdown so changing to end dialogue
                                //return await stepContext.BeginDialogAsync(nameof(ChallengeGuesserDialog), null, cancellationToken);
                                return(await stepContext.EndDialogAsync());
                            }
                        }

                        double distanceFromResult = DistanceMeasureHelper.GetDistanceFromResult(entry.latitude, entry.longitude, dailyChallenge.latitude, dailyChallenge.longitude);

                        entry.distanceFrom = distanceFromResult;
                        entry.userName     = stepContext.Context.Activity.From.Name;
                        entry.userId       = stepContext.Context.Activity.From.Id;
                        dailyChallenge.entries.Add(entry);

                        await tableService.SaveDailyChallenge(dailyChallenge);

                        IMessageActivity            reply         = MessageFactory.Attachment(new List <Attachment>());
                        DailyChallengeEntriesStatus currentStatus = await CheckWhetherAllEntriesReceived(stepContext, cancellationToken, dailyChallenge, info);

                        reply.Attachments.Add(AttachmentHelper.AwaitingGuesses(currentStatus.userCount, dailyChallenge.photoUrl, currentStatus.usersWithEntryCount, entry.userName, entry.imageResponse));

                        await stepContext.Context.SendActivityAsync((Activity)reply);

                        return(await stepContext.EndDialogAsync(null, cancellationToken));
                    }
                }
                catch (Exception exp)
                {
                    TelemetryClient.TrackTrace("Error loading results: " + exp.Message + exp.StackTrace, Severity.Error, null);
                    throw exp;
                }
            }
        }
Example #17
0
        private async Task <DailyChallengeEntriesStatus> CheckWhetherAllEntriesReceived(WaterfallStepContext stepContext, CancellationToken cancellationToken, DailyChallenge dailyChallenge, DailyChallengeInfo info)
        {
            try
            {
                // Fill in the "standard" properties for BotMessageReceived
                // and add our own property.
                Logger.LogInformation("Checking whether all entries received");
                DailyChallengeEntriesStatus currentStatus = new DailyChallengeEntriesStatus()
                {
                    allResultsReceived = false
                };

                List <DailyChallengeEntry> todayEntries = dailyChallenge.entries;
                if (info.users == null)
                {
                    info.users = new List <DailyChallengeUser>();
                }
                List <DailyChallengeUser> challengeUsers = new List <DailyChallengeUser>();

                var microsoftAppId       = Configuration["MicrosoftAppId"];
                var microsoftAppPassword = Configuration["MicrosoftAppPassword"];

                var connector = new ConnectorClient(new Uri(stepContext.Context.Activity.ServiceUrl), microsoftAppId, microsoftAppPassword);
                var response  = await connector.Conversations.GetConversationMembersWithHttpMessagesAsync(stepContext.Context.Activity.Conversation.Id);

                //var response = (await connectorClient.Conversations.GetConversationMembersAsync());
                foreach (var user in response.Body)
                {
                    challengeUsers.Add(new DailyChallengeUser()
                    {
                        id       = user.Id,
                        username = user.Name
                    });
                }

                int userCount           = challengeUsers.Count;
                int usersWithEntryCount = 0;

                foreach (var user in challengeUsers)
                {
                    if (todayEntries.Exists(matchingItem => matchingItem.userName == user.username))
                    {
                        usersWithEntryCount++;
                    }
                }

                if (usersWithEntryCount >= userCount)
                {
                    currentStatus.allResultsReceived = true;
                }

                currentStatus.userCount           = userCount;
                currentStatus.usersWithEntryCount = usersWithEntryCount;
                return(currentStatus);
            }
            catch (Exception exp)
            {
                Logger.LogError(exp, $"Error checking whether all entries received: {exp.Message} - {exp.StackTrace}", null);
                throw exp;
            }
        }
Example #18
0
        private async Task CheckResults(WaterfallStepContext stepContext, CancellationToken cancellationToken, DailyChallenge dailyChallenge, DailyChallengeInfo info)
        {
            List <DailyChallengeEntry> todayEntries = dailyChallenge.entries;

            string currentWinningUser     = "";
            string currentWinningEntry    = "";
            double currentWinningDistance = double.MaxValue;


            foreach (var entry in todayEntries)
            {
                if (entry.distanceFrom < currentWinningDistance)
                {
                    currentWinningUser     = entry.userName;
                    currentWinningEntry    = entry.imageResponse;
                    currentWinningDistance = entry.distanceFrom;
                }
            }
            try
            {
                DailyChallengeImage image = await tableService.getDailyChallengeImage();

                dailyChallenge.distanceToEntry = currentWinningDistance;
                dailyChallenge.winnerName      = currentWinningUser;
                dailyChallenge.winnerGuess     = currentWinningEntry;
                dailyChallenge.resultSet       = true;

                await tableService.SaveDailyChallenge(dailyChallenge);

                IMessageActivity reply = MessageFactory.Attachment(new List <Attachment>());

                reply.Attachments.Add(AttachmentHelper.ResultCardAttachment(currentWinningUser.ToString(), image.Url, currentWinningEntry, currentWinningDistance.ToString("#.##"), dailyChallenge.extractedLocation, dailyChallenge.text));
                await stepContext.Context.SendActivityAsync(reply);
            }
            catch (Exception exp)
            {
                Console.WriteLine("Error checking results: " + exp.Message);
            }
            return;
        }
Example #19
0
        private async Task <DialogTurnResult> IntroStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken)
        {
            DailyChallenge dailyChallenge = await tableService.GetDailyChallenge();

            DailyChallengeInfo info = await tableService.GetLatestInfo();

            DailyChallengeEntriesStatus currentStatus = await CheckWhetherAllEntriesReceived(stepContext, cancellationToken, dailyChallenge, info);

            if (currentStatus.allResultsReceived)
            {
                await CheckResults(stepContext, cancellationToken, dailyChallenge, info);

                return(await stepContext.EndDialogAsync(cancellationToken));
            }
            else
            {
                string messageText = null;
                if (stepContext != null && stepContext.Result != null)
                {
                    messageText = stepContext.Result.ToString();
                }
                else if (stepContext != null && stepContext.Context != null && stepContext.Context.Activity != null && stepContext.Context.Activity.Text != null)
                {
                    messageText = stepContext.Context.Activity.Text;
                }
                else if (stepContext != null && stepContext.Options != null)
                {
                    PromptOptions options = (PromptOptions)stepContext.Options;
                    messageText = options.Prompt.Text;
                }
                if (messageText != null)
                {
                    if (messageText.ToLower().Contains("check results"))
                    {
                        await CheckResults(stepContext, cancellationToken, dailyChallenge, info);

                        return(await stepContext.EndDialogAsync(cancellationToken));
                    }

                    var userEntries = dailyChallenge.entries.FindAll(e => e.userName == stepContext.Context.Activity.From.Name);
                    if (userEntries != null && userEntries.Count > 0)
                    {
                        IMessageActivity beginReply   = MessageFactory.Text($"Sorry {stepContext.Context.Activity.From.Name}, we already have a result from you. Time for the next person.");
                        PromptOptions    beginOptions = new PromptOptions()
                        {
                            Prompt = (Activity)beginReply
                        };
                        return(await stepContext.PromptAsync(nameof(TextPrompt), beginOptions, cancellationToken));
                    }
                    return(await stepContext.NextAsync(messageText));
                }

                IMessageActivity reply = MessageFactory.Attachment(new List <Attachment>());
                reply.Attachments.Add(AttachmentHelper.ImageChosen(dailyChallenge.photoUrl));
                PromptOptions promptOptions = new PromptOptions
                {
                    Prompt = (Activity)reply,
                };
                return(await stepContext.PromptAsync(nameof(TextPrompt), promptOptions, cancellationToken));
            }
        }
Example #20
0
        private async Task <DialogTurnResult> IntroStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken)
        {
            TelemetryClient.TrackTrace("Main dialog started", Severity.Information, null);
            if (string.IsNullOrEmpty(Configuration["DailyChallengeTableConnectionString"]))
            {
                TelemetryClient.TrackTrace("Connection String not defined", Severity.Error, null);
                await stepContext.Context.SendActivityAsync(
                    MessageFactory.Text("NOTE: Storage Connection String is not configured. To continue, add 'DailyChallengeTableConnectionString' to the appsettings.json file."), cancellationToken);

                return(await stepContext.EndDialogAsync(null, cancellationToken));
            }
            else
            {
                IMessageActivity reply = null;

                TelemetryClient.TrackTrace("Get Daily Challenge and Team Info", Severity.Information, null);
                DailyChallenge dailyChallenge = await tableService.GetDailyChallenge();

                DailyChallengeTeam team = await tableService.getDailyChallengeTeamInfo();

                TelemetryClient.TrackTrace("Check whether today's challenge exists", Severity.Information, null);
                if (dailyChallenge.photoUrl == null)
                {
                    TelemetryClient.TrackTrace("No Daily Challenge so check details", Severity.Information, null);
                    var activity = stepContext.Context.Activity;
                    if (team.ChannelData == null)
                    {
                        team.ChannelData = activity.GetChannelData <TeamsChannelData>();
                    }
                    var teamsChannelData = team.ChannelData;

                    var    channelId = teamsChannelData.Channel.Id;
                    var    tenantId  = teamsChannelData.Tenant.Id;
                    string myBotId   = activity.Recipient.Id;
                    string teamId    = teamsChannelData.Team.Id;
                    string teamName  = teamsChannelData.Team.Name;

                    await this.tableService.SaveDailyChallengeTeamInfo(new DailyChallengeTeam()
                    {
                        ServiceUrl    = activity.ServiceUrl,
                        TeamId        = teamId,
                        TeamName      = teamName,
                        TenantId      = tenantId,
                        InstallerName = "Automatic",
                        BotId         = myBotId,
                        ChannelId     = channelId,
                        ChannelData   = teamsChannelData
                    });

                    reply = MessageFactory.Attachment(new List <Attachment>());
                    Attachment attachment = null;

                    DailyChallengeInfo info = await GetInfo(stepContext);

                    if (info.currentSource == ImageSource.Google)
                    {
                        TelemetryClient.TrackTrace("Current source is Google so get an image", Severity.Information, null);
                        attachment = await GetGoogleImageChoiceAttachment();

                        TelemetryClient.TrackTrace("Loaded Google image", Severity.Information, null);
                    }
                    else
                    {
                        TelemetryClient.TrackTrace("Current source is Bing so get the latest image", Severity.Information, null);
                        int imageIndex = info.currentImageIndex;
                        attachment = await GetBingImageChoiceAttachment(imageIndex);

                        TelemetryClient.TrackTrace("Loaded Bing image", Severity.Information, null);
                    }

                    reply.Attachments.Add(attachment);
                    TelemetryClient.TrackTrace("Sending image reply", Severity.Information, null);
                    return(await stepContext.PromptAsync(nameof(TextPrompt), new PromptOptions { Prompt = (Activity)reply }, cancellationToken));
                }
                else
                {
                    if (!dailyChallenge.resultSet)
                    {
                        // Pass on the check results message from the proactive controller if set
                        PromptOptions options = null;
                        if (stepContext != null && stepContext.Options != null)
                        {
                            options = (PromptOptions)stepContext.Options;
                        }
                        return(await stepContext.ReplaceDialogAsync(nameof(ChallengeGuesserDialog), options, cancellationToken));
                    }
                    else
                    {
                        IMessageActivity winningReply = MessageFactory.Attachment(new List <Attachment>());

                        winningReply.Attachments.Add(AttachmentHelper.ResultCardAttachment(dailyChallenge.winnerName, dailyChallenge.photoUrl, dailyChallenge.winnerGuess, dailyChallenge.distanceToEntry.ToString("#.##"), dailyChallenge.extractedLocation, dailyChallenge.text));
                        await stepContext.Context.SendActivityAsync(winningReply);

                        return(await stepContext.EndDialogAsync(cancellationToken : cancellationToken));
                    }
                }
            }
        }