コード例 #1
0
        private void RemoveHashtags()
        {
            Transform container = chirpPane.transform.FindChild("Chirps").FindChild("Clipper").FindChild("Container").gameObject.transform;

            foreach (ChirpMessage message in hashTaggedMessages)
            {
                // Set showHide time low to stop overlap.
                chirpPane.m_ShowHideTime = 0.05f;

                // Delete old message.
                DeleteMessage(message);

                // Construct new message without hashtags.
                string       newMessageText = ChirpFilter.DeHashTagMessage(message);
                ChirpMessage newMessage     = new ChirpMessage(message.senderName, newMessageText, message.senderID);

                chirpPane.StartCoroutine(AddMessageCo(newMessage));

                // Set showHide time to normal.
                chirpPane.m_ShowHideTime = showHideTime;

                // Clean up ...
                bool filtered;

                if (messageFilterMap.TryGetValue(message, out filtered))
                {
                    messageFilterMap.Remove(message);
                    messageFilterMap.Add(newMessage, filtered);
                }

                IChirperMessage managerMessage;

                if (messageMap.TryGetValue(message, out managerMessage))
                {
                    messageMap.Remove(message);
                    messageMap.Add(newMessage, managerMessage);
                }

                hashTaggedMessages.Remove(message);
            }
        }
コード例 #2
0
        //Thread: Main
        public override void OnNewMessage(IChirperMessage message)
        {
            // To make mute collapsing work better.
            userOpened = chirpPane.isShowing;
            newMsgIn   = true;

            DebugOutputPanel.AddMessage(PluginManager.MessageType.Message, "[SuperChirper] Message received");
            if (!isMuted)
            {
                // Cast message and check whether it should be filtered.
                CitizenMessage cm            = message as CitizenMessage;
                ChirpMessage   storedMessage = new ChirpMessage(message.senderName, message.text, message.senderID);

                bool filter = ChirpFilter.FilterMessage(cm.m_messageID);

                if (cm != null)
                {
                    // Check if message is garbage


                    // Check if we should make noise
                    chirpPane.m_NotificationSound = ((isFiltered && filter) ? null : SuperChirperLoader.MessageSound);

                    // TODO: Change to ChirpMessage in dictionary, to make compatible with hashtag removal.
                    messageFilterMap.Add(storedMessage, filter);
                }
                else
                {
                    // Default to unfiltered messages.
                    messageFilterMap.Add(storedMessage, false);
                }

                hashTaggedMessages.Add(storedMessage);
                messageMap.Add(storedMessage, message);
            }
        }