using UnityEngine; using System.Xml; using AX.NetworkSystem; public class StartSession : MonoBehaviour { void Awake() { InitializeLoginSetting(); } void Start() { var ip = default(string); var port = default(short); if (GameSettings.LoginSetting.GetLoginAddress(out ip, out port)) { NetworkManager.CreateDefaultSession(ip, port); NetworkManager.Default.Start(); } } private void InitializeLoginSetting() { var doc = new XmlDocument(); doc.Load(Application.dataPath + @"\StreamingAssets\LoginSetting.xml"); var children = doc.SelectSingleNode("loginSetting").ChildNodes; foreach (XmlElement node in children) { var ip = node.Attributes["ip"].Value; var port = short.Parse(node.Attributes["port"].Value); GameSettings.LoginSetting.SetLoginAddress(ip, port); } } }