40 lines
1.0 KiB
C#
40 lines
1.0 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.SceneManagement;
|
|
namespace AdamSync
|
|
{
|
|
public class ContectServer : MonoBehaviour
|
|
{
|
|
public bool isLinkAgain = false;
|
|
public string serverIP;
|
|
public int port;
|
|
// Start is called before the first frame update
|
|
private async void Awake()
|
|
{
|
|
Debug.Log("Net");
|
|
DontDestroyOnLoad(gameObject);
|
|
SceneManager.LoadScene("SampleScene");
|
|
//try
|
|
//{
|
|
isLinkAgain = true;
|
|
await SyncCreateRoom.StartLinkTCPServer(serverIP, port);
|
|
//}
|
|
//catch (System.Exception e)
|
|
//{
|
|
// if (isLinkAgain)
|
|
// {
|
|
// Awake();
|
|
// }
|
|
// Debug.Log(e.ToString());
|
|
//}
|
|
}
|
|
|
|
private void OnDisable()
|
|
{
|
|
SyncCreateRoom.CloseClint();
|
|
isLinkAgain = false;
|
|
}
|
|
}
|
|
}
|