예제 #1
0
 /// <summary>
 /// Start discovery
 /// </summary>
 void Start()
 {
     s_Instance = this;
     Initialize();
     StartAsClient();
     StartCoroutine(CleanUpEntries());
 }
예제 #2
0
 /// <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");
 }
예제 #3
0
    /// <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);
        }
    }
예제 #4
0
    /// <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();
        }
    }
예제 #5
0
 void Start()
 {
     s_Instance       = this;
     networkDiscovery = OxyniteNetworkDiscovery.GetInstance();
 }
예제 #6
0
 /// <summary>
 /// Singleton assignation
 /// </summary>
 private void Awake()
 {
     s_Instance = this;
 }