public virtual void SetChatEntryView(ChatEntryData data, ChatScroll chatScroll, int index, float contentViewWidth) { var thisDelta = thisRectTransform.sizeDelta; thisDelta.x = contentViewWidth; thisRectTransform.sizeDelta = thisDelta; var textDelta = textRectTransform.sizeDelta; textDelta.x = contentViewWidth / textRectTransform.localScale.x; textRectTransform.sizeDelta = textDelta; Index = index; this.chatScroll = chatScroll; visibleText.text = data.Message; entryData = data; gameObject.SetActive(true); StartCoroutine(UpdateMinHeight()); }
private void AddMessageLine(UserModel user, string message) { TextBlock tb = new TextBlock(); if (user != null) { //Kolor nicka var nickRun = new Run(); nickRun.Foreground = new SolidColorBrush(Colors.LightGray); nickRun.Text = user.Username; nickRun.FontWeight = FontWeights.Bold; //Cenzor if (Properties.Settings.Default.Censor) { IEnumerable <Regex> badWordMatchers = this.BadWords. Select(x => new Regex(string.Format(PatternTemplate, x), Options)); message = badWordMatchers. Aggregate(message, (current, matcher) => matcher.Replace(current, CensoredText)); } //Tekst var messageRun = new Run(); messageRun.Foreground = new SolidColorBrush(Colors.White); messageRun.Text = ": " + message; tb.Inlines.Add(nickRun); //Dodajemy do textblocka tb.Inlines.Add(messageRun); } else { tb.Text = "Dealer: " + message; tb.Foreground = new SolidColorBrush(Colors.Gray); } tb.TextWrapping = TextWrapping.Wrap; Chat.Children.Add(tb); ChatScroll.ScrollToEnd(); }
public Chat() { InitializeComponent(); ChatScroll.ScrollToEnd(); }