Ejemplo n.º 1
0
        // Token: 0x06003489 RID: 13449 RVA: 0x00159464 File Offset: 0x00157864
        public static Transform getVehicle(ushort id, ushort skin, ushort mythic, VehicleAsset vehicleAsset, SkinAsset skinAsset)
        {
            if (vehicleAsset != null && vehicleAsset.vehicle != null)
            {
                if (id != vehicleAsset.id)
                {
                    Debug.LogError("ID and asset ID are not in sync!");
                }
                Transform transform = UnityEngine.Object.Instantiate <GameObject>(vehicleAsset.vehicle).transform;
                transform.name = id.ToString();
                if (skinAsset != null)
                {
                    InteractableVehicle interactableVehicle = transform.gameObject.AddComponent <InteractableVehicle>();
                    interactableVehicle.id            = id;
                    interactableVehicle.skinID        = skin;
                    interactableVehicle.mythicID      = mythic;
                    interactableVehicle.fuel          = 10000;
                    interactableVehicle.isExploded    = false;
                    interactableVehicle.health        = 10000;
                    interactableVehicle.batteryCharge = 10000;
                    interactableVehicle.safeInit();
                    interactableVehicle.updateFires();
                    interactableVehicle.updateSkin();
                }
                return(transform);
            }
            Transform transform2 = new GameObject().transform;

            transform2.name             = id.ToString();
            transform2.tag              = "Vehicle";
            transform2.gameObject.layer = LayerMasks.VEHICLE;
            return(transform2);
        }
Ejemplo n.º 2
0
        // Token: 0x06001C36 RID: 7222 RVA: 0x00099740 File Offset: 0x00097B40
        public override string formatReward(Player player)
        {
            if (string.IsNullOrEmpty(this.text))
            {
                this.text = PlayerNPCQuestUI.localization.read("Reward_Vehicle");
            }
            VehicleAsset vehicleAsset = Assets.find(EAssetType.VEHICLE, this.id) as VehicleAsset;
            string       arg;

            if (vehicleAsset != null)
            {
                arg = string.Concat(new string[]
                {
                    "<color=",
                    Palette.hex(ItemTool.getRarityColorUI(vehicleAsset.rarity)),
                    ">",
                    vehicleAsset.vehicleName,
                    "</color>"
                });
            }
            else
            {
                arg = "?";
            }
            return(string.Format(this.text, arg));
        }
 // Token: 0x0600356E RID: 13678 RVA: 0x00165820 File Offset: 0x00163C20
 private static void onClickedAddVehicleButton(SleekButton button)
 {
     if ((int)EditorSpawns.selectedVehicle < LevelVehicles.tables.Count && (int)EditorSpawnsVehiclesUI.selectedTier < LevelVehicles.tables[(int)EditorSpawns.selectedVehicle].tiers.Count)
     {
         VehicleAsset vehicleAsset = (VehicleAsset)Assets.find(EAssetType.VEHICLE, EditorSpawnsVehiclesUI.vehicleIDField.state);
         if (vehicleAsset != null)
         {
             LevelVehicles.tables[(int)EditorSpawns.selectedVehicle].addVehicle(EditorSpawnsVehiclesUI.selectedTier, EditorSpawnsVehiclesUI.vehicleIDField.state);
             EditorSpawnsVehiclesUI.updateSelection();
             EditorSpawnsVehiclesUI.spawnsScrollBox.state = new Vector2(0f, float.MaxValue);
         }
         EditorSpawnsVehiclesUI.vehicleIDField.state = 0;
     }
 }
Ejemplo n.º 4
0
        // Token: 0x0600348B RID: 13451 RVA: 0x001595EC File Offset: 0x001579EC
        public static bool giveVehicle(Player player, ushort id)
        {
            VehicleAsset vehicleAsset = (VehicleAsset)Assets.find(EAssetType.VEHICLE, id);

            if (vehicleAsset != null)
            {
                Vector3    vector = player.transform.position + player.transform.forward * 6f;
                RaycastHit raycastHit;
                Physics.Raycast(vector + Vector3.up * 16f, Vector3.down, out raycastHit, 32f, RayMasks.BLOCK_VEHICLE);
                if (raycastHit.collider != null)
                {
                    vector.y = raycastHit.point.y + 16f;
                }
                VehicleManager.spawnVehicle(id, vector, player.transform.rotation);
                return(true);
            }
            return(false);
        }
