Exemplo n.º 1
0
        /// <summary>
        /// Setar as configurações de todos os botões do Chat.
        /// </summary>
        public void ConfigButtons()
        {
            OpenCreateChannelButton.onClick.AddListener(delegate
            {
                CreaterChannelPainelISOpen = !CreaterChannelPainelISOpen;
                CreaterChannelPainel.gameObject.SetActive(CreaterChannelPainelISOpen);
            });

            CreateChannelButton.onClick.AddListener(delegate
            {
                if (!string.IsNullOrEmpty(NewChannelName.text))
                {
                    FirebaseController.CreaterChannelDataBase(NewChannelName.text, FirebaseController.UserName);
                    NewChannelName.text = "";
                    FirebaseController.GetChannelsDatabase(Channels);

                    CreaterChannelPainelISOpen = !CreaterChannelPainelISOpen;
                    CreaterChannelPainel.gameObject.SetActive(CreaterChannelPainelISOpen);
                }
            });

            RefreshChannelButton.onClick.AddListener(delegate
            {
                FirebaseController.GetChannelsDatabase(Channels);
            });

            SendMessages.onClick.AddListener(delegate
            {
                if (!string.IsNullOrEmpty(ChatInput.text))
                {
                    FirebaseController.CreateMessage(ChannelReferenceSelected.ChanneId, FirebaseController.UserName, ChatInput.text);
                    ChatInput.text = "";
                }
            });

            ReturnChat.onClick.AddListener(delegate
            {
                foreach (var item in MessageItems)
                {
                    Destroy(item);
                }
                MessageItems.Clear();
                ChatPainel.gameObject.SetActive(false);
            });
        }
Exemplo n.º 2
0
    public void ConfigButtons()
    {
        getStartBtn.onClick.AddListener(delegate
        {
            if (!string.IsNullOrEmpty(displayInput.text))
            {
                firebaseController.AuthenticateAnonymouslyUser();
                userName.text     = displayInput.text;
                displayInput.text = "";
            }
        });

        signOutBtn.onClick.AddListener(delegate
        {
            firebaseController.SignOutAplication();
            ClosePainel(channelPainel, true);
            ClearAplication();
        });

        openCreateChannelBtn.onClick.AddListener(delegate
        {
            if (!createrChannelPainelISOpen)
            {
                createrChannelPainel.DOAnchorPos(createrChannelPainelPos, timePainel, false);
            }
            else
            {
                createrChannelPainel.DOAnchorPos(Vector2.zero, timePainel, false);
            }
            createrChannelPainelISOpen = !createrChannelPainelISOpen;
        });

        createChannelBtn.onClick.AddListener(delegate
        {
            if (!string.IsNullOrEmpty(newChannelName.text))
            {
                firebaseController.CreaterChannelDataBase(newChannelName.text, userName.text);
                newChannelName.text = "";
                firebaseController.GetChannelsDatabase(channels);
                createrChannelPainel.DOAnchorPos(Vector2.zero, timePainel, false);
                createrChannelPainelISOpen = !createrChannelPainelISOpen;
            }
        });

        refreshChannelBtn.onClick.AddListener(delegate
        {
            firebaseController.GetChannelsDatabase(channels);
        });

        sendMessage.onClick.AddListener(delegate
        {
            if (!string.IsNullOrEmpty(chatInput.text))
            {
                firebaseController.CreateMessage(channelReferenceSelected.idChannel, userName.text, chatInput.text);
                chatInput.text = "";
            }
        });

        returnChat.onClick.AddListener(delegate
        {
            foreach (var item in messageItens)
            {
                Destroy(item);
            }
            messageItens.Clear();
            ClosePainel(chatPainel, true);
        });
    }