A NetworkManager that handles client connection and disconnection with customizable actions.
Inheritance: NetworkManager
Exemple #1
0
        /// <summary>
        /// The Unity Awake() method.
        /// </summary>
        public void Awake()
        {
            // Initialize the pool of Join Room buttons.
            for (int i = 0; i < _matchPageSize; i++)
            {
                GameObject button = Instantiate(JoinRoomListRowPrefab);
                button.transform.SetParent(RoomListPanel.transform, false);
                button.GetComponent <RectTransform>().anchoredPosition =
                    new Vector2(0, -(100 * i));
                button.SetActive(true);
                button.GetComponentInChildren <Text>().text = string.Empty;
                _joinRoomButtonsPool.Add(button);
            }

#pragma warning disable 618
            _manager = GetComponent <CloudAnchorsNetworkManager>();
#pragma warning restore 618
            _manager.StartMatchMaker();
            _manager.matchMaker.ListMatches(
                startPageNumber: 0,
                resultPageSize: _matchPageSize,
                matchNameFilter: string.Empty,
                filterOutPrivateMatchesFromResults: false,
                eloScoreTarget: 0,
                requestDomain: 0,
                callback: OnMatchList);
            ChangeLobbyUIVisibility(true);
        }
Exemple #2
0
        public void Start()
        {
            m_NetworkManager = UIController.GetComponent <CloudAnchorsNetworkManager>();
            m_NetworkManager.OnClientConnected    += _OnConnectedToServer;
            m_NetworkManager.OnClientDisconnected += _OnDisconnectedFromServer;

            // A Name is provided to the Game Object so it can be found by other Scripts
            // instantiated as prefabs in the scene.
            gameObject.name = "CloudAnchorsExampleController";
            ARCoreRoot.SetActive(false);

            _ResetStatus();
        }
        /// <summary>
        /// The Unity Start() method.
        /// </summary>
        public void Start()
        {
#pragma warning disable 618
            _networkManager = NetworkUIController.GetComponent <CloudAnchorsNetworkManager>();
#pragma warning restore 618
            _networkManager.OnClientConnected    += OnConnectedToServer;
            _networkManager.OnClientDisconnected += OnDisconnectedFromServer;

            // A Name is provided to the Game Object so it can be found by other Scripts
            // instantiated as prefabs in the scene.
            gameObject.name = "CloudAnchorsExampleController";
            ARCoreRoot.SetActive(false);
            ARKitRoot.SetActive(false);
            ResetStatus();
        }