Exemplo n.º 1
0
        protected override void OnFinish(IGUIState guiState)
        {
            if (onSliderEnd != null)
            {
                onSliderEnd(guiState, hoveredControl, m_SliderData.position);
            }

            guiState.UseCurrentEvent();
            guiState.Repaint();
        }
        protected override bool GetTriggerContidtion(IGUIState guiState)
        {
            if (guiState.eventType == EventType.ValidateCommand && guiState.commandName == m_CommandName)
            {
                guiState.UseCurrentEvent();
                return(true);
            }

            return(false);
        }
Exemplo n.º 3
0
        protected override void OnTrigger(IGUIState guiState)
        {
            base.OnTrigger(guiState);

            if (onClick != null)
            {
                onClick(guiState, hoveredControl);
            }

            if (m_UseEvent)
            {
                guiState.UseCurrentEvent();
            }
        }
Exemplo n.º 4
0
        public void OnGUI()
        {
            var nearestLayoutData = LayoutData.zero;

            foreach (var control in m_Controls)
            {
                control.GetControl(m_GUIState);
            }

            if (m_GUIState.eventType == EventType.Layout)
            {
                foreach (var control in m_Controls)
                {
                    control.BeginLayout(m_GUIState);
                }

                foreach (var control in m_Controls)
                {
                    control.Layout(m_GUIState);
                    nearestLayoutData = LayoutData.Nearest(nearestLayoutData, control.layoutData);
                }

                foreach (var control in m_Controls)
                {
                    m_GUIState.AddControl(control.ID, control.layoutData.distance);
                }

                foreach (var control in m_Controls)
                {
                    control.EndLayout(m_GUIState);
                }

                if (m_PrevNearestControl == m_GUIState.nearestControl)
                {
                    if (nearestLayoutData.index != m_PrevNearestLayoutData.index)
                    {
                        m_GUIState.Repaint();
                    }
                }
                else
                {
                    m_PrevNearestControl = m_GUIState.nearestControl;
                    m_GUIState.Repaint();
                }

                m_PrevNearestLayoutData = nearestLayoutData;
            }

            if (m_GUIState.eventType == EventType.Repaint)
            {
                foreach (var action in m_Actions)
                {
                    if (action.IsRepaintEnabled(m_GUIState))
                    {
                        action.PreRepaint(m_GUIState);
                    }
                }

                foreach (var control in m_Controls)
                {
                    control.Repaint(m_GUIState);
                }
            }

            var repaintOnMouseMove = false;

            foreach (var action in m_Actions)
            {
                if (IsMouseMoveEvent())
                {
                    repaintOnMouseMove |= action.IsRepaintOnMouseMoveEnabled(m_GUIState);
                }

                action.OnGUI(m_GUIState);
            }

            if (repaintOnMouseMove)
            {
                m_GUIState.UseCurrentEvent();
            }
        }
Exemplo n.º 5
0
        public void OnGUI()
        {
            var controlIDCheck = m_GUIState.GetControlID(kControlIDCheckHashCode, FocusType.Passive);

            if (m_GUIState.eventType == EventType.Layout)
            {
                m_ControlIDCheck = controlIDCheck;
            }
            else if (m_GUIState.eventType != EventType.Used && m_ControlIDCheck != controlIDCheck)
            {
                Debug.LogWarning("GetControlID at event " + m_GUIState.eventType + " returns a controlID different from the one in Layout event");
            }

            var nearestLayoutData = LayoutData.zero;

            foreach (var control in m_Controls)
            {
                control.GetControl(m_GUIState);
            }

            if (m_GUIState.eventType == EventType.Layout)
            {
                foreach (var control in m_Controls)
                {
                    control.BeginLayout(m_GUIState);
                }

                foreach (var control in m_Controls)
                {
                    control.Layout(m_GUIState);
                    nearestLayoutData = LayoutData.Nearest(nearestLayoutData, control.layoutData);
                }

                foreach (var control in m_Controls)
                {
                    m_GUIState.AddControl(control.ID, control.layoutData.distance);
                }

                foreach (var control in m_Controls)
                {
                    control.EndLayout(m_GUIState);
                }

                if (m_PrevNearestControl == m_GUIState.nearestControl)
                {
                    if (nearestLayoutData.index != m_PrevNearestLayoutData.index)
                    {
                        m_GUIState.Repaint();
                    }
                }
                else
                {
                    m_PrevNearestControl = m_GUIState.nearestControl;
                    m_GUIState.Repaint();
                }

                m_PrevNearestLayoutData = nearestLayoutData;
            }

            if (m_GUIState.eventType == EventType.Repaint)
            {
                foreach (var action in m_Actions)
                {
                    if (action.IsRepaintEnabled(m_GUIState))
                    {
                        action.PreRepaint(m_GUIState);
                    }
                }

                foreach (var control in m_Controls)
                {
                    control.Repaint(m_GUIState);
                }
            }

            var repaintOnMouseMove = false;

            foreach (var action in m_Actions)
            {
                if (IsMouseMoveEvent())
                {
                    repaintOnMouseMove |= action.IsRepaintOnMouseMoveEnabled(m_GUIState);
                }

                action.OnGUI(m_GUIState);
            }

            if (repaintOnMouseMove)
            {
                m_GUIState.UseCurrentEvent();
            }
        }