public override void OnEnter()
        {
            DTutorialOverlay dTutorialOverlay = new DTutorialOverlay();
            bool             flag             = true;

            if (UseTarget)
            {
                if (!string.IsNullOrEmpty(TargetName))
                {
                    GameObject gameObject = GameObject.Find(TargetName);
                    if (gameObject != null)
                    {
                        dTutorialOverlay.Target = gameObject;
                    }
                    else
                    {
                        Disney.LaunchPadFramework.Log.LogErrorFormatted(this, "Tutorial overlay skipped. Target {0} not found. Tutorial: {1}", TargetName, i18TranslatedArg0.Value);
                        flag = false;
                    }
                }
                else if (TargetObject.Value == null)
                {
                    Disney.LaunchPadFramework.Log.LogErrorFormatted(this, "Tutorial overlay skipped. Target object was null. Tutorial: {0}", i18TranslatedArg0.Value);
                    flag = false;
                }
                else
                {
                    dTutorialOverlay.Target = TargetObject.Value;
                }
            }
            if (flag)
            {
                dTutorialOverlay.Position             = HighlightPosition.Value;
                dTutorialOverlay.AutoSize             = AutoSize;
                dTutorialOverlay.Size                 = Size;
                dTutorialOverlay.Shape                = Shape;
                dTutorialOverlay.ArrowPosition        = ArrowPosition;
                dTutorialOverlay.ArrowOffset          = ArrowOffset;
                dTutorialOverlay.TextBoxOffset        = TextBoxOffset;
                dTutorialOverlay.TextBoxPivot         = TextBoxPivot;
                dTutorialOverlay.MaxTextBoxSize       = MaxTextBoxSize;
                dTutorialOverlay.ShowHighlightOutline = ShowHighlightOutline;
                dTutorialOverlay.Text                 = Service.Get <Localizer>().GetTokenTranslation(i18nBubbleText);
                if (!string.IsNullOrEmpty(i18TranslatedArg0.Value))
                {
                    dTutorialOverlay.Text = string.Format(dTutorialOverlay.Text, i18TranslatedArg0.Value);
                }
                dTutorialOverlay.ShowArrow     = ShowArrow;
                dTutorialOverlay.Opacity       = Opacity;
                dTutorialOverlay.DisableUI     = DisableUI;
                dTutorialOverlay.EnableTarget  = EnableTarget;
                dTutorialOverlay.BlocksRaycast = BlocksRaycast;
                Service.Get <EventDispatcher>().DispatchEvent(new TutorialUIEvents.ShowHighlightOverlay(dTutorialOverlay));
            }
            Finish();
        }
Пример #2
0
        public void SetHighlight(DTutorialOverlay overlayData)
        {
            data = overlayData;
            Vector3 worldPoint = Vector3.zero;

            highlightSize = Vector2.zero;
            if (data.Target != null)
            {
                RectTransform component = data.Target.GetComponent <RectTransform>();
                if (component != null)
                {
                    Canvas componentInParent = data.Target.GetComponentInParent <Canvas>();
                    worldPoint = component.position;
                    if (componentInParent.renderMode == RenderMode.ScreenSpaceCamera)
                    {
                        worldPoint = RectTransformUtility.WorldToScreenPoint(componentInParent.worldCamera, worldPoint);
                    }
                    if (data.AutoSize)
                    {
                        highlightSize = component.rect.size;
                    }
                }
                else
                {
                    worldPoint = Camera.main.WorldToScreenPoint(data.Target.transform.position);
                }
            }
            CanvasScalerExt component2 = GetComponentInParent <Canvas>().GetComponent <CanvasScalerExt>();
            Vector2         vector     = new Vector2(component2.ReferenceResolutionY / (float)Screen.height, component2.ReferenceResolutionY / (float)Screen.height);

            vector *= 1f / component2.ScaleModifier;
            int num = 0;
            DataEntityHandle entityByType = Service.Get <CPDataEntityCollection>().GetEntityByType <SystemBarsData>();

            if (!entityByType.IsNull)
            {
                SystemBarsData component3 = Service.Get <CPDataEntityCollection>().GetComponent <SystemBarsData>(entityByType);
                num = component3.CurrentNavigationBarHeight;
            }
            if (data.Target != null)
            {
                highlightPosition = new Vector2((data.Position.x + worldPoint.x) * vector.x, (data.Position.y - (float)num + worldPoint.y) * vector.y);
            }
            else
            {
                highlightPosition = new Vector2((float)Screen.width * data.Position.x * vector.x, (float)Screen.height * (data.Position.y - (float)num) * vector.y);
            }
            highlightSize += data.Size;
            Color color = new Color(1f, 1f, 1f, Mathf.Clamp(data.Opacity, 0f, 1f));

            BackgroundShape.GetComponent <Image>().sprite = getShapeSprite(data.Shape);
            BackgroundShape.GetComponent <Image>().color  = color;
            LeftBG.GetComponent <Image>().color           = color;
            RightBG.GetComponent <Image>().color          = color;
            TopBG.GetComponent <Image>().color            = color;
            BottomBG.GetComponent <Image>().color         = color;
            updateBackground();
            updatePopup();
            isShowing = true;
            base.gameObject.SetActive(value: true);
            if (data.DisableUI)
            {
                Service.Get <EventDispatcher>().DispatchEvent(default(UIDisablerEvents.DisableAllUIElements));
                Service.Get <EventDispatcher>().DispatchEvent(new UIDisablerEvents.DisableUIElement("Joystick"));
                if (data.Target != null && data.EnableTarget)
                {
                    UIElementDisabler component4 = data.Target.GetComponent <UIElementDisabler>();
                    if (component4 != null)
                    {
                        Service.Get <EventDispatcher>().DispatchEvent(new UIDisablerEvents.EnableUIElement(component4.UIElementID));
                    }
                }
            }
            UpdateHighlightOutline(data.ShowHighlightOutline);
            enableUIElementsOnClose = data.DisableUI;
            GetComponent <CanvasGroup>().blocksRaycasts = data.BlocksRaycast;
            Service.Get <BackButtonController>().Add(onBackClicked);
        }
Пример #3
0
 public ShowHighlightOverlay(DTutorialOverlay tutorialOverlayData)
 {
     TutorialOverlayData = tutorialOverlayData;
 }