Exemplo n.º 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: 0x060038E0 RID: 14560 RVA: 0x001A1321 File Offset: 0x0019F721
 public static void open(VendorAsset newVendor, DialogueResponse newResponse, DialogueAsset newDialogue, DialogueAsset newPrevDialogue)
 {
     if (PlayerNPCVendorUI.active)
     {
         return;
     }
     PlayerNPCVendorUI.active = true;
     PlayerNPCVendorUI.updateVendor(newVendor, newResponse, newDialogue, newPrevDialogue);
     PlayerNPCVendorUI.container.lerpPositionScale(0f, 0f, ESleekLerp.EXPONENTIAL, 20f);
 }
 // 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);
 }
Exemplo n.º 4
0
 // Token: 0x060038D1 RID: 14545 RVA: 0x0019FD44 File Offset: 0x0019E144
 public static void registerResponse(DialogueAsset dialogue, DialogueResponse response)
 {
     if ((response.conditions != null && response.conditions.Length > 0) || (response.rewards != null && response.rewards.Length > 0))
     {
         Player.player.quests.sendRegisterResponse(dialogue.id, response.index);
         if (!Provider.isServer)
         {
             Player.player.quests.registerResponse(dialogue.id, response.index);
         }
     }
 }
Exemplo n.º 5
0
        public override void use()
        {
            DialogueAsset dialogueAsset = Assets.find(EAssetType.NPC, this.npcAsset.dialogue) as DialogueAsset;

            if (dialogueAsset == null)
            {
                return;
            }
            ObjectManager.useObjectNPC(base.transform);
            Player.player.quests.checkNPC = this;
            PlayerLifeUI.close();
            PlayerLifeUI.npc       = this;
            this.isLookingAtPlayer = true;
            PlayerNPCDialogueUI.open(dialogueAsset, null);
        }
Exemplo n.º 6
0
 // Token: 0x060038C7 RID: 14535 RVA: 0x0019F15C File Offset: 0x0019D55C
 public static void open(DialogueAsset newDialogue, DialogueAsset newPrevDialogue)
 {
     if (PlayerNPCDialogueUI.active)
     {
         return;
     }
     PlayerNPCDialogueUI.active = true;
     if (PlayerLifeUI.npc != null && PlayerLifeUI.npc.npcAsset != null)
     {
         PlayerNPCDialogueUI.characterLabel.text = PlayerLifeUI.npc.npcAsset.npcName;
     }
     else
     {
         PlayerNPCDialogueUI.characterLabel.text = "?";
     }
     PlayerNPCDialogueUI.updateDialogue(newDialogue, newPrevDialogue);
     PlayerNPCDialogueUI.container.lerpPositionScale(0f, 0f, ESleekLerp.EXPONENTIAL, 20f);
 }
Exemplo n.º 7
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();
        }
        // Token: 0x060038E3 RID: 14563 RVA: 0x001A1398 File Offset: 0x0019F798
        private static void updateVendor(VendorAsset newVendor, DialogueResponse newResponse, DialogueAsset newDialogue, DialogueAsset newPrevDialogue)
        {
            PlayerNPCVendorUI.vendor       = newVendor;
            PlayerNPCVendorUI.response     = newResponse;
            PlayerNPCVendorUI.dialogue     = newDialogue;
            PlayerNPCVendorUI.prevDialogue = newPrevDialogue;
            if (PlayerNPCVendorUI.vendor == null)
            {
                return;
            }
            PlayerNPCVendorUI.nameLabel.text = PlayerNPCVendorUI.vendor.vendorName;
            string text = PlayerNPCVendorUI.vendor.vendorDescription;

            text = text.Replace("<br>", "\n");
            PlayerNPCVendorUI.descriptionLabel.text = text;
            PlayerNPCVendorUI.buttons.Clear();
            PlayerNPCVendorUI.buying.Clear();
            byte b = 0;

            while ((int)b < PlayerNPCVendorUI.vendor.buying.Length)
            {
                VendorBuying vendorBuying = PlayerNPCVendorUI.vendor.buying[(int)b];
                if (vendorBuying.areConditionsMet(Player.player))
                {
                    PlayerNPCVendorUI.buying.Add(vendorBuying);
                }
                b += 1;
            }
            PlayerNPCVendorUI.buying.Sort(PlayerNPCVendorUI.buyingComparator);
            PlayerNPCVendorUI.buyingBox.isVisible = (PlayerNPCVendorUI.buying.Count > 0);
            PlayerNPCVendorUI.buyingBox.remove();
            int  num = 0;
            byte b2  = 0;

            while ((int)b2 < PlayerNPCVendorUI.buying.Count)
            {
                VendorBuying newElement  = PlayerNPCVendorUI.buying[(int)b2];
                SleekVendor  sleekVendor = new SleekVendor(newElement);
                sleekVendor.positionOffset_Y = num;
                sleekVendor.sizeOffset_X     = -30;
                sleekVendor.sizeScale_X      = 1f;
                SleekButton sleekButton = sleekVendor;
                if (PlayerNPCVendorUI.< > f__mg$cache0 == null)
                {
                    PlayerNPCVendorUI.< > f__mg$cache0 = new ClickedButton(PlayerNPCVendorUI.onClickedBuyingButton);
                }
                sleekButton.onClickedButton = PlayerNPCVendorUI.< > f__mg$cache0;
                PlayerNPCVendorUI.buyingBox.add(sleekVendor);
                num += sleekVendor.sizeOffset_Y;
                PlayerNPCVendorUI.buttons.Add(sleekVendor);
                b2 += 1;
            }
            PlayerNPCVendorUI.buyingBox.area = new Rect(0f, 0f, 5f, (float)num);
            PlayerNPCVendorUI.selling.Clear();
            byte b3 = 0;

            while ((int)b3 < PlayerNPCVendorUI.vendor.selling.Length)
            {
                VendorSelling vendorSelling = PlayerNPCVendorUI.vendor.selling[(int)b3];
                if (vendorSelling.areConditionsMet(Player.player))
                {
                    PlayerNPCVendorUI.selling.Add(vendorSelling);
                }
                b3 += 1;
            }
            PlayerNPCVendorUI.selling.Sort(PlayerNPCVendorUI.sellingComparator);
            PlayerNPCVendorUI.sellingBox.isVisible = (PlayerNPCVendorUI.selling.Count > 0);
            PlayerNPCVendorUI.sellingBox.remove();
            int  num2 = 0;
            byte b4   = 0;

            while ((int)b4 < PlayerNPCVendorUI.selling.Count)
            {
                VendorSelling newElement2  = PlayerNPCVendorUI.selling[(int)b4];
                SleekVendor   sleekVendor2 = new SleekVendor(newElement2);
                sleekVendor2.positionOffset_Y = num2;
                sleekVendor2.sizeOffset_X     = -30;
                sleekVendor2.sizeScale_X      = 1f;
                SleekButton sleekButton2 = sleekVendor2;
                if (PlayerNPCVendorUI.< > f__mg$cache1 == null)
                {
                    PlayerNPCVendorUI.< > f__mg$cache1 = new ClickedButton(PlayerNPCVendorUI.onClickedSellingButton);
                }
                sleekButton2.onClickedButton = PlayerNPCVendorUI.< > f__mg$cache1;
                PlayerNPCVendorUI.sellingBox.add(sleekVendor2);
                num2 += sleekVendor2.sizeOffset_Y;
                PlayerNPCVendorUI.buttons.Add(sleekVendor2);
                b4 += 1;
            }
            PlayerNPCVendorUI.sellingBox.area = new Rect(0f, 0f, 5f, (float)num2);
        }
        // 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;
            }
        }