Пример #1
0
    public static ConnectorFile LoadConnFile(string filename)
    {
        ConnectorFile cf = new ConnectorFile();

        if (!File.Exists(filename))
        {
            string[] newlines = new string[1];
            newlines[0] = "propertiesfile=";
            File.WriteAllLines(filename, newlines);
        }

        string[] lines = File.ReadAllLines(filename);
        for (int i = 0; i < lines.Length; i++)
        {
            if (lines[i].Split('=').Length == 2)
            {
                if (lines[i].Split('=')[0] == "propertiesfile")
                {
                    cf.PropertiesFile = lines[i].Split('=')[1];
                }
            }
        }

        return(cf);
    }
Пример #2
0
    // Use this for initialization
    void Start()
    {
        // Eine Datei zu jedem Model schreiben, in der der Pfad zur Properties-file steht
        // Die hier einfach laden, bzw erstellen. Dann das inputField zum Path mit dem Pfad zur Properties-file füllen. Wenn nicht, leer lassen.
        connFile = FileLoader.LoadConnFile(".\\model" + Level1.garageIndex + ".connb");
        inputPropertiesPath.text = connFile.PropertiesFile;

        if (File.Exists(connFile.PropertiesFile))
        {
            carProps = FileLoader.LoadSettingFromFile(connFile.PropertiesFile);
        }
        else
        {
            carProps = new CarPropertiesSetting();
        }

        // TODO
        // Fill inputFields with carProps

        inputPropDamperheightLF.text   = Convert.ToString(carProps.DamperHeightLF);
        inputPropDamperheightRF.text   = Convert.ToString(carProps.DamperHeightRF);
        inputPropDamperheightLR.text   = Convert.ToString(carProps.DamperHeightLR);
        inputPropDamperheightRR.text   = Convert.ToString(carProps.DamperHeightRR);
        inputPropDamperstrengthLF.text = Convert.ToString(carProps.DamperStrengthLF);
        inputPropDamperstrengthRF.text = Convert.ToString(carProps.DamperStrengthRF);
        inputPropDamperstrengthLR.text = Convert.ToString(carProps.DamperStrengthLR);
        inputPropDamperstrengthRR.text = Convert.ToString(carProps.DamperStrengthRR);
        inputPropSpringstrengthLF.text = Convert.ToString(carProps.SpringStrengthLF);
        inputPropSpringstrengthRF.text = Convert.ToString(carProps.SpringStrengthRF);
        inputPropSpringstrengthLR.text = Convert.ToString(carProps.SpringStrengthLR);
        inputPropSpringstrengthRR.text = Convert.ToString(carProps.SpringStrengthRR);

        GetComponent <Canvas>().enabled = false;
        GetComponent <Canvas>().enabled = true;
    }
Пример #3
0
    void Start()
    {
        ConnectorFile        connFile = FileLoader.LoadConnFile(".\\model" + Level1.garageIndex + ".connb");
        CarPropertiesSetting carProps = FileLoader.LoadSettingFromFile(connFile.PropertiesFile);

        testCar.GetComponent <TestCar>().Freeze = true;
        testCar.GetComponent <TestCar>().ApplyCar(Racing.calculatedCarNew, carProps);
        testCar.transform.position = startPosition.position;

        beforeShootings = new bool[testCar.GetComponent <TestCar>().ShootingWeapon.Length];

        if (miniMap != null)
        {
            miniMap.AddObject(testCar, IpAndPort.playername);
        }

        players      = new OtherPlayer[255];
        otherPlayers = new GameObject[255];


        //Instantiate(maps[0]);
    }
Пример #4
0
    // Use this for initialization
    void Start()
    {
        if (garageNumber != -1)
        {
            calculatedCar = Analyzer.AnalyzeCar(".\\model" + garageNumber + ".baguette");
            connFile      = FileLoader.LoadConnFile(".\\model" + garageNumber + ".connb");
            carProps      = FileLoader.LoadSettingFromFile(connFile.PropertiesFile);

            if (calculatedCar == null)
            {
                SceneManager.LoadScene("Garages");
            }
            else
            {
                car.GetComponent <TestCar>().Freeze = true;
                car.GetComponent <TestCar>().ApplyCar(calculatedCar, carProps);
                car.transform.position = new Vector3(0f, 0f, 0f);
            }
        }
        else
        {
            SceneManager.LoadScene("Garages");
        }
    }
Пример #5
0
 public static void SaveConnFile(string filename, ConnectorFile connFile)
 {
     string[] lines = new string[1];
     lines[0] = "propertiesfile=" + connFile.PropertiesFile;
     File.WriteAllLines(filename, lines);
 }