Ejemplo n.º 5
0
        // Token: 0x0600348A RID: 13450 RVA: 0x00159560 File Offset: 0x00157960
        public static void getIcon(ushort id, ushort skin, VehicleAsset vehicleAsset, SkinAsset skinAsset, int x, int y, VehicleIconReady callback)
        {
            if (vehicleAsset != null && id != vehicleAsset.id)
            {
                Debug.LogError("ID and vehicle asset ID are not in sync!");
            }
            if (skinAsset != null && skin != skinAsset.id)
            {
                Debug.LogError("ID and skin asset ID are not in sync!");
            }
            VehicleIconInfo vehicleIconInfo = new VehicleIconInfo();

            vehicleIconInfo.id           = id;
            vehicleIconInfo.skin         = skin;
            vehicleIconInfo.vehicleAsset = vehicleAsset;
            vehicleIconInfo.skinAsset    = skinAsset;
            vehicleIconInfo.x            = x;
            vehicleIconInfo.y            = y;
            vehicleIconInfo.callback     = callback;
            VehicleTool.icons.Enqueue(vehicleIconInfo);
        }
Ejemplo n.º 6
0
        // Token: 0x06003477 RID: 13431 RVA: 0x00157C1C File Offset: 0x0015601C
        private static bool isVariantVehicleTier(VehicleTier tier)
        {
            if (tier.table.Count < 6)
            {
                return(false);
            }
            VehicleAsset vehicleAsset = (VehicleAsset)Assets.find(EAssetType.VEHICLE, tier.table[0].vehicle);

            if (vehicleAsset == null)
            {
                return(false);
            }
            int num = vehicleAsset.vehicleName.IndexOf(" ");

            if (num <= 0)
            {
                return(false);
            }
            string text = vehicleAsset.vehicleName.Substring(num + 1);

            if (text.Length <= 1)
            {
                Debug.LogError(vehicleAsset.vehicleName + " name has a trailing space!");
                return(false);
            }
            for (int i = 1; i < tier.table.Count; i++)
            {
                VehicleAsset vehicleAsset2 = (VehicleAsset)Assets.find(EAssetType.VEHICLE, tier.table[i].vehicle);
                if (!vehicleAsset2.vehicleName.Contains(text))
                {
                    return(false);
                }
            }
            tier.name = text;
            return(true);
        }
 // Token: 0x06003561 RID: 13665 RVA: 0x00164CDC File Offset: 0x001630DC
 public static void updateSelection()
 {
     if ((int)EditorSpawns.selectedVehicle < LevelVehicles.tables.Count)
     {
         VehicleTable vehicleTable = LevelVehicles.tables[(int)EditorSpawns.selectedVehicle];
         EditorSpawnsVehiclesUI.selectedBox.text       = vehicleTable.name;
         EditorSpawnsVehiclesUI.tableNameField.text    = vehicleTable.name;
         EditorSpawnsVehiclesUI.tableIDField.state     = vehicleTable.tableID;
         EditorSpawnsVehiclesUI.tableColorPicker.state = vehicleTable.color;
         if (EditorSpawnsVehiclesUI.tierButtons != null)
         {
             for (int i = 0; i < EditorSpawnsVehiclesUI.tierButtons.Length; i++)
             {
                 EditorSpawnsVehiclesUI.spawnsScrollBox.remove(EditorSpawnsVehiclesUI.tierButtons[i]);
             }
         }
         EditorSpawnsVehiclesUI.tierButtons = new SleekButton[vehicleTable.tiers.Count];
         for (int j = 0; j < EditorSpawnsVehiclesUI.tierButtons.Length; j++)
         {
             VehicleTier vehicleTier = vehicleTable.tiers[j];
             SleekButton sleekButton = new SleekButton();
             sleekButton.positionOffset_X = 240;
             sleekButton.positionOffset_Y = 170 + j * 70;
             sleekButton.sizeOffset_X     = 200;
             sleekButton.sizeOffset_Y     = 30;
             sleekButton.text             = vehicleTier.name;
             SleekButton sleekButton2 = sleekButton;
             if (EditorSpawnsVehiclesUI.< > f__mg$cache1 == null)
             {
                 EditorSpawnsVehiclesUI.< > f__mg$cache1 = new ClickedButton(EditorSpawnsVehiclesUI.onClickedTierButton);
             }
             sleekButton2.onClickedButton = EditorSpawnsVehiclesUI.< > f__mg$cache1;
             EditorSpawnsVehiclesUI.spawnsScrollBox.add(sleekButton);
             SleekSlider sleekSlider = new SleekSlider();
             sleekSlider.positionOffset_Y = 40;
             sleekSlider.sizeOffset_X     = 200;
             sleekSlider.sizeOffset_Y     = 20;
             sleekSlider.orientation      = ESleekOrientation.HORIZONTAL;
             sleekSlider.state            = vehicleTier.chance;
             sleekSlider.addLabel(Mathf.RoundToInt(vehicleTier.chance * 100f) + "%", ESleekSide.LEFT);
             SleekSlider sleekSlider2 = sleekSlider;
             if (EditorSpawnsVehiclesUI.< > f__mg$cache2 == null)
             {
                 EditorSpawnsVehiclesUI.< > f__mg$cache2 = new Dragged(EditorSpawnsVehiclesUI.onDraggedChanceSlider);
             }
             sleekSlider2.onDragged = EditorSpawnsVehiclesUI.< > f__mg$cache2;
             sleekButton.add(sleekSlider);
             EditorSpawnsVehiclesUI.tierButtons[j] = sleekButton;
         }
         EditorSpawnsVehiclesUI.tierNameField.positionOffset_Y    = 170 + EditorSpawnsVehiclesUI.tierButtons.Length * 70;
         EditorSpawnsVehiclesUI.addTierButton.positionOffset_Y    = 170 + EditorSpawnsVehiclesUI.tierButtons.Length * 70 + 40;
         EditorSpawnsVehiclesUI.removeTierButton.positionOffset_Y = 170 + EditorSpawnsVehiclesUI.tierButtons.Length * 70 + 40;
         if (EditorSpawnsVehiclesUI.vehicleButtons != null)
         {
             for (int k = 0; k < EditorSpawnsVehiclesUI.vehicleButtons.Length; k++)
             {
                 EditorSpawnsVehiclesUI.spawnsScrollBox.remove(EditorSpawnsVehiclesUI.vehicleButtons[k]);
             }
         }
         if ((int)EditorSpawnsVehiclesUI.selectedTier < vehicleTable.tiers.Count)
         {
             EditorSpawnsVehiclesUI.tierNameField.text = vehicleTable.tiers[(int)EditorSpawnsVehiclesUI.selectedTier].name;
             EditorSpawnsVehiclesUI.vehicleButtons     = new SleekButton[vehicleTable.tiers[(int)EditorSpawnsVehiclesUI.selectedTier].table.Count];
             for (int l = 0; l < EditorSpawnsVehiclesUI.vehicleButtons.Length; l++)
             {
                 SleekButton sleekButton3 = new SleekButton();
                 sleekButton3.positionOffset_X = 240;
                 sleekButton3.positionOffset_Y = 170 + EditorSpawnsVehiclesUI.tierButtons.Length * 70 + 80 + l * 40;
                 sleekButton3.sizeOffset_X     = 200;
                 sleekButton3.sizeOffset_Y     = 30;
                 VehicleAsset vehicleAsset = (VehicleAsset)Assets.find(EAssetType.VEHICLE, vehicleTable.tiers[(int)EditorSpawnsVehiclesUI.selectedTier].table[l].vehicle);
                 string       str          = "?";
                 if (vehicleAsset != null)
                 {
                     if (string.IsNullOrEmpty(vehicleAsset.vehicleName))
                     {
                         str = vehicleAsset.name;
                     }
                     else
                     {
                         str = vehicleAsset.vehicleName;
                     }
                 }
                 sleekButton3.text = vehicleTable.tiers[(int)EditorSpawnsVehiclesUI.selectedTier].table[l].vehicle.ToString() + " " + str;
                 SleekButton sleekButton4 = sleekButton3;
                 if (EditorSpawnsVehiclesUI.< > f__mg$cache3 == null)
                 {
                     EditorSpawnsVehiclesUI.< > f__mg$cache3 = new ClickedButton(EditorSpawnsVehiclesUI.onClickVehicleButton);
                 }
                 sleekButton4.onClickedButton = EditorSpawnsVehiclesUI.< > f__mg$cache3;
                 EditorSpawnsVehiclesUI.spawnsScrollBox.add(sleekButton3);
                 EditorSpawnsVehiclesUI.vehicleButtons[l] = sleekButton3;
             }
         }
         else
         {
             EditorSpawnsVehiclesUI.tierNameField.text = string.Empty;
             EditorSpawnsVehiclesUI.vehicleButtons     = new SleekButton[0];
         }
         EditorSpawnsVehiclesUI.vehicleIDField.positionOffset_Y      = 170 + EditorSpawnsVehiclesUI.tierButtons.Length * 70 + 80 + EditorSpawnsVehiclesUI.vehicleButtons.Length * 40;
         EditorSpawnsVehiclesUI.addVehicleButton.positionOffset_Y    = 170 + EditorSpawnsVehiclesUI.tierButtons.Length * 70 + 80 + EditorSpawnsVehiclesUI.vehicleButtons.Length * 40 + 40;
         EditorSpawnsVehiclesUI.removeVehicleButton.positionOffset_Y = 170 + EditorSpawnsVehiclesUI.tierButtons.Length * 70 + 80 + EditorSpawnsVehiclesUI.vehicleButtons.Length * 40 + 40;
         EditorSpawnsVehiclesUI.spawnsScrollBox.area = new Rect(0f, 0f, 5f, (float)(170 + EditorSpawnsVehiclesUI.tierButtons.Length * 70 + 80 + EditorSpawnsVehiclesUI.vehicleButtons.Length * 40 + 70));
     }
     else
     {
         EditorSpawnsVehiclesUI.selectedBox.text       = string.Empty;
         EditorSpawnsVehiclesUI.tableNameField.text    = string.Empty;
         EditorSpawnsVehiclesUI.tableIDField.state     = 0;
         EditorSpawnsVehiclesUI.tableColorPicker.state = Color.white;
         if (EditorSpawnsVehiclesUI.tierButtons != null)
         {
             for (int m = 0; m < EditorSpawnsVehiclesUI.tierButtons.Length; m++)
             {
                 EditorSpawnsVehiclesUI.spawnsScrollBox.remove(EditorSpawnsVehiclesUI.tierButtons[m]);
             }
         }
         EditorSpawnsVehiclesUI.tierButtons                       = null;
         EditorSpawnsVehiclesUI.tierNameField.text                = string.Empty;
         EditorSpawnsVehiclesUI.tierNameField.positionOffset_Y    = 170;
         EditorSpawnsVehiclesUI.addTierButton.positionOffset_Y    = 210;
         EditorSpawnsVehiclesUI.removeTierButton.positionOffset_Y = 210;
         if (EditorSpawnsVehiclesUI.vehicleButtons != null)
         {
             for (int n = 0; n < EditorSpawnsVehiclesUI.vehicleButtons.Length; n++)
             {
                 EditorSpawnsVehiclesUI.spawnsScrollBox.remove(EditorSpawnsVehiclesUI.vehicleButtons[n]);
             }
         }
         EditorSpawnsVehiclesUI.vehicleButtons = null;
         EditorSpawnsVehiclesUI.vehicleIDField.positionOffset_Y      = 250;
         EditorSpawnsVehiclesUI.addVehicleButton.positionOffset_Y    = 290;
         EditorSpawnsVehiclesUI.removeVehicleButton.positionOffset_Y = 290;
         EditorSpawnsVehiclesUI.spawnsScrollBox.area = new Rect(0f, 0f, 5f, 320f);
     }
 }
