Example #1
0
 // Token: 0x060038CD RID: 14541 RVA: 0x0019F872 File Offset: 0x0019DC72
 public static void nextPage()
 {
     if ((int)PlayerNPCDialogueUI.dialoguePage == PlayerNPCDialogueUI.message.pages.Length - 1)
     {
         PlayerNPCDialogueUI.updateDialogue(PlayerNPCDialogueUI.prevDialogue, null);
     }
     else
     {
         PlayerNPCDialogueUI.dialoguePage += 1;
         PlayerNPCDialogueUI.updatePage();
     }
 }
Example #2
0
        // Token: 0x060038C9 RID: 14537 RVA: 0x0019F214 File Offset: 0x0019D614
        private static void updateDialogue(DialogueAsset newDialogue, DialogueAsset newPrevDialogue)
        {
            PlayerNPCDialogueUI.dialogue     = newDialogue;
            PlayerNPCDialogueUI.prevDialogue = newPrevDialogue;
            if (PlayerNPCDialogueUI.dialogue == null)
            {
                return;
            }
            PlayerNPCDialogueUI.responseBox.isVisible = false;
            int availableMessage = PlayerNPCDialogueUI.dialogue.getAvailableMessage(Player.player);

            if (availableMessage == -1)
            {
                return;
            }
            PlayerNPCDialogueUI.message = PlayerNPCDialogueUI.dialogue.messages[availableMessage];
            if ((PlayerNPCDialogueUI.message.conditions != null && PlayerNPCDialogueUI.message.conditions.Length > 0) || (PlayerNPCDialogueUI.message.rewards != null && PlayerNPCDialogueUI.message.rewards.Length > 0))
            {
                Player.player.quests.sendRegisterMessage(PlayerNPCDialogueUI.dialogue.id);
                if (!Provider.isServer)
                {
                    Player.player.quests.registerMessage(PlayerNPCDialogueUI.dialogue.id);
                }
            }
            PlayerNPCDialogueUI.responses.Clear();
            if (PlayerNPCDialogueUI.message.responses != null && PlayerNPCDialogueUI.message.responses.Length > 0)
            {
                for (int i = 0; i < PlayerNPCDialogueUI.message.responses.Length; i++)
                {
                    DialogueResponse dialogueResponse = PlayerNPCDialogueUI.dialogue.responses[(int)PlayerNPCDialogueUI.message.responses[i]];
                    if (dialogueResponse.areConditionsMet(Player.player))
                    {
                        PlayerNPCDialogueUI.responses.Add(dialogueResponse);
                    }
                }
            }
            else
            {
                int j = 0;
                while (j < PlayerNPCDialogueUI.dialogue.responses.Length)
                {
                    DialogueResponse dialogueResponse2 = PlayerNPCDialogueUI.dialogue.responses[j];
                    if (dialogueResponse2.messages == null || dialogueResponse2.messages.Length <= 0)
                    {
                        goto IL_1BE;
                    }
                    bool flag = false;
                    for (int k = 0; k < dialogueResponse2.messages.Length; k++)
                    {
                        if ((int)dialogueResponse2.messages[k] == availableMessage)
                        {
                            flag = true;
                            break;
                        }
                    }
                    if (flag)
                    {
                        goto IL_1BE;
                    }
IL_1DB:
                    j++;
                    continue;
IL_1BE:
                    if (dialogueResponse2.areConditionsMet(Player.player))
                    {
                        PlayerNPCDialogueUI.responses.Add(dialogueResponse2);
                        goto IL_1DB;
                    }
                    goto IL_1DB;
                }
            }
            if (PlayerNPCDialogueUI.message.prev != 0)
            {
                PlayerNPCDialogueUI.prevDialogue = (Assets.find(EAssetType.NPC, PlayerNPCDialogueUI.message.prev) as DialogueAsset);
            }
            if (PlayerNPCDialogueUI.responses.Count == 0)
            {
                if (PlayerNPCDialogueUI.prevDialogue == null)
                {
                    PlayerNPCDialogueUI.responses.Add(new DialogueResponse(0, null, 0, 0, 0, PlayerNPCDialogueUI.localization.format("Goodbye"), null, null));
                }
            }
            else
            {
                PlayerNPCDialogueUI.prevDialogue = null;
            }
            PlayerNPCDialogueUI.responseBox.remove();
            for (int l = 0; l < PlayerNPCDialogueUI.responses.Count; l++)
            {
                DialogueResponse dialogueResponse3 = PlayerNPCDialogueUI.responses[l];
                string           text = dialogueResponse3.text;
                text = text.Replace("<name_npc>", (!(PlayerLifeUI.npc != null)) ? "?" : PlayerLifeUI.npc.npcAsset.npcName);
                text = text.Replace("<name_char>", Player.player.channel.owner.playerID.characterName);
                Texture2D newIcon = null;
                if (dialogueResponse3.quest != 0)
                {
                    if (Player.player.quests.getQuestStatus(dialogueResponse3.quest) == ENPCQuestStatus.READY)
                    {
                        newIcon = (Texture2D)PlayerNPCDialogueUI.icons.load("Quest_End");
                    }
                    else
                    {
                        newIcon = (Texture2D)PlayerNPCDialogueUI.icons.load("Quest_Begin");
                    }
                }
                else if (dialogueResponse3.vendor != 0)
                {
                    newIcon = (Texture2D)PlayerNPCDialogueUI.icons.load("Vendor");
                }
                SleekButtonIcon sleekButtonIcon = new SleekButtonIcon(newIcon);
                sleekButtonIcon.positionOffset_Y = l * 30;
                sleekButtonIcon.sizeOffset_X     = -30;
                sleekButtonIcon.sizeOffset_Y     = 30;
                sleekButtonIcon.sizeScale_X      = 1f;
                sleekButtonIcon.foregroundTint   = ESleekTint.NONE;
                sleekButtonIcon.isRich           = true;
                sleekButtonIcon.text             = text;
                SleekButton sleekButton = sleekButtonIcon;
                if (PlayerNPCDialogueUI.< > f__mg$cache0 == null)
                {
                    PlayerNPCDialogueUI.< > f__mg$cache0 = new ClickedButton(PlayerNPCDialogueUI.onClickedResponseButton);
                }
                sleekButton.onClickedButton = PlayerNPCDialogueUI.< > f__mg$cache0;
                PlayerNPCDialogueUI.responseBox.add(sleekButtonIcon);
                sleekButtonIcon.isVisible = false;
            }
            PlayerNPCDialogueUI.responseBox.area = new Rect(0f, 0f, 5f, 0f);
            PlayerNPCDialogueUI.dialoguePage     = 0;
            PlayerNPCDialogueUI.updatePage();
        }