- 最后登录
- 2019-12-25
- 注册时间
- 2012-8-24
- 阅读权限
- 90
- 积分
- 71088
 
- 纳金币
- 52352
- 精华
- 343
|
- //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 "";
- }
- }
复制代码 |
|