This commit is contained in:
parent
a635a91f55
commit
cee0f3d5cb
|
@ -0,0 +1 @@
|
|||
111.229.30.246:48888
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: bd6e81e1f70f9cd4882885d83be5028e
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -218,6 +218,7 @@ GameObject:
|
|||
m_Component:
|
||||
- component: {fileID: 2132962759}
|
||||
- component: {fileID: 2132962758}
|
||||
- component: {fileID: 2132962760}
|
||||
m_Layer: 0
|
||||
m_Name: Net
|
||||
m_TagString: Untagged
|
||||
|
@ -255,3 +256,15 @@ Transform:
|
|||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &2132962760
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2132962757}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 7849c2de1b8e12e478bd7b1e0af1e553, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Networking;
|
||||
using static InterfaceManager;
|
||||
|
||||
public class AddConfing : MonoBehaviour
|
||||
{
|
||||
private static string ipSetting = "IPPort.txt";
|
||||
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
StartCoroutine(GetSetting(ipSetting, (data) =>
|
||||
{
|
||||
string[] datas= data.ToString().Split(':');
|
||||
//Debug.Log(IP);
|
||||
//Debug.Log(Port);
|
||||
//Debug.Log(Url_Action);
|
||||
IP = datas[0];
|
||||
Port = datas[1];
|
||||
//Debug.Log(IP);
|
||||
//Debug.Log(Port);
|
||||
//Debug.Log(Url_Action);
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取配置文件
|
||||
/// </summary>
|
||||
/// <param name="_settings"></param>
|
||||
/// <param name="callback"></param>
|
||||
/// <returns></returns>
|
||||
public static IEnumerator GetSetting(string _settings, Action<string> callback)
|
||||
{
|
||||
string _url = Path.Combine(Application.streamingAssetsPath, _settings);
|
||||
UnityWebRequest www = UnityWebRequest.Get(_url);
|
||||
yield return www.SendWebRequest();
|
||||
if (www.isNetworkError || www.isHttpError)
|
||||
{
|
||||
callback(null);
|
||||
Debug.Log("网络请求失败了");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!string.IsNullOrEmpty(www.downloadHandler.text))
|
||||
{
|
||||
callback(www.downloadHandler.text);
|
||||
}
|
||||
else
|
||||
{
|
||||
callback(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 7849c2de1b8e12e478bd7b1e0af1e553
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -8,9 +8,27 @@ using Newtonsoft.Json.Linq;
|
|||
|
||||
public static class InterfaceManager
|
||||
{
|
||||
|
||||
public static string IP { get => "111.229.30.246"; }
|
||||
public static string Port { get => "48888"; }
|
||||
|
||||
private static string _IP = "111.229.30.246";
|
||||
public static string IP
|
||||
{
|
||||
get { return _IP; }
|
||||
set
|
||||
{
|
||||
if (_IP != value)
|
||||
_IP = value;
|
||||
}
|
||||
}
|
||||
private static string _Port = "48888";
|
||||
public static string Port
|
||||
{
|
||||
get { return _Port; }
|
||||
set
|
||||
{
|
||||
if (_Port != value)
|
||||
_Port = value;
|
||||
}
|
||||
}
|
||||
public static string IpAddress { get => string.Format("http://{0}:{1}", IP, Port); }
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue