private void Awake() { //foreach (var item in clips) //循环将播放器数组加入字典 //{ // clipList.Add(item.name, item); //} if (Instance == null) { Instance = this; } // LoadAllData.Instance.GetFile(); XMLUtil xml = new XMLUtil(Application.streamingAssetsPath + "/IP.xml"); //传入IP端口号xml表 路径 ip = xml.GetInnerValueStr("root/ip"); //获取xml中的IP ReceivePort = int.Parse(xml.GetInnerValueStr("root/ReceivePort")); //获取收包 端口号 SendPort = int.Parse(xml.GetInnerValueStr("root/SendPort")); //获取发包 端口号 IsPosition = Convert.ToBoolean(int.Parse(xml.GetInnerValueStr("root/IsPosition"))); //转换为Bool UDPServer.Instance.InitSocket(ip, ReceivePort, SendPort); //调用Socket方法 传值 Debug.Log(ip + "~~~~" + ReceivePort); }