string AdminMessageRichText(AdminMessage message) { return("<color=#" + SendBirdTheme.ToHex(uiTheme.systemMessageColor) + ">" + message.Message + "</color>"); }
void InitComponents() { uiPanel = GameObject.Find("SendBirdUnity/UIPanel"); (Instantiate(uiThemePrefab) as GameObject).transform.parent = uiPanel.transform; editPopup = GameObject.Find("SendBirdUnity/UIPanel/GroupChannelPanel/EditPopup"); editPopup.gameObject.SetActive(false); uiTheme = GameObject.FindObjectOfType(typeof(SendBirdTheme)) as SendBirdTheme; #region MenuPanel menuPanel = GameObject.Find("SendBirdUnity/UIPanel/MenuPanel"); menuPanel.GetComponent <Image>().sprite = uiTheme.channelListFrameBG; var txtMenuTitle = GameObject.Find("SendBirdUnity/UIPanel/MenuPanel/TxtTitle").GetComponent <Text>(); txtMenuTitle.color = uiTheme.titleColor; btnConnect = GameObject.Find("SendBirdUnity/UIPanel/MenuPanel/BtnConnect").GetComponent <Button>(); btnConnect.GetComponent <Image>().sprite = uiTheme.sendButton; btnConnect.GetComponent <Image>().type = Image.Type.Sliced; btnConnect.onClick.AddListener(() => { nickname = inputUserName.text; userId = nickname; // Please assign user's unique id. if (nickname == null || nickname.Length <= 0) { return; } btnConnect.gameObject.SetActive(false); btnOpenChannelList.gameObject.SetActive(true); btnStartGroupChannel.gameObject.SetActive(true); btnGroupChannelList.gameObject.SetActive(true); SendBirdClient.Connect(userId, (user, e) => { // if (e != null) { Debug.Log(e.Code + ": " + e.Message); return; } SendBirdClient.UpdateCurrentUserInfo(nickname, null, (e1) => { if (e1 != null) { Debug.Log(e.Code + ": " + e.Message); return; } }); }); }); btnOpenChannelList = GameObject.Find("SendBirdUnity/UIPanel/MenuPanel/BtnOpenChannel").GetComponent <Button>(); btnOpenChannelList.GetComponent <Image>().sprite = uiTheme.sendButton; btnOpenChannelList.GetComponent <Image>().type = Image.Type.Sliced; btnOpenChannelList.onClick.AddListener(() => { menuPanel.SetActive(false); OpenOpenChannelList(); }); btnStartGroupChannel = GameObject.Find("SendBirdUnity/UIPanel/MenuPanel/BtnStartGroupChannel").GetComponent <Button>(); btnStartGroupChannel.GetComponent <Image>().sprite = uiTheme.sendButton; btnStartGroupChannel.GetComponent <Image>().type = Image.Type.Sliced; btnStartGroupChannel.onClick.AddListener(() => { menuPanel.SetActive(false); OpenUserList(); }); btnGroupChannelList = GameObject.Find("SendBirdUnity/UIPanel/MenuPanel/BtnGroupChannel").GetComponent <Button>(); btnGroupChannelList.GetComponent <Image>().sprite = uiTheme.sendButton; btnGroupChannelList.GetComponent <Image>().type = Image.Type.Sliced; btnGroupChannelList.onClick.AddListener(() => { menuPanel.SetActive(false); OpenGroupChannelList(); }); inputUserName = GameObject.Find("SendBirdUnity/UIPanel/MenuPanel/InputUserName").GetComponent <InputField>(); inputUserName.GetComponent <Image>().sprite = uiTheme.inputTextBG; #endregion #region OpenChannel openChannelPanel = GameObject.Find("SendBirdUnity/UIPanel/OpenChannelPanel"); openChannelPanel.GetComponent <Image>().sprite = uiTheme.chatFrameBG; txtOpenChannelContent = GameObject.Find("SendBirdUnity/UIPanel/OpenChannelPanel/ScrollArea/TxtContent").GetComponent <Text>(); // (Text); txtOpenChannelContent.color = uiTheme.messageColor; txtOpenChannelTitle = GameObject.Find("SendBirdUnity/UIPanel/OpenChannelPanel/TxtTitle").GetComponent <Text>(); txtOpenChannelTitle.color = uiTheme.titleColor; openChannelScrollbar = GameObject.Find("SendBirdUnity/UIPanel/OpenChannelPanel/Scrollbar").GetComponent <Scrollbar>(); ColorBlock cb = openChannelScrollbar.colors; cb.normalColor = uiTheme.scrollBarColor; cb.pressedColor = uiTheme.scrollBarColor; cb.highlightedColor = uiTheme.scrollBarColor; openChannelScrollbar.colors = cb; openChannelScrollbar.onValueChanged.AddListener((float value) => { if (value <= 0) { autoScroll = true; lastTextPositionY = txtOpenChannelContent.transform.position.y; return; } if (lastTextPositionY - txtOpenChannelContent.transform.position.y >= 100) { autoScroll = false; } lastTextPositionY = txtOpenChannelContent.transform.position.y; }); inputOpenChannel = GameObject.Find("SendBirdUnity/UIPanel/OpenChannelPanel/InputOpenChannel").GetComponent <InputField>(); inputOpenChannel.GetComponent <Image>().sprite = uiTheme.inputTextBG; inputOpenChannel.onEndEdit.AddListener((string msg) => { SubmitOpenChannel(); }); GameObject.Find("SendBirdUnity/UIPanel/OpenChannelPanel/InputOpenChannel/Placeholder").GetComponent <Text>().color = uiTheme.inputTextPlaceholderColor; GameObject.Find("SendBirdUnity/UIPanel/OpenChannelPanel/InputOpenChannel/Text").GetComponent <Text>().color = uiTheme.inputTextColor; btnOpenChannelSend = GameObject.Find("SendBirdUnity/UIPanel/OpenChannelPanel/BtnOpenChannelSend").GetComponent <Button>(); btnOpenChannelSend.GetComponent <Image>().sprite = uiTheme.sendButton; btnOpenChannelSend.GetComponentInChildren <Text>().color = uiTheme.sendButtonColor; btnOpenChannelSend.onClick.AddListener(() => { SubmitOpenChannel(); }); btnOpenChannelClose = GameObject.Find("SendBirdUnity/UIPanel/OpenChannelPanel/BtnOpenChannelClose").GetComponent <Button>(); btnOpenChannelClose.GetComponent <Image>().sprite = uiTheme.closeButton; btnOpenChannelClose.onClick.AddListener(() => { openChannelPanel.SetActive(false); menuPanel.SetActive(true); }); #endregion #region ChannelList openChannelListPanel = GameObject.Find("SendBirdUnity/UIPanel/OpenChannelListPanel"); openChannelListPanel.GetComponent <Image>().sprite = uiTheme.channelListFrameBG; channelGridPannel = GameObject.Find("SendBirdUnity/UIPanel/OpenChannelListPanel/ScrollArea/GridPanel"); GameObject.Find("SendBirdUnity/UIPanel/OpenChannelListPanel/TxtTitle").GetComponent <Text>().color = uiTheme.titleColor; var channelScrollbar = GameObject.Find("SendBirdUnity/UIPanel/OpenChannelListPanel/Scrollbar").GetComponent <Scrollbar>(); cb = channelScrollbar.colors; cb.normalColor = uiTheme.scrollBarColor; cb.pressedColor = uiTheme.scrollBarColor; cb.highlightedColor = uiTheme.scrollBarColor; channelScrollbar.colors = cb; channelScrollbar.onValueChanged.AddListener((float value) => { if (value <= 0) { LoadOpenChannels(); } }); btnOpenChannelListClose = GameObject.Find("SendBirdUnity/UIPanel/OpenChannelListPanel/BtnOpenChannelListClose").GetComponent <Button>(); btnOpenChannelListClose.GetComponent <Image>().sprite = uiTheme.closeButton; btnOpenChannelListClose.onClick.AddListener(() => { openChannelListPanel.SetActive(false); menuPanel.SetActive(true); }); #endregion #region GroupChannel groupChannelPanel = GameObject.Find("SendBirdUnity/UIPanel/GroupChannelPanel"); groupChannelPanel.GetComponent <Image>().sprite = uiTheme.chatFrameBG; txtGroupChannelTitle = GameObject.Find("SendBirdUnity/UIPanel/GroupChannelPanel/TxtTitle").GetComponent <Text>(); txtGroupChannelTitle.color = uiTheme.titleColor; groupScrollArea = GameObject.Find("SendBirdUnity/UIPanel/GroupChannelPanel/ScrollArea"); editableScrollArea = GameObject.Find("SendBirdUnity/UIPanel/GroupChannelPanel/EditableScrollArea"); editableGridPannel = GameObject.Find("SendBirdUnity/UIPanel/GroupChannelPanel/EditableScrollArea/GridPanel"); btnGroupChannelLeave = GameObject.Find("SendBirdUnity/UIPanel/GroupChannelPanel/BtnGroupChannelLeave").GetComponent <Button>(); btnGroupChannelLeave.GetComponent <Image>().sprite = uiTheme.channelButtonOff; btnGroupChannelLeave.onClick.AddListener(() => { groupChannelPanel.SetActive(false); menuPanel.SetActive(true); foreach (UnityEngine.Object obj in btnMessage) { GameObject.Destroy(obj); } btnMessage.Clear(); string channelUrl = currentChannel.Url; GroupChannel.GetChannel(channelUrl, new GroupChannel.GroupChannelGetHandler((GroupChannel groupChannel1, SendBirdException e1) => { try { if (e1 != null) { } groupChannel1.Leave(new GroupChannel.GroupChannelLeaveHandler((SendBirdException e2) => { })); // When you delete a Group Channel you no longer use if (groupChannel1.Members.Count == 0) { groupChannel1.DeleteChannel(channelUrl, new GroupChannel.GroupChannelLeaveHandler((SendBirdException e3) => { })); } } catch (Exception z) { Debug.Log(z); } })); }); btnGroupChannelClose = GameObject.Find("SendBirdUnity/UIPanel/GroupChannelPanel/BtnGroupChannelClose").GetComponent <Button>(); btnGroupChannelClose.GetComponent <Image>().sprite = uiTheme.closeButton; btnGroupChannelClose.onClick.AddListener(() => { groupChannelPanel.SetActive(false); menuPanel.SetActive(true); // sskim add string channelUrl = currentChannel.Url; GroupChannel.GetChannel(channelUrl, new GroupChannel.GroupChannelGetHandler((GroupChannel groupChannel1, SendBirdException e1) => { try { if (e1 != null) { } groupChannelListPanel.SetActive(false); } catch (Exception z) { Debug.Log(z); } })); }); txtGroupChannelContent = GameObject.Find("SendBirdUnity/UIPanel/GroupChannelPanel/ScrollArea/TxtContent").GetComponent <Text>(); // (Text); txtGroupChannelContent.color = uiTheme.messageColor; //txtGroupChannelContent2 = GameObject.Find("SendBirdUnity/UIPanel/GroupChannelPanel/EditableScrollArea/GridPanel/PrevChatListItem/TxtContent").GetComponent<Text>(); // (Text); //txtGroupChannelContent2.color = uiTheme.messageColor; txtGroupChannelTitle = GameObject.Find("SendBirdUnity/UIPanel/GroupChannelPanel/TxtTitle").GetComponent <Text>(); txtGroupChannelTitle.color = uiTheme.titleColor; groupChannelScrollbar = GameObject.Find("SendBirdUnity/UIPanel/GroupChannelPanel/ScrollArea/Scrollbar").GetComponent <Scrollbar>(); ColorBlock cb_groupChannel = groupChannelScrollbar.colors; cb_groupChannel.normalColor = uiTheme.scrollBarColor; cb_groupChannel.pressedColor = uiTheme.scrollBarColor; cb_groupChannel.highlightedColor = uiTheme.scrollBarColor; groupChannelScrollbar.colors = cb_groupChannel; groupChannelScrollbar.onValueChanged.AddListener((float value) => { if (value <= 0) { autoScroll = true; lastTextPositionY = txtGroupChannelContent.transform.position.y; return; } if (lastTextPositionY - txtGroupChannelContent.transform.position.y >= 30) { autoScroll = false; } lastTextPositionY = txtGroupChannelContent.transform.position.y; }); inputGroupChannel = GameObject.Find("SendBirdUnity/UIPanel/GroupChannelPanel/InputGroupChannel").GetComponent <InputField>(); inputGroupChannel.GetComponent <Image>().sprite = uiTheme.inputTextBG; inputGroupChannel.onEndEdit.AddListener((string msg) => { SubmitGroupChannel(); }); GameObject.Find("SendBirdUnity/UIPanel/GroupChannelPanel/InputGroupChannel/Placeholder").GetComponent <Text>().color = uiTheme.inputTextPlaceholderColor; GameObject.Find("SendBirdUnity/UIPanel/GroupChannelPanel/InputGroupChannel/Text").GetComponent <Text>().color = uiTheme.inputTextColor; btnGroupChannelSend = GameObject.Find("SendBirdUnity/UIPanel/GroupChannelPanel/BtnGroupChannelSend").GetComponent <Button>(); btnGroupChannelSend.GetComponent <Image>().sprite = uiTheme.sendButton; btnGroupChannelSend.GetComponentInChildren <Text>().color = uiTheme.sendButtonColor; btnGroupChannelSend.onClick.AddListener(() => { SubmitGroupChannel(); }); groupChannelScrollbar2 = GameObject.Find("SendBirdUnity/UIPanel/GroupChannelPanel/EditableScrollArea/Scrollbar2").GetComponent <Scrollbar>(); cb = groupChannelScrollbar2.colors; cb.normalColor = uiTheme.scrollBarColor; cb.pressedColor = uiTheme.scrollBarColor; cb.highlightedColor = uiTheme.scrollBarColor; groupChannelScrollbar2.colors = cb; groupChannelScrollbar2.onValueChanged.AddListener((float value) => { if (btnMessage.Count > 0) { if (value <= 0) { autoScroll = true; lastTextPositionY = ((GameObject)btnMessage[btnMessage.Count - 1]).transform.position.y; return; } if (lastTextPositionY - ((GameObject)btnMessage[btnMessage.Count - 1]).transform.position.y >= 30) { autoScroll = false; } lastTextPositionY = ((GameObject)btnMessage[btnMessage.Count - 1]).transform.position.y; } }); #endregion #region UserList userListPanel = GameObject.Find("SendBirdUnity/UIPanel/UserListPanel"); userListPanel.GetComponent <Image>().sprite = uiTheme.channelListFrameBG; userListGridPanel = GameObject.Find("SendBirdUnity/UIPanel/UserListPanel/ScrollArea/GridPanel"); GameObject.Find("SendBirdUnity/UIPanel/UserListPanel/TxtTitle").GetComponent <Text>().color = uiTheme.titleColor; var userListScrollBar = GameObject.Find("SendBirdUnity/UIPanel/UserListPanel/Scrollbar").GetComponent <Scrollbar>(); cb = userListScrollBar.colors; cb.normalColor = uiTheme.scrollBarColor; cb.pressedColor = uiTheme.scrollBarColor; cb.highlightedColor = uiTheme.scrollBarColor; userListScrollBar.colors = cb; userListScrollBar.onValueChanged.AddListener((float value) => { if (value <= 0) { LoadUsers(); } }); btnUserListClose = GameObject.Find("SendBirdUnity/UIPanel/UserListPanel/BtnUserListClose").GetComponent <Button>(); btnUserListClose.GetComponent <Image>().sprite = uiTheme.closeButton; btnUserListClose.onClick.AddListener(() => { userListPanel.SetActive(false); menuPanel.SetActive(true); }); btnInvite = GameObject.Find("SendBirdUnity/UIPanel/UserListPanel/BtnInvite").GetComponent <Button>(); btnInvite.GetComponent <Image>().sprite = uiTheme.sendButton; btnInvite.onClick.AddListener(() => { if (mUserList.Count <= 0) { Debug.Log("Please select one or more."); return; } GroupChannel.CreateChannelWithUserIds(mUserList, false, (channel, e) => { if (e != null) { Debug.Log(e.Code + ": " + e.Message); return; } userListPanel.SetActive(false); editableScrollArea.SetActive(true); groupScrollArea.SetActive(false); groupChannelPanel.SetActive(true); currentChannel = channel; ResetGroupChannelContent(); txtGroupChannelTitle.text = channel.Name + ":" + GetDisplayMemberNames(channel.Members); }); }); #endregion #region GroupChannelList groupChannelListPanel = GameObject.Find("SendBirdUnity/UIPanel/GroupChannelListPanel"); groupChannelListPanel.GetComponent <Image>().sprite = uiTheme.channelListFrameBG; groupChannelListGridPanel = GameObject.Find("SendBirdUnity/UIPanel/GroupChannelListPanel/ScrollArea/GridPanel"); GameObject.Find("SendBirdUnity/UIPanel/GroupChannelListPanel/TxtTitle").GetComponent <Text>().color = uiTheme.titleColor; var groupChannelListScrollbar = GameObject.Find("SendBirdUnity/UIPanel/GroupChannelListPanel/Scrollbar").GetComponent <Scrollbar>(); cb = groupChannelListScrollbar.colors; cb.normalColor = uiTheme.scrollBarColor; cb.pressedColor = uiTheme.scrollBarColor; cb.highlightedColor = uiTheme.scrollBarColor; groupChannelListScrollbar.colors = cb; groupChannelListScrollbar.onValueChanged.AddListener((float value) => { if (value <= 0) { LoadGroupChannels(); } }); btnGroupChannelClose = GameObject.Find("SendBirdUnity/UIPanel/GroupChannelListPanel/BtnGroupChannelListClose").GetComponent <Button>(); btnGroupChannelClose.GetComponent <Image>().sprite = uiTheme.closeButton; btnGroupChannelClose.onClick.AddListener(() => { groupChannelListPanel.SetActive(false); if (!groupChannelListPanel.activeSelf) { menuPanel.SetActive(true); } }); #endregion uiPanel.SetActive(true); menuPanel.SetActive(true); openChannelListPanel.SetActive(false); openChannelPanel.SetActive(false); groupChannelPanel.SetActive(false); userListPanel.SetActive(false); groupChannelListPanel.SetActive(false); }
string MessageRichText(Message message) { return("<color=#" + SendBirdTheme.ToHex(uiTheme.senderColor) + ">" + message.GetSenderName() + ": </color>" + message.message); }
string FileMessageRichText(FileMessage message) { return("<color=#" + SendBirdTheme.ToHex(uiTheme.senderColor) + ">" + message.Sender.Nickname + ": </color>" + message.Name); }
void InitComponents() { uiPanel = GameObject.Find("SendBirdUnity/UIPanel"); (Instantiate(uiThemePrefab) as GameObject).transform.parent = uiPanel.transform; uiTheme = GameObject.FindObjectOfType(typeof(SendBirdTheme)) as SendBirdTheme; #region MenuPanel menuPanel = GameObject.Find("SendBirdUnity/UIPanel/MenuPanel"); menuPanel.GetComponent <Image> ().sprite = uiTheme.channelListFrameBG; var txtMenuTitle = GameObject.Find("SendBirdUnity/UIPanel/MenuPanel/TxtTitle").GetComponent <Text> (); txtMenuTitle.color = uiTheme.titleColor; btnOpenChannel = GameObject.Find("SendBirdUnity/UIPanel/MenuPanel/BtnOpenChannel").GetComponent <Button> (); btnOpenChannel.GetComponent <Image> ().sprite = uiTheme.sendButton; btnOpenChannel.GetComponent <Image> ().type = Image.Type.Sliced; btnOpenChannel.onClick.AddListener(() => { mEventProcessor.QueueEvent(new Action(() => { menuPanel.SetActive(false); openChatPanel.SetActive(true); ResetOpenChatContent(); InitOpenChat(); SendBirdSDK.Join("jia_test.lobby"); SendBirdSDK.Connect(GetMaxMessageTimestamp()); SelectTab(TAB_MODE.CHANNEL); })); }); btnStartMessaging = GameObject.Find("SendBirdUnity/UIPanel/MenuPanel/BtnStartMessaging").GetComponent <Button> (); btnStartMessaging.GetComponent <Image> ().sprite = uiTheme.sendButton; btnStartMessaging.GetComponent <Image> ().type = Image.Type.Sliced; btnStartMessaging.onClick.AddListener(() => { mEventProcessor.QueueEvent(new Action(() => { menuPanel.SetActive(false); userListPanel.SetActive(true); OpenUserList(); })); }); btnJoinMessaging = GameObject.Find("SendBirdUnity/UIPanel/MenuPanel/BtnJoinMessaging").GetComponent <Button> (); btnJoinMessaging.GetComponent <Image> ().sprite = uiTheme.sendButton; btnJoinMessaging.GetComponent <Image> ().type = Image.Type.Sliced; btnJoinMessaging.onClick.AddListener(() => { mEventProcessor.QueueEvent(new Action(() => { menuPanel.SetActive(false); messagingChannelListPanel.SetActive(true); OpenMessagingList(); })); }); inputUserName = GameObject.Find("SendBirdUnity/UIPanel/MenuPanel/InputUserName").GetComponent <InputField> (); inputUserName.GetComponent <Image> ().sprite = uiTheme.inputTextBG; #endregion #region OpenChannel openChatPanel = GameObject.Find("SendBirdUnity/UIPanel/OpenChatPanel"); openChatPanel.GetComponent <Image> ().sprite = uiTheme.chatFrameBG; txtOpenChatContent = GameObject.Find("SendBirdUnity/UIPanel/OpenChatPanel/ScrollArea/TxtContent").GetComponent <Text>(); // (Text); txtOpenChatContent.color = uiTheme.messageColor; txtOpenChatTitle = GameObject.Find("SendBirdUnity/UIPanel/OpenChatPanel/TxtTitle").GetComponent <Text> (); txtOpenChatTitle.color = uiTheme.titleColor; openChatScrollbar = GameObject.Find("SendBirdUnity/UIPanel/OpenChatPanel/Scrollbar").GetComponent <Scrollbar>(); ColorBlock cb = openChatScrollbar.colors; cb.normalColor = uiTheme.scrollBarColor; cb.pressedColor = uiTheme.scrollBarColor; cb.highlightedColor = uiTheme.scrollBarColor; openChatScrollbar.colors = cb; openChatScrollbar.onValueChanged.AddListener((float value) => { if (value <= 0) { autoScroll = true; lastTextPositionY = txtOpenChatContent.transform.position.y; return; } if (lastTextPositionY - txtOpenChatContent.transform.position.y >= 100) { autoScroll = false; } lastTextPositionY = txtOpenChatContent.transform.position.y; }); inputOpenChat = GameObject.Find("SendBirdUnity/UIPanel/OpenChatPanel/InputOpenChat").GetComponent <InputField> (); inputOpenChat.GetComponent <Image> ().sprite = uiTheme.inputTextBG; inputOpenChat.onEndEdit.AddListener((string msg) => { SubmitOpenChat(); }); GameObject.Find("SendBirdUnity/UIPanel/OpenChatPanel/InputOpenChat/Placeholder").GetComponent <Text> ().color = uiTheme.inputTextPlaceholderColor; GameObject.Find("SendBirdUnity/UIPanel/OpenChatPanel/InputOpenChat/Text").GetComponent <Text> ().color = uiTheme.inputTextColor; btnOpenChatSend = GameObject.Find("SendBirdUnity/UIPanel/OpenChatPanel/BtnOpenChatSend").GetComponent <Button> (); btnOpenChatSend.GetComponent <Image> ().sprite = uiTheme.sendButton; btnOpenChatSend.GetComponentInChildren <Text> ().color = uiTheme.sendButtonColor; btnOpenChatSend.onClick.AddListener(() => { SubmitOpenChat(); }); btnClan = GameObject.Find("SendBirdUnity/UIPanel/OpenChatPanel/BtnClan").GetComponent <Button> (); btnClan.GetComponent <Image> ().sprite = uiTheme.chatChannelButtonOff; btnClan.onClick.AddListener(() => { ResetOpenChatContent(); SendBirdSDK.Join("jia_test.clan"); SendBirdSDK.Connect(GetMaxMessageTimestamp()); SelectTab(TAB_MODE.CLAN); }); btnOpenChatClose = GameObject.Find("SendBirdUnity/UIPanel/OpenChatPanel/BtnOpenChatClose").GetComponent <Button> (); btnOpenChatClose.GetComponent <Image> ().sprite = uiTheme.closeButton; btnOpenChatClose.onClick.AddListener(() => { Disconnect(); mEventProcessor.QueueEvent(new Action(() => { openChatPanel.SetActive(false); menuPanel.SetActive(true); })); }); btnChannel = GameObject.Find("SendBirdUnity/UIPanel/OpenChatPanel/BtnChannel").GetComponent <Button> (); btnChannel.GetComponent <Image> ().sprite = uiTheme.chatChannelButtonOff; btnChannel.onClick.AddListener(() => { OpenChannelList(); }); #endregion #region ChannelList channelPanel = GameObject.Find("SendBirdUnity/UIPanel/ChannelPanel"); channelPanel.GetComponent <Image> ().sprite = uiTheme.channelListFrameBG; channelGridPannel = GameObject.Find("SendBirdUnity/UIPanel/ChannelPanel/ScrollArea/GridPanel"); GameObject.Find("SendBirdUnity/UIPanel/ChannelPanel/TxtTitle").GetComponent <Text> ().color = uiTheme.titleColor; var channelScrollbar = GameObject.Find("SendBirdUnity/UIPanel/ChannelPanel/Scrollbar").GetComponent <Scrollbar>(); cb = channelScrollbar.colors; cb.normalColor = uiTheme.scrollBarColor; cb.pressedColor = uiTheme.scrollBarColor; cb.highlightedColor = uiTheme.scrollBarColor; channelScrollbar.colors = cb; btnChannelClose = GameObject.Find("SendBirdUnity/UIPanel/ChannelPanel/BtnChannelClose").GetComponent <Button> (); btnChannelClose.GetComponent <Image> ().sprite = uiTheme.closeButton; btnChannelClose.onClick.AddListener(() => { mEventProcessor.QueueEvent(new Action(() => { channelPanel.SetActive(false); })); }); #endregion #region Messaging messagingPanel = GameObject.Find("SendBirdUnity/UIPanel/MessagingPanel"); messagingPanel.GetComponent <Image> ().sprite = uiTheme.chatFrameBG; txtMessagingTitle = GameObject.Find("SendBirdUnity/UIPanel/MessagingPanel/TxtTitle").GetComponent <Text> (); txtMessagingTitle.color = uiTheme.titleColor; btnMessagingClose = GameObject.Find("SendBirdUnity/UIPanel/MessagingPanel/BtnMessagingClose").GetComponent <Button> (); btnMessagingClose.GetComponent <Image> ().sprite = uiTheme.closeButton; btnMessagingClose.onClick.AddListener(() => { mEventProcessor.QueueEvent(new Action(() => { messagingPanel.SetActive(false); menuPanel.SetActive(true); })); }); txtMessagingContent = GameObject.Find("SendBirdUnity/UIPanel/MessagingPanel/ScrollArea/TxtContent").GetComponent <Text>(); // (Text); txtMessagingContent.color = uiTheme.messageColor; txtMessagingTitle = GameObject.Find("SendBirdUnity/UIPanel/MessagingPanel/TxtTitle").GetComponent <Text> (); txtMessagingTitle.color = uiTheme.titleColor; messagingScrollbar = GameObject.Find("SendBirdUnity/UIPanel/MessagingPanel/Scrollbar").GetComponent <Scrollbar>(); ColorBlock cb_messaging = messagingScrollbar.colors; cb_messaging.normalColor = uiTheme.scrollBarColor; cb_messaging.pressedColor = uiTheme.scrollBarColor; cb_messaging.highlightedColor = uiTheme.scrollBarColor; messagingScrollbar.colors = cb_messaging; messagingScrollbar.onValueChanged.AddListener((float value) => { if (value <= 0) { autoScroll = true; lastTextPositionY = txtMessagingContent.transform.position.y; return; } if (lastTextPositionY - txtMessagingContent.transform.position.y >= 100) { autoScroll = false; } lastTextPositionY = txtMessagingContent.transform.position.y; }); inputMessaging = GameObject.Find("SendBirdUnity/UIPanel/MessagingPanel/InputMessaging").GetComponent <InputField> (); inputMessaging.GetComponent <Image> ().sprite = uiTheme.inputTextBG; inputMessaging.onEndEdit.AddListener((string msg) => { SubmitMessaging(); }); GameObject.Find("SendBirdUnity/UIPanel/MessagingPanel/InputMessaging/Placeholder").GetComponent <Text> ().color = uiTheme.inputTextPlaceholderColor; GameObject.Find("SendBirdUnity/UIPanel/MessagingPanel/InputMessaging/Text").GetComponent <Text> ().color = uiTheme.inputTextColor; btnMessagingSend = GameObject.Find("SendBirdUnity/UIPanel/MessagingPanel/BtnMessagingSend").GetComponent <Button> (); btnMessagingSend.GetComponent <Image> ().sprite = uiTheme.sendButton; btnMessagingSend.GetComponentInChildren <Text> ().color = uiTheme.sendButtonColor; btnMessagingSend.onClick.AddListener(() => { SubmitMessaging(); }); btnMessagingList = GameObject.Find("SendBirdUnity/UIPanel/MessagingPanel/BtnMessagingList").GetComponent <Button> (); btnMessagingList.GetComponent <Image> ().sprite = uiTheme.chatChannelButtonOff; btnMessagingList.GetComponent <Image> ().type = Image.Type.Sliced; btnMessagingList.GetComponentInChildren <Text>().color = uiTheme.chatChannelButtonOffColor; btnMessagingList.onClick.AddListener(() => { OpenMessagingList(); }); #endregion #region UserList userListPanel = GameObject.Find("SendBirdUnity/UIPanel/UserListPanel"); userListPanel.GetComponent <Image> ().sprite = uiTheme.channelListFrameBG; userListGridPanel = GameObject.Find("SendBirdUnity/UIPanel/UserListPanel/ScrollArea/GridPanel"); GameObject.Find("SendBirdUnity/UIPanel/UserListPanel/TxtTitle").GetComponent <Text> ().color = uiTheme.titleColor; var userListScrollBar = GameObject.Find("SendBirdUnity/UIPanel/UserListPanel/Scrollbar").GetComponent <Scrollbar>(); cb = userListScrollBar.colors; cb.normalColor = uiTheme.scrollBarColor; cb.pressedColor = uiTheme.scrollBarColor; cb.highlightedColor = uiTheme.scrollBarColor; userListScrollBar.colors = cb; userListScrollBar.onValueChanged.AddListener((float value) => { if (value <= 0) { LoadMoreUsers(); } }); btnUserListClose = GameObject.Find("SendBirdUnity/UIPanel/UserListPanel/BtnUserListClose").GetComponent <Button> (); btnUserListClose.GetComponent <Image> ().sprite = uiTheme.closeButton; btnUserListClose.onClick.AddListener(() => { mEventProcessor.QueueEvent(new Action(() => { userListPanel.SetActive(false); menuPanel.SetActive(true); })); }); btnInvite = GameObject.Find("SendBirdUnity/UIPanel/UserListPanel/BtnInvite").GetComponent <Button> (); btnInvite.GetComponent <Image> ().sprite = uiTheme.sendButton; btnInvite.onClick.AddListener(() => { mEventProcessor.QueueEvent(new Action(() => { userListPanel.SetActive(false); messagingPanel.SetActive(true); })); InviteMessaging(mUserList); }); #endregion #region MessagingList messagingChannelListPanel = GameObject.Find("SendBirdUnity/UIPanel/MessagingChannelListPanel"); messagingChannelListPanel.GetComponent <Image> ().sprite = uiTheme.channelListFrameBG; messagingChannelListGridPanel = GameObject.Find("SendBirdUnity/UIPanel/MessagingChannelListPanel/ScrollArea/GridPanel"); GameObject.Find("SendBirdUnity/UIPanel/MessagingChannelListPanel/TxtTitle").GetComponent <Text> ().color = uiTheme.titleColor; var messagingChannelListScrollbar = GameObject.Find("SendBirdUnity/UIPanel/MessagingChannelListPanel/Scrollbar").GetComponent <Scrollbar>(); cb = messagingChannelListScrollbar.colors; cb.normalColor = uiTheme.scrollBarColor; cb.pressedColor = uiTheme.scrollBarColor; cb.highlightedColor = uiTheme.scrollBarColor; messagingChannelListScrollbar.colors = cb; messagingChannelListScrollbar.onValueChanged.AddListener((float value) => { if (value <= 0) { } }); btnMessagingClose = GameObject.Find("SendBirdUnity/UIPanel/MessagingChannelListPanel/BtnMessagingChannelListClose").GetComponent <Button> (); btnMessagingClose.GetComponent <Image> ().sprite = uiTheme.closeButton; btnMessagingClose.onClick.AddListener(() => { mEventProcessor.QueueEvent(new Action(() => { messagingChannelListPanel.SetActive(false); if (!messagingPanel.activeSelf) { menuPanel.SetActive(true); } })); }); #endregion uiPanel.SetActive(true); menuPanel.SetActive(true); openChatPanel.SetActive(false); channelPanel.SetActive(false); messagingPanel.SetActive(false); userListPanel.SetActive(false); messagingChannelListPanel.SetActive(false); }
void InitComponents () { uiPanel = GameObject.Find ("SendBirdUI/UIPanel"); (Instantiate (uiThemePrefab) as GameObject).transform.parent = uiPanel.transform; uiTheme = GameObject.FindObjectOfType (typeof(SendBirdTheme)) as SendBirdTheme; mainPanel = GameObject.Find ("SendBirdUI/UIPanel/MainPanel"); mainPanel.GetComponent<Image> ().sprite = uiTheme.chatFrameBG; channelPanel = GameObject.Find ("SendBirdUI/UIPanel/ChannelPanel"); channelPanel.GetComponent<Image> ().sprite = uiTheme.channelListFrameBG; gridPannel = GameObject.Find ("SendBirdUI/UIPanel/ChannelPanel/ScrollArea/GridPanel"); txtContent = GameObject.Find("SendBirdUI/UIPanel/MainPanel/ScrollArea/TxtContent").GetComponent<Text>();// (Text); txtContent.color = uiTheme.messageColor; txtTitle = GameObject.Find ("SendBirdUI/UIPanel/MainPanel/TxtTitle").GetComponent<Text> (); txtTitle.color = uiTheme.titleColor; scrollbar = GameObject.Find ("SendBirdUI/UIPanel/MainPanel/Scrollbar").GetComponent<Scrollbar>(); ColorBlock cb = scrollbar.colors; cb.normalColor = uiTheme.scrollBarColor; cb.pressedColor = uiTheme.scrollBarColor; cb.highlightedColor = uiTheme.scrollBarColor; scrollbar.colors = cb; scrollbar.onValueChanged.AddListener ((float value) => { if(value <= 0) { autoScroll = true; lastTextPositionY = txtContent.transform.position.y; return; } if(lastTextPositionY - txtContent.transform.position.y >= 100) { autoScroll = false; } lastTextPositionY = txtContent.transform.position.y; }); inputMessage = GameObject.Find ("SendBirdUI/UIPanel/MainPanel/InputMessage").GetComponent<InputField> (); inputMessage.GetComponent<Image> ().sprite = uiTheme.inputTextBG; inputMessage.onEndEdit.AddListener ((string msg) => { Submit(); }); GameObject.Find ("SendBirdUI/UIPanel/MainPanel/InputMessage/Placeholder").GetComponent<Text> ().color = uiTheme.inputTextPlaceholderColor; GameObject.Find ("SendBirdUI/UIPanel/MainPanel/InputMessage/Text").GetComponent<Text> ().color = uiTheme.inputTextColor; btnSend = GameObject.Find ("SendBirdUI/UIPanel/MainPanel/BtnSend").GetComponent<Button> (); btnSend.GetComponent<Image> ().sprite = uiTheme.sendButton; btnSend.GetComponentInChildren<Text> ().color = uiTheme.sendButtonColor; btnSend.onClick.AddListener (() => { Submit(); }); btnClan = GameObject.Find ("SendBirdUI/UIPanel/MainPanel/BtnClan").GetComponent<Button> (); btnClan.GetComponent<Image> ().sprite = uiTheme.chatChannelButtonOff; btnClan.onClick.AddListener (() => { Connect ("jia_test.Clan"); SelectTab(TAB_MODE.CLAN); }); btnMainClose = GameObject.Find ("SendBirdUI/UIPanel/MainPanel/BtnClose").GetComponent<Button> (); btnMainClose.GetComponent<Image> ().sprite = uiTheme.closeButton; btnMainClose.onClick.AddListener (() => { uiPanel.SetActive(false); }); GameObject.Find ("SendBirdUI/UIPanel/ChannelPanel/TxtTitle").GetComponent<Text> ().color = uiTheme.titleColor; Scrollbar channelScrollbar = GameObject.Find ("SendBirdUI/UIPanel/ChannelPanel/Scrollbar").GetComponent<Scrollbar>(); cb = channelScrollbar.colors; cb.normalColor = uiTheme.scrollBarColor; cb.pressedColor = uiTheme.scrollBarColor; cb.highlightedColor = uiTheme.scrollBarColor; channelScrollbar.colors = cb; btnChannel = GameObject.Find ("SendBirdUI/UIPanel/MainPanel/BtnChannel").GetComponent<Button> (); btnChannel.GetComponent<Image> ().sprite = uiTheme.chatChannelButtonOff; btnChannel.onClick.AddListener (() => { OpenChannelList(); }); btnChannelClose = GameObject.Find ("SendBirdUI/UIPanel/ChannelPanel/BtnChannelClose").GetComponent<Button> (); btnChannelClose.GetComponent<Image> ().sprite = uiTheme.closeButton; btnChannelClose.onClick.AddListener (() => { channelPanel.SetActive(false); }); uiPanel.SetActive (true); mainPanel.SetActive (true); channelPanel.SetActive (false); }
void InitComponents () { uiPanel = GameObject.Find ("SendBirdUnity/UIPanel"); (Instantiate (uiThemePrefab) as GameObject).transform.parent = uiPanel.transform; uiTheme = GameObject.FindObjectOfType (typeof(SendBirdTheme)) as SendBirdTheme; #region MenuPanel menuPanel = GameObject.Find ("SendBirdUnity/UIPanel/MenuPanel"); menuPanel.GetComponent<Image> ().sprite = uiTheme.channelListFrameBG; var txtMenuTitle = GameObject.Find ("SendBirdUnity/UIPanel/MenuPanel/TxtTitle").GetComponent<Text> (); txtMenuTitle.color = uiTheme.titleColor; btnConnect = GameObject.Find ("SendBirdUnity/UIPanel/MenuPanel/BtnConnect").GetComponent<Button> (); btnConnect.GetComponent<Image> ().sprite = uiTheme.sendButton; btnConnect.GetComponent<Image> ().type = Image.Type.Sliced; btnConnect.onClick.AddListener (() => { nickname = inputUserName.text; userId = nickname; // Assign user's unique id. if (nickname == null || nickname.Length <= 0) { return; } SendBirdClient.Connect (userId, (user, e) => { if (e != null) { Debug.Log (e.Code + ": " + e.Message); return; } btnConnect.gameObject.SetActive (false); btnOpenChannelList.gameObject.SetActive (true); btnStartGroupChannel.gameObject.SetActive (true); btnGroupChannelList.gameObject.SetActive (true); SendBirdClient.UpdateCurrentUserInfo (nickname, null, (e1) => { if (e1 != null) { Debug.Log (e.Code + ": " + e.Message); return; } }); }); }); btnOpenChannelList = GameObject.Find ("SendBirdUnity/UIPanel/MenuPanel/BtnOpenChannel").GetComponent<Button> (); btnOpenChannelList.GetComponent<Image> ().sprite = uiTheme.sendButton; btnOpenChannelList.GetComponent<Image> ().type = Image.Type.Sliced; btnOpenChannelList.onClick.AddListener (() => { menuPanel.SetActive (false); OpenOpenChannelList (); }); btnStartGroupChannel = GameObject.Find ("SendBirdUnity/UIPanel/MenuPanel/BtnStartGroupChannel").GetComponent<Button> (); btnStartGroupChannel.GetComponent<Image> ().sprite = uiTheme.sendButton; btnStartGroupChannel.GetComponent<Image> ().type = Image.Type.Sliced; btnStartGroupChannel.onClick.AddListener (() => { menuPanel.SetActive (false); OpenUserList (); }); btnGroupChannelList = GameObject.Find ("SendBirdUnity/UIPanel/MenuPanel/BtnGroupChannel").GetComponent<Button> (); btnGroupChannelList.GetComponent<Image> ().sprite = uiTheme.sendButton; btnGroupChannelList.GetComponent<Image> ().type = Image.Type.Sliced; btnGroupChannelList.onClick.AddListener (() => { menuPanel.SetActive (false); OpenGroupChannelList (); }); inputUserName = GameObject.Find ("SendBirdUnity/UIPanel/MenuPanel/InputUserName").GetComponent<InputField> (); inputUserName.GetComponent<Image> ().sprite = uiTheme.inputTextBG; #endregion #region OpenChannel openChannelPanel = GameObject.Find ("SendBirdUnity/UIPanel/OpenChannelPanel"); openChannelPanel.GetComponent<Image> ().sprite = uiTheme.chatFrameBG; txtOpenChannelContent = GameObject.Find ("SendBirdUnity/UIPanel/OpenChannelPanel/ScrollArea/TxtContent").GetComponent<Text> (); // (Text); txtOpenChannelContent.color = uiTheme.messageColor; txtOpenChannelTitle = GameObject.Find ("SendBirdUnity/UIPanel/OpenChannelPanel/TxtTitle").GetComponent<Text> (); txtOpenChannelTitle.color = uiTheme.titleColor; openChannelScrollbar = GameObject.Find ("SendBirdUnity/UIPanel/OpenChannelPanel/Scrollbar").GetComponent<Scrollbar> (); ColorBlock cb = openChannelScrollbar.colors; cb.normalColor = uiTheme.scrollBarColor; cb.pressedColor = uiTheme.scrollBarColor; cb.highlightedColor = uiTheme.scrollBarColor; openChannelScrollbar.colors = cb; openChannelScrollbar.onValueChanged.AddListener ((float value) => { if (value <= 0) { autoScroll = true; lastTextPositionY = txtOpenChannelContent.transform.position.y; return; } if (lastTextPositionY - txtOpenChannelContent.transform.position.y >= 100) { autoScroll = false; } lastTextPositionY = txtOpenChannelContent.transform.position.y; }); inputOpenChannel = GameObject.Find ("SendBirdUnity/UIPanel/OpenChannelPanel/InputOpenChannel").GetComponent<InputField> (); inputOpenChannel.GetComponent<Image> ().sprite = uiTheme.inputTextBG; inputOpenChannel.onEndEdit.AddListener ((string msg) => { SubmitOpenChannel (); }); GameObject.Find ("SendBirdUnity/UIPanel/OpenChannelPanel/InputOpenChannel/Placeholder").GetComponent<Text> ().color = uiTheme.inputTextPlaceholderColor; GameObject.Find ("SendBirdUnity/UIPanel/OpenChannelPanel/InputOpenChannel/Text").GetComponent<Text> ().color = uiTheme.inputTextColor; btnOpenChannelSend = GameObject.Find ("SendBirdUnity/UIPanel/OpenChannelPanel/BtnOpenChannelSend").GetComponent<Button> (); btnOpenChannelSend.GetComponent<Image> ().sprite = uiTheme.sendButton; btnOpenChannelSend.GetComponentInChildren<Text> ().color = uiTheme.sendButtonColor; btnOpenChannelSend.onClick.AddListener (() => { SubmitOpenChannel (); }); btnOpenChannelClose = GameObject.Find ("SendBirdUnity/UIPanel/OpenChannelPanel/BtnOpenChannelClose").GetComponent<Button> (); btnOpenChannelClose.GetComponent<Image> ().sprite = uiTheme.closeButton; btnOpenChannelClose.onClick.AddListener (() => { openChannelPanel.SetActive (false); menuPanel.SetActive (true); }); #endregion #region ChannelList openChannelListPanel = GameObject.Find ("SendBirdUnity/UIPanel/OpenChannelListPanel"); openChannelListPanel.GetComponent<Image> ().sprite = uiTheme.channelListFrameBG; channelGridPannel = GameObject.Find ("SendBirdUnity/UIPanel/OpenChannelListPanel/ScrollArea/GridPanel"); GameObject.Find ("SendBirdUnity/UIPanel/OpenChannelListPanel/TxtTitle").GetComponent<Text> ().color = uiTheme.titleColor; var channelScrollbar = GameObject.Find ("SendBirdUnity/UIPanel/OpenChannelListPanel/Scrollbar").GetComponent<Scrollbar> (); cb = channelScrollbar.colors; cb.normalColor = uiTheme.scrollBarColor; cb.pressedColor = uiTheme.scrollBarColor; cb.highlightedColor = uiTheme.scrollBarColor; channelScrollbar.colors = cb; channelScrollbar.onValueChanged.AddListener ((float value) => { if (value <= 0) { LoadOpenChannels (); } }); btnOpenChannelListClose = GameObject.Find ("SendBirdUnity/UIPanel/OpenChannelListPanel/BtnOpenChannelListClose").GetComponent<Button> (); btnOpenChannelListClose.GetComponent<Image> ().sprite = uiTheme.closeButton; btnOpenChannelListClose.onClick.AddListener (() => { openChannelListPanel.SetActive (false); menuPanel.SetActive(true); }); #endregion #region GroupChannel groupChannelPanel = GameObject.Find ("SendBirdUnity/UIPanel/GroupChannelPanel"); groupChannelPanel.GetComponent<Image> ().sprite = uiTheme.chatFrameBG; txtGroupChannelTitle = GameObject.Find ("SendBirdUnity/UIPanel/GroupChannelPanel/TxtTitle").GetComponent<Text> (); txtGroupChannelTitle.color = uiTheme.titleColor; btnGroupChannelClose = GameObject.Find ("SendBirdUnity/UIPanel/GroupChannelPanel/BtnGroupChannelClose").GetComponent<Button> (); btnGroupChannelClose.GetComponent<Image> ().sprite = uiTheme.closeButton; btnGroupChannelClose.onClick.AddListener (() => { groupChannelPanel.SetActive (false); menuPanel.SetActive (true); }); txtGroupChannelContent = GameObject.Find ("SendBirdUnity/UIPanel/GroupChannelPanel/ScrollArea/TxtContent").GetComponent<Text> (); // (Text); txtGroupChannelContent.color = uiTheme.messageColor; txtGroupChannelTitle = GameObject.Find ("SendBirdUnity/UIPanel/GroupChannelPanel/TxtTitle").GetComponent<Text> (); txtGroupChannelTitle.color = uiTheme.titleColor; groupChannelScrollbar = GameObject.Find ("SendBirdUnity/UIPanel/GroupChannelPanel/Scrollbar").GetComponent<Scrollbar> (); ColorBlock cb_groupChannel = groupChannelScrollbar.colors; cb_groupChannel.normalColor = uiTheme.scrollBarColor; cb_groupChannel.pressedColor = uiTheme.scrollBarColor; cb_groupChannel.highlightedColor = uiTheme.scrollBarColor; groupChannelScrollbar.colors = cb_groupChannel; groupChannelScrollbar.onValueChanged.AddListener ((float value) => { if (value <= 0) { autoScroll = true; lastTextPositionY = txtGroupChannelContent.transform.position.y; return; } if (lastTextPositionY - txtGroupChannelContent.transform.position.y >= 100) { autoScroll = false; } lastTextPositionY = txtGroupChannelContent.transform.position.y; }); inputGroupChannel = GameObject.Find ("SendBirdUnity/UIPanel/GroupChannelPanel/InputGroupChannel").GetComponent<InputField> (); inputGroupChannel.GetComponent<Image> ().sprite = uiTheme.inputTextBG; inputGroupChannel.onEndEdit.AddListener ((string msg) => { SubmitGroupChannel (); }); GameObject.Find ("SendBirdUnity/UIPanel/GroupChannelPanel/InputGroupChannel/Placeholder").GetComponent<Text> ().color = uiTheme.inputTextPlaceholderColor; GameObject.Find ("SendBirdUnity/UIPanel/GroupChannelPanel/InputGroupChannel/Text").GetComponent<Text> ().color = uiTheme.inputTextColor; btnGroupChannelSend = GameObject.Find ("SendBirdUnity/UIPanel/GroupChannelPanel/BtnGroupChannelSend").GetComponent<Button> (); btnGroupChannelSend.GetComponent<Image> ().sprite = uiTheme.sendButton; btnGroupChannelSend.GetComponentInChildren<Text> ().color = uiTheme.sendButtonColor; btnGroupChannelSend.onClick.AddListener (() => { SubmitGroupChannel (); }); #endregion #region UserList userListPanel = GameObject.Find ("SendBirdUnity/UIPanel/UserListPanel"); userListPanel.GetComponent<Image> ().sprite = uiTheme.channelListFrameBG; userListGridPanel = GameObject.Find ("SendBirdUnity/UIPanel/UserListPanel/ScrollArea/GridPanel"); GameObject.Find ("SendBirdUnity/UIPanel/UserListPanel/TxtTitle").GetComponent<Text> ().color = uiTheme.titleColor; var userListScrollBar = GameObject.Find ("SendBirdUnity/UIPanel/UserListPanel/Scrollbar").GetComponent<Scrollbar> (); cb = userListScrollBar.colors; cb.normalColor = uiTheme.scrollBarColor; cb.pressedColor = uiTheme.scrollBarColor; cb.highlightedColor = uiTheme.scrollBarColor; userListScrollBar.colors = cb; userListScrollBar.onValueChanged.AddListener ((float value) => { if (value <= 0) { LoadUsers (); } }); btnUserListClose = GameObject.Find ("SendBirdUnity/UIPanel/UserListPanel/BtnUserListClose").GetComponent<Button> (); btnUserListClose.GetComponent<Image> ().sprite = uiTheme.closeButton; btnUserListClose.onClick.AddListener (() => { userListPanel.SetActive (false); menuPanel.SetActive (true); }); btnInvite = GameObject.Find ("SendBirdUnity/UIPanel/UserListPanel/BtnInvite").GetComponent<Button> (); btnInvite.GetComponent<Image> ().sprite = uiTheme.sendButton; btnInvite.onClick.AddListener (() => { if(mUserList.Count <= 0) { return; } userListPanel.SetActive (false); groupChannelPanel.SetActive (true); GroupChannel.CreateChannelWithUserIds(mUserList, false, (channel, e) => { if(e != null) { Debug.Log(e.Code + ": " + e.Message); return; } currentChannel = channel; ResetGroupChannelContent(); txtGroupChannelTitle.text = GetDisplayMemberNames(channel.Members); }); }); #endregion #region GroupChannelList groupChannelListPanel = GameObject.Find ("SendBirdUnity/UIPanel/GroupChannelListPanel"); groupChannelListPanel.GetComponent<Image> ().sprite = uiTheme.channelListFrameBG; groupChannelListGridPanel = GameObject.Find ("SendBirdUnity/UIPanel/GroupChannelListPanel/ScrollArea/GridPanel"); GameObject.Find ("SendBirdUnity/UIPanel/GroupChannelListPanel/TxtTitle").GetComponent<Text> ().color = uiTheme.titleColor; var groupChannelListScrollbar = GameObject.Find ("SendBirdUnity/UIPanel/GroupChannelListPanel/Scrollbar").GetComponent<Scrollbar> (); cb = groupChannelListScrollbar.colors; cb.normalColor = uiTheme.scrollBarColor; cb.pressedColor = uiTheme.scrollBarColor; cb.highlightedColor = uiTheme.scrollBarColor; groupChannelListScrollbar.colors = cb; groupChannelListScrollbar.onValueChanged.AddListener ((float value) => { if (value <= 0) { LoadGroupChannels(); } }); btnGroupChannelClose = GameObject.Find ("SendBirdUnity/UIPanel/GroupChannelListPanel/BtnGroupChannelListClose").GetComponent<Button> (); btnGroupChannelClose.GetComponent<Image> ().sprite = uiTheme.closeButton; btnGroupChannelClose.onClick.AddListener (() => { groupChannelListPanel.SetActive (false); if (!groupChannelListPanel.activeSelf) { menuPanel.SetActive (true); } }); #endregion uiPanel.SetActive (true); menuPanel.SetActive (true); openChannelListPanel.SetActive (false); openChannelPanel.SetActive (false); groupChannelPanel.SetActive (false); userListPanel.SetActive (false); groupChannelListPanel.SetActive (false); }
void InitComponents() { uiPanel = GameObject.Find("SendBirdUnity/UIPanel"); (Instantiate(uiThemePrefab) as GameObject).transform.parent = uiPanel.transform; uiTheme = GameObject.FindObjectOfType(typeof(SendBirdTheme)) as SendBirdTheme; #region MenuPanel menuPanel = GameObject.Find("SendBirdUnity/UIPanel/MenuPanel"); menuPanel.GetComponent <Image> ().sprite = uiTheme.channelListFrameBG; var txtMenuTitle = GameObject.Find("SendBirdUnity/UIPanel/MenuPanel/TxtTitle").GetComponent <Text> (); txtMenuTitle.color = uiTheme.titleColor; btnConnect = GameObject.Find("SendBirdUnity/UIPanel/MenuPanel/BtnConnect").GetComponent <Button> (); btnConnect.GetComponent <Image> ().sprite = uiTheme.sendButton; btnConnect.GetComponent <Image> ().type = Image.Type.Sliced; btnConnect.onClick.AddListener(() => { nickname = inputUserName.text; userId = nickname; // Assign user's unique id. if (nickname == null || nickname.Length <= 0) { return; } SendBirdClient.Connect(userId, (user, e) => { if (e != null) { Debug.Log(e.Code + ": " + e.Message); return; } btnConnect.gameObject.SetActive(false); btnOpenChannelList.gameObject.SetActive(true); btnStartGroupChannel.gameObject.SetActive(true); btnGroupChannelList.gameObject.SetActive(true); SendBirdClient.UpdateCurrentUserInfo(nickname, null, (e1) => { if (e1 != null) { Debug.Log(e.Code + ": " + e.Message); return; } }); }); }); btnOpenChannelList = GameObject.Find("SendBirdUnity/UIPanel/MenuPanel/BtnOpenChannel").GetComponent <Button> (); btnOpenChannelList.GetComponent <Image> ().sprite = uiTheme.sendButton; btnOpenChannelList.GetComponent <Image> ().type = Image.Type.Sliced; btnOpenChannelList.onClick.AddListener(() => { menuPanel.SetActive(false); OpenOpenChannelList(); }); btnStartGroupChannel = GameObject.Find("SendBirdUnity/UIPanel/MenuPanel/BtnStartGroupChannel").GetComponent <Button> (); btnStartGroupChannel.GetComponent <Image> ().sprite = uiTheme.sendButton; btnStartGroupChannel.GetComponent <Image> ().type = Image.Type.Sliced; btnStartGroupChannel.onClick.AddListener(() => { menuPanel.SetActive(false); OpenUserList(); }); btnGroupChannelList = GameObject.Find("SendBirdUnity/UIPanel/MenuPanel/BtnGroupChannel").GetComponent <Button> (); btnGroupChannelList.GetComponent <Image> ().sprite = uiTheme.sendButton; btnGroupChannelList.GetComponent <Image> ().type = Image.Type.Sliced; btnGroupChannelList.onClick.AddListener(() => { menuPanel.SetActive(false); OpenGroupChannelList(); }); inputUserName = GameObject.Find("SendBirdUnity/UIPanel/MenuPanel/InputUserName").GetComponent <InputField> (); inputUserName.GetComponent <Image> ().sprite = uiTheme.inputTextBG; #endregion #region OpenChannel openChannelPanel = GameObject.Find("SendBirdUnity/UIPanel/OpenChannelPanel"); openChannelPanel.GetComponent <Image> ().sprite = uiTheme.chatFrameBG; txtOpenChannelContent = GameObject.Find("SendBirdUnity/UIPanel/OpenChannelPanel/ScrollArea/TxtContent").GetComponent <Text> (); // (Text); txtOpenChannelContent.color = uiTheme.messageColor; txtOpenChannelTitle = GameObject.Find("SendBirdUnity/UIPanel/OpenChannelPanel/TxtTitle").GetComponent <Text> (); txtOpenChannelTitle.color = uiTheme.titleColor; openChannelScrollbar = GameObject.Find("SendBirdUnity/UIPanel/OpenChannelPanel/Scrollbar").GetComponent <Scrollbar> (); ColorBlock cb = openChannelScrollbar.colors; cb.normalColor = uiTheme.scrollBarColor; cb.pressedColor = uiTheme.scrollBarColor; cb.highlightedColor = uiTheme.scrollBarColor; openChannelScrollbar.colors = cb; openChannelScrollbar.onValueChanged.AddListener((float value) => { if (value <= 0) { autoScroll = true; lastTextPositionY = txtOpenChannelContent.transform.position.y; return; } if (lastTextPositionY - txtOpenChannelContent.transform.position.y >= 100) { autoScroll = false; } lastTextPositionY = txtOpenChannelContent.transform.position.y; }); inputOpenChannel = GameObject.Find("SendBirdUnity/UIPanel/OpenChannelPanel/InputOpenChannel").GetComponent <InputField> (); inputOpenChannel.GetComponent <Image> ().sprite = uiTheme.inputTextBG; inputOpenChannel.onEndEdit.AddListener((string msg) => { SubmitOpenChannel(); }); GameObject.Find("SendBirdUnity/UIPanel/OpenChannelPanel/InputOpenChannel/Placeholder").GetComponent <Text> ().color = uiTheme.inputTextPlaceholderColor; GameObject.Find("SendBirdUnity/UIPanel/OpenChannelPanel/InputOpenChannel/Text").GetComponent <Text> ().color = uiTheme.inputTextColor; btnOpenChannelSend = GameObject.Find("SendBirdUnity/UIPanel/OpenChannelPanel/BtnOpenChannelSend").GetComponent <Button> (); btnOpenChannelSend.GetComponent <Image> ().sprite = uiTheme.sendButton; btnOpenChannelSend.GetComponentInChildren <Text> ().color = uiTheme.sendButtonColor; btnOpenChannelSend.onClick.AddListener(() => { SubmitOpenChannel(); }); btnOpenChannelClose = GameObject.Find("SendBirdUnity/UIPanel/OpenChannelPanel/BtnOpenChannelClose").GetComponent <Button> (); btnOpenChannelClose.GetComponent <Image> ().sprite = uiTheme.closeButton; btnOpenChannelClose.onClick.AddListener(() => { openChannelPanel.SetActive(false); menuPanel.SetActive(true); }); #endregion #region ChannelList openChannelListPanel = GameObject.Find("SendBirdUnity/UIPanel/OpenChannelListPanel"); openChannelListPanel.GetComponent <Image> ().sprite = uiTheme.channelListFrameBG; channelGridPannel = GameObject.Find("SendBirdUnity/UIPanel/OpenChannelListPanel/ScrollArea/GridPanel"); GameObject.Find("SendBirdUnity/UIPanel/OpenChannelListPanel/TxtTitle").GetComponent <Text> ().color = uiTheme.titleColor; var channelScrollbar = GameObject.Find("SendBirdUnity/UIPanel/OpenChannelListPanel/Scrollbar").GetComponent <Scrollbar> (); cb = channelScrollbar.colors; cb.normalColor = uiTheme.scrollBarColor; cb.pressedColor = uiTheme.scrollBarColor; cb.highlightedColor = uiTheme.scrollBarColor; channelScrollbar.colors = cb; channelScrollbar.onValueChanged.AddListener((float value) => { if (value <= 0) { LoadOpenChannels(); } }); btnOpenChannelListClose = GameObject.Find("SendBirdUnity/UIPanel/OpenChannelListPanel/BtnOpenChannelListClose").GetComponent <Button> (); btnOpenChannelListClose.GetComponent <Image> ().sprite = uiTheme.closeButton; btnOpenChannelListClose.onClick.AddListener(() => { openChannelListPanel.SetActive(false); menuPanel.SetActive(true); }); #endregion #region GroupChannel groupChannelPanel = GameObject.Find("SendBirdUnity/UIPanel/GroupChannelPanel"); groupChannelPanel.GetComponent <Image> ().sprite = uiTheme.chatFrameBG; txtGroupChannelTitle = GameObject.Find("SendBirdUnity/UIPanel/GroupChannelPanel/TxtTitle").GetComponent <Text> (); txtGroupChannelTitle.color = uiTheme.titleColor; btnGroupChannelClose = GameObject.Find("SendBirdUnity/UIPanel/GroupChannelPanel/BtnGroupChannelClose").GetComponent <Button> (); btnGroupChannelClose.GetComponent <Image> ().sprite = uiTheme.closeButton; btnGroupChannelClose.onClick.AddListener(() => { groupChannelPanel.SetActive(false); menuPanel.SetActive(true); }); txtGroupChannelContent = GameObject.Find("SendBirdUnity/UIPanel/GroupChannelPanel/ScrollArea/TxtContent").GetComponent <Text> (); // (Text); txtGroupChannelContent.color = uiTheme.messageColor; txtGroupChannelTitle = GameObject.Find("SendBirdUnity/UIPanel/GroupChannelPanel/TxtTitle").GetComponent <Text> (); txtGroupChannelTitle.color = uiTheme.titleColor; groupChannelScrollbar = GameObject.Find("SendBirdUnity/UIPanel/GroupChannelPanel/Scrollbar").GetComponent <Scrollbar> (); ColorBlock cb_groupChannel = groupChannelScrollbar.colors; cb_groupChannel.normalColor = uiTheme.scrollBarColor; cb_groupChannel.pressedColor = uiTheme.scrollBarColor; cb_groupChannel.highlightedColor = uiTheme.scrollBarColor; groupChannelScrollbar.colors = cb_groupChannel; groupChannelScrollbar.onValueChanged.AddListener((float value) => { if (value <= 0) { autoScroll = true; lastTextPositionY = txtGroupChannelContent.transform.position.y; return; } if (lastTextPositionY - txtGroupChannelContent.transform.position.y >= 100) { autoScroll = false; } lastTextPositionY = txtGroupChannelContent.transform.position.y; }); inputGroupChannel = GameObject.Find("SendBirdUnity/UIPanel/GroupChannelPanel/InputGroupChannel").GetComponent <InputField> (); inputGroupChannel.GetComponent <Image> ().sprite = uiTheme.inputTextBG; inputGroupChannel.onEndEdit.AddListener((string msg) => { SubmitGroupChannel(); }); GameObject.Find("SendBirdUnity/UIPanel/GroupChannelPanel/InputGroupChannel/Placeholder").GetComponent <Text> ().color = uiTheme.inputTextPlaceholderColor; GameObject.Find("SendBirdUnity/UIPanel/GroupChannelPanel/InputGroupChannel/Text").GetComponent <Text> ().color = uiTheme.inputTextColor; btnGroupChannelSend = GameObject.Find("SendBirdUnity/UIPanel/GroupChannelPanel/BtnGroupChannelSend").GetComponent <Button> (); btnGroupChannelSend.GetComponent <Image> ().sprite = uiTheme.sendButton; btnGroupChannelSend.GetComponentInChildren <Text> ().color = uiTheme.sendButtonColor; btnGroupChannelSend.onClick.AddListener(() => { SubmitGroupChannel(); }); #endregion #region UserList userListPanel = GameObject.Find("SendBirdUnity/UIPanel/UserListPanel"); userListPanel.GetComponent <Image> ().sprite = uiTheme.channelListFrameBG; userListGridPanel = GameObject.Find("SendBirdUnity/UIPanel/UserListPanel/ScrollArea/GridPanel"); GameObject.Find("SendBirdUnity/UIPanel/UserListPanel/TxtTitle").GetComponent <Text> ().color = uiTheme.titleColor; var userListScrollBar = GameObject.Find("SendBirdUnity/UIPanel/UserListPanel/Scrollbar").GetComponent <Scrollbar> (); cb = userListScrollBar.colors; cb.normalColor = uiTheme.scrollBarColor; cb.pressedColor = uiTheme.scrollBarColor; cb.highlightedColor = uiTheme.scrollBarColor; userListScrollBar.colors = cb; userListScrollBar.onValueChanged.AddListener((float value) => { if (value <= 0) { LoadUsers(); } }); btnUserListClose = GameObject.Find("SendBirdUnity/UIPanel/UserListPanel/BtnUserListClose").GetComponent <Button> (); btnUserListClose.GetComponent <Image> ().sprite = uiTheme.closeButton; btnUserListClose.onClick.AddListener(() => { userListPanel.SetActive(false); menuPanel.SetActive(true); }); btnInvite = GameObject.Find("SendBirdUnity/UIPanel/UserListPanel/BtnInvite").GetComponent <Button> (); btnInvite.GetComponent <Image> ().sprite = uiTheme.sendButton; btnInvite.onClick.AddListener(() => { if (mUserList.Count <= 0) { return; } userListPanel.SetActive(false); groupChannelPanel.SetActive(true); GroupChannel.CreateChannelWithUserIds(mUserList, false, (channel, e) => { if (e != null) { Debug.Log(e.Code + ": " + e.Message); return; } currentChannel = channel; ResetGroupChannelContent(); txtGroupChannelTitle.text = GetDisplayMemberNames(channel.Members); }); }); #endregion #region GroupChannelList groupChannelListPanel = GameObject.Find("SendBirdUnity/UIPanel/GroupChannelListPanel"); groupChannelListPanel.GetComponent <Image> ().sprite = uiTheme.channelListFrameBG; groupChannelListGridPanel = GameObject.Find("SendBirdUnity/UIPanel/GroupChannelListPanel/ScrollArea/GridPanel"); GameObject.Find("SendBirdUnity/UIPanel/GroupChannelListPanel/TxtTitle").GetComponent <Text> ().color = uiTheme.titleColor; var groupChannelListScrollbar = GameObject.Find("SendBirdUnity/UIPanel/GroupChannelListPanel/Scrollbar").GetComponent <Scrollbar> (); cb = groupChannelListScrollbar.colors; cb.normalColor = uiTheme.scrollBarColor; cb.pressedColor = uiTheme.scrollBarColor; cb.highlightedColor = uiTheme.scrollBarColor; groupChannelListScrollbar.colors = cb; groupChannelListScrollbar.onValueChanged.AddListener((float value) => { if (value <= 0) { LoadGroupChannels(); } }); btnGroupChannelClose = GameObject.Find("SendBirdUnity/UIPanel/GroupChannelListPanel/BtnGroupChannelListClose").GetComponent <Button> (); btnGroupChannelClose.GetComponent <Image> ().sprite = uiTheme.closeButton; btnGroupChannelClose.onClick.AddListener(() => { groupChannelListPanel.SetActive(false); if (!groupChannelListPanel.activeSelf) { menuPanel.SetActive(true); } }); #endregion uiPanel.SetActive(true); menuPanel.SetActive(true); openChannelListPanel.SetActive(false); openChannelPanel.SetActive(false); groupChannelPanel.SetActive(false); userListPanel.SetActive(false); groupChannelListPanel.SetActive(false); }
string UserMessageRichText(UserMessage message) { return("<color=#" + SendBirdTheme.ToHex(uiTheme.senderColor) + ">" + message.GetSender().Nickname + ": </color>" + message.Message); }