Ejemplo n.º 1
0
 public void remove(string key)
 {
     LoadUtil.show(false);
     isReceiveMsg = false;
     receives.Remove(key);
     currentKey = null;
 }
Ejemplo n.º 2
0
 void uploadPicOk(SendMessageEntity entity, UITexture texture1, UITexture texture2)
 {
     if (texture1 != null && texture2 != null)
     {
         EventDelegate ok = new EventDelegate(this, "uploadPicOk");
         ok.parameters[0]     = new EventDelegate.Parameter();
         ok.parameters[0].obj = entity;
         ok.parameters[1]     = new EventDelegate.Parameter();
         ok.parameters[1].obj = texture2;
         ok.parameters[2]     = new EventDelegate.Parameter();
         ok.parameters[2].obj = null;
         JustRun.Instance.upLoadPic(entity.names[1], ((Texture2D)texture1.mainTexture).EncodeToJPG(), ok, new EventDelegate(uploadPicFail));
     }
     else if (texture1 != null && texture2 == null)
     {
         EventDelegate ok = new EventDelegate(this, "uploadPicOk");
         ok.parameters[0]     = new EventDelegate.Parameter();
         ok.parameters[0].obj = entity;
         ok.parameters[1]     = new EventDelegate.Parameter();
         ok.parameters[1].obj = null;
         ok.parameters[2]     = new EventDelegate.Parameter();
         ok.parameters[2].obj = null;
         JustRun.Instance.upLoadPic(entity.names[2], ((Texture2D)texture1.mainTexture).EncodeToJPG(), ok, new EventDelegate(uploadPicFail));
     }
     else
     {
         isUploaded = true;
         LoadUtil.show(false);
         EventDelegate next = new EventDelegate(this, "sendMessage");
         next.parameters[0]     = new EventDelegate.Parameter();
         next.parameters[0].obj = entity;
         DialogUtil.tip("图片上传成功点击确定继续", true, next);
     }
 }
Ejemplo n.º 3
0
    void uploadPicOk(SendMessageEntity entity)
    {
        LoadUtil.show(false);
        EventDelegate next = new EventDelegate(this, "sendRZ");

        next.parameters[0]     = new EventDelegate.Parameter();
        next.parameters[0].obj = entity;
        DialogUtil.tip("图片上传成功点击确定继续认证", true, next);
    }
Ejemplo n.º 4
0
 public void SendMessage(byte[] datas, bool needShowLoading)
 {
     if (!socket.Connected)
     {
         ConfirmUtil.confirm("未连接服务器,连接?", tryToReconnect);
         return;
     }
     try  {
         LoadUtil.show(needShowLoading);
         socket.BeginSend(datas, 0, datas.Length, SocketFlags.None, null, socket);
     }  catch  {
         Debug.Log("send message error");
     }
 }
Ejemplo n.º 5
0
    void sendPicture(Texture2D texture, MainData.FriendBody friend)
    {
        LoadUtil.show(true, "图片发送中请稍后");
        System.DateTime   now     = System.DateTime.Now;
        string            dateStr = now.Year + "-" + now.Month + "-" + now.Day + " " + now.Hour + "-" + now.Minute + "-" + now.Second;
        string            picName = "[" + MainData.instance.user.id + "," + friend.fid + "] " + dateStr + ".jpg";
        SendMessageEntity entity  = new SendMessageEntity();

        entity.buffer.skip(4);
        entity.buffer.WriteString("FriendMessage");
        entity.buffer.WriteLong(MainData.instance.user.id); //自己编号
        entity.buffer.WriteLong(friend.fid);                //好友编号
        entity.buffer.WriteByte(1);                         //0 文字内容,1图片
        entity.buffer.WriteString(picName);                 //上传的文件名字
        EventDelegate ok_event = new EventDelegate(this, "sendPictureOk");

        ok_event.parameters[0]     = new EventDelegate.Parameter();
        ok_event.parameters[0].obj = entity;
        JustRun.Instance.upLoadPic(picName, texture.EncodeToJPG(), ok_event, new EventDelegate(sendPictureFail));
    }
Ejemplo n.º 6
0
    public void doRZ(GameObject container)
    {
        UIPopupList type_list = container.transform.FindChild("type").GetComponent <UIPopupList>();
        UIInput     key_input = container.transform.FindChild("key").GetComponent <UIInput>();

        if (MyUtilTools.stringIsNull(key_input.value))
        {
            UILabel label = key_input.transform.FindChild("tips").GetComponent <UILabel>();
            DialogUtil.tip(label.text);
            return;
        }
        UITexture texture = container.transform.FindChild("front").FindChild("context").GetComponent <UITexture>();

        if (texture.mainTexture == null)
        {
            DialogUtil.tip("请拍摄证件正面");
            return;
        }
        SendMessageEntity entity = new SendMessageEntity();
        Texture2D         t2d    = (Texture2D)texture.mainTexture;
        EventDelegate     ok     = new EventDelegate(this, "uploadPicOk");

        ok.parameters[0]     = new EventDelegate.Parameter();
        ok.parameters[0].obj = entity;
        System.DateTime tody    = System.DateTime.Now;
        string          dateStr = tody.Year + "-" + tody.Month + "-" + tody.Day + "-" + tody.Hour + "-" + tody.Minute + "-" + tody.Second + ".jpg";
        string          picName = MainData.instance.user.account + "-sellercommit-" + dateStr;

        entity.buffer.skip(4);
        entity.buffer.WriteString("SellerCommit");
        entity.buffer.WriteLong(MainData.instance.user.id);
        entity.buffer.WriteByte((byte)(type_list.value.Equals("个人") ? 0 : 1));
        entity.buffer.WriteString(key_input.value);
        entity.buffer.WriteString(picName);
        LoadUtil.show(true, "上传图片中请稍后");
        JustRun.Instance.upLoadPic(picName, t2d.EncodeToJPG(), ok, new EventDelegate(uploadPicFail));
    }
