修改HttpServer,进入速度加快
This commit is contained in:
2455
Assets/DC/浦口龙湖天街地形_幻影交锋.prefab
Normal file
2455
Assets/DC/浦口龙湖天街地形_幻影交锋.prefab
Normal file
File diff suppressed because it is too large
Load Diff
7
Assets/DC/浦口龙湖天街地形_幻影交锋.prefab.meta
Normal file
7
Assets/DC/浦口龙湖天街地形_幻影交锋.prefab.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b15c696474c12d942854a63adc151a9f
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
@@ -5,6 +5,7 @@ using System.Text;
|
||||
using System.Threading;
|
||||
using System.Collections.Concurrent;
|
||||
using UnityEngine;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
[Serializable]
|
||||
public class IntentMessage
|
||||
@@ -41,12 +42,12 @@ public class HttpServer : MonoBehaviour
|
||||
|
||||
void Awake()
|
||||
{
|
||||
DontDestroyOnLoad(gameObject);
|
||||
Task.Run(StartServer);
|
||||
}
|
||||
|
||||
void Start()
|
||||
{
|
||||
StartServer();
|
||||
|
||||
}
|
||||
|
||||
#region HTTP Server
|
||||
@@ -56,15 +57,11 @@ public class HttpServer : MonoBehaviour
|
||||
try
|
||||
{
|
||||
listener = new HttpListener();
|
||||
listener.Prefixes.Add(SERVER_URL);
|
||||
listener.Prefixes.Add($"http://{GetLocalIP()}:12345/");
|
||||
listener.Start();
|
||||
|
||||
isRunning = true;
|
||||
serverThread = new Thread(ListenLoop)
|
||||
{
|
||||
IsBackground = true
|
||||
};
|
||||
serverThread.Start();
|
||||
ListenLoop();
|
||||
|
||||
Debug.Log($"✅ HTTP Server 启动成功:{SERVER_URL}");
|
||||
}
|
||||
@@ -74,6 +71,17 @@ public class HttpServer : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
private string GetLocalIP()
|
||||
{
|
||||
var host = System.Net.Dns.GetHostEntry(System.Net.Dns.GetHostName());
|
||||
foreach (var ip in host.AddressList)
|
||||
{
|
||||
if (ip.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
|
||||
return ip.ToString();
|
||||
}
|
||||
return "127.0.0.1";
|
||||
}
|
||||
|
||||
private void ListenLoop()
|
||||
{
|
||||
while (isRunning && listener.IsListening)
|
||||
|
||||
@@ -134,7 +134,7 @@ EditorBuildSettings:
|
||||
- enabled: 0
|
||||
path: Assets/_KOF/Scenes/Henan_Xinxiang_Wandaguangchang_Shinei.unity
|
||||
guid: b09470651ebef8841bf194df66b89800
|
||||
- enabled: 0
|
||||
- enabled: 1
|
||||
path: Assets/_KOF/Scenes/Nanjing_Pukou_Longhutianjie.unity
|
||||
guid: 6d8510f4d2a2dce43a497a8373573d70
|
||||
- enabled: 0
|
||||
@@ -266,7 +266,7 @@ EditorBuildSettings:
|
||||
- enabled: 0
|
||||
path: Assets/_KOF/Scenes/Ningxia_Yinchuan_Xingqing_XinhuaBaihuo_Shiwai.unity
|
||||
guid: 246641dbceb880f4db66db908398dd97
|
||||
- enabled: 1
|
||||
- enabled: 0
|
||||
path: Assets/_KOF/Scenes/Ningxia_Wuzhong_Litong_YiwuShangmaocheng.unity
|
||||
guid: 24f56b18ece336f4490e1b4b2ab6f0f0
|
||||
m_configObjects:
|
||||
|
||||
@@ -162,7 +162,7 @@ PlayerSettings:
|
||||
androidSupportedAspectRatio: 1
|
||||
androidMaxAspectRatio: 2.1
|
||||
applicationIdentifier:
|
||||
Android: com.pineappletech.kof.ningxiawuzhonglitongyiwushangmaocheng
|
||||
Android: com.pineappletech.kof.nanjingpukoulonghutianjie
|
||||
Standalone: com.DefaultCompany.com.unity.template.ar
|
||||
buildNumber:
|
||||
Standalone: 0
|
||||
|
||||
Reference in New Issue
Block a user