public TutorialFinger CreateTutorialFinger(TutorialFingerData data) { GameObject prefab = Services.ResourceService.Prefabs.GetPrefab("finger"); GameObject instance = GameObject.Instantiate(prefab); instance.GetComponent <RectTransform>().SetParent(Services.ViewService.GetCanvasTransform(CanvasType.UI), false); var fingerView = instance.GetComponent <TutorialFinger>(); fingerView.Setup(data); return(fingerView); }
public void Setup(TutorialFingerData data) { Data = data; GetComponent <RectTransform>().anchoredPosition = data.Position; if (data.IsTooltipVisible) { tooltipParent.gameObject.Activate(); tooltipText.text = data.TooltipText; SetupTooltipLayout(data); var colorData = AnimUtils.GetColorAnimData(tooltipText.color.ChangeAlpha(0), tooltipText.color, 0.3f, EaseType.EaseInOutQuad, tooltipText.GetComponent <RectTransform>(), BosAnimationMode.Single); tooltipText.gameObject.GetOrAdd <ColorAnimator>().StartAnimation(colorData); } else { tooltipParent.gameObject.Deactivate(); } if (Data.Timeout > 0f) { StartCoroutine(RemoveAfterTimeout(Data.Timeout)); } }
private void SetupTooltipLayout(TutorialFingerData data) { textLayout.preferredWidth = data.TooltipWidth; tooltipParent.anchoredPosition = data.TooltipPosition; tooltipParent.localScale = data.TooltipScale; }