protected override void OnClicked(GameObject _go) { if (_go.name.Equals("BtnReg")) { if (mAccInput.text.Length == 0 || mPassInput.text.Length == 0 || mPassInput0.text.Length == 0) { PopWindowManager.AddMsg("输入信息不能为空"); } else if (mAccInput.text.Length < 2 || mPassInput.text.Length < 4) { PopWindowManager.AddMsg("注册信息不合法"); } else if (!mPassInput.text.Equals(mPassInput0.text)) { PopWindowManager.AddMsg("密码不匹配"); } GameProtocol.dto.AccountModel model = new GameProtocol.dto.AccountModel(); model.account = mAccInput.text; model.password = mPassInput.text; loginhandler.register(model); PopWindowManager.AddMsg("正在向服务器请求注册..."); } else if (_go.name.Equals("BtnCancelReg")) { //base.Hide(); base.SetNewState(State.login); } }
protected override void OnClicked(GameObject _go) { if (_go.name.Equals("btnlogin")) { if (accInput.text.Length == 0 || passInput.text.Length == 0) { PopWindowManager.AddMsg("账号密码不能为空"); return; } else if (accInput.text.Length < 2) { PopWindowManager.AddMsg("账号至少为2个字符"); return; } else if (passInput.text.Length < 4) { PopWindowManager.AddMsg("密码至少为4个字符"); return; } GameProtocol.dto.AccountModel model = new GameProtocol.dto.AccountModel(); model.account = accInput.text; model.password = passInput.text; //登陆的时候像服务器发送消息 loginhandler.login(model); if (toggle.isOn) { //保存账号密码 } PopWindowManager.AddMsg("正在向服务器请求登陆..."); } }
public void login(GameProtocol.dto.AccountModel dto) { //NetIO.Instance.write((byte)type, 0, GameProtocol.LoginProtocol.LOGIN_CREQ, dto); this.Write((byte)type, 0, GameProtocol.LoginProtocol.LOGIN_CREQ, dto); }
public void register(GameProtocol.dto.AccountModel dto) { // NetIO.Instance.write((byte)type, 0, GameProtocol.LoginProtocol.REG_CREQ, dto); this.Write((byte)type, 0, GameProtocol.LoginProtocol.REG_CREQ, dto); }