private void RecycleText(HUDText hudtext) { if (hudtext == null) { return; } hudtext.RectTrans.anchoredPosition3D = new Vector3(10000, 0, 0); var go = hudtext.gameObject; _HudTextPool?.Release(go); }
private void UpdateHUDTextAnim(HUDText text) { if (text.currentModel.Models.Count > 0) { foreach (MotionModel motion in text.currentModel.Models) { if (motion == null) { continue; } var duration = motion.duration; var dalay = motion.delay; var motionType = motion.GetMotionType(); if (motionType == enHUDMotionType.Scale) { var model = motion as MotionScaleModel; text.currentTime += Time.deltaTime; if (model != null) { Vector3 startValue = model.startScale; Vector3 endValue = model.endScale; if (text.currentTime > dalay) { float animTime = text.currentTime - dalay; float t = animTime / duration; float ease = UIAnimationEquations.GetEaseFloat(t, model.easeType, model.Parameters); Vector3 value = UnClampedLerp(startValue, endValue, ease); text.RectTrans.localScale = value; } } } else if (motionType == enHUDMotionType.Alpha) { var model = motion as MotionAlphaModel; text.currentTime += Time.deltaTime; if (model != null) { float startValue = model.startAlpha; float endValue = model.endAlpha; if (text.currentTime > dalay) { float animTime = text.currentTime - dalay; float t = animTime / duration; float ease = UIAnimationEquations.GetEaseFloat(t, model.easeType, model.Parameters); float value = UnClampedLerp(startValue, endValue, ease); text.CanvasGrp.alpha = value; } } } else if (motionType == enHUDMotionType.Linear) { var model = motion as MotionLinearModel; text.currentTime += Time.deltaTime; if (model != null) { Vector3 startValue = model.startOffset; Vector3 endValue = model.endOffset; if (text.currentTime > dalay) { float animTime = text.currentTime - dalay; float t = animTime / duration; float ease = UIAnimationEquations.GetEaseFloat(t, model.easeType, model.Parameters); Vector3 value = UnClampedLerp(startValue, endValue, ease); if (text.IsFollow) { var pos = text.FollowGameObject.transform.position; pos.y += GetModelHeight(text.FollowGameObject, 1, false); Vector3 uipos = TranslatePosToUIPos(pos + text.OffectVector3 + value); text.RectTrans.position = uipos; } else { Vector3 uipos = TranslatePosToUIPos(text.StartPos + value); text.RectTrans.position = uipos; } } } } } } }