コード例 #1
0
    public void Save()
    {
        string path = TeamDirectory.TeamPath(name);

        #if UNITY_EDITOR && !BUILD_MODE
        TeamData existingAsset = AssetDatabase.LoadAssetAtPath <TeamData>(path);
        if (existingAsset == null)
        {
            AssetDatabase.CreateAsset(this, path);
        }
        else
        {
            existingAsset.builtInBotDatas = builtInBotDatas;
            existingAsset.customBotNames  = customBotNames;
            existingAsset.demoable        = demoable;
        }
        #else
        StreamWriter file = File.CreateText(path);
        file.WriteLine(customBotNames.Length.ToString());
        foreach (string botName in customBotNames)
        {
            file.WriteLine(botName);
        }
        file.Close();
        #endif
    }
コード例 #2
0
    public void DeleteOnDisk()
    {
        string path = TeamDirectory.TeamPath(name);

        #if UNITY_EDITOR && !BUILD_MODE
        AssetDatabase.DeleteAsset(path);
        #else
        File.Delete(path);
        #endif
    }
コード例 #3
0
    public void Rename(string newName)
    {
        string fromPath = TeamDirectory.TeamPath(name);
        string toPath   = TeamDirectory.TeamPath(newName);

        #if UNITY_EDITOR && !BUILD_MODE
        AssetDatabase.RenameAsset(fromPath, newName);
        #else
        File.Move(fromPath, toPath);
        #endif
        name = newName;
    }