示例#1
0
    public void SavePlayer()
    {
        string path = Application.dataPath;

        path = path.Substring(path.Length);
        //Debug.Log(path);
        string currentText = System.IO.File.ReadAllText(path + "Players.txt");

        string[] lines    = currentText.Split('\n');
        string[] allLines = new string[lines.Length];

        int index;

        for (index = 0; index < lines.Length - 1; index++)
        {
            allLines[index] = lines[index];
        }
        string inputLine = lines.Length.ToString() + ")\t" + Name + "\t" + FrontR + "," + FrontG + "," + FrontB
                           + "\t" + BackR + "," + BackG + "," + BackB + "\t" + MidR + "," + MidG + "," + MidB + "\t" + 0 + "," + 0 + "\t" + 0;

        //0,0 is for wins/loss & 0 is for playing
        allLines[index] = inputLine;
        System.IO.File.WriteAllLines(@"" + path + "Players.txt", allLines);

        Menus.ChangePage(4);
    }