/// <summary> /// Start discovery /// </summary> void Start() { s_Instance = this; Initialize(); StartAsClient(); StartCoroutine(CleanUpEntries()); }
/// <summary> /// Handles "find" button action, refresh the UI /// </summary> public void FindGame() { networkDiscovery = FindObjectOfType <OxyniteNetworkDiscovery>(); networkDiscovery.StartListening(); networkDiscovery.CleanEntries(); CleanLANServersList(); RefreshRoomList(); Debug.Log("List cleared"); }
/// <summary> /// Gets nickname or asks for new one /// </summary> void Start() { networkManager = OxyniteNetworkManager.GetInstance(); networkDiscovery = OxyniteNetworkDiscovery.GetInstance(); networkManager.StartMatchMaker(); RefreshRoomList(); if (PlayerPrefs.HasKey("nickname")) { nicknamePanel.gameObject.SetActive(false); nicknameText.text = PlayerPrefs.GetString("nickname"); } else { nicknamePanel.gameObject.SetActive(true); } }
/// <summary> /// Handles "ready" button action /// </summary> public void ReadyGame() { networkDiscovery = FindObjectOfType <OxyniteNetworkDiscovery>(); if (roomList.Count > 0) { ServerSlot serverSlot = roomList[Random.Range(0, roomList.Count)]; JoinRoom(serverSlot.GetMatch()); } else if (networkDiscovery.GetLanEntries() != null) { List <LanEntry> entries = networkDiscovery.GetLanEntries(); LanEntry server = entries[Random.Range(0, entries.Count)]; networkManager.StartGame(server.ipAddress); } else { HostGame(); } }
void Start() { s_Instance = this; networkDiscovery = OxyniteNetworkDiscovery.GetInstance(); }
/// <summary> /// Singleton assignation /// </summary> private void Awake() { s_Instance = this; }