コード例 #1
0
        protected override async void OnIncomingPayload(NotificationPayload payload)
        {
            string challengeId;
            string winnerId;

            if (payload.Payload.TryGetValue("challengeId", out challengeId))
            {
                if (challengeId == ViewModel?.Challenge?.Id)
                {
                    await ViewModel.RefreshChallenge();

                    if (ViewModel.Challenge == null)
                    {
                        OnDecline?.Invoke();
                        await Navigation.PopAsync();

                        return;
                    }

                    if (payload.Payload.TryGetValue("winningAthleteId", out winnerId))
                    {
                        OnPostResults?.Invoke();
                    }
                }
            }
        }
コード例 #2
0
        private IEnumerator HandleConversation(PlayerController interactor)
        {
            SpriteOutlineManager.AddOutlineToSprite(base.sprite, Color.black);
            base.spriteAnimator.PlayForDuration("talk_start", 1, "talk");
            interactor.SetInputOverride("npcConversation");
            Pixelator.Instance.LerpToLetterbox(0.35f, 0.25f);
            yield return(null);

            int conversationIndex = m_allowMeToIntroduceMyself ? 0 : conversation.Count - 1;

            while (conversationIndex < conversation.Count - 1)
            {
                Tools.Print($"Index: {conversationIndex}");
                TextBoxManager.ClearTextBox(this.talkPoint);
                TextBoxManager.ShowTextBox(this.talkPoint.position, this.talkPoint, -1f, conversation[conversationIndex], interactor.characterAudioSpeechTag, instant: false, showContinueText: true);
                float timer = 0;
                while (!BraveInput.GetInstanceForPlayer(interactor.PlayerIDX).ActiveActions.GetActionFromType(GungeonActions.GungeonActionType.Interact).WasPressed || timer < 0.4f)
                {
                    timer += BraveTime.DeltaTime;
                    yield return(null);
                }
                conversationIndex++;
            }
            m_allowMeToIntroduceMyself = false;
            TextBoxManager.ShowTextBox(this.talkPoint.position, this.talkPoint, -1f, conversation[conversation.Count - 1], interactor.characterAudioSpeechTag, instant: false, showContinueText: true);

            GameUIRoot.Instance.DisplayPlayerConversationOptions(interactor, null, acceptText, declineText);
            int selectedResponse = -1;

            while (!GameUIRoot.Instance.GetPlayerConversationResponse(out selectedResponse))
            {
                yield return(null);
            }

            if (selectedResponse == 0)
            {
                TextBoxManager.ClearTextBox(this.talkPoint);
                base.spriteAnimator.PlayForDuration("do_effect", -1, "talk");

                while (base.spriteAnimator.CurrentFrame < 20) //play do effect anim
                {
                    yield return(null);
                }
                OnAccept?.Invoke(interactor, this.gameObject);
                base.spriteAnimator.Play("talk");
                TextBoxManager.ShowTextBox(this.talkPoint.position, this.talkPoint, 1f, "Bam!", interactor.characterAudioSpeechTag, instant: false);
                yield return(new WaitForSeconds(1f));
            }
            else
            {
                OnDecline?.Invoke(interactor, this.gameObject);
                TextBoxManager.ClearTextBox(this.talkPoint);
            }

            // Free player and run OnAccept/OnDecline actions
            interactor.ClearInputOverride("npcConversation");
            Pixelator.Instance.LerpToLetterbox(1, 0.25f);
            base.spriteAnimator.Play("idle");
        }
コード例 #3
0
        async void OnRefreshChallenge()
        {
            using (new HUD("Refreshing..."))
            {
                if (!await ViewModel.RefreshChallenge(true))
                {
                    OnDecline?.Invoke();
                    await Navigation.PopAsync();

                    return;
                }
            }
        }
コード例 #4
0
        async void OnRevokeChallenge()
        {
            var decline = await DisplayAlert("Really?", "Are you sure you want to revoke challenge?", "Yes", "No");

            if (!decline)
            {
                return;
            }

            bool success;

            using (new HUD("Revoking challenge..."))
            {
                success = await ViewModel.DeclineChallenge();
            }

            if (success)
            {
                "Challenge revoked".ToToast();
            }

            OnDecline?.Invoke();
            await Navigation.PopAsync();
        }
コード例 #5
0
        async void OnDeclineChallenge()
        {
            var decline = await DisplayAlert("Really?", "Are you sure you want to cowardly decline this honorable duel?", "Yes", "No");

            if (!decline)
            {
                return;
            }

            bool success;

            using (new HUD("Declining..."))
            {
                success = await ViewModel.DeclineChallenge();
            }

            if (success)
            {
                "Challenge declined".ToToast();
            }

            OnDecline?.Invoke();
            await Navigation.PopAsync();
        }
