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.
38 lines
1021 B
38 lines
1021 B
4 years ago
|
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);
|
||
|
}
|
||
|
}
|
||
|
}
|