コード例 #1
0
    private void ShowMessage(SocketIOEvent data)
    {
        JsonData jsonData = JsonMapper.ToObject(data.data.ToString());
        ChatItem item     = SpawnItem();

        item.Init(jsonData["id"].ToString(), jsonData["chatMessage"].ToString(), UpdateContentPosition);
    }
コード例 #2
0
        private ICollection <CardActionContext> GetActions(ChatItem chatItem, string Title)
        {
            var selectAction = new CardActionContext
            {
                Text    = "Select",
                Command = new Command(() =>
                {
                    var index = chat.Items.IndexOf(chatItem);
                    chat.Items.RemoveAt(index);
                    chat.Items.Add(new TextMessage {
                        Author = this.chat.Author, Text = Title
                    });
                })
            };

            var seeBioAction = new CardActionContext
            {
                Text    = "See Bio",
                Command = new Command(() =>
                {
                    var index = chat.Items.IndexOf(chatItem);
                    chat.Items.RemoveAt(index);
                    chat.Items.Add(new TextMessage {
                        Author = this.chat.Author, Text = Title + " biography"
                    });
                })
            };

            return(new List <CardActionContext>()
            {
                selectAction, seeBioAction
            });
        }
コード例 #3
0
ファイル: PlayerControlsUI.cs プロジェクト: Quoclon/GGJ2020
    private void DequeueChatQueue()
    {
        timeSinceLastCooldown += Time.deltaTime;

        if (chatQueue.Count == 0)
        {
            if (!gameController.GameStarted)
            {
                gameController.GameStarted = true;
            }

            return;
        }

        if (timeSinceLastCooldown < chatCooldown)
        {
            return;
        }

        ChatItem nextItem = chatQueue.Dequeue();

        CreateChat(nextItem);

        timeSinceLastCooldown = 0;
        chatCooldown          = Random.Range(MinChatCooldown, MaxChatCooldown);
    }
コード例 #4
0
    public void ShowMessage(string msg)
    {
        ChatItem tmpMsg;

        tmpMsg = new ChatItem(SessionInfo.None, "알림", msg, false);
        MessageMenu.instance.AddChat(tmpMsg, true);
    }
コード例 #5
0
    public void AddChatItem(ChatItemType type, object param)
    {
        if ((int)type >= objChatItemProfabs.Length)
        {
            return;
        }
        ChatItem objSelf = null;

        for (int i = 0; i < listAllObject.Count; ++i)
        {
            ChatItem obj = listAllObject[i];
            if ((!obj.gameObject.activeSelf) && obj.GetChatItemType() == type)
            {
                objSelf = obj;
                break;
            }
        }
        if (objSelf == null)
        {
            objSelf = Object.Instantiate(objChatItemProfabs[(int)type].gameObject).GetComponent <ChatItem>();
            listAllObject.Add(objSelf);
        }
        objSelf.gameObject.SetActive(true);
        objSelf.transform.parent = scrollContent.transform;
        lastChatItem             = objSelf;
        objSelf.ShowItem(param);
        scrollToBottom();
    }
