Ejemplo n.º 1
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);
        });
    }