Ejemplo n.º 8
0
        private static void refresh()
        {
            MenuWorkshopSpawnsUI.rawField.isVisible  = false;
            MenuWorkshopSpawnsUI.rootsBox.isVisible  = true;
            MenuWorkshopSpawnsUI.tablesBox.isVisible = true;
            MenuWorkshopSpawnsUI.rootsBox.remove();
            MenuWorkshopSpawnsUI.tablesBox.remove();
            MenuWorkshopSpawnsUI.asset = (SpawnAsset)Assets.find(EAssetType.SPAWN, MenuWorkshopSpawnsUI.viewIDField.state);
            switch (MenuWorkshopSpawnsUI.typeButton.state)
            {
            case 0:
                MenuWorkshopSpawnsUI.type = EAssetType.ITEM;
                break;

            case 1:
                MenuWorkshopSpawnsUI.type = EAssetType.VEHICLE;
                break;

            case 2:
                MenuWorkshopSpawnsUI.type = EAssetType.ANIMAL;
                break;

            default:
                MenuWorkshopSpawnsUI.type = EAssetType.NONE;
                return;
            }
            int num = 120;

            MenuWorkshopSpawnsUI.rootsBox.positionOffset_Y = num;
            num += 40;
            if (MenuWorkshopSpawnsUI.asset != null)
            {
                MenuWorkshopSpawnsUI.rootsBox.text = MenuWorkshopSpawnsUI.localization.format("Roots_Box", new object[]
                {
                    MenuWorkshopSpawnsUI.viewIDField.state + " " + MenuWorkshopSpawnsUI.asset.name
                });
                for (int i = 0; i < MenuWorkshopSpawnsUI.asset.roots.Count; i++)
                {
                    SpawnTable spawnTable = MenuWorkshopSpawnsUI.asset.roots[i];
                    if (spawnTable.spawnID != 0)
                    {
                        SleekButton sleekButton = new SleekButton();
                        sleekButton.positionOffset_Y = 40 + i * 40;
                        sleekButton.sizeOffset_X     = -260;
                        sleekButton.sizeScale_X      = 1f;
                        sleekButton.sizeOffset_Y     = 30;
                        SleekButton sleekButton2 = sleekButton;
                        if (MenuWorkshopSpawnsUI.< > f__mg$cache0 == null)
                        {
                            MenuWorkshopSpawnsUI.< > f__mg$cache0 = new ClickedButton(MenuWorkshopSpawnsUI.onClickedRootButton);
                        }
                        sleekButton2.onClickedButton = MenuWorkshopSpawnsUI.< > f__mg$cache0;
                        MenuWorkshopSpawnsUI.rootsBox.add(sleekButton);
                        num += 40;
                        SpawnAsset spawnAsset = (SpawnAsset)Assets.find(EAssetType.SPAWN, spawnTable.spawnID);
                        if (spawnAsset != null)
                        {
                            sleekButton.text = spawnTable.spawnID + " " + spawnAsset.name;
                        }
                        else
                        {
                            sleekButton.text = spawnTable.spawnID + " ?";
                        }
                        SleekInt32Field sleekInt32Field = new SleekInt32Field();
                        sleekInt32Field.positionOffset_X = 10;
                        sleekInt32Field.positionScale_X  = 1f;
                        sleekInt32Field.sizeOffset_X     = 55;
                        sleekInt32Field.sizeOffset_Y     = 30;
                        sleekInt32Field.state            = spawnTable.weight;
                        sleekInt32Field.tooltip          = MenuWorkshopSpawnsUI.localization.format("Weight_Tooltip");
                        SleekInt32Field sleekInt32Field2 = sleekInt32Field;
                        Delegate        onTypedInt       = sleekInt32Field2.onTypedInt;
                        if (MenuWorkshopSpawnsUI.< > f__mg$cache1 == null)
                        {
                            MenuWorkshopSpawnsUI.< > f__mg$cache1 = new TypedInt32(MenuWorkshopSpawnsUI.onTypedRootWeightField);
                        }
                        sleekInt32Field2.onTypedInt = (TypedInt32)Delegate.Combine(onTypedInt, MenuWorkshopSpawnsUI.< > f__mg$cache1);
                        sleekButton.add(sleekInt32Field);
                        sleekButton.add(new SleekBox
                        {
                            positionOffset_X = 75,
                            positionScale_X  = 1f,
                            sizeOffset_X     = 55,
                            sizeOffset_Y     = 30,
                            text             = (Math.Round((double)(spawnTable.chance * 1000f)) / 10.0).ToString() + "%",
                            tooltip          = MenuWorkshopSpawnsUI.localization.format("Chance_Tooltip")
                        });
                        SleekButtonIcon sleekButtonIcon = new SleekButtonIcon((Texture2D)MenuWorkshopEditorUI.icons.load("Remove"));
                        sleekButtonIcon.positionOffset_X = 140;
                        sleekButtonIcon.positionScale_X  = 1f;
                        sleekButtonIcon.sizeOffset_X     = 120;
                        sleekButtonIcon.sizeOffset_Y     = 30;
                        sleekButtonIcon.text             = MenuWorkshopSpawnsUI.localization.format("Remove_Root_Button");
                        sleekButtonIcon.tooltip          = MenuWorkshopSpawnsUI.localization.format("Remove_Root_Button_Tooltip");
                        SleekButton sleekButton3 = sleekButtonIcon;
                        if (MenuWorkshopSpawnsUI.< > f__mg$cache2 == null)
                        {
                            MenuWorkshopSpawnsUI.< > f__mg$cache2 = new ClickedButton(MenuWorkshopSpawnsUI.onClickedRemoveRootButton);
                        }
                        sleekButton3.onClickedButton = MenuWorkshopSpawnsUI.< > f__mg$cache2;
                        sleekButton.add(sleekButtonIcon);
                    }
                }
                MenuWorkshopSpawnsUI.addRootIDField.positionOffset_Y     = num;
                MenuWorkshopSpawnsUI.addRootSpawnButton.positionOffset_Y = num;
                num += 40;
                MenuWorkshopSpawnsUI.addRootIDField.isVisible     = true;
                MenuWorkshopSpawnsUI.addRootSpawnButton.isVisible = true;
            }
            else
            {
                MenuWorkshopSpawnsUI.rootsBox.text = MenuWorkshopSpawnsUI.localization.format("Roots_Box", new object[]
                {
                    MenuWorkshopSpawnsUI.viewIDField.state + " ?"
                });
                MenuWorkshopSpawnsUI.addRootIDField.isVisible     = false;
                MenuWorkshopSpawnsUI.addRootSpawnButton.isVisible = false;
            }
            num += 40;
            MenuWorkshopSpawnsUI.tablesBox.positionOffset_Y = num;
            num += 40;
            if (MenuWorkshopSpawnsUI.asset != null)
            {
                MenuWorkshopSpawnsUI.tablesBox.text = MenuWorkshopSpawnsUI.localization.format("Tables_Box", new object[]
                {
                    MenuWorkshopSpawnsUI.viewIDField.state + " " + MenuWorkshopSpawnsUI.asset.name
                });
                for (int j = 0; j < MenuWorkshopSpawnsUI.asset.tables.Count; j++)
                {
                    SpawnTable spawnTable2 = MenuWorkshopSpawnsUI.asset.tables[j];
                    Sleek      sleek       = null;
                    if (spawnTable2.spawnID != 0)
                    {
                        SleekButton sleekButton4 = new SleekButton();
                        sleekButton4.positionOffset_Y = 40 + j * 40;
                        sleekButton4.sizeOffset_X     = -260;
                        sleekButton4.sizeScale_X      = 1f;
                        sleekButton4.sizeOffset_Y     = 30;
                        SleekButton sleekButton5 = sleekButton4;
                        if (MenuWorkshopSpawnsUI.< > f__mg$cache3 == null)
                        {
                            MenuWorkshopSpawnsUI.< > f__mg$cache3 = new ClickedButton(MenuWorkshopSpawnsUI.onClickedTableButton);
                        }
                        sleekButton5.onClickedButton = MenuWorkshopSpawnsUI.< > f__mg$cache3;
                        MenuWorkshopSpawnsUI.tablesBox.add(sleekButton4);
                        sleek = sleekButton4;
                        num  += 40;
                        SpawnAsset spawnAsset2 = (SpawnAsset)Assets.find(EAssetType.SPAWN, spawnTable2.spawnID);
                        if (spawnAsset2 != null)
                        {
                            sleekButton4.text = spawnTable2.spawnID + " " + spawnAsset2.name;
                        }
                        else
                        {
                            sleekButton4.text = spawnTable2.spawnID + " ?";
                        }
                    }
                    else if (spawnTable2.assetID != 0)
                    {
                        SleekBox sleekBox = new SleekBox();
                        sleekBox.positionOffset_Y = 40 + j * 40;
                        sleekBox.sizeOffset_X     = -260;
                        sleekBox.sizeScale_X      = 1f;
                        sleekBox.sizeOffset_Y     = 30;
                        MenuWorkshopSpawnsUI.tablesBox.add(sleekBox);
                        sleek = sleekBox;
                        num  += 40;
                        Asset asset = Assets.find(MenuWorkshopSpawnsUI.type, spawnTable2.assetID);
                        if (asset != null)
                        {
                            sleekBox.text = spawnTable2.assetID + " " + asset.name;
                            if (MenuWorkshopSpawnsUI.type == EAssetType.ITEM)
                            {
                                ItemAsset itemAsset = asset as ItemAsset;
                                if (MenuWorkshopSpawnsUI.asset != null)
                                {
                                    sleekBox.foregroundTint  = ESleekTint.NONE;
                                    sleekBox.foregroundColor = ItemTool.getRarityColorUI(itemAsset.rarity);
                                }
                            }
                            else if (MenuWorkshopSpawnsUI.type == EAssetType.VEHICLE)
                            {
                                VehicleAsset vehicleAsset = asset as VehicleAsset;
                                if (MenuWorkshopSpawnsUI.asset != null)
                                {
                                    sleekBox.foregroundTint  = ESleekTint.NONE;
                                    sleekBox.foregroundColor = ItemTool.getRarityColorUI(vehicleAsset.rarity);
                                }
                            }
                        }
                        else
                        {
                            sleekBox.text = spawnTable2.assetID + " ?";
                        }
                    }
                    if (sleek != null)
                    {
                        SleekInt32Field sleekInt32Field3 = new SleekInt32Field();
                        sleekInt32Field3.positionOffset_X = 10;
                        sleekInt32Field3.positionScale_X  = 1f;
                        sleekInt32Field3.sizeOffset_X     = 55;
                        sleekInt32Field3.sizeOffset_Y     = 30;
                        sleekInt32Field3.state            = spawnTable2.weight;
                        sleekInt32Field3.tooltip          = MenuWorkshopSpawnsUI.localization.format("Weight_Tooltip");
                        SleekInt32Field sleekInt32Field4 = sleekInt32Field3;
                        Delegate        onTypedInt2      = sleekInt32Field4.onTypedInt;
                        if (MenuWorkshopSpawnsUI.< > f__mg$cache4 == null)
                        {
                            MenuWorkshopSpawnsUI.< > f__mg$cache4 = new TypedInt32(MenuWorkshopSpawnsUI.onTypedTableWeightField);
                        }
                        sleekInt32Field4.onTypedInt = (TypedInt32)Delegate.Combine(onTypedInt2, MenuWorkshopSpawnsUI.< > f__mg$cache4);
                        sleek.add(sleekInt32Field3);
                        float num2 = spawnTable2.chance;
                        if (j > 0)
                        {
                            num2 -= MenuWorkshopSpawnsUI.asset.tables[j - 1].chance;
                        }
                        sleek.add(new SleekBox
                        {
                            positionOffset_X = 75,
                            positionScale_X  = 1f,
                            sizeOffset_X     = 55,
                            sizeOffset_Y     = 30,
                            text             = (Math.Round((double)(num2 * 1000f)) / 10.0).ToString() + "%",
                            tooltip          = MenuWorkshopSpawnsUI.localization.format("Chance_Tooltip")
                        });
                        SleekButtonIcon sleekButtonIcon2 = new SleekButtonIcon((Texture2D)MenuWorkshopEditorUI.icons.load("Remove"));
                        sleekButtonIcon2.positionOffset_X = 140;
                        sleekButtonIcon2.positionScale_X  = 1f;
                        sleekButtonIcon2.sizeOffset_X     = 120;
                        sleekButtonIcon2.sizeOffset_Y     = 30;
                        sleekButtonIcon2.text             = MenuWorkshopSpawnsUI.localization.format("Remove_Table_Button");
                        sleekButtonIcon2.tooltip          = MenuWorkshopSpawnsUI.localization.format("Remove_Table_Button_Tooltip");
                        SleekButton sleekButton6 = sleekButtonIcon2;
                        if (MenuWorkshopSpawnsUI.< > f__mg$cache5 == null)
                        {
                            MenuWorkshopSpawnsUI.< > f__mg$cache5 = new ClickedButton(MenuWorkshopSpawnsUI.onClickedRemoveTableButton);
                        }
                        sleekButton6.onClickedButton = MenuWorkshopSpawnsUI.< > f__mg$cache5;
                        sleek.add(sleekButtonIcon2);
                    }
                }
                MenuWorkshopSpawnsUI.addTableIDField.positionOffset_Y     = num;
                MenuWorkshopSpawnsUI.addTableAssetButton.positionOffset_Y = num;
                MenuWorkshopSpawnsUI.addTableSpawnButton.positionOffset_Y = num;
                num += 40;
                MenuWorkshopSpawnsUI.addTableIDField.isVisible     = true;
                MenuWorkshopSpawnsUI.addTableAssetButton.isVisible = true;
                MenuWorkshopSpawnsUI.addTableSpawnButton.isVisible = true;
            }
            else
            {
                MenuWorkshopSpawnsUI.tablesBox.text = MenuWorkshopSpawnsUI.localization.format("Tables_Box", new object[]
                {
                    MenuWorkshopSpawnsUI.viewIDField.state + " ?"
                });
                MenuWorkshopSpawnsUI.addTableIDField.isVisible     = false;
                MenuWorkshopSpawnsUI.addTableAssetButton.isVisible = false;
                MenuWorkshopSpawnsUI.addTableSpawnButton.isVisible = false;
            }
            if (MenuWorkshopSpawnsUI.asset != null)
            {
                MenuWorkshopSpawnsUI.applyWeightsButton.positionOffset_Y = num;
                num += 40;
                MenuWorkshopSpawnsUI.applyWeightsButton.isVisible = true;
            }
            else
            {
                MenuWorkshopSpawnsUI.applyWeightsButton.isVisible = false;
            }
            MenuWorkshopSpawnsUI.spawnsBox.area = new Rect(0f, 0f, 5f, (float)(num - 10));
        }
        // Token: 0x06003740 RID: 14144 RVA: 0x0018163C File Offset: 0x0017FA3C
        public static void viewItem(int newItem, ulong newInstance)
        {
            MenuSurvivorsClothingInspectUI.item     = newItem;
            MenuSurvivorsClothingInspectUI.instance = newInstance;
            if (MenuSurvivorsClothingInspectUI.model != null)
            {
                UnityEngine.Object.Destroy(MenuSurvivorsClothingInspectUI.model.gameObject);
            }
            ushort id;
            ushort id2;

            Provider.provider.economyService.getInventoryTargetID(MenuSurvivorsClothingInspectUI.item, out id, out id2);
            ushort       inventorySkinID   = Provider.provider.economyService.getInventorySkinID(MenuSurvivorsClothingInspectUI.item);
            ushort       inventoryMythicID = Provider.provider.economyService.getInventoryMythicID(MenuSurvivorsClothingInspectUI.item);
            ItemAsset    itemAsset         = (ItemAsset)Assets.find(EAssetType.ITEM, id);
            VehicleAsset vehicleAsset      = (VehicleAsset)Assets.find(EAssetType.VEHICLE, id2);

            if (itemAsset == null && vehicleAsset == null)
            {
                return;
            }
            if (inventorySkinID != 0)
            {
                SkinAsset skinAsset = (SkinAsset)Assets.find(EAssetType.SKIN, inventorySkinID);
                if (vehicleAsset != null)
                {
                    MenuSurvivorsClothingInspectUI.model = VehicleTool.getVehicle(vehicleAsset.id, skinAsset.id, inventoryMythicID, vehicleAsset, skinAsset);
                }
                else
                {
                    ushort    id3        = itemAsset.id;
                    ushort    skin       = inventorySkinID;
                    byte      quality    = 100;
                    byte[]    state      = itemAsset.getState();
                    bool      viewmodel  = false;
                    ItemAsset itemAsset2 = itemAsset;
                    SkinAsset skinAsset2 = skinAsset;
                    if (MenuSurvivorsClothingInspectUI.< > f__mg$cache0 == null)
                    {
                        MenuSurvivorsClothingInspectUI.< > f__mg$cache0 = new GetStatTrackerValueHandler(MenuSurvivorsClothingInspectUI.getInspectedItemStatTrackerValue);
                    }
                    MenuSurvivorsClothingInspectUI.model = ItemTool.getItem(id3, skin, quality, state, viewmodel, itemAsset2, skinAsset2, MenuSurvivorsClothingInspectUI.< > f__mg$cache0);
                    if (inventoryMythicID != 0)
                    {
                        ItemTool.applyEffect(MenuSurvivorsClothingInspectUI.model, inventoryMythicID, EEffectType.THIRD);
                    }
                }
            }
            else
            {
                ushort    id4        = itemAsset.id;
                ushort    skin2      = 0;
                byte      quality2   = 100;
                byte[]    state2     = itemAsset.getState();
                bool      viewmodel2 = false;
                ItemAsset itemAsset3 = itemAsset;
                if (MenuSurvivorsClothingInspectUI.< > f__mg$cache1 == null)
                {
                    MenuSurvivorsClothingInspectUI.< > f__mg$cache1 = new GetStatTrackerValueHandler(MenuSurvivorsClothingInspectUI.getInspectedItemStatTrackerValue);
                }
                MenuSurvivorsClothingInspectUI.model = ItemTool.getItem(id4, skin2, quality2, state2, viewmodel2, itemAsset3, MenuSurvivorsClothingInspectUI.< > f__mg$cache1);
                if (inventoryMythicID != 0)
                {
                    ItemTool.applyEffect(MenuSurvivorsClothingInspectUI.model, inventoryMythicID, EEffectType.HOOK);
                }
            }
            MenuSurvivorsClothingInspectUI.model.parent        = MenuSurvivorsClothingInspectUI.inspect;
            MenuSurvivorsClothingInspectUI.model.localPosition = Vector3.zero;
            if (vehicleAsset != null)
            {
                MenuSurvivorsClothingInspectUI.model.localRotation = Quaternion.identity;
            }
            else if (itemAsset != null && itemAsset.type == EItemType.MELEE)
            {
                MenuSurvivorsClothingInspectUI.model.localRotation = Quaternion.Euler(0f, -90f, 90f);
            }
            else
            {
                MenuSurvivorsClothingInspectUI.model.localRotation = Quaternion.Euler(-90f, 0f, 0f);
            }
            Bounds bounds = new Bounds(MenuSurvivorsClothingInspectUI.model.position, Vector3.zero);

            Collider[] components = MenuSurvivorsClothingInspectUI.model.GetComponents <Collider>();
            foreach (Collider collider in components)
            {
                Bounds bounds2 = collider.bounds;
                bounds.Encapsulate(bounds2);
            }
            MenuSurvivorsClothingInspectUI.look.pos  = bounds.center;
            MenuSurvivorsClothingInspectUI.look.dist = bounds.extents.magnitude * 2.25f;
        }