Esempio n. 1
0
 /// <summary>
 /// 发送喇叭
 /// </summary>
 /// <param name="go"></param>
 void Send(GameObject go)
 {
     if (UserInfoModel.userInfo.walletAgNum < 20000)
     {
         TipManager.Instance.OpenTip(TipType.SimpleTip, "银币不足20000,发送失败");
         return;
     }
     if (string.IsNullOrEmpty(input.text))
     {
         TipManager.Instance.OpenTip(TipType.SimpleTip, "发送内容不能为空!");
         return;
     }
     if (Encoding.UTF8.GetByteCount(input.text) > 28 * 3)
     {
         TipManager.Instance.OpenTip(TipType.SimpleTip, "发送内容超过字符限制!");
         return;
     }
     if (BlockWordModel.CheckIsBlock(input.text))
     {
         TipManager.Instance.OpenTip(TipType.SimpleTip, "消息中含有敏感词汇!");
         return;
     }
     SocketClient.Instance.AddSendMessageQueue(new C2GMessage()
     {
         sendHornMsg = new SendHornMsg()
         {
             content = input.text
         },
         msgid = MessageId.C2G_SendHornMsg
     });
     input.text = string.Empty;
     Close();
 }
Esempio n. 2
0
    /// <summary>
    /// 发送打字
    /// </summary>
    void SendDazi()
    {
        if (string.IsNullOrEmpty(input.text))
        {
            TipManager.Instance.OpenTip(TipType.SimpleTip, "请输入聊天内容");
            return;
        }
        if (Encoding.UTF8.GetByteCount(input.text) > 150)
        {
            TipManager.Instance.OpenTip(TipType.SimpleTip, "聊天内容过长");
            return;
        }
        if (BlockWordModel.CheckIsBlock(input.text))
        {
            TipManager.Instance.OpenTip(TipType.SimpleTip, "文字违规!");
            return;
        }
        SocialModel.Instance.SendMessage(curInfo.chatWithId, input.text, 0);

        ////测试
        //UserInfoModel.userInfo.userId = 0;
        //ChatInfo info = new ChatInfo();
        //info.senderId = Random.Range(0, 2);
        //info.chatWithId = curInfo.chatWithId;
        //info.type = 0;
        //info.text = input.text;
        //SocialModel.Instance.ReceiveMessage(info);

        input.text = string.Empty;
    }
Esempio n. 3
0
    /// <summary>
    /// 发送消息
    /// </summary>
    void SendBtn()
    {
        string text = input.text;

        if (string.IsNullOrEmpty(text))
        {
            TipManager.Instance.OpenTip(TipType.SimpleTip, "请输入消息内容");
            return;
        }
        if (System.Text.Encoding.UTF8.GetBytes(text.ToCharArray()).Length > limit * 3)
        {
            TipManager.Instance.OpenTip(TipType.SimpleTip, "消息长度不能超过" + limit + "个字符!");
            return;
        }
        if (BlockWordModel.CheckIsBlock(text))
        {
            TipManager.Instance.OpenTip(TipType.SimpleTip, "消息中含有敏感词汇!");
            return;
        }
        SendChatMessage(text, 0);
        input.text = string.Empty;
    }