コード例 #6
0
        private IEnumerator HandleConversation(PlayerController interactor)
        {
            SpriteOutlineManager.AddOutlineToSprite(base.sprite, Color.black);
            base.spriteAnimator.PlayForDuration("talk_start", 1, "talk");
            interactor.SetInputOverride("npcConversation");
            Pixelator.Instance.LerpToLetterbox(0.35f, 0.25f);
            yield return(null);

            //Determine Dialogue
            var conversationToUse = new List <string>()
            {
                "Null"
            };

            //Price Mult
            GameLevelDefinition lastLoadedLevelDefinition = GameManager.Instance.GetLastLoadedLevelDefinition();
            float PriceMult = (lastLoadedLevelDefinition == null) ? 1f : lastLoadedLevelDefinition.priceMultiplier;

            //Check for if ever met before and then else
            if (hasDeclinedAlreadyThisRun)
            {
                conversationToUse = new List <string>()
                {
                    "You're back? Did you change your mind?",
                    "Did you get hopelessly lost?",
                    "Please tell me you got hopelessly lost!",
                };
            }
            else
            {
                conversationToUse = new List <string>()
                {
                    "Well hello again, young adventurer!",
                    "You look lost... mayhaps you are in need of a finely crafted... map?",
                    "Only " + (20 * PriceMult) + " of those little janglies, you know the deal."
                };
            }


            int conversationIndex = 0;

            while (conversationIndex < conversationToUse.Count - 1)
            {
                TextBoxManager.ClearTextBox(this.talkPoint);
                TextBoxManager.ShowTextBox(this.talkPoint.position, this.talkPoint, -1f, conversationToUse[conversationIndex], interactor.characterAudioSpeechTag, instant: false, showContinueText: true);
                float timer = 0;
                while (!BraveInput.GetInstanceForPlayer(interactor.PlayerIDX).ActiveActions.GetActionFromType(GungeonActions.GungeonActionType.Interact).WasPressed || timer < 0.4f)
                {
                    timer += BraveTime.DeltaTime;
                    yield return(null);
                }
                conversationIndex++;
            }
            TextBoxManager.ShowTextBox(this.talkPoint.position, this.talkPoint, -1f, conversationToUse[conversationToUse.Count - 1], interactor.characterAudioSpeechTag, instant: false, showContinueText: true);


            var acceptanceTextToUse = "Null";
            var declineTextToUse    = "Null";

            if (hasDeclinedAlreadyThisRun)
            {
                acceptanceTextToUse = "...Just give me the map. <Lose " + (20 * PriceMult) + " Money>";
                declineTextToUse    = "Not lost, I know EXACTLY where I am!";
            }
            else
            {
                acceptanceTextToUse = "Yeah, a map would be nice <Lose " + (20 * PriceMult) + " Money>";
                declineTextToUse    = "No thanks, I can find my way around juuust fine.";
            }

            GameUIRoot.Instance.DisplayPlayerConversationOptions(interactor, null, acceptanceTextToUse, declineTextToUse);
            int selectedResponse = -1;

            while (!GameUIRoot.Instance.GetPlayerConversationResponse(out selectedResponse))
            {
                yield return(null);
            }

            if (selectedResponse == 0)
            {
                TextBoxManager.ClearTextBox(this.talkPoint);
                base.spriteAnimator.PlayForDuration("do_effect", -1, "talk");
                base.spriteAnimator.Play("talk");
                if (interactor.carriedConsumables.Currency >= (20 * PriceMult))
                {
                    TextBoxManager.ShowTextBox(this.talkPoint.position, this.talkPoint, 1f, "Enjoy the fruits of my knowledge!", interactor.characterAudioSpeechTag, instant: false);
                    OnAccept?.Invoke(interactor, this.gameObject);
                    hasBeenUsedThisRun = true;
                }
                else
                {
                    TextBoxManager.ShowTextBox(this.talkPoint.position, this.talkPoint, 1f, "Oh... looks like you don't have the cash. Welp, research ain't free.", interactor.characterAudioSpeechTag, instant: false);
                }
                yield return(new WaitForSeconds(1f));
            }
            else
            {
                OnDecline?.Invoke(interactor, this.gameObject);
                TextBoxManager.ShowTextBox(this.talkPoint.position, this.talkPoint, 1f, "Harumph, enjoy being lost...", interactor.characterAudioSpeechTag, instant: false);
                hasDeclinedAlreadyThisRun = true;
                TextBoxManager.ClearTextBox(this.talkPoint);
            }

            interactor.ClearInputOverride("npcConversation");
            Pixelator.Instance.LerpToLetterbox(1, 0.25f);
            base.spriteAnimator.Play("idle");
        }
