Esempio n. 1
0
 public void SetContextByMessage(CommunityChatMessage message)
 {
     this.m_message = message;
     this.m_destroyButton.SetActive(this.m_message.CanBeDestroyed());
     this.m_reportButton.SetActive(!this.m_message.CreatedBySelf() && ReportSystem.CanReportPlayer(this.m_message.GetAsPlayerLocation()));
     this.m_divider.SetActive(this.m_destroyButton.activeSelf && this.m_reportButton.activeSelf);
 }
Esempio n. 2
0
        private void AddChatMessage(CommunityChatMessage message)
        {
            string text = message.TimeStamp.ToString("MMM dd, yyyy");

            if (this.m_earliestDate == string.Empty)
            {
                this.m_earliestDate = text;
            }
            if (this.m_latestDate != text)
            {
                this.m_latestDate = text;
                GameObject gameObject          = this.m_chatContent.AddAsChildObject(this.m_dateObjectPrefab);
                Text       componentInChildren = gameObject.GetComponentInChildren <Text>();
                componentInChildren.text = text.ToUpper();
            }
            GameObject        gameObject2 = this.m_chatContent.AddAsChildObject(this.m_chatObjectPrefab);
            CommunityChatItem component   = gameObject2.GetComponent <CommunityChatItem>();

            component.SetChatInfo(message);
            if (this.ShouldMinimizeChatItem(message))
            {
                gameObject2.GetComponent <CommunityChatItem>().MinimizeChatItem();
            }
            else
            {
                this.m_lastChatItem = component;
            }
        }
 public void SetChatInfo(CommunityChatMessage message)
 {
     this.m_characterName.text = message.Author;
     this.m_bodyText.text      = message.Message;
     this.m_timeStamp          = message.TimeStamp;
     this.m_postTime.text      = this.m_timeStamp.ToShortTimeString();
     this.m_moderatorImage.SetActive(message.PostedByModerator());
 }
Esempio n. 4
0
 public void SetChatInfo(CommunityChatMessage message)
 {
     this.m_message            = message;
     this.m_characterName.text = message.Author;
     this.m_bodyText.text      = message.Message;
     this.m_timeStamp          = message.TimeStamp;
     this.m_postTime.text      = this.m_timeStamp.ToShortTimeString();
     this.m_classIcon.sprite   = GeneralHelpers.LoadClassIcon((int)this.m_message.ClassID);
     this.m_moderatorImage.SetActive(message.PostedByModerator());
 }
Esempio n. 5
0
        private bool ShouldMinimizeChatItem(CommunityChatMessage message)
        {
            if (this.m_lastChatItem == null)
            {
                return(false);
            }
            TimeSpan timeSpan = message.TimeStamp - this.m_lastChatItem.TimeStamp;

            return(this.m_lastChatItem.GetAuthor() == message.Author && timeSpan.Minutes < 5 && timeSpan.Days == 0 && timeSpan.Hours == 0);
        }
 public CommunityChatMessage HandleMessageUpdatedEvent(Club.ClubMessageUpdatedEvent messageEvent)
 {
     if (messageEvent.ClubID == this.m_clubId && messageEvent.StreamID == this.StreamId)
     {
         CommunityChatMessage communityChatMessage = this.m_messages.Find((CommunityChatMessage message) => message.MessageIdentifier.epoch == messageEvent.MessageID.epoch && message.MessageIdentifier.position == messageEvent.MessageID.position);
         communityChatMessage.UpdateMessage(messageEvent);
         return(communityChatMessage);
     }
     return(null);
 }
        private bool ShouldMinimizeChatItem(CommunityChatMessage message)
        {
            if (this.m_lastChatItem == null)
            {
                return(false);
            }
            TimeSpan timeStamp = message.TimeStamp - this.m_lastChatItem.TimeStamp;

            return(!(this.m_lastChatItem.GetAuthor() == message.Author) || timeStamp.Minutes >= 5 || timeStamp.Days != 0 ? false : timeStamp.Hours == 0);
        }
 public void SetChatInfo(CommunityChatMessage message)
 {
     this.m_message            = message;
     this.m_characterName.text = message.Author;
     this.m_bodyText.text      = message.Message;
     this.m_bodyText.fontStyle = ((!message.Destroyed) ? 0 : 2);
     this.m_postTime.text      = message.TimeStamp.ToShortTimeString();
     this.m_classIcon.sprite   = GeneralHelpers.LoadClassIcon(this.m_message.ClassID);
     this.m_moderatorImage.SetActive(message.PostedByModerator() || message.PostedByLeaderOrOwner());
     this.m_moderatorImage.GetComponent <Image>().sprite = ((!message.PostedByModerator()) ? this.m_leaderOwnerSprite : this.m_moderatorSprite);
 }
