Beispiel #1
0
 protected override void OnDisplay()
 {
     m_Panel.ActivatePromoBorder(!m_TossState || ShouldShowTossVisuals());
     if (m_HintObject != null)
     {
         AudioManager.m_Instance.PlayHintAnimateSound(m_HintObject.transform.position);
     }
 }
Beispiel #2
0
        public override void OnActive()
        {
            // Update line visibility and alignment.
            bool lineVisible = !SketchControlsScript.m_Instance.IsUserInteractingWithUI() && !TossState;

            if (lineVisible)
            {
                if (!PromoManager.m_Instance.HintLine.gameObject.activeSelf)
                {
                    PromoManager.m_Instance.HintLine.gameObject.SetActive(true);
                    PromoManager.m_Instance.HintLine.GlobalMode = true;
                }
                AlignHintLine();
            }
            else if (PromoManager.m_Instance.HintLine.gameObject.activeSelf)
            {
                PromoManager.m_Instance.HintLine.gameObject.SetActive(false);
                PromoManager.m_Instance.HintLine.Reset();
            }

            // Update grab state.
            if (!TossState)
            {
                // If we open a new panel while the promo is active, switch focus to that panel.
                BasePanel lastPanel = PanelManager.m_Instance.LastOpenedPanel();
                if (m_Panel != lastPanel)
                {
                    m_Panel.ActivatePromoBorder(false);
                    m_Panel = lastPanel;
                    m_Panel.ActivatePromoBorder(true);
                    m_InitialPanel = m_Panel;
                }

                // If we're grabbing our highlighted panel, change the toss state.
                if (SketchControlsScript.m_Instance.IsUserGrabbingWidget(m_Panel.WidgetSibling))
                {
                    TossState = true;
                    RequestDisplayForTossState();
                }
                else
                {
                    // Bunch of cases where we should cancel the promo for now.
                    bool usingActiveTool =
                        InputManager.m_Instance.GetCommand(InputManager.SketchCommands.Activate) &&
                        !SketchSurfacePanel.m_Instance.ActiveTool.IsEatingInput;
                    if (usingActiveTool ||
                        SketchControlsScript.m_Instance.IsUserInteractingWithAnyWidget() ||
                        SketchControlsScript.m_Instance.IsUserGrabbingWorld() ||
                        InputManager.m_Instance.ControllersAreSwapping())
                    {
                        m_RequireNewPanelToDisplay = true;
                        m_Request = RequestingState.ToHide;
                    }
                }
            }
            else
            {
                // If we threw the panel, this promo is complete.
                if (m_Panel.WidgetSibling.IsTossed())
                {
                    PromoManager.m_Instance.RecordCompletion(this.PromoType);
                }
                else if (!SketchControlsScript.m_Instance.IsUserGrabbingWidget(m_Panel.WidgetSibling))
                {
                    // If we stopped grabbing the panel, be done for now.
                    m_Request = RequestingState.ToHide;
                }
            }
        }