Ejemplo n.º 1
0
        // Token: 0x0600348C RID: 13452 RVA: 0x001596A4 File Offset: 0x00157AA4
        private void Update()
        {
            if (VehicleTool.icons == null || VehicleTool.icons.Count == 0)
            {
                return;
            }
            VehicleIconInfo vehicleIconInfo = VehicleTool.icons.Dequeue();

            if (vehicleIconInfo == null)
            {
                return;
            }
            if (vehicleIconInfo.vehicleAsset == null)
            {
                return;
            }
            Transform vehicle = VehicleTool.getVehicle(vehicleIconInfo.id, vehicleIconInfo.skin, 0, vehicleIconInfo.vehicleAsset, vehicleIconInfo.skinAsset);

            vehicle.position = new Vector3(-256f, -256f, 0f);
            Transform transform = vehicle.FindChild("Icon2");

            if (transform == null)
            {
                UnityEngine.Object.Destroy(vehicle.gameObject);
                Assets.errors.Add("Failed to find a skin icon hook on " + vehicleIconInfo.id + ".");
                return;
            }
            float     size2_z = vehicleIconInfo.vehicleAsset.size2_z;
            Texture2D texture = ItemTool.captureIcon(vehicleIconInfo.id, vehicleIconInfo.skin, vehicle, transform, vehicleIconInfo.x, vehicleIconInfo.y, size2_z);

            if (vehicleIconInfo.callback != null)
            {
                vehicleIconInfo.callback(texture);
            }
        }
        // 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;
        }