Esempio n. 1
0
    public static bool CheckPassword(string playername, string pass)
    {
        if (string.IsNullOrEmpty(pass))
        {
            PopManager.ShowSimpleItem("密码不能为空");
            return(false);
        }
        if (playername.Equals(pass))
        {
            //PopMessageUIItem.Show(LanguageManager.GetLanguage(1942));
            PopManager.ShowSimpleItem("密码不能与用户名相同");
            return(false);
        }
        if (pass.Length < 8 || pass.Length > 14)
        {
            //PopMessageUIItem.Show(LanguageManager.GetLanguage(295));
            PopManager.ShowSimpleItem("密码长度必须介于8~14个字符之间");
            return(false);
        }

        int  asc        = 0;
        bool havenum    = false;
        bool haveletter = false;

        foreach (char c in pass)
        {
            asc = c;
            if (!(asc <= 126 && asc >= 33))
            {
                //PopMessageUIItem.Show(LanguageManager.GetLanguage(1940));
                PopManager.ShowSimpleItem("密码只能包含英文字母(区分大小写)、数字字符以及标点符号");
                return(false);
            }
            if (asc > 47 && asc < 58)
            {
                havenum = true;
            }
            if ((asc > 64 && asc < 91) || (asc > 96 && asc < 123))
            {
                haveletter = true;
            }
        }

        if ((!havenum) || (!haveletter))
        {
            //PopMessageUIItem.Show(LanguageManager.GetLanguage(1941));
            PopManager.ShowSimpleItem("密码至少包含1个英文字母和1个数字字符");
            return(false);
        }

        return(true);
    }
    private void OnAddQQGroup()
    {
        //if (Initiator.instance.Channel == "a4399")
        //    return;
#if UNITY_EDITOR
#elif UNITY_ANDROID
        AndroidJavaClass  jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
        AndroidJavaObject jo = jc.GetStatic <AndroidJavaObject>("currentActivity");
        bool b = jo.Call <bool>("JoinQQGroup");
        if (!b)
        {
            PopManager.ShowSimpleItem("未安装手机QQ或安装的版本不支持");
        }
#elif UNITY_IPHONE
#endif
    }
