upd
This commit is contained in:
parent
afdf37a4d6
commit
dc373870e0
@ -1755,6 +1755,8 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 888381d2f37742ae809685fc98b89251, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
NetworkManager: {fileID: 1495427289}
|
||||
externalIP: localhost
|
||||
--- !u!114 &678043785
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -1779,7 +1781,6 @@ GameObject:
|
||||
- component: {fileID: 685655170}
|
||||
- component: {fileID: 685655169}
|
||||
- component: {fileID: 685655168}
|
||||
- component: {fileID: 685655172}
|
||||
m_Layer: 11
|
||||
m_Name: Camera
|
||||
m_TagString: MainCamera
|
||||
@ -1905,19 +1906,6 @@ Transform:
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &685655172
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 685655167}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fbc9d11c053e4cf9b3f111038086b924, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
networkManager: {fileID: 1495427289}
|
||||
--- !u!1 &753208638
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -3243,7 +3231,7 @@ MonoBehaviour:
|
||||
offlineScene:
|
||||
onlineScene: Assets/Scenes/Menu/Menu.unity
|
||||
transport: {fileID: 1495427290}
|
||||
networkAddress: localhost
|
||||
networkAddress: oscar.koptilnya.xyz
|
||||
maxConnections: 100
|
||||
disconnectInactiveConnections: 0
|
||||
disconnectInactiveTimeout: 60
|
||||
|
@ -4,14 +4,17 @@ using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Networking;
|
||||
using UnityEngine.Serialization;
|
||||
|
||||
namespace Network
|
||||
{
|
||||
public class HttpRequests : MonoBehaviour
|
||||
{
|
||||
public CustomNetworkManager NetworkManager;
|
||||
|
||||
private string baseUrl = "https://kotpilnya.xyz/slowpoker/api/";
|
||||
public Dictionary<string, string> ServerListResponse;
|
||||
private string _externalIP = "localhost";
|
||||
public string externalIP = "localhost";
|
||||
|
||||
[System.Serializable] public class ServerInfo
|
||||
{
|
||||
@ -28,7 +31,7 @@ namespace Network
|
||||
ServerInfo serverInfo = new ServerInfo
|
||||
{
|
||||
name = "Oscar",
|
||||
address = _externalIP
|
||||
address = externalIP
|
||||
};
|
||||
|
||||
string jsonData = JsonUtility.ToJson(serverInfo);
|
||||
@ -51,8 +54,9 @@ namespace Network
|
||||
}
|
||||
else
|
||||
{
|
||||
_externalIP = request.downloadHandler.text;
|
||||
Debug.Log("External IP Address: " + _externalIP);
|
||||
externalIP = request.downloadHandler.text;
|
||||
// NetworkManager.networkAddress = _externalIP;
|
||||
Debug.Log("External IP Address: " + externalIP);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,15 +1,22 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Network;
|
||||
using UnityEngine;
|
||||
|
||||
public class JoinCollider : MonoBehaviour
|
||||
{
|
||||
public CustomNetworkManager networkManager;
|
||||
public GameObject door;
|
||||
private HttpRequests _httpRequests;
|
||||
|
||||
void Start()
|
||||
{
|
||||
_httpRequests = transform.GetComponentInParent<HttpRequests>();
|
||||
}
|
||||
private void OnTriggerEnter(Collider other)
|
||||
{
|
||||
door.SetActive(true);
|
||||
// networkManager.networkAddress = "localhost";
|
||||
// networkManager.networkAddress = _httpRequests.ServerListResponse[0];
|
||||
networkManager.StartClient();
|
||||
}
|
||||
}
|
||||
|
BIN
slowpoker.zip
(Stored with Git LFS)
Normal file
BIN
slowpoker.zip
(Stored with Git LFS)
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user