Ejemplo n.º 7
0
 void uploadPicFail()
 {
     LoadUtil.show(false);
     DialogUtil.tip("图片上传失败");
 }
Ejemplo n.º 8
0
    public void upload(GameObject container)
    {
        UIPopupList wjs_list    = container.transform.FindChild("wjs").GetComponent <UIPopupList>();
        UIPopupList yhk_list    = container.transform.FindChild("yhk").GetComponent <UIPopupList>();
        UIInput     tel_input   = container.transform.FindChild("tel").GetComponent <UIInput>();
        UIInput     email_input = container.transform.FindChild("email").GetComponent <UIInput>();

        //UIInput token_input = container.transform.FindChild("token").GetComponent<UIInput>();
        if (MyUtilTools.stringIsNull(tel_input.value))
        {
            DialogUtil.tip("请输入开户手机号码");
            return;
        }
        if (tel_input.value.Length != 11)
        {
            DialogUtil.tip("手机号码尾数不对");
            return;
        }
        if (!MyUtilTools.checkEmail(email_input.value))
        {
            DialogUtil.tip("请输入合法的email");
            return;
        }

        /*
         * if (MyUtilTools.checkEmail(token_input.value))
         * {
         *  DialogUtil.tip("请输入验证码");
         *  return;
         * }*/
        Transform indent_trans         = container.transform.FindChild("indents");
        UITexture indent_front_texture = indent_trans.FindChild("front").FindChild("context").GetComponent <UITexture>();

        if (indent_front_texture.mainTexture == null)
        {
            DialogUtil.tip("请上传身份证正面");
            return;
        }
        UITexture indent_back_texture = indent_trans.FindChild("back").FindChild("context").GetComponent <UITexture>();

        if (indent_back_texture.mainTexture == null)
        {
            DialogUtil.tip("请上传身份证反面");
            return;
        }
        UITexture bank_texture = container.transform.FindChild("bank").FindChild("front").FindChild("context").GetComponent <UITexture>();

        if (bank_texture.mainTexture == null)
        {
            DialogUtil.tip("请上传银行卡正面");
            return;
        }
        SendMessageEntity entity = new SendMessageEntity();

        System.DateTime tody    = System.DateTime.Now;
        string          dateStr = tody.Year + "-" + tody.Month + "-" + tody.Day + "-" + tody.Hour + "-" + tody.Minute + "-" + tody.Second + ".jpg";

        entity.names.Add(tel_input.value + "-indent-front-" + dateStr);
        entity.names.Add(tel_input.value + "-indent-back-" + dateStr);
        entity.names.Add(tel_input.value + "-bank-front-" + dateStr);
        entity.buffer.skip(4);
        entity.buffer.WriteString("OpenAccountApply");
        entity.buffer.WriteString(wjs_list.value);
        entity.buffer.WriteString(yhk_list.value);
        entity.buffer.WriteString(tel_input.value);
        entity.buffer.WriteString(email_input.value);
        //entity.buffer.WriteString(token_input.value);
        entity.buffer.WriteString(entity.names[0]);
        entity.buffer.WriteString(entity.names[1]);
        entity.buffer.WriteString(entity.names[2]);
        if (!isUploaded)
        {
            EventDelegate ok = new EventDelegate(this, "uploadPicOk");
            ok.parameters[0]     = new EventDelegate.Parameter();
            ok.parameters[0].obj = entity;
            ok.parameters[1]     = new EventDelegate.Parameter();
            ok.parameters[1].obj = indent_back_texture;
            ok.parameters[2]     = new EventDelegate.Parameter();
            ok.parameters[2].obj = bank_texture;
            LoadUtil.show(true, "上传图片中请稍后");
            JustRun.Instance.upLoadPic(entity.names[0], ((Texture2D)indent_front_texture.mainTexture).EncodeToJPG(), ok, new EventDelegate(uploadPicFail));
        }
        else
        {
            sendMessage(entity);
        }
    }
Ejemplo n.º 9
0
 void sendPictureOk(SendMessageEntity entity)
 {
     LoadUtil.show(false);
     NetUtil.getInstance.SendMessage(entity.buffer);
 }
Ejemplo n.º 10
0
 void sendPictureFail()
 {
     LoadUtil.show(false);
     DialogUtil.tip("图片发送失败");
 }