コード例 #7
0
        private IEnumerator HandleConversation(PlayerController interactor)
        {
            // Show text and lock player in place
            TextBoxManager.ShowStoneTablet(this.talkPoint.position, this.talkPoint, -1f, text, true, false);
            int selectedResponse = -1;

            interactor.SetInputOverride("shrineConversation");
            yield return(null);

            // Wait for player response
            if (!m_canUse)
            {
                GameUIRoot.Instance.DisplayPlayerConversationOptions(interactor, null, declineText, string.Empty);
            }
            else if (isToggle)
            {
                if (m_isToggled)
                {
                    GameUIRoot.Instance.DisplayPlayerConversationOptions(interactor, null, declineText, string.Empty);
                }
                else
                {
                    GameUIRoot.Instance.DisplayPlayerConversationOptions(interactor, null, acceptText, string.Empty);
                }
            }
            else
            {
                GameUIRoot.Instance.DisplayPlayerConversationOptions(interactor, null, acceptText, declineText);
            }


            while (!GameUIRoot.Instance.GetPlayerConversationResponse(out selectedResponse))
            {
                yield return(null);
            }

            // Free player and run OnAccept/OnDecline actions
            interactor.ClearInputOverride("shrineConversation");
            TextBoxManager.ClearTextBox(this.talkPoint);
            if (!m_canUse)
            {
                yield break;
            }

            if (selectedResponse == 0 && isToggle)
            {
                (m_isToggled ? OnDecline : OnAccept)?.Invoke(interactor, this.gameObject);
                m_isToggled = !m_isToggled;
                yield break;
            }

            if (selectedResponse == 0)
            {
                OnAccept?.Invoke(interactor, this.gameObject);
            }
            else
            {
                OnDecline?.Invoke(interactor, this.gameObject);
            }
            yield break;
        }
コード例 #8
0
 public void Decline()
 {
     OnDecline?.Invoke();
     Close();
 }
コード例 #9
0
 private void ButtonCancel_OnClick(object sender, EventArgs e)
 {
     OnDecline?.Invoke(data, null);
 }
コード例 #10
0
        private IEnumerator HandleConversation(PlayerController interactor)
        {
            //ETGModConsole.Log("HandleConversation Started");
            SpriteOutlineManager.AddOutlineToSprite(base.sprite, Color.black);
            base.spriteAnimator.PlayForDuration("talk_start", 1, "talk");
            interactor.SetInputOverride("npcConversation");
            Pixelator.Instance.LerpToLetterbox(0.35f, 0.25f);
            yield return(null);

            var conversationToUse = AllJammedState.AllJammedActive ? conversation2 : conversation;
            int conversationIndex = 0;

            //ETGModConsole.Log("We made it to the while loop");
            while (conversationIndex < conversationToUse.Count - 1)
            {
                Tools.Print($"Index: {conversationIndex}");
                TextBoxManager.ClearTextBox(this.talkPoint);
                TextBoxManager.ShowTextBox(this.talkPoint.position, this.talkPoint, -1f, conversationToUse[conversationIndex], interactor.characterAudioSpeechTag, instant: false, showContinueText: true);
                float timer = 0;
                while (!BraveInput.GetInstanceForPlayer(interactor.PlayerIDX).ActiveActions.GetActionFromType(GungeonActions.GungeonActionType.Interact).WasPressed || timer < 0.4f)
                {
                    timer += BraveTime.DeltaTime;
                    yield return(null);
                }
                conversationIndex++;
            }
            //ETGModConsole.Log("We made it through the while loop");
            m_allowMeToIntroduceMyself = false;
            TextBoxManager.ShowTextBox(this.talkPoint.position, this.talkPoint, -1f, conversationToUse[conversationToUse.Count - 1], interactor.characterAudioSpeechTag, instant: false, showContinueText: true);

            var acceptanceTextToUse = AllJammedState.AllJammedActive ? acceptText2 : acceptText;
            var declineTextToUse    = AllJammedState.AllJammedActive ? declineText2 : declineText;

            GameUIRoot.Instance.DisplayPlayerConversationOptions(interactor, null, acceptanceTextToUse, declineTextToUse);
            int selectedResponse = -1;

            while (!GameUIRoot.Instance.GetPlayerConversationResponse(out selectedResponse))
            {
                yield return(null);
            }
            //ETGModConsole.Log("We made it to the if statement");
            if (selectedResponse == 0)
            {
                TextBoxManager.ClearTextBox(this.talkPoint);
                base.spriteAnimator.PlayForDuration("do_effect", -1, "talk");
                OnAccept?.Invoke(interactor, this.gameObject);
                base.spriteAnimator.Play("talk");
                TextBoxManager.ShowTextBox(this.talkPoint.position, this.talkPoint, 1f, "It is done...", interactor.characterAudioSpeechTag, instant: false);
                yield return(new WaitForSeconds(1f));
            }
            else
            {
                OnDecline?.Invoke(interactor, this.gameObject);
                TextBoxManager.ClearTextBox(this.talkPoint);
            }
            //ETGModConsole.Log("We made it through the if statement");

            // Free player and run OnAccept/OnDecline actions
            interactor.ClearInputOverride("npcConversation");
            Pixelator.Instance.LerpToLetterbox(1, 0.25f);
            base.spriteAnimator.Play("idle");
            //ETGModConsole.Log("We made it");
        }