using System.Collections; using System.Collections.Generic; using UnityEngine; using AX.NetworkSystem; using System.Xml; public class StartSession : MonoBehaviour { public string IPAddress; public int Port; public string Tag; void Start() { InitializeLoginSetting(); if (GameSetting.LoginSetting.GetLoginAddress(out IPAddress, out Port)) { var session = NetworkManager.CreateSession(IPAddress, Port, Tag); session.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); GameSetting.LoginSetting.SetLoginAddress(ip, port); } } }