public static void Main(string[] args) { FileReader __fileReader = new FileReader(); SocketController __server = new SocketController(); SocketInitializationData __socketData = __fileReader.GetSocketInitializationData(); __server.Initialize(__socketData); __server.StartSocket(delegate { Console.WriteLine("SERVER ON"); __server.StartAcceptTcpClientThread(delegate { Console.WriteLine("ALL CLIENTS OK"); __server.StartWaitClientsStreamThread(delegate { Console.WriteLine("ALL DATA RECEIVED"); }); }); }, delegate { Console.WriteLine("DEU RUIM"); }); while (true) { } }
/// <summary> /// Initializes objects and binds /// </summary> protected void Start() { //Reference validation if (UI == null) { UI = GameObject.FindWithTag("UI").gameObject; } if (LoginPanel == null) { Debug.LogError("LoginPanel is missing from login.cs"); } if (remmeber == null) { Debug.LogError("remmeber is missing from login.cs"); } if (submitBtn == null) { Debug.LogError("submitBtn is missing from login.cs"); } if (usrField == null) { Debug.LogError("usrField is missing from login.cs"); } if (pwdField == null) { Debug.LogError("pwdField is missing from login.cs"); } //Unity Binds submitBtn.onClick.AddListener(SubmitValidation); remmeber.onValueChanged.AddListener(delegate { OnRemmeberChange(remmeber); }); usrField.onValueChanged.AddListener(delegate { OnUsernameChange(usrField); }); pwdField.onValueChanged.AddListener(delegate { OnPasswordChange(pwdField); }); //Start the network area SocketController.Initialize(); SocketController.BindEvent(NetworkInstructions.Disconnect, OnServerOffline); SocketController.BindEvent(NetworkInstructions.Connect, OnConnectionEstablished); SocketController.BindEvent(NetworkInstructions.ServerOffline, OnServerOffline); //Hide login panel till we get a connection with the remote server HideLoginPanel(); //Disable submit until we get data submitBtn.interactable = false; //Lets see if the user has saved or asked to if (PlayerPrefs.GetInt("login_remmeber") == 1) { remmeber.isOn = true; //Remmeber me input load if (!String.IsNullOrWhiteSpace(PlayerPrefs.GetString("login_username"))) { usrField.text = PlayerPrefs.GetString("login_username"); } else if (!String.IsNullOrWhiteSpace(PlayerPrefs.GetString("login_password"))) { pwdField.text = PlayerPrefs.GetString("login_password"); } } }