Пример #1
0
        public void FindUIElements()
        {
            // Only find if none of the critical UI elements are assigned:
            var elements = UnityUISelectorElements.instance;

            if (elements == null)
            {
                elements = SearchForElements(DialogueManager.instance.transform);
            }
            if (elements != null)
            {
                UnityUISelectorElements.instance = elements;
            }
            if (mainGraphic == null && nameText == null && reticleInRange == null)
            {
                if (elements == null)
                {
                    if (DialogueDebug.logWarnings)
                    {
                        Debug.LogWarning("Dialogue System: UnityUISelectorDisplay can't find UI elements", this);
                    }
                }
                else
                {
                    if (mainGraphic == null)
                    {
                        mainGraphic = elements.mainGraphic;
                    }
                    if (nameText == null)
                    {
                        nameText = elements.nameText;
                    }
                    if (useMessageText == null)
                    {
                        useMessageText = elements.useMessageText;
                    }
                    inRangeColor    = elements.inRangeColor;
                    outOfRangeColor = elements.outOfRangeColor;
                    if (reticleInRange == null)
                    {
                        reticleInRange = elements.reticleInRange;
                    }
                    if (reticleOutOfRange == null)
                    {
                        reticleOutOfRange = elements.reticleOutOfRange;
                    }
                    animationTransitions = elements.animationTransitions;
                }
            }
            if (mainGraphic != null)
            {
                animator = mainGraphic.GetComponentInChildren <Animator>();
            }
        }
 /// <summary>
 /// Opens the abandon popup modally if assigned; otherwise immediately confirms.
 /// </summary>
 /// <param name="title">Quest title.</param>
 private void OpenAbandonPopup(string title)
 {
     if (abandonPopup != null)
     {
         Tools.SetGameObjectActive(abandonPopup, true);
         if (abandonQuestTitle != null) abandonQuestTitle.text = title;
         if (autoFocus && (UnityEngine.EventSystems.EventSystem.current != null))
         {
             var button = abandonPopup.GetComponentInChildren<UnityEngine.UI.Button>();
             if (button != null)
             {
                 UnityEngine.EventSystems.EventSystem.current.SetSelectedGameObject(button.gameObject);
             }
         }
         else
         {
             this.confirmAbandonQuestHandler();
         }
     }
 }