Ejemplo n.º 1
0
    // Token: 0x06002A8D RID: 10893 RVA: 0x0001B295 File Offset: 0x00019495
    public IEnumerator ReloadCar(CarLoader reloadCar)
    {
        string name = reloadCar.GetRoot().name;

        base.StartCoroutine(reloadCar.LoadCar(name));
        while (!reloadCar.IsCarLoaded())
        {
            yield return(new WaitForEndOfFrame());
        }
        yield return(new WaitForEndOfFrame());

        reloadCar.PlaceAtPosition();
        reloadCar.SetRandomCarColor();
        reloadCar.SetOilLevelAndCondition(1f, 1f);
        reloadCar.SetMileage(this.mileage);
        yield break;
    }
Ejemplo n.º 2
0
        internal static void SortJob(ref Job job, CarLoader carLoader)
        {
            if (currentProfile != ProfileManager.Get().GetSelectedProfile())
            {
                currentProfile = ProfileManager.Get().GetSelectedProfile();
                sortedJobs.Clear();
            }

            if (!sortedJobs.Contains(job.id))
            {
                foreach (JobPart jobPart in job.jobParts)
                {
                    Dictionary <string, int> partDict = new Dictionary <string, int>();

                    //Store the existing order
                    for (int i = 0; i < jobPart.partsCount; i++)
                    {
                        partDict.Add(jobPart.partList[i], i);
                    }

                    List <string> sorted = new List <string>();

                    //Sort them by the display name
                    if (jobPart.type != "Body")
                    {
                        sorted = (from p in jobPart.partList
                                  orderby GameInventory.Get().GetItemLocalizeName(p.Substring(p.LastIndexOf('/') + 1))
                                  select p).ToList();
                    }
                    else
                    {
                        sorted = (from p in jobPart.partList
                                  orderby GameInventory.Get().GetBodyLocalizedName(carLoader.carToLoad + "-" + carLoader.GetDefaultName(p.Substring(p.LastIndexOf('/') + 1)))
                                  select p).ToList();
                    }

                    jobPart.partList = sorted;
                }

                sortedJobs.Add(job.id);
            }
        }
Ejemplo n.º 3
0
    // Token: 0x06002162 RID: 8546
    private IEnumerator CreateCar(Transform t)
    {
        GameObject go2 = new GameObject();

        go2.transform.position    = t.position;
        go2.transform.eulerAngles = t.eulerAngles;
        go2.name = "CarPosition";
        go2.AddComponent <CarLoader>();
        go2.GetComponent <CarLoader>().addInteractiveObject = true;
        go2.GetComponent <CarLoader>().groundPosition       = go2.transform;
        go2.AddComponent <CarDebug>();
        List <CarsIdWithConfig> listOfAviableCars = Singleton <CarBundleLoader> .Instance.GetCarsSpawnsInScene(SceneType.Junkyard);

        CarsIdWithConfig randomCar = listOfAviableCars[UnityEngine.Random.Range(0, listOfAviableCars.Count)];
        CarLoader        cl        = go2.GetComponent <CarLoader>();

        cl.ConfigVersion = randomCar.ConfigVersion;
        base.StartCoroutine(cl.LoadCar(randomCar.CarID));
        while (!cl.IsCarLoaded())
        {
            yield return(new WaitForEndOfFrame());
        }
        LicensePlate licensePlate = Singleton <GameInventory> .Instance.GetRandomLicensePlate();

        cl.ChangeLicencePlateTexture(cl.GetCarPart("license_plate_front"), licensePlate.name);
        cl.ChangeLicencePlateTexture(cl.GetCarPart("license_plate_rear"), licensePlate.name);
        CarDoorOpenBlocker doorBlocker = t.GetComponent <CarDoorOpenBlocker>();

        if (doorBlocker)
        {
            cl.LockObject("door_front_left", doorBlocker.openLeftSide);
            cl.LockObject("door_rear_left", doorBlocker.openLeftSide);
            cl.LockObject("door_front_right", doorBlocker.openRightSide);
            cl.LockObject("door_rear_right", doorBlocker.openRightSide);
        }
        cl.PlaceAtPosition();
        cl.SetRandomCarColor();
        yield return(new WaitForEndOfFrame());

        cl.SetRandomMissingPanels(this.percMissingPanels);
        yield return(new WaitForEndOfFrame());

        cl.SetRandomPartsConditions(this.rangePartsCondition.x, this.rangePartsCondition.y);
        yield return(new WaitForEndOfFrame());

        cl.SetRustRandomParts(this.rangeBodyPartsCondition.x, this.rangeBodyPartsCondition.y);
        yield return(new WaitForEndOfFrame());

        cl.SetRandomMissingParts((int)this.percRangeUnmountIO.x, (int)this.percRangeUnmountIO.y);
        yield return(new WaitForEndOfFrame());

        base.StartCoroutine(cl.SetRandomColorPanels(this.percRandomPartsColor, this.rangeColorPartsCondition.x, this.rangeColorPartsCondition.y));
        yield return(new WaitForEndOfFrame());

        cl.SetRandomCarLivery();
        yield return(new WaitForEndOfFrame());

        cl.SetNegotiationPriceMod(UnityEngine.Random.Range(this.rangeNegotationMod.x, this.rangeNegotationMod.y));
        yield return(new WaitForEndOfFrame());

        cl.RunInstantExamine();
        yield return(new WaitForEndOfFrame());

        CarHelper.SetRandomFactoryColor(cl);
        cl.EnableDust(true);
        cl.EnableRustOutside(null, true);
        cl.SetRandomMileage(SceneType.Auction);
        if (go2)
        {
            go2.transform.position    = t.position;
            go2.transform.eulerAngles = t.eulerAngles;
            t.gameObject.SetActive(false);
        }
        yield break;
    }