public RectTransform GetCustomMessageCellViewNode(FizzChannelMessage message) { if (message.Data != null) { if (message.Data.ContainsKey("type") && message.Data["type"].Equals("fizz_predefine_phrase")) { string id = message.Data["phrase_id"]; FizzHypercasualPhraseDataItem phraseData = dataProvider.GetPhrase(id); if (phraseData != null) { FizzCustomPhraseView phraseView = Instantiate(PhrasePrefab); phraseView.gameObject.SetActive(true); phraseView.SetPhrase(phraseData.GetLocalizedContent(Application.systemLanguage)); // Theme color change phraseView.GetComponent <ThemeLabelColor>().SetColor((message.From.Equals(FizzService.Instance.UserId)? ThemeColor.Base_2 : ThemeColor.Base_1)); return(phraseView.GetComponent <RectTransform> ()); } } else if (message.Data.ContainsKey("type") && message.Data["type"].Equals("fizz_predefine_sticker")) { string id = message.Data["sticker_id"]; FizzHypercasualStickerDataItem stickerData = dataProvider.GetSticker(id); if (stickerData != null) { FizzCustomStickerView sticker = Instantiate(StickerPrefab); sticker.gameObject.SetActive(true); sticker.SetSticker(stickerData.Content); return(sticker.GetComponent <RectTransform> ()); } } } return(null); }
private void LoadPhrases(bool loadRecent = false) { ReturnPhraseViewToPool(); if (!loadRecent && selectedTab == null) { return; } List <string> phrases = loadRecent ? dataProvider.GetRecentPhrases() : dataProvider.GetAllPhrases(selectedTab.Tag); if (phrases.Count == 0) { return; } foreach (string id in phrases) { FizzHypercasualDataItem phraseItem = dataProvider.GetPhrase(id); if (phraseItem == null) { continue; } FizzHypercasualPhraseView phraseView = GetPhraseViewFromPool(); phraseView.gameObject.SetActive(true); phraseView.transform.SetParent(PhrasesContainer, false); phraseView.transform.localScale = Vector3.one; phraseView.SetPhraseData(phraseItem); phraseView.OnPhraseClick = OnPhraseClicked; } }