Esempio n. 9
0
        public CommunitiesChatContextMenu CreateChatContextMenu(CommunityChatMessage message)
        {
            if (this.m_communitesChatContextMenu == null)
            {
                return(null);
            }
            CommunitiesChatContextMenu communitiesChatContextMenu = Object.Instantiate <CommunitiesChatContextMenu>(this.m_communitesChatContextMenu, this.Level3Canvas.transform, false);

            communitiesChatContextMenu.SetContextByMessage(message);
            communitiesChatContextMenu.gameObject.name = "CommunitiesChatContextMenu";
            return(communitiesChatContextMenu);
        }
Esempio n. 10
0
        public CommunityChatMessage HandleMessageAddedEvent(Club.ClubMessageAddedEvent messageEvent)
        {
            ClubMessageInfo?messageInfo = Club.GetMessageInfo(this.m_clubId, this.StreamId, messageEvent.MessageID);

            if (messageInfo != null)
            {
                CommunityChatMessage communityChatMessage = new CommunityChatMessage(messageInfo.Value);
                this.m_messages.Add(communityChatMessage);
                return(communityChatMessage);
            }
            return(null);
        }
Esempio n. 11
0
        private void OnMessageAdded(Club.ClubMessageAddedEvent messageEvent)
        {
            CommunityChatMessage communityChatMessage = null;

            if (this.m_focusedStream != null)
            {
                communityChatMessage = this.m_focusedStream.HandleMessageAddedEvent(messageEvent);
            }
            if (communityChatMessage != null)
            {
                this.AddChatMessage(communityChatMessage);
                this.ScrollToBottom();
            }
            else
            {
                CommunityData.Instance.HandleMessageAddedEvent(messageEvent);
            }
        }
Esempio n. 12
0
        private void AddChatMessage(CommunityChatMessage message)
        {
            CultureInfo cultureInfoLocale = MobileDeviceLocale.GetCultureInfoLocale();
            CultureInfo currentCulture    = Thread.CurrentThread.CurrentCulture;

            Thread.CurrentThread.CurrentCulture = cultureInfoLocale;
            string text = message.TimeStamp.ToString(StaticDB.GetString("FULL_DATE", "dddd, MMMM d, yyyy"));

            if (this.m_earliestDate == string.Empty)
            {
                this.m_earliestDate = text;
            }
            if (this.m_latestDate != text)
            {
                this.m_latestDate = text;
                GameObject gameObject          = this.m_chatContent.AddAsChildObject(this.m_dateObjectPrefab);
                Text       componentInChildren = gameObject.GetComponentInChildren <Text>();
                componentInChildren.text = text;
            }
            GameObject        gameObject2 = this.m_chatContent.AddAsChildObject(this.m_chatObjectPrefab);
            CommunityChatItem component   = gameObject2.GetComponent <CommunityChatItem>();

            component.SetChatInfo(message);
            if (string.IsNullOrEmpty(message.Author))
            {
                if (this.m_pendingMemberIDs.Count == 0)
                {
                    Club.OnClubMemberUpdated += new Club.ClubMemberUpdatedHandler(this.UpdatePendingMessages);
                }
                this.m_pendingMemberIDs.Add(message.MemberID);
            }
            if (this.ShouldMinimizeChatItem(message))
            {
                gameObject2.GetComponent <CommunityChatItem>().MinimizeChatItem();
            }
            else
            {
                this.m_lastChatItem = component;
            }
            Thread.CurrentThread.CurrentCulture = currentCulture;
        }
Esempio n. 13
0
        private void OnMessageUpdated(Club.ClubMessageUpdatedEvent messageEvent)
        {
            CommunityChatMessage newMessage = null;

            if (this.m_focusedStream != null)
            {
                newMessage = this.m_focusedStream.HandleMessageUpdatedEvent(messageEvent);
            }
            if (newMessage != null)
            {
                CommunityChatItem communityChatItem = this.m_chatContent.GetComponentsInChildren <CommunityChatItem>().FirstOrDefault((CommunityChatItem item) => item.IsSameMessage(newMessage));
                if (communityChatItem != null)
                {
                    communityChatItem.SetChatInfo(newMessage);
                }
            }
            else
            {
                CommunityData.Instance.HandleMessageUpdatedEvent(messageEvent);
            }
        }
Esempio n. 14
0
 public void EditMessage(CommunityChatMessage message, string newMessage)
 {
     Club.EditMessage(this.m_clubId, this.StreamId, message.MessageIdentifier, newMessage);
 }
Esempio n. 15
0
 public void DeleteMessage(CommunityChatMessage message)
 {
     Club.DestroyMessage(this.m_clubId, this.StreamId, message.MessageIdentifier);
 }
 public bool IsSameMessage(CommunityChatMessage compareMessage)
 {
     return(compareMessage.MessageIdentifier.epoch == this.m_message.MessageIdentifier.epoch && compareMessage.MessageIdentifier.position == this.m_message.MessageIdentifier.position);
 }
Esempio n. 17
0
 public void InitializeReportDialog(CommunityChatMessage message)
 {
     this.m_reportedMessage = message;
     this.m_headerText.text = MobileClient.FormatString(StaticDB.GetString("REPORT_PLAYER_FOR", "[PH]Report " + message.Author + ":"), message.Author);
 }