示例#1
0
    public void LoginBtnClickAck(object o)
    {
        LoginACK ack = new LoginACK();

        ack.MergeFrom((LoginACK)o);
        if (ack.Result == "OK")
        {
            Debug.Log("登录成功");
            msgBox.textDic["Text_Tip"].text = "登录成功";
            _isLogin = true;
            NetController.netCtrlerInstance.AccountName = accountName;
            NetController.netCtrlerInstance.RoleId      = (int)ack.RoleID;
            NetController.netCtrlerInstance.GoldNumber  = (int)ack.GoldNumber;
            Debug.Log(ack.RoleID);
        }
        else
        {
            Debug.Log("登录失败" + ack.Result);
            msgBox.textDic["Text_Tip"].text = "登录失败";
        }
    }
示例#2
0
    private void LoginBtnClickAck(object o)
    {
        LoginACK ack = new LoginACK();

        ack.MergeFrom((LoginACK)o);   //反序列化
        if (ack.Result == "OK")
        {
            Debug.Log("登录成功");
            //TODO  --切换场景 之类
            Application.LoadLevel("SelectPlayerScene");
            _isLogin = true;
            NetController.instance.AccountName = usernameField.text;
            NetController.instance.RoleID      = (int)ack.RoleID;        //unit 强转为int   uint是 无符号整形
            NetController.instance.GoldNumber  = (int)ack.GoldNumber;


            Debug.Log(ack.RoleID);
            Debug.Log(ack.GoldNumber);
        }
        else
        {
            Debug.Log("登录失败:" + ack.Result);
        }
    }