Test de communication de paquets entre un client et un serveur
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

UIManager.cs 828B

12345678910111213141516171819202122232425262728293031323334353637
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Net;
  4. using UnityEngine;
  5. using UnityEngine.UI;
  6. public class UIManager : MonoBehaviour
  7. {
  8. public static UIManager instance;
  9. public GameObject startMenu;
  10. public InputField usernameField;
  11. public InputField ipField;
  12. private void Awake()
  13. {
  14. if (instance == null)
  15. {
  16. instance = this;
  17. }
  18. else if (instance != this)
  19. {
  20. Debug.Log("Instance already exists. Destroying object !");
  21. Destroy(this);
  22. }
  23. }
  24. public void ConnectToServer()
  25. {
  26. startMenu.SetActive(false);
  27. usernameField.interactable = false;
  28. ipField.interactable = false;
  29. Client.instance.ip = ipField.text;
  30. Client.instance.ConnectToServer();
  31. }
  32. }