예제 #1
0
        /// <summary>
        /// Close this widget.
        /// </summary>
        public virtual void Close()
        {
            if (!m_IsShowing)
            {
                return;
            }
            m_IsShowing = false;
            TweenCanvasGroupAlpha(m_CanvasGroup.alpha, 0f);
            TweenTransformScale(m_RectTransform.localScale, Vector3.zero);

            WidgetUtility.PlaySound(this.m_CloseSound, 1.0f);
            m_CanvasGroup.interactable   = false;
            m_CanvasGroup.blocksRaycasts = false;
            if (this.m_ShowAndHideCursor)
            {
                m_CurrentVisibleWidgets.Remove(this);
                if (m_CurrentVisibleWidgets.Count == 0)
                {
                    //Cursor.lockState = m_PreviousCursorLockMode;
                    //Cursor.visible = m_PreviousCursorVisibility;
                    if (this.m_CameraController != null)
                    {
                        this.m_CameraTransform.SendMessage("Deactivate", this.m_CameraPreset, SendMessageOptions.DontRequireReceiver);
                        //this.m_CameraController.enabled = m_PreviousCameraControllerEnabled;
                        if (this.m_CameraController.enabled && this.m_FocusPlayer)
                        {
                            this.m_CameraController.SendMessage("Focus", false, SendMessageOptions.DontRequireReceiver);
                        }
                    }
                }
            }

            Execute("OnClose", new CallbackEventData());
        }
예제 #2
0
        public override void Repaint()
        {
            if (ObservedItem != null)
            {
                Notification container = Container as Notification;

                if (this.m_Text != null)
                {
                    this.m_Text.text = WidgetUtility.ColorString(ObservedItem.text, ObservedItem.color);
                    DelayCrossFade(this.m_Text, ObservedItem);
                }

                if (this.m_Time != null)
                {
                    this.m_Time.text = (string.IsNullOrEmpty(container.timeFormat) ? "" : "[" + DateTime.Now.ToString(container.timeFormat) + "] ");
                    DelayCrossFade(this.m_Time, ObservedItem);
                }

                if (this.m_Icon != null)
                {
                    this.m_Icon.gameObject.SetActive(ObservedItem.icon != null);
                    if (ObservedItem.icon != null)
                    {
                        this.m_Icon.overrideSprite = ObservedItem.icon;
                        DelayCrossFade(this.m_Icon, ObservedItem);
                    }
                }
            }
        }
예제 #3
0
 public static void LockAll(bool state)
 {
     UIWidget[] widgets = WidgetUtility.FindAll <UIWidget>();
     for (int i = 0; i < widgets.Length; i++)
     {
         widgets[i].Lock(state);
     }
 }
예제 #4
0
        public void Show(string name)
        {
            UIWidget widget = WidgetUtility.Find <UIWidget>(name);

            if (widget != null)
            {
                widget.Show();
            }
        }
예제 #5
0
        public void Close(string name)
        {
            UIWidget widget = WidgetUtility.Find <UIWidget>(name);

            if (widget != null)
            {
                widget.Close();
            }
        }
예제 #6
0
        /// <summary>
        /// Show this widget.
        /// </summary>
        public virtual void Show()
        {
            if (this.m_IsShowing)
            {
                return;
            }
            this.m_IsShowing = true;
            gameObject.SetActive(true);
            if (this.m_Focus)
            {
                Focus();
            }
            TweenCanvasGroupAlpha(m_CanvasGroup.alpha, 1f);
            TweenTransformScale(Vector3.ClampMagnitude(m_RectTransform.localScale, 1.9f), Vector3.one);

            WidgetUtility.PlaySound(this.m_ShowSound, 1.0f);
            m_CanvasGroup.interactable   = true;
            m_CanvasGroup.blocksRaycasts = true;
            Canvas.ForceUpdateCanvases();
            for (int i = 0; i < this.m_Scrollbars.Length; i++)
            {
                this.m_Scrollbars[i].value = 1f;
            }
            if (this.m_ShowAndHideCursor)
            {
                if (m_CurrentVisibleWidgets.Count == 0)
                {
                    m_PreviousCursorLockMode   = Cursor.lockState;
                    m_PreviousCursorVisibility = Cursor.visible;
                    if (m_CameraController != null)
                    {
                        m_PreviousCameraControllerEnabled = m_CameraController.enabled;
                    }
                }
                m_CurrentVisibleWidgets.Add(this);
                if (m_CameraController != null && !Input.GetKey(this.m_Deactivate))
                {
                    this.m_CameraController.enabled = false;
                    if (this.m_FocusPlayer)
                    {
                        this.m_CameraController.SendMessage("Focus", true, SendMessageOptions.DontRequireReceiver);
                    }
                }
                Cursor.lockState = CursorLockMode.None;
                Cursor.visible   = true;
            }

            Execute("OnShow", new CallbackEventData());
        }
예제 #7
0
        private IEnumerator DelayTooltip(float delay)
        {
            float time = 0.0f;

            yield return(true);

            while (time < delay)
            {
                time += Time.deltaTime;
                yield return(true);
            }


            instance.Show(WidgetUtility.ColorString(tooltipTitle, color), WidgetUtility.ColorString(tooltip, color), icon, m_PropertyPairs, width, showBackground);
        }
예제 #8
0
 /// <summary>
 /// Start is called on the frame when a script is enabled just before any of the Update methods is called the first time.
 /// </summary>
 private void Start()
 {
     //Find tooltip instance with name "Tooltip"
     instance = WidgetUtility.Find <Tooltip> (instanceName);
     //Check if an instance of UITooltip is located in scene
     if (enabled && instance == null)
     {
         //No instance -> disable trigger
         enabled = false;
     }
     this.m_PropertyPairs = new List <KeyValuePair <string, string> >();
     for (int i = 0; i < properties.Length; i++)
     {
         this.m_PropertyPairs.Add(new KeyValuePair <string, string>(properties[i].key, properties[i].value));
     }
 }
예제 #9
0
        /// <summary>
        /// Close this widget.
        /// </summary>
        public virtual void Close()
        {
            if (!m_IsShowing)
            {
                return;
            }
            m_IsShowing = false;
            TweenCanvasGroupAlpha(m_CanvasGroup.alpha, 0f);
            TweenTransformScale(m_RectTransform.localScale, Vector3.zero);

            WidgetUtility.PlaySound(closeSound, 1.0f);
            m_CanvasGroup.interactable   = false;
            m_CanvasGroup.blocksRaycasts = false;
            if (onClose != null)
            {
                onClose.Invoke();
            }
        }
예제 #10
0
        /// <summary>
        /// Show this widget.
        /// </summary>
        public virtual void Show()
        {
            if (m_IsShowing)
            {
                return;
            }
            m_IsShowing = true;
            gameObject.SetActive(true);
            if (m_Focus)
            {
                Focus();
            }
            TweenCanvasGroupAlpha(m_CanvasGroup.alpha, 1f);
            TweenTransformScale(Vector3.ClampMagnitude(m_RectTransform.localScale, 1.9f), Vector3.one);

            WidgetUtility.PlaySound(showSound, 1.0f);
            m_CanvasGroup.interactable   = true;
            m_CanvasGroup.blocksRaycasts = true;
            if (onShow != null)
            {
                onShow.Invoke();
            }
        }
예제 #11
0
 public virtual void Show(NotificationOptions settings, UnityAction <int> result, params string[] buttons)
 {
     Show(settings.title, WidgetUtility.ColorString(settings.text, settings.color), settings.icon, result, buttons);
 }