示例#1
0
        // Token: 0x060038D2 RID: 14546 RVA: 0x0019FDC4 File Offset: 0x0019E1C4
        private static void onClickedResponseButton(SleekButton button)
        {
            byte             index            = (byte)PlayerNPCDialogueUI.responseBox.search(button);
            DialogueResponse dialogueResponse = PlayerNPCDialogueUI.responses[(int)index];
            DialogueAsset    dialogueAsset    = (DialogueAsset)Assets.find(EAssetType.NPC, dialogueResponse.dialogue);
            QuestAsset       questAsset       = (QuestAsset)Assets.find(EAssetType.NPC, dialogueResponse.quest);

            if (questAsset != null)
            {
                PlayerNPCDialogueUI.close();
                PlayerNPCQuestUI.open(questAsset, dialogueResponse, dialogueAsset, PlayerNPCDialogueUI.dialogue, (Player.player.quests.getQuestStatus(dialogueResponse.quest) != ENPCQuestStatus.READY) ? EQuestViewMode.BEGIN : EQuestViewMode.END);
            }
            else
            {
                VendorAsset vendorAsset = (VendorAsset)Assets.find(EAssetType.NPC, dialogueResponse.vendor);
                if (vendorAsset != null)
                {
                    PlayerNPCDialogueUI.close();
                    PlayerNPCVendorUI.open(vendorAsset, dialogueResponse, dialogueAsset, PlayerNPCDialogueUI.dialogue);
                }
                else
                {
                    PlayerNPCDialogueUI.registerResponse(PlayerNPCDialogueUI.dialogue, dialogueResponse);
                    if (dialogueAsset != null)
                    {
                        PlayerNPCDialogueUI.updateDialogue(dialogueAsset, PlayerNPCDialogueUI.dialogue);
                    }
                    else
                    {
                        PlayerNPCDialogueUI.close();
                        PlayerLifeUI.open();
                    }
                }
            }
        }
 // Token: 0x060038D5 RID: 14549 RVA: 0x001A07A2 File Offset: 0x0019EBA2
 public static void open(QuestAsset newQuest, DialogueResponse newResponse, DialogueAsset newAcceptDialogue, DialogueAsset newDeclineDialogue, EQuestViewMode newMode)
 {
     if (PlayerNPCQuestUI.active)
     {
         return;
     }
     PlayerNPCQuestUI.active = true;
     PlayerNPCQuestUI.updateQuest(newQuest, newResponse, newAcceptDialogue, newDeclineDialogue, newMode);
     PlayerNPCQuestUI.container.lerpPositionScale(0f, 0f, ESleekLerp.EXPONENTIAL, 20f);
 }
        // Token: 0x060038D8 RID: 14552 RVA: 0x001A088C File Offset: 0x0019EC8C
        private static void updateQuest(QuestAsset newQuest, DialogueResponse newResponse, DialogueAsset newAcceptDialogue, DialogueAsset newDeclineDialogue, EQuestViewMode newMode)
        {
            PlayerNPCQuestUI.quest           = newQuest;
            PlayerNPCQuestUI.response        = newResponse;
            PlayerNPCQuestUI.acceptDialogue  = newAcceptDialogue;
            PlayerNPCQuestUI.declineDialogue = newDeclineDialogue;
            PlayerNPCQuestUI.mode            = newMode;
            if (PlayerNPCQuestUI.quest == null)
            {
                return;
            }
            PlayerNPCQuestUI.beginContainer.isVisible   = (PlayerNPCQuestUI.mode == EQuestViewMode.BEGIN);
            PlayerNPCQuestUI.endContainer.isVisible     = (PlayerNPCQuestUI.mode == EQuestViewMode.END);
            PlayerNPCQuestUI.detailsContainer.isVisible = (PlayerNPCQuestUI.mode == EQuestViewMode.DETAILS);
            if (PlayerNPCQuestUI.mode == EQuestViewMode.DETAILS)
            {
                if (Player.player.quests.TrackedQuestID == PlayerNPCQuestUI.quest.id)
                {
                    PlayerNPCQuestUI.trackButton.text = PlayerNPCQuestUI.localization.format("Track_Off");
                }
                else
                {
                    PlayerNPCQuestUI.trackButton.text = PlayerNPCQuestUI.localization.format("Track_On");
                }
            }
            PlayerNPCQuestUI.nameLabel.text = PlayerNPCQuestUI.quest.questName;
            string text = PlayerNPCQuestUI.quest.questDescription;

            text = text.Replace("<br>", "\n");
            PlayerNPCQuestUI.descriptionLabel.text = text;
            int num  = Screen.height - 80;
            int num2 = 0;

            if (PlayerNPCQuestUI.quest.conditions != null && PlayerNPCQuestUI.quest.conditions.Length > 0)
            {
                PlayerNPCQuestUI.conditionsLabel.isVisible     = true;
                PlayerNPCQuestUI.conditionsContainer.isVisible = true;
                PlayerNPCQuestUI.conditionsContainer.remove();
                int num3 = 0;
                for (int i = 0; i < PlayerNPCQuestUI.quest.conditions.Length; i++)
                {
                    INPCCondition inpccondition = PlayerNPCQuestUI.quest.conditions[i];
                    bool          flag          = inpccondition.isConditionMet(Player.player);
                    Texture2D     icon          = null;
                    if (PlayerNPCQuestUI.mode != EQuestViewMode.BEGIN)
                    {
                        if (flag)
                        {
                            icon = (Texture2D)PlayerNPCQuestUI.icons.load("Complete");
                        }
                        else
                        {
                            icon = (Texture2D)PlayerNPCQuestUI.icons.load("Incomplete");
                        }
                    }
                    Sleek sleek = inpccondition.createUI(Player.player, icon);
                    if (sleek != null)
                    {
                        sleek.positionOffset_Y = num3;
                        PlayerNPCQuestUI.conditionsContainer.add(sleek);
                        num3 += sleek.sizeOffset_Y;
                    }
                }
                PlayerNPCQuestUI.conditionsContainer.sizeOffset_Y = num3;
                num2 += 30;
                num2 += num3;
            }
            else
            {
                PlayerNPCQuestUI.conditionsLabel.isVisible     = false;
                PlayerNPCQuestUI.conditionsContainer.isVisible = false;
            }
            if (PlayerNPCQuestUI.quest.rewards != null && PlayerNPCQuestUI.quest.rewards.Length > 0)
            {
                PlayerNPCQuestUI.rewardsLabel.isVisible     = true;
                PlayerNPCQuestUI.rewardsContainer.isVisible = true;
                PlayerNPCQuestUI.rewardsContainer.remove();
                int num4 = 0;
                for (int j = 0; j < PlayerNPCQuestUI.quest.rewards.Length; j++)
                {
                    INPCReward inpcreward = PlayerNPCQuestUI.quest.rewards[j];
                    Sleek      sleek2     = inpcreward.createUI(Player.player);
                    if (sleek2 != null)
                    {
                        sleek2.positionOffset_Y = num4;
                        PlayerNPCQuestUI.rewardsContainer.add(sleek2);
                        num4 += sleek2.sizeOffset_Y;
                    }
                }
                PlayerNPCQuestUI.rewardsLabel.positionOffset_Y     = num2;
                PlayerNPCQuestUI.rewardsContainer.positionOffset_Y = num2 + 30;
                PlayerNPCQuestUI.rewardsContainer.sizeOffset_Y     = num4;
                num2 += 30;
                num2 += num4;
            }
            else
            {
                PlayerNPCQuestUI.rewardsLabel.isVisible     = false;
                PlayerNPCQuestUI.rewardsContainer.isVisible = false;
            }
            PlayerNPCQuestUI.detailsBox.area = new Rect(0f, 0f, 5f, (float)num2);
            if (num2 + 105 > num)
            {
                PlayerNPCQuestUI.questBox.positionOffset_Y   = 0;
                PlayerNPCQuestUI.questBox.positionScale_Y    = 0f;
                PlayerNPCQuestUI.questBox.sizeOffset_Y       = num;
                PlayerNPCQuestUI.detailsBox.positionOffset_Y = -num + 100;
                PlayerNPCQuestUI.detailsBox.sizeOffset_Y     = num - 105;
                PlayerNPCQuestUI.detailsBox.sizeOffset_X     = -10;
            }
            else
            {
                PlayerNPCQuestUI.questBox.positionOffset_Y   = -num2 / 2 - 80;
                PlayerNPCQuestUI.questBox.positionScale_Y    = 0.5f;
                PlayerNPCQuestUI.questBox.sizeOffset_Y       = num2 + 100;
                PlayerNPCQuestUI.detailsBox.positionOffset_Y = -5 - num2;
                PlayerNPCQuestUI.detailsBox.sizeOffset_Y     = num2;
                PlayerNPCQuestUI.detailsBox.sizeOffset_X     = 20;
            }
        }