void Update() { if (null == m_button) { return; } // update button text and interactable state if (NetBroadcast.IsListening()) { string buttonText = m_originalButtonText; int numDots = (int)Time.time % 3 + 1; for (int i = 0; i < numDots; i++) { buttonText += "."; } if (m_buttonTextComponent) { m_buttonTextComponent.text = buttonText; } m_button.interactable = false; } else { if (m_buttonTextComponent) { m_buttonTextComponent.text = m_originalButtonText; } m_button.interactable = true; } }
private void DelayedStop() { if (NetBroadcast.IsListening()) { NetBroadcast.StopBroadcastingAndListening(); } }
void Awake() { if (singleton != null) { return; } singleton = this; // // create custom network discovery // m_customNetworkDiscovery = new GameObject ("NetworkDiscovery").AddComponent<CustomNetworkDiscovery> (); // DontDestroyOnLoad (m_customNetworkDiscovery.gameObject); // // register to event // m_customNetworkDiscovery.onReceivedBroadcast += (string arg1, string arg2) => { OnReceivedBroadcastFromCustomNetworkDiscovery(arg1, arg2); }; }
void OnClicked() { // clear the table, and start listening if not already started NetBroadcast.allReceivedBroadcastData.Clear(); if (this.table) { this.table.Clear(); this.table.UpdateTable(); } if (!NetBroadcast.IsListening()) { NetBroadcast.StartListening(); LANScan2UI.StopListeningLater(); } }
void OnTabSwitched() { if (this.tabView.ActiveTab && this.tabView.ActiveTab.tabButtonText == this.tabName) { // our tab was opened if (!NetBroadcast.IsListening()) { // clear table if (this.table) { this.table.Clear(); this.table.UpdateTable(); UpdateTableLater(this.table); } // start listening NetBroadcast.StartListening(); // stop after some time StopListeningLater(); } } }