37 lines
1.0 KiB
C#
37 lines
1.0 KiB
C#
using UnityEngine;
|
||
using System.Collections;
|
||
using System.IO;
|
||
using System.Text;
|
||
|
||
public class LoadConfig : MonoBehaviour
|
||
{
|
||
void Start()
|
||
{
|
||
Load();
|
||
}
|
||
public void Load()
|
||
{
|
||
string tempStr;
|
||
int i;
|
||
if (File.Exists(Application.streamingAssetsPath+ "/Sys.config"))
|
||
{
|
||
StreamReader file = new StreamReader(Application.streamingAssetsPath + "/Sys.config", Encoding.UTF8);
|
||
tempStr = file.ReadLine().Trim ();
|
||
while (tempStr !=null )
|
||
{
|
||
if (tempStr.Contains(":"))
|
||
{
|
||
i = tempStr.IndexOf(":");
|
||
if (i < tempStr.Length - 1)
|
||
{
|
||
PlayerPrefs.SetString(tempStr.Substring(0, i), tempStr.Substring(i + 1));
|
||
//Debug.Log("IP地址:" + tempStr.Substring(0, i) + "内容" + tempStr.Substring(i + 1));
|
||
}
|
||
}
|
||
tempStr = null;
|
||
tempStr = file.ReadLine();
|
||
}
|
||
}
|
||
}
|
||
}
|