配置端口
This commit is contained in:
parent
ac273c9a34
commit
78bba402a1
|
@ -1,6 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
@ -36,6 +37,10 @@ public class CallForTest : MonoBehaviour
|
||||||
/// Æô¶¯Æ÷´«¹ýÀ´µÄ·þÎñÆ÷IP
|
/// Æô¶¯Æ÷´«¹ýÀ´µÄ·þÎñÆ÷IP
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string ServerIP;
|
public string ServerIP;
|
||||||
|
/// <summary>
|
||||||
|
/// 服务器端口设置
|
||||||
|
/// </summary>
|
||||||
|
public int ServerPort;
|
||||||
|
|
||||||
[DllImport("user32.dll", EntryPoint = "FindWindow")]
|
[DllImport("user32.dll", EntryPoint = "FindWindow")]
|
||||||
private static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
|
private static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
|
||||||
|
@ -48,13 +53,14 @@ public class CallForTest : MonoBehaviour
|
||||||
instance = this;
|
instance = this;
|
||||||
DontDestroyOnLoad(gameObject);
|
DontDestroyOnLoad(gameObject);
|
||||||
|
|
||||||
//#if UNITY_EDITOR
|
|
||||||
// Debug.unityLogger.logEnabled = true;
|
|
||||||
//#else
|
|
||||||
// Debug.unityLogger.logEnabled = false;
|
|
||||||
//#endif
|
|
||||||
Debug.Log(Application.productName);
|
Debug.Log(Application.productName);
|
||||||
|
|
||||||
|
using (StreamReader _reader = new StreamReader(Application.streamingAssetsPath + "/Port.txt"))
|
||||||
|
{
|
||||||
|
ServerPort = int.Parse(_reader.ReadLine());
|
||||||
|
Debug.Log("端口配置:" + ServerPort);
|
||||||
|
}
|
||||||
|
|
||||||
IntPtr ptr = FindWindow(null, Application.productName);
|
IntPtr ptr = FindWindow(null, Application.productName);
|
||||||
SetWindowPos(ptr, (IntPtr)HWND_TOPMOST, 0, 0, Screen.width, Screen.height, SWP_SHOWWINDOW);
|
SetWindowPos(ptr, (IntPtr)HWND_TOPMOST, 0, 0, Screen.width, Screen.height, SWP_SHOWWINDOW);
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ public class ApiManager : Singleton<ApiManager>
|
||||||
if (!Application.isEditor)
|
if (!Application.isEditor)
|
||||||
{
|
{
|
||||||
//发布出来
|
//发布出来
|
||||||
return "http://" + CallForTest.instance.ServerIP + ":4000";
|
return "http://" + CallForTest.instance.ServerIP + ":"+CallForTest.instance.ServerPort;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
4000
|
|
@ -0,0 +1,7 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 26dd212f0d5cecf408706c553b82a106
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -0,0 +1 @@
|
||||||
|
0
|
Loading…
Reference in New Issue