예제 #1
0
 private void OnUnofficialTransfer(UnofficialTransferCashInfo info)
 {
     if (info.IsSuccess)
     {
         StartCoroutine(EmitObjectImpl());
         StartCoroutine(ShowParticles());
         StartCoroutine(ShowMoveTextImpl(info));
     }
     else
     {
         StartCoroutine(EmitObjectImpl());
         StartCoroutine(ShowParticles());
         StartCoroutine(ShowMoveTextFailImpl(info));
     }
 }
예제 #2
0
        private IEnumerator ShowMoveTextFailImpl(UnofficialTransferCashInfo info)
        {
            yield return(new WaitForSeconds(interval));

            GameObject textPrefab   = Services.ResourceService.Prefabs.GetPrefab("movetext");
            GameObject textInstance = Instantiate(textPrefab);

            Text text = textInstance.GetComponent <Text>();

            text.text = $"-{BosUtils.GetCurrencyString(info.LooseValue.ToCurrencyNumber(), "", "")}";
            //text.SetAllDirty();

            RectTransform textTransform = textInstance.GetComponent <RectTransform>();

            textTransform.SetParent(transform, false);
            textTransform.anchoredPosition = endObject.anchoredPosition;
            textTransform.localScale       = new Vector3(2, 2, 1);
            Color startColor = Color.red;
            Color endColor   = Color.red.ChangeAlpha(0.1f);
            var   colorData  = AnimUtils.GetColorAnimData(startColor, endColor, 1.5f, EaseType.EaseOutQuintic,
                                                          textTransform, BosAnimationMode.Single,
                                                          () => { });
            var positionData = new Vector2AnimationData()
            {
                StartValue = textTransform.anchoredPosition,
                EndValue   = textTransform.anchoredPosition - new Vector2(0, 300),
                Duration   = 1.5f,
                EaseType   = EaseType.EaseOutQuintic,
                Target     = textInstance,
                OnStart    = (p, o) => textTransform.anchoredPosition = p,
                OnUpdate   = (p, t, o) => textTransform.anchoredPosition = p,
                OnEnd      = (p, o) => {
                    textTransform.anchoredPosition = p;
                    Destroy(textInstance);
                }
            };
            ColorAnimator   colorAnimator    = textInstance.GetComponent <ColorAnimator>();
            Vector2Animator positionAnimator = textInstance.GetComponent <Vector2Animator>();

            colorAnimator.StartAnimation(colorData);
            positionAnimator.StartAnimation(positionData);
            Sounds.PlayOneShot(SoundName.slotFail);
            ViewService.ShowDelayed(ViewType.TransferWarningView, 0.5f, new ViewData {
                ViewDepth = ViewService.NextViewDepth,
                UserData  = info.LooseValue
            });
            animObjects.Add(textInstance);
        }