Esempio n. 3
0
    private static IEnumerator Send(WWWForm form, EnumHTTPHead head)
    {
        string url = "http://" + ip + ":" + port + "/" + GetHeadString(head);
        WWW    www = new WWW(url, form.data, cookies);

        //Debug.Log("request http url " + url + " cmdID, " + _cmdFormDic[form]);
        yield return(www);

        int cmdID = _cmdFormDic[form];

        _cmdFormDic.Remove(form);
        if (www.error != null)
        {
            Debug.Log("serch fail...");
        }
        else if (www.isDone)
        {
            if (www.bytes.Length == 0)
            {
                HttpEvent evt = new HttpEvent(cmdID.ToString());
                _dispatcher.DispatchEventInstance(evt);
                yield break;
            }
            ByteArray receiveBytes = new ByteArray();
            receiveBytes.WriteBytes(www.bytes);

            ReceivePackage pack = CmdUtil.ParseCmd(receiveBytes);
            if (pack.CmdID == (int)MsgType.ErrorMsg)
            {
                RetErrorMsg errorMsg = ProtoBuf.Serializer.Deserialize <RetErrorMsg>(pack.BodyStream);
                if (errorMsg.RetCode == 0)
                {
                    Debug.Log("response http url success" + url);
                    HttpEvent evt = new HttpEvent(cmdID.ToString());
                    _dispatcher.DispatchEventInstance(evt);
                }
                else
                {
                    if (LoginServerErrorCode.ErrorCodeName == errorMsg.RetCode)
                    {
                        PopManager.ShowSimpleItem("用户名最多为4个汉字或8个英文字符");
                    }
                    else if (LoginServerErrorCode.ErrorCodeAuthErr == errorMsg.RetCode)
                    {
                        PopManager.ShowSimpleItem("验证码错误,还可以输入" + errorMsg.Params + "次");
                    }
                    else if (LoginServerErrorCode.ErrorCodeDb == errorMsg.RetCode)
                    {
                        PopManager.ShowSimpleItem("设置密码错误");
                    }
                    else if (LoginServerErrorCode.ErrorCodePass == errorMsg.RetCode)
                    {
                        if (cmdID == (int)MsgType.CheckOldPassword)
                        {
                            PopManager.ShowSimpleItem("密码错误");
                        }
                        else
                        {
                            PopManager.ShowSimpleItem("账号或密码错误");
                        }
                    }
                    else if (LoginServerErrorCode.ErrorCodeParam == errorMsg.RetCode)
                    {
                        if (cmdID == (int)MsgType.ChangePasswd || cmdID == (int)MsgType.SetPasswd || cmdID == (int)MsgType.CheckOldPassword)
                        {
                            PopManager.ShowSimpleItem("密码复杂度不够");
                        }
                        else if (cmdID == (int)MsgType.AuthCode)
                        {
                            PopManager.ShowSimpleItem("获取验证码过于频繁");
                            HttpEvent evt = new HttpEvent(MsgType.ErrorMsg.ToString());
                            _dispatcher.DispatchEventInstance(evt);
                        }
                        else
                        {
                            PopManager.ShowSimpleItem("参数错误");
                        }
                    }
                    else if (LoginServerErrorCode.ErrorCodeIsBind == errorMsg.RetCode)
                    {
                        PopManager.ShowSimpleItem("手机号已被绑定");
                    }
                    else if (LoginServerErrorCode.ErrorCodeMsgErr == errorMsg.RetCode)
                    {
                        PopManager.ShowSimpleItem("短信服务器出错");
                    }
                    else if (LoginServerErrorCode.ErrorCodeTelErr == errorMsg.RetCode)
                    {
                        PopManager.ShowSimpleItem("手机号错误");
                    }
                    else if (LoginServerErrorCode.ErrorCodeMaxMsg == errorMsg.RetCode)
                    {
                        PopManager.ShowSimpleItem("今天短信次数已用完");
                    }
                    else if (LoginServerErrorCode.ErrorCodeMaxErr == errorMsg.RetCode)
                    {
                        PopManager.ShowSimpleItem("密码错误已超过最大限制");
                    }
                    else if (LoginServerErrorCode.ErrorCodeExist == errorMsg.RetCode)
                    {
                        PopManager.ShowSimpleItem("用户名已存在");
                    }
                    else if (LoginServerErrorCode.ErrorCodeUnBind == errorMsg.RetCode)
                    {
                        PopManager.ShowSimpleItem("未绑定手机");
                    }
                    else if (LoginServerErrorCode.ErrorCodeSetAccountTm == errorMsg.RetCode)
                    {
                        ulong leftDays = errorMsg.Params / (24 * 60 * 60);
                        if (leftDays >= 1)
                        {
                            PopManager.ShowSimpleItem("还需 " + (uint)leftDays + "天才可以修改用户名");
                        }
                        else
                        {
                            ulong leftHours = errorMsg.Params / (60 * 60);
                            if (leftHours >= 1)
                            {
                                PopManager.ShowSimpleItem("还需 " + (uint)leftHours + "小时才可以修改用户名");
                            }
                            else
                            {
                                PopManager.ShowSimpleItem("还需 " + (uint)(errorMsg.Params / 60) + "分钟才可以修改用户名");
                            }
                        }
                    }
                    else if (LoginServerErrorCode.ErrorCodeSignReward == errorMsg.RetCode)
                    {
                        PopManager.ShowSimpleItem("签到奖励领取失败");
                    }
                    else if (LoginServerErrorCode.ErrorCodeSignIned == errorMsg.RetCode)
                    {
                        PopManager.ShowSimpleItem("已签到");
                    }
                    else if (LoginServerErrorCode.ErrorCodeRoom == errorMsg.RetCode)
                    {
                        PopManager.ShowSimpleItem("未找到房间");
                    }
                    else if (LoginServerErrorCode.ErrorCodeIsFull == errorMsg.RetCode)
                    {
                        PopManager.ShowSimpleItem("目标房间已满");
                    }
                    else if (LoginServerErrorCode.ErrorCodeDb == errorMsg.RetCode)
                    {
                        PopManager.ShowSimpleItem("数据库错误");
                    }

                    Log("http cmd error code:" + errorMsg.RetCode + " para:" + errorMsg.Params);
                }
            }
            else
            {
                Log("response http url success " + url + " CmdID:" + (MsgType)pack.CmdID);
                HttpEvent evt = new HttpEvent(pack.CmdID.ToString(), pack.BodyStream);
                _dispatcher.DispatchEventInstance(evt);
            }
        }
    }