mirror of
				https://github.com/DerTyp7/defrain-shooter-unity.git
				synced 2025-10-30 04:57:10 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			26 lines
		
	
	
		
			642 B
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			26 lines
		
	
	
		
			642 B
		
	
	
	
		
			C#
		
	
	
	
	
	
| using Mirror;
 | |
| using UnityEngine;
 | |
| using UnityEngine.UI;
 | |
| using TMPro;
 | |
| 
 | |
| public class JoinBtnScript : MonoBehaviour
 | |
| {
 | |
|     [SerializeField] private TMP_InputField inputIp;
 | |
|     [SerializeField] private TMP_InputField inputUsername;
 | |
| 
 | |
|     private JoinLeaveManager joinLeaveManager;
 | |
| 
 | |
|     private void Start()
 | |
|     {
 | |
|         gameObject.GetComponent<Button>().onClick.AddListener(JoinServer);
 | |
| 
 | |
|         joinLeaveManager = GameObject.Find("GameManager").GetComponent<JoinLeaveManager>();
 | |
|     }
 | |
| 
 | |
|     public void JoinServer()
 | |
|     {
 | |
|         NetworkClient.Connect(inputIp.text);
 | |
|         joinLeaveManager.Join(inputIp.text, inputUsername.text);        
 | |
|     }
 | |
| }
 | 
