- 最后登录
- 2021-7-6
- 注册时间
- 2012-12-27
- 阅读权限
- 90
- 积分
- 76145
- 纳金币
- 53488
- 精华
- 316
|
//config.ini放在打包后的exe的同级文件夹
string DoneExePath()
{
string dpath = Application.dataPath;
int num = dpath.LastIndexOf("/");
dpath = dpath.Substring(0, num);
string url = dpath + "/config.ini";
string text = ReadFile(url, 2);
return text;
}
//config.ini放在打包后的_data文件夹
string DoneDataPath()
{
string dpath = Application.dataPath;
string url = dpath + "/config.ini";
string text = ReadFile(url, 2);
return text;
}
string ReadFile(string filePath, int lineNumber)
{
string[] strs = File.ReadAllLines(filePath);
if (lineNumber == 0)
{
return "";
}
else if (lineNumber <= strs.Length)
{
return strs[lineNumber - 1];
}
else
{
Debug.LogWarning("your lineNumber out of text row counts!");
return "";
}
}
|
|