广西桂平帝恒管道燃气投资有限公司多角色网上演练
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
964 B

1 year ago
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);
}
}
}