예제 #1
0
파일: Header.cs 프로젝트: yuu0123/DojoUI1
    public void SetHeaderHeight(Vector2 data)
    {
        float deltaY = Mathf.Min(m_ScrollRect.content.localPosition.y, 0);

        rectTransform.sizeDelta = new Vector2(rectTransform.sizeDelta.x, initHeight - deltaY);

        float force = deltaY / -1500;

        m_ForceField.force = Mathf.Min(force, 0.2f);

        if (deltaY < m_ThresholdReturn)
        {
            if (!m_IsReturn)
            {
                m_IsReturn = true;
                m_HeaderText.GetComponent <Text>().text = m_TitleReturn;
                m_HeaderText.Play();
                m_ReturnButton.GetComponent <RectTransform>().DOAnchorPos(showReturnButtonPosition, 0.2f, true).SetEase(Ease.OutBack);
                m_HamburgerButton.GetComponent <RectTransform>().DOAnchorPos(hideHamburgerButtonPosition, 0.2f, true).SetEase(Ease.OutBack);
            }
        }
        else
        {
            if (m_IsReturn)
            {
                m_IsReturn = false;
                m_HeaderText.GetComponent <Text>().text = m_TitleDefault;
                m_HeaderText.Play();
                m_ReturnButton.GetComponent <RectTransform>().DOAnchorPos(hideReturnButtonPosition, 0.2f, true).SetEase(Ease.OutBack);
                m_HamburgerButton.GetComponent <RectTransform>().DOAnchorPos(showHamburgerButtonPosition, 0.2f, true).SetEase(Ease.OutBack);
            }
        }
    }
예제 #2
0
 public void OnPanelCount(int addCount)
 {
     count            += addCount;
     valueTextBox.text = string.Format("×{0}", count);
     IsVisible();
     typefaceAnimator.Play();
 }
예제 #3
0
 private void Start()
 {
     typefaceAnim.onComplete.AddListener(() =>
     {
         // 次のtextが存在する場合
         if (displayScript.IndexOf(textBox.text) + 1 < displayScript.Count)
         {
             textBox.text = displayScript[displayScript.IndexOf(textBox.text) + 1];
             typefaceAnim.Play();
         }
         else
         {
             // call event
             WorldStateMachine.Instance.SetStateMachine(WorldStateMachine.States.State.InTheGame);
             transform.parent.gameObject.SetActive(false);
         }
     });
 }
예제 #4
0
    IEnumerator DefenceCoroutine(int damage)
    {
        m_HP -= damage;
        float percentage = (float)m_HP / (float)m_Data.hp;

        yield return(new WaitForSeconds(0.2f));

        m_DamageText.gameObject.SetActive(true);
        m_DamageText.GetComponent <Text>().text = damage.ToString();
        m_DamageText.Play();

        Sequence sequence = DOTween.Sequence();

        sequence.Append(rectTransform.DOAnchorPos(defaultPosition + stepDistance, 0.05f, true).SetEase(Ease.OutQuad));
        sequence.Append(rectTransform.DOAnchorPos(defaultPosition, 0.2f, true).SetEase(Ease.OutElastic));

        yield return(new WaitForSeconds(0.1f));

        SendMessage("SetSliderValue", percentage);

        yield return(new WaitForSeconds(0.6f));

        m_DamageText.gameObject.SetActive(false);

        // エネミーがやられた場合
        if (m_HP <= 0 && characterType == CharacterType.Enemy)
        {
            endBattle.Invoke();

            var image = GetComponent <Image>();
            yield return(new WaitForSeconds(0.2f));

            image.enabled = false;
            yield return(new WaitForSeconds(0.05f));

            image.enabled = true;
            yield return(new WaitForSeconds(0.05f));

            image.enabled = false;
            yield return(new WaitForSeconds(0.05f));

            image.enabled = true;
            yield return(new WaitForSeconds(0.05f));

            image.enabled = false;
        }
    }
예제 #5
0
    //左右のスクロールから戻るアニメーションを行い、新しいStateを返す
    public Card.State GetNextStateAfterAnimation()
    {
        Card.State result   = m_CurrentState;
        float      duration = 0.4f;
        float      targetX  = 0;

        m_currentHorizontalScrollMode = HorizontalScrollMode.Non;

        switch (m_CurrentState)
        {
        case State.Defection:

            //閾値以上のドラッグかつメンバーがマックスに到達していなければカードがアクティブになる
            if (m_Body.rectTransform.anchoredPosition.x > m_ThresholdHorizontal)
            {
                targetX = m_ThresholdHorizontal;
                result  = SetJoin();
            }
            else
            {
                targetX = 0;
                result  = SetDefection();
            }
            break;

        case State.Join:
            targetX = 0;
            result  = SetDefection();
            break;
        }

        //トゥイーンアニメーション
        m_Body.transform.DOLocalMoveX(targetX, duration, true).SetEase(Ease.OutBack);

        //テキストが揺れる
        m_NameText.Play();

        return(result);
    }
예제 #6
0
 public void PlayText(string text)
 {
     buffTextBox.text  = text;
     buffTextBox.color = Color.white;
     typeFaceAnimator.Play();
 }
예제 #7
0
 void TextAnimation()
 {
     titleText.Play();
     titleText.onComplete.AddListener(() => buttonText.Play());
     buttonText.onComplete.AddListener(() => button.interactable = true);
 }