using System.Collections; using System.Collections.Generic; using UnityEngine; namespace BossRoom.Viz { /// /// Provides backing logic for all of the UI that runs in the MainMenu stage. /// public class MainMenuUI : MonoBehaviour { public GameObject GameHubGO; public GameObject InputTextGO; private BossRoom.GameNetHub m_netHub; // Start is called before the first frame update void Start() { m_netHub = GameHubGO.GetComponent(); } // Update is called once per frame void Update() { } /// /// Gets the IP Address the user set in the UI, or returns 127.0.0.1 if IP is not present. /// /// IP address entered by user, in string form. private string GetIPAddress() { string iptext = InputTextGO.GetComponent().text; if( iptext == "" ) { return "127.0.0.1"; } return iptext; } public void OnHostClicked() { GetIPAddress(); m_netHub.StartHost(GetIPAddress(), 9998); } public void OnConnectClicked() { m_netHub.StartClient(GetIPAddress(), 9998); } } }