47 lines
1.2 KiB
C#
47 lines
1.2 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.Networking;
|
|
|
|
/* Saját NetworkManager, hogy a hálozati hibakezelést meg lehessen vele valósítani.
|
|
*/
|
|
|
|
public class networkManagerCustom : NetworkManager
|
|
{
|
|
public GameObject offlineCanvas;
|
|
public GameObject onlineCanvas;
|
|
|
|
|
|
public override void OnClientDisconnect (NetworkConnection conn)
|
|
{
|
|
//onlineCanvas.SetActive(false);
|
|
|
|
offlineCanvas.SetActive(true);
|
|
offlineCanvas.GetComponent<clientMenu>().errorField.text = "Error: " + conn.lastError.ToString();
|
|
|
|
base.OnClientDisconnect(conn);
|
|
|
|
}
|
|
|
|
public override void OnClientConnect (NetworkConnection conn)
|
|
{
|
|
Debug.Log("Simulation client connected to " + networkAddress);
|
|
//onlineCanvas.SetActive(true);
|
|
|
|
offlineCanvas.GetComponent<clientMenu>().errorField.text = "No errors so far.";
|
|
offlineCanvas.SetActive(false);
|
|
|
|
base.OnClientConnect(conn);
|
|
|
|
}
|
|
|
|
public override void OnClientError (NetworkConnection conn, int errorCode)
|
|
{
|
|
onlineCanvas.SetActive(false);
|
|
|
|
offlineCanvas.SetActive(true);
|
|
offlineCanvas.GetComponent<clientMenu>().errorField.text = "Error: " + conn.lastError.ToString();
|
|
|
|
base.OnClientError(conn, errorCode);
|
|
}
|
|
}
|