示例#1
0
        public void OnInputNext()
        {
            switch (phase)
            {
            case MessagePhase.messageFilling:
                MessageAgregator <FillingTextDisplayMessage> .Publish();

                uiText.text = textForMessage;
                phase       = MessagePhase.messageFill;
                break;

            case MessagePhase.messageFill:
                MessageAgregator <FillTextDisplayMessage> .Publish();

                phase     = MessagePhase.boxGoingOut;
                timeCount = 0;
                break;

            case MessagePhase.boxOut:
                MessageAgregator <TextBoxGoingMessage> .Publish();

                messagePanel.anchoredPosition = originalPos;
                phase = MessagePhase.messageFilling;
                break;

            case MessagePhase.boxGoingOut:
                startMens = false;
                phase     = MessagePhase.boxExited;
                MessageAgregator <TextBoxCommingMessage> .Publish();

                messageArrayIndex++;
                break;
            }
        }
示例#2
0
        public MessagePhase ReadMessage()
        {
            timeCount += Time.deltaTime;
            if (startMens)
            {
                switch (phase)
                {
                case MessagePhase.boxOut:
                    if (Vector2.Distance(messagePanel.anchoredPosition, originalPos) > 0.1f)
                    {
                        messagePanel.anchoredPosition = Vector2.Lerp(
                            messagePanel.anchoredPosition, originalPos, Time.deltaTime * speedWindow);
                    }
                    else
                    {
                        phase     = MessagePhase.messageFilling;
                        timeCount = 0;
                    }
                    break;

                case MessagePhase.messageFilling:
                    if ((int)(timeCount * speedLetters) <= textForMessage.Length && !textForMessage.Contains("<co"))
                    {
                        uiText.text = textForMessage.Substring(0, (int)(timeCount * speedLetters));
                    }
                    else
                    {
                        phase       = MessagePhase.messageFill;
                        uiText.text = textForMessage;
                    }
                    break;

                case MessagePhase.boxGoingOut:
                    if (Mathf.Abs(messagePanel.anchoredPosition.y - Screen.height) > 0.1f)
                    {
                        messagePanel.anchoredPosition = Vector2.Lerp(messagePanel.anchoredPosition,
                                                                     new Vector2(messagePanel.anchoredPosition.x, Screen.height),
                                                                     Time.deltaTime * speedWindow);
                    }
                    else
                    {
                        startMens = false;
                        phase     = MessagePhase.boxExited;
                    }
                    break;
                }
            }
            return(phase);
        }
示例#3
0
        public void OnInputNext()
        {
            switch (phase)
            {
            case MessagePhase.messageFilling:
                UiEventAgregator.Publish(UIEventKey.mensagemEnchendo);
                //EventAgregator.Publish(new StandardSendGameEvent(GameController.g.gameObject, EventKey.disparaSom, SoundEffectID.Book1.ToString()));
                uiText.text = textForMessage;
                phase       = MessagePhase.messageFill;
                break;

            case MessagePhase.messageFill:
                UiEventAgregator.Publish(UIEventKey.mensgemCheia);
                //EventAgregator.Publish(new StandardSendGameEvent(GameController.g.gameObject, EventKey.disparaSom, SoundEffectID.Book1.ToString()));
                phase     = MessagePhase.bocGoingOut;
                timeCount = 0;
                break;

            case MessagePhase.boxOut:
                UiEventAgregator.Publish(UIEventKey.caixaDeTextoIndo);
                //EventAgregator.Publish(new StandardSendGameEvent(GameController.g.gameObject, EventKey.disparaSom, SoundEffectID.Book1.ToString()));
                messagePanel.anchoredPosition = originalPos;
                phase = MessagePhase.messageFilling;
                break;

            case MessagePhase.bocGoingOut:
                startMens = false;
                phase     = MessagePhase.boxExited;
                UiEventAgregator.Publish(UIEventKey.caixaDeTextoSaiu);
                messageArrayIndex++;
                break;

                /*
                 * EventAgregator.Publish(new StandardSendStringEvent(GameController.g.gameObject, SoundEffectID.Book1.ToString(), EventKey.disparaSom));
                 * painelDaMens.anchoredPosition = new Vector2(painelDaMens.anchoredPosition.x, Screen.height);
                 * fase = FasesDaMensagem.caixaSaiu;
                 * break;*/
            }
        }
示例#4
0
        public void StartShowMessage(string texto, Sprite sDaFoto = null)
        {
            if (!startMens)
            {
                startMens = true;
                messagePanel.gameObject.SetActive(true);
                messagePanel.anchoredPosition = new Vector2(originalPos.x, Screen.height);
                uiText.text = "";

                if (sDaFoto != null)
                {
                    img.enabled = true;
                    img.sprite  = sDaFoto;
                }
                else
                {
                    img.enabled = false;
                }

                phase = MessagePhase.boxOut;
                this.textForMessage = texto;
            }
        }