Exemple #1
0
 public static void Disconnect()
 {
     LWLogin.Logout();
     NetworkManager.singleton.StopClient();
     NetworkManager.singleton.StopServer();
     LWInterface.NewNotification("Disconnected.", LWInterface.Notification.LWNotificationType.Message);
 }
Exemple #2
0
            void OnGUI()
            {
                GUI.skin = skin;

                GUILayout.BeginArea(new Rect(5, 5, Screen.width / 4, Screen.height / 4));

                GUILayout.BeginVertical();
                if (!LWLogin.isLoggedIn && (LWNetwork.NetworkMode == LWNetwork.LWNetworkModes.dev_client || LWNetwork.NetworkMode == LWNetwork.LWNetworkModes.rel_client))
                {
                    email    = GUILayout.TextField(email);
                    password = GUILayout.PasswordField(password, '*');
                    if (GUILayout.Button("CONNECT"))
                    {
                        if (email != "" && password != "")
                        {
                            LWLogin.Credentials.SetLogin(email, password);
                            StartCoroutine(LWLogin.Login());
                            password = string.Empty;
                        }
                        else
                        {
                            if (email == "")
                            {
                                NewNotification("Email required.", Notification.LWNotificationType.Error);
                            }

                            if (password == "")
                            {
                                NewNotification("Password required.", Notification.LWNotificationType.Error);
                            }
                        }
                    }
                }
                else
                {
                    if (GUILayout.Button("DISCONNECT") && (LWNetwork.NetworkMode == LWNetwork.LWNetworkModes.dev_client || LWNetwork.NetworkMode == LWNetwork.LWNetworkModes.rel_client))
                    {
                        LWNetwork.Client.Disconnect();
                    }
                }
                GUILayout.EndVertical();

                GUILayout.EndArea();
            }