private void OnDestroy() { _inputUsername = null; _inputPassword = null; EventCenter.UnRegisterButtonEvent("Login-Login"); EventCenter.UnRegisterButtonEvent("Login-Register"); _buttonLogin = null; _buttonRegister = null; _networkClient.Off(CmdManager.Login, SocketIOLogin); _networkClient.Off(CmdManager.Register, SocketIORegister); _networkClient.Off(CmdManager.GetRole, SocketIOGetRole); _networkClient = null; }
private void Start() { _networkClient = NetworkClient._instance; _inputUsername = transform.Find("Control - Simple Input Field - Username").GetComponent <UIInput>(); _inputPassword = transform.Find("Control - Simple Input Field - Password").GetComponent <UIInput>(); _buttonLogin = EventCenter.RegisterButtonEvent("Login-Login", new Login_LoginExcute()) as Login_LoginExcute; _buttonRegister = EventCenter.RegisterButtonEvent("Login-Register", new Login_RegisterExcute()) as Login_RegisterExcute; _networkClient.On(CmdManager.Login, SocketIOLogin); _networkClient.On(CmdManager.Register, SocketIORegister); _networkClient.On(CmdManager.GetRole, SocketIOGetRole); }