コード例 #6
0
        public async Task <IActionResult> PutChatItem(int id, ChatItem chatItem)
        {
            if (id != chatItem.Id)
            {
                return(BadRequest());
            }

            _context.Entry(chatItem).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ChatItemExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
コード例 #7
0
ファイル: Chat.cs プロジェクト: isoundy000/shmj3d
    void playVoice()
    {
        VoiceMgr vmr = VoiceMgr.GetInstance();
        RoomMgr  rm  = RoomMgr.GetInstance();

        if (_playingSeat < 0 && mVoiceQueue.Count > 0)
        {
            ChatItem vm    = mVoiceQueue.Dequeue();
            string   msg   = vm.voice.msg;
            string   file  = vm.path;
            int      si    = rm.getSeatIndexByID(vm.sender);
            int      local = rm.getLocalIndex(si);
            _playingSeat = local;

            vmr.writeVoice(file, msg);
            vmr.play(file);

            if (playing != null)
            {
                playing.SetActive(false);
                playing = null;
            }

            playing = vm.vobj;
            if (playing != null)
            {
                playing.SetActive(true);
            }

            _lastPlayTime = PUtils.getMilliSeconds() + vm.voice.time;
        }
    }
コード例 #8
0
    /// <summary>
    /// 添加内容到聊天窗口
    /// </summary>
    /// <param name="text"></param>
    private void Add(string name, string nameColor, string text, string textColor, byte[] bytes)
    {
        GameObject go;

        if (mList.Count >= MaxCount)
        {
            go = mList[0];
            mList.Remove(go);
        }
        else
        {
            go = Instantiate(ChatCell) as GameObject;
        }

        ChatItem cell = go.GetComponent <ChatItem>();

        go.transform.parent     = grid.transform;
        go.transform.localScale = ChatCell.transform.localScale;
        cell.nameColor          = nameColor;
        cell.infoColor          = textColor;
        cell.nameText           = name;
        cell.text = text;

        mList.Add(go);

        grid.Reposition();
        scrollBar.value = 1;
    }
コード例 #9
0
    void OnRespond(Notification notify)
    {
        Transform item  = Instantiate <Transform>(chatLeftModel);
        ChatItem  cItem = item.GetComponent <ChatItem>();

        cItem.SetMsg(notify["text"].ToString());
        container.AddItem(item, cItem.msgText.preferredHeight + 100, true);
    }
コード例 #10
0
ファイル: ChatItem.cs プロジェクト: npnf-seta/Fox-Poker
    public static ChatItem Create(DataChat data)
    {
        GameObject gobj = GameObject.Instantiate(Resources.Load("Prefabs/Gameplay/ChatItem")) as GameObject;
        ChatItem   item = gobj.GetComponent <ChatItem>();

        item.initData(data);
        return(item);
    }
コード例 #11
0
ファイル: BotPattern.cs プロジェクト: SaladLab/Chatty
        public override Task OnWhisper(ChatItem chatItem)
        {
            if (chatItem.Message.ToLower() == "kill")
            {
                _context.Service.Kill();
            }

            return(Task.CompletedTask);
        }
コード例 #12
0
ファイル: Chat.cs プロジェクト: isoundy000/shmj3d
    void onVoiceMsg(VoiceMsgPush vmp)
    {
        ChatItem item = new ChatItem(vmp);

        addItem(item);

        mVoiceQueue.Enqueue(item);
        playVoice();
    }
コード例 #13
0
        // POST api/<controller>
        public void PostChat(ChatItem chatItem)
        {
            chatItem.Id       = Guid.NewGuid();
            chatItem.DateTime = DateTime.Now;
            _manager.AddChat(chatItem);

            //broadcast the chat to all the clients
            _chatHub.SendMessage(chatItem);
        }
コード例 #14
0
ファイル: BotPattern.cs プロジェクト: SaladLab/Chatty
        public override Task OnWhisper(ChatItem chatItem)
        {
            if (chatItem.Message.ToLower() == "kill")
            {
                _context.Service.Kill();
            }

            return(WhisperToAsync(chatItem.UserId, $"Wow you sent a whisper (length={chatItem.Message.Length})"));
        }
コード例 #15
0
    // 활성화된 채널에 참여
    private void JoinChannel(ChannelNodeObject node)
    {
        ErrorInfo info;

        Backend.Chat.JoinChannel(node.type, node.host, node.port, node.channel_uuid, out info);

        // 채널 입장 메시지
        chatItem = new ChatItem(SessionInfo.None, infoText, string.Format(CHAT_ENTER, node.alias), false);
        BackEndUIManager.instance.AddChat(chatItem);
    }
コード例 #16
0
    /// <summary>
    /// 查看玩家信息
    /// </summary>
    private void OnClickChatItem(GameObject go)
    {
        ChatItem item = go.transform.parent.GetComponent <ChatItem>();

        if (item != null)
        {
            ChatInfo info = item.Data;
            ServerCustom.instance.SendClientMethods("onClientGetPlayerInfo", info.dbid);
        }
    }
コード例 #17
0
        public static ChatItem CreateFromContact(Contact contact)
        {
            var ci = new ChatItem();

            ci.Contact = contact;
            ci.Text    = contact.Name;
            ci.Jid     = contact.Jid;

            return(ci);
        }
コード例 #18
0
        public bool IsChatDbPresentInDB()
        {
            ChatItem model = liteDBService.ReadAllItems <ChatItem>().FirstOrDefault(t => t.ID != 0);

            if (model == null)
            {
                return(false);
            }
            return(true);
        }
コード例 #19
0
ファイル: ChatMsgView.cs プロジェクト: rerwr/test
        //将一条聊天内容放入聊天窗口
        private void AddContent(ChatLog c)
        {
            GameObject go = GameObject.Instantiate(chatItem) as GameObject;

            go.transform.SetParent(MsgWindows);
            go.transform.localScale = new Vector3(1, 1, 1);

            ChatItem _chatLog = go.AddComponent <ChatItem>();

            _chatLog.Init(c);
        }
コード例 #20
0
ファイル: ChatUI.cs プロジェクト: onerain88/HelloUGUI
    public void onSendButtonClicked()
    {
        string     chat        = this.chatInputField.text;
        string     chatItemRes = Random.Range(0, 2) == 0 ? "LeftChatItem" : "RightChatItem";
        GameObject chatItemGO  = Instantiate(Resources.Load(chatItemRes), chatContentTransform) as GameObject;
        ChatItem   chatItem    = chatItemGO.GetComponent <ChatItem>();

        chatItem.setChat(chat);

        StartCoroutine(goToBottom());
    }
コード例 #21
0
        protected override DataTemplate OnSelectTemplate(object item, BindableObject container)
        {
            ChatItem chatItem = item as ChatItem;

            if (chatItem != null && chatItem.Data is InsuranceInfo)
            {
                return(this.InsuranceInfoTemplate);
            }

            return(base.OnSelectTemplate(item, container));
        }
コード例 #22
0
ファイル: ChatScene.cs プロジェクト: SaladLab/Chatty
    void IUserEventObserver.Whisper(ChatItem chatItem)
    {
        if (string.IsNullOrEmpty(_currentRoomName))
        {
            return;
        }

        _roomItemMap[_currentRoomName].ChatPanel.AppendChatMessage(string.Format(
                                                                       "@ <color=#800080ff><b>{0}</b></color>: {1}",
                                                                       chatItem.UserId, chatItem.Message));
    }
コード例 #23
0
        protected override DataTemplate OnSelectTemplate(object item, BindableObject container)
        {
            ChatItem chatItem = item as ChatItem;
            var      myItem   = chatItem?.Data as SimpleChatItem;

            if (myItem != null && myItem.Category == MessageCategory.Important)
            {
                return(this.ImportantMessageTemplate);
            }
            return(base.OnSelectTemplate(item, container));
        }
コード例 #24
0
 public static ChatDataItem ChatItemToDataItem(ChatItem chatItem)
 {
     return(new ChatDataItem
     {
         sendUserId = chatItem.sendUserId,
         receiveUserId = chatItem.receiveUserId,
         chatType = ((ChatDataItem.ChatType)(uint) chatItem.chatType),
         chatBody = chatItem.chatBody,
         date = TimeJavaToCSharp(chatItem.date),
         targetType = ((ChatDataItem.TargetType)(uint) chatItem.targetType),
     });
 }
コード例 #25
0
        public async Task <bool> SendMessagesAsync(ChatItem item)
        {
            var json = JsonConvert.SerializeObject(item);
            var data = new StringContent(json, Encoding.UTF8, "application/json");
            HttpResponseMessage response = await _client.PostAsync(_apiUrl, data);

            if (response.IsSuccessStatusCode)
            {
                return(true);
            }
            return(false);
        }
コード例 #26
0
    int NewChat(ChatItem item, int lastID, List <ChatItemSetUI> currList)
    {
        lastID = (lastID + 1) % ChatManager.CHAT_MAX_COUNT;
        if (currList[lastID] == null)
        {
            GameObject go = NGUITools.AddChild(table.gameObject, mPref_ChatItemSet);
            currList[lastID] = go.GetComponent <ChatItemSetUI>();
        }

        currList[lastID].Set(item);
        return(lastID);
    }
コード例 #27
0
    void CmdChatSendMessage(string sender, string message)
    {
        GameObject chatItem = Instantiate(chatItemPrefab);

        chatItem.transform.SetParent(chat.transform);
        ChatItem messageSettings = chatItem.GetComponent <ChatItem>();

        messageSettings.Setup(sender, message);
        messageSettings.chatNetId = chat.GetComponent <NetworkIdentity>().netId;
        NetworkServer.Spawn(chatItem);
        StartCoroutine(WaitForExpire(chatItem));
    }
コード例 #28
0
        public ChatItem[] ParseBackup(string fileContent, string tag = null, string sourceFile = null)
        {
            var items = new List <ChatItem>();

            var regex = new Regex(@"([0-9]*\.[0-9]*\.[0-9]*), ([0-9]*:[0-9]*) - (.*): (.*)");

            ChatItem item = null;

            foreach (var l in fileContent.Split('\n'))
            {
                if (regex.IsMatch(l))
                {
                    if (item != null)
                    {
                        items.Add(item);
                    }

                    var match = regex.Match(l);

                    string name = match.Groups[3].Value;

                    var preText = string.Empty;
                    if (name.Contains(":"))
                    {
                        var idx = name.IndexOf(':');
                        preText = name.Substring(idx + 1) + ":";
                        name    = name.Substring(0, idx);
                    }
                    string text = $"{preText} {match.Groups[4].Value}";

                    var timestampText = match.Groups[2].Value;
                    var dateTimeText  = match.Groups[1].Value;

                    var date = DateTime.ParseExact(dateTimeText, @"dd\.MM\.yy", CultureInfo.InvariantCulture);
                    var time = TimeSpan.ParseExact(timestampText, @"hh\:mm", CultureInfo.InvariantCulture);

                    var timestamp = date.Add(time);

                    item = new ChatItem(name.Trim(), text.Trim(), timestamp, tag, sourceFile);
                }
                else
                {
                    item?.AppendText(l);
                }
            }

            if (item != null)
            {
                items.Add(item);
            }

            return(items.ToArray());
        }
コード例 #29
0
ファイル: BotPattern.cs プロジェクト: SaladLab/Chatty
        public override async Task OnSay(ChatItem chatItem)
        {
            if (chatItem.UserId.StartsWith("bot"))
            {
                return;
            }

            if (chatItem.Message.Contains("bot?"))
            {
                await SayAsync("Yes I'm a bot.");
            }
        }
コード例 #30
0
        public async Task <ActionResult <ChatItem> > PostChatItem(ChatItem chatItem)
        {
            var client        = new HttpClient();
            var appId         = Program.Configuration["Luis:appId"];
            var predictionKey = Program.Configuration["Luis:predictionKey"];

            var predictionEndpoint       = $"https://westus.api.cognitive.microsoft.com/luis/prediction/v3.0/apps/{appId}/slots/production/predict?subscription-key={predictionKey}&verbose=true&show-all-intents=true&log=true&query={chatItem.Utterance}";
            HttpResponseMessage response = await client.GetAsync(predictionEndpoint);

            string strResponseContent = await response.Content.ReadAsStringAsync();

            return(Ok(strResponseContent));
        }
コード例 #31
0
ファイル: InitGame.cs プロジェクト: jonbro/hull_breach
 void AddChat(string text, string player, double time)
 {
     // check to see if this is duped in the logs
     foreach(ChatItem c in chatLog){
         if(c.time == time && player == c.player){
             return;
         }
     }
     chatLog.RemoveAt(0);
     ChatItem chat = new ChatItem();
     chat.text = text;
     chat.player = player;
     chat.time = time;
     chatLog.Add(chat);
 }
コード例 #32
0
ファイル: TumblrDataSource.cs プロジェクト: clinejj/tumbl8r
 private void setDialogueFromArray(JsonArray arr)
 {
     this._dialogue = new Collection<ChatItem>();
     foreach (var a in arr)
     {
         JsonObject item = a.GetObject();
         ChatItem c = new ChatItem();
         if (item.ContainsKey(STR_NAME))
             c.Name = item.GetNamedString(STR_NAME);
         if (item.ContainsKey(STR_LABEL))
             c.Label = item.GetNamedString(STR_LABEL);
         if (item.ContainsKey(STR_PHRASE))
             c.Phrase = item.GetNamedString(STR_PHRASE);
         this._dialogue.Add(c);
     }
 }