Esempio n. 1
0
        private static void onClickedTypeButton(SleekButton button)
        {
            byte typeIndex = (byte)((button.positionOffset_X + -(PlayerDashboardCraftingUI.TYPES * -30 + 5)) / 60);

            PlayerDashboardCraftingUI.searchField.text = string.Empty;
            PlayerDashboardCraftingUI.updateSelection(null, typeIndex, PlayerDashboardCraftingUI.hideUncraftable, string.Empty);
        }
Esempio n. 2
0
 private static void onInventoryResized(byte page, byte newWidth, byte newHeight)
 {
     if (PlayerDashboardCraftingUI.active)
     {
         PlayerDashboardCraftingUI.updateSelection();
     }
 }
Esempio n. 3
0
 private static void onCraftingUpdated()
 {
     if (PlayerDashboardCraftingUI.active)
     {
         PlayerDashboardCraftingUI.updateSelection();
     }
 }
 // Token: 0x0600387A RID: 14458 RVA: 0x00198E10 File Offset: 0x00197210
 public static void close()
 {
     if (!PlayerDashboardUI.active)
     {
         return;
     }
     PlayerDashboardUI.active = false;
     if (PlayerDashboardInventoryUI.active)
     {
         PlayerDashboardInventoryUI.close();
         PlayerDashboardInventoryUI.active = true;
     }
     else if (PlayerDashboardCraftingUI.active)
     {
         PlayerDashboardCraftingUI.close();
         PlayerDashboardCraftingUI.active = true;
     }
     else if (PlayerDashboardSkillsUI.active)
     {
         PlayerDashboardSkillsUI.close();
         PlayerDashboardSkillsUI.active = true;
     }
     else if (PlayerDashboardInformationUI.active)
     {
         PlayerDashboardInformationUI.close();
         PlayerDashboardInformationUI.active = true;
     }
     PlayerDashboardUI.container.lerpPositionScale(0f, -1f, ESleekLerp.EXPONENTIAL, 20f);
 }
Esempio n. 5
0
 public static void open()
 {
     if (PlayerDashboardCraftingUI.active)
     {
         return;
     }
     PlayerDashboardCraftingUI.active = true;
     PlayerDashboardCraftingUI.updateSelection(PlayerDashboardCraftingUI.viewBlueprints, PlayerDashboardCraftingUI.selectedType, PlayerDashboardCraftingUI.hideUncraftable, PlayerDashboardCraftingUI.searchText);
     PlayerDashboardCraftingUI.container.lerpPositionScale(0f, 0f, ESleekLerp.EXPONENTIAL, 20f);
 }
 // Token: 0x0600387E RID: 14462 RVA: 0x00198F38 File Offset: 0x00197338
 private static void onClickedInformationButton(SleekButton button)
 {
     PlayerDashboardInventoryUI.close();
     PlayerDashboardCraftingUI.close();
     PlayerDashboardSkillsUI.close();
     if (PlayerDashboardInformationUI.active)
     {
         PlayerDashboardUI.close();
         PlayerLifeUI.open();
     }
     else
     {
         PlayerDashboardInformationUI.open();
     }
 }
Esempio n. 7
0
 private static void onClickedSearchButton(SleekButton button)
 {
     PlayerDashboardCraftingUI.updateSelection(null, PlayerDashboardCraftingUI.selectedType, PlayerDashboardCraftingUI.hideUncraftable, PlayerDashboardCraftingUI.searchField.text);
 }
Esempio n. 8
0
 private static void onEnteredSearchField(SleekField field)
 {
     PlayerDashboardCraftingUI.updateSelection(null, PlayerDashboardCraftingUI.selectedType, PlayerDashboardCraftingUI.hideUncraftable, PlayerDashboardCraftingUI.searchField.text);
 }
Esempio n. 9
0
 private static void onToggledHideUncraftableToggle(SleekToggle toggle, bool state)
 {
     PlayerDashboardCraftingUI.updateSelection(PlayerDashboardCraftingUI.viewBlueprints, PlayerDashboardCraftingUI.selectedType, state, PlayerDashboardCraftingUI.searchText);
 }
Esempio n. 10
0
        private static void updateSelection(Blueprint[] view, byte typeIndex, bool uncraftable, string search)
        {
            bool             flag = PowerTool.checkFires(Player.player.transform.position, 16f);
            List <Blueprint> list;

            if (view == null)
            {
                list = new List <Blueprint>();
                foreach (ItemAsset itemAsset in Assets.find(EAssetType.ITEM))
                {
                    if (itemAsset != null)
                    {
                        for (int j = 0; j < itemAsset.blueprints.Count; j++)
                        {
                            Blueprint blueprint = itemAsset.blueprints[j];
                            if ((search.Length <= 0) ? (blueprint.type == (EBlueprintType)typeIndex) : PlayerDashboardCraftingUI.searchBlueprintText(blueprint, search))
                            {
                                list.Add(blueprint);
                            }
                        }
                    }
                }
            }
            else
            {
                list = new List <Blueprint>(view);
            }
            List <Blueprint> list2 = new List <Blueprint>();

            for (int k = 0; k < list.Count; k++)
            {
                Blueprint blueprint2 = list[k];
                if (blueprint2.skill != EBlueprintSkill.REPAIR || (uint)blueprint2.level <= Provider.modeConfigData.Gameplay.Repair_Level_Max)
                {
                    if (string.IsNullOrEmpty(blueprint2.map) || blueprint2.map.Equals(Level.info.name, StringComparison.InvariantCultureIgnoreCase))
                    {
                        ItemAsset itemAsset2 = (ItemAsset)Assets.find(EAssetType.ITEM, blueprint2.source);
                        ushort    num        = 0;
                        bool      flag2      = true;
                        blueprint2.hasSupplies = true;
                        blueprint2.hasSkills   = (blueprint2.skill == EBlueprintSkill.NONE || (blueprint2.skill == EBlueprintSkill.CRAFT && Player.player.skills.skills[2][1].level >= blueprint2.level) || (blueprint2.skill == EBlueprintSkill.COOK && flag && Player.player.skills.skills[2][3].level >= blueprint2.level) || (blueprint2.skill == EBlueprintSkill.REPAIR && Player.player.skills.skills[2][7].level >= blueprint2.level));
                        List <InventorySearch>[] array2 = new List <InventorySearch> [blueprint2.supplies.Length];
                        byte b = 0;
                        while ((int)b < blueprint2.supplies.Length)
                        {
                            BlueprintSupply        blueprintSupply = blueprint2.supplies[(int)b];
                            List <InventorySearch> list3           = Player.player.inventory.search(blueprintSupply.id, false, true);
                            ushort num2 = 0;
                            byte   b2   = 0;
                            while ((int)b2 < list3.Count)
                            {
                                num2 += (ushort)list3[(int)b2].jar.item.amount;
                                b2   += 1;
                            }
                            num += num2;
                            blueprintSupply.hasAmount = num2;
                            if (blueprint2.type == EBlueprintType.AMMO)
                            {
                                if (blueprintSupply.hasAmount == 0)
                                {
                                    blueprint2.hasSupplies = false;
                                }
                            }
                            else if (blueprintSupply.hasAmount < blueprintSupply.amount)
                            {
                                blueprint2.hasSupplies = false;
                            }
                            if (blueprintSupply.hasAmount < blueprintSupply.amount && blueprintSupply.isCritical)
                            {
                                flag2 = false;
                            }
                            array2[(int)b] = list3;
                            b += 1;
                        }
                        if (blueprint2.tool != 0)
                        {
                            InventorySearch inventorySearch = Player.player.inventory.has(blueprint2.tool);
                            blueprint2.tools   = ((inventorySearch == null) ? 0 : 1);
                            blueprint2.hasTool = (inventorySearch != null);
                            if (inventorySearch == null && blueprint2.toolCritical)
                            {
                                flag2 = false;
                            }
                        }
                        else
                        {
                            blueprint2.tools   = 1;
                            blueprint2.hasTool = true;
                        }
                        if (!flag2)
                        {
                            num = 0;
                        }
                        if (blueprint2.type == EBlueprintType.REPAIR)
                        {
                            List <InventorySearch> list4 = Player.player.inventory.search(itemAsset2.id, false, false);
                            byte b3 = byte.MaxValue;
                            byte b4 = byte.MaxValue;
                            byte b5 = 0;
                            while ((int)b5 < list4.Count)
                            {
                                if (list4[(int)b5].jar.item.quality < b3)
                                {
                                    b3 = list4[(int)b5].jar.item.quality;
                                    b4 = b5;
                                }
                                b5 += 1;
                            }
                            if (b4 != 255)
                            {
                                blueprint2.items = (ushort)list4[(int)b4].jar.item.quality;
                                num += 1;
                            }
                            else
                            {
                                blueprint2.items = 0;
                            }
                            blueprint2.hasItem = (b4 != byte.MaxValue);
                        }
                        else if (blueprint2.type == EBlueprintType.AMMO)
                        {
                            List <InventorySearch> list5 = Player.player.inventory.search(itemAsset2.id, true, true);
                            int  num3 = -1;
                            byte b6   = byte.MaxValue;
                            byte b7   = 0;
                            while ((int)b7 < list5.Count)
                            {
                                if ((int)list5[(int)b7].jar.item.amount > num3 && list5[(int)b7].jar.item.amount < itemAsset2.amount)
                                {
                                    num3 = (int)list5[(int)b7].jar.item.amount;
                                    b6   = b7;
                                }
                                b7 += 1;
                            }
                            if (b6 != 255)
                            {
                                if (list5[(int)b6].jar.item.id == blueprint2.supplies[0].id)
                                {
                                    BlueprintSupply blueprintSupply2 = blueprint2.supplies[0];
                                    blueprintSupply2.hasAmount -= (ushort)num3;
                                }
                                blueprint2.supplies[0].amount = (ushort)((byte)((int)itemAsset2.amount - num3));
                                blueprint2.items = (ushort)list5[(int)b6].jar.item.amount;
                                num += 1;
                            }
                            else
                            {
                                blueprint2.supplies[0].amount = 0;
                                blueprint2.items = 0;
                            }
                            blueprint2.hasItem = (b6 != byte.MaxValue);
                            if (b6 == 255)
                            {
                                blueprint2.products = 0;
                            }
                            else if (blueprint2.items + blueprint2.supplies[0].hasAmount > (ushort)itemAsset2.amount)
                            {
                                blueprint2.products = (ushort)itemAsset2.amount;
                            }
                            else
                            {
                                blueprint2.products = blueprint2.items + blueprint2.supplies[0].hasAmount;
                            }
                        }
                        else
                        {
                            blueprint2.hasItem = true;
                        }
                        if (uncraftable)
                        {
                            if (blueprint2.hasSupplies && blueprint2.hasTool && blueprint2.hasItem && blueprint2.hasSkills)
                            {
                                list2.Add(blueprint2);
                            }
                        }
                        else if (view != null)
                        {
                            if (blueprint2.hasSupplies && blueprint2.hasTool && blueprint2.hasItem && blueprint2.hasSkills)
                            {
                                list2.Insert(0, blueprint2);
                            }
                            else
                            {
                                list2.Add(blueprint2);
                            }
                        }
                        else if (blueprint2.hasSupplies && blueprint2.hasTool && blueprint2.hasItem && blueprint2.hasSkills)
                        {
                            list2.Insert(0, blueprint2);
                        }
                        else if ((blueprint2.type == EBlueprintType.AMMO || blueprint2.type == EBlueprintType.REPAIR || num != 0) && blueprint2.hasItem)
                        {
                            list2.Add(blueprint2);
                        }
                    }
                }
            }
            PlayerDashboardCraftingUI.viewBlueprints  = view;
            PlayerDashboardCraftingUI.selectedType    = typeIndex;
            PlayerDashboardCraftingUI.hideUncraftable = uncraftable;
            PlayerDashboardCraftingUI.searchText      = search;
            PlayerDashboardCraftingUI.blueprints      = list2.ToArray();
            PlayerDashboardCraftingUI.blueprintsScrollBox.remove();
            PlayerDashboardCraftingUI.blueprintsScrollBox.area = new Rect(0f, 0f, 5f, (float)(PlayerDashboardCraftingUI.blueprints.Length * 205 - 10));
            for (int l = 0; l < PlayerDashboardCraftingUI.blueprints.Length; l++)
            {
                Blueprint      newBlueprint   = PlayerDashboardCraftingUI.blueprints[l];
                SleekBlueprint sleekBlueprint = new SleekBlueprint(newBlueprint);
                sleekBlueprint.positionOffset_Y = l * 205;
                sleekBlueprint.sizeOffset_X     = -30;
                sleekBlueprint.sizeOffset_Y     = 195;
                sleekBlueprint.sizeScale_X      = 1f;
                SleekButton sleekButton = sleekBlueprint;
                if (PlayerDashboardCraftingUI.< > f__mg$cache0 == null)
                {
                    PlayerDashboardCraftingUI.< > f__mg$cache0 = new ClickedButton(PlayerDashboardCraftingUI.onClickedBlueprintButton);
                }
                sleekButton.onClickedButton = PlayerDashboardCraftingUI.< > f__mg$cache0;
                PlayerDashboardCraftingUI.blueprintsScrollBox.add(sleekBlueprint);
            }
            PlayerDashboardCraftingUI.infoBox.isVisible = (PlayerDashboardCraftingUI.blueprints.Length == 0);
        }
Esempio n. 11
0
 public static void updateSelection()
 {
     PlayerDashboardCraftingUI.updateSelection(PlayerDashboardCraftingUI.viewBlueprints, PlayerDashboardCraftingUI.selectedType, PlayerDashboardCraftingUI.hideUncraftable, PlayerDashboardCraftingUI.searchText);
 }