Ejemplo 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: 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);
        }