Exemplo n.º 1
0
        public void StartMarqueeing(MarqueeType marqueeType)
        {
            mIsMarqueerOn = true;
            mStoryboard   = new Storyboard();

            if (MarqueeType.LeftToRight == marqueeType)
            {
                LeftToRightMarquee();
            }
            else if (MarqueeType.RightToLeft == marqueeType)
            {
                RightToLeftMarquee();
            }
            else if (MarqueeType.TopToBottom == marqueeType)
            {
                TopToBottomMarquee();
            }
            else if (MarqueeType.BottomToTop == marqueeType)
            {
                BottomToTopMarquee();
            }
            else
            {
                mIsMarqueerOn = false;
                mStoryboard.Stop();
                mStoryboard = null;
            }
        }
Exemplo n.º 2
0
 private void HandleEditModeChange()
 {
     // Handles changes in EditMode while tool is expected to be in the same mode
     if (isPicking && EditMode.editMode != EditMode.SceneViewEditMode.GridPicking)
     {
         m_MarqueeStart = null;
         m_MarqueeType  = MarqueeType.None;
         if (isHotControl)
         {
             GUI.changed           = true;
             GUIUtility.hotControl = 0;
         }
     }
     if (isBoxing && EditMode.editMode != EditMode.SceneViewEditMode.GridBox)
     {
         m_MarqueeStart = null;
         m_MarqueeType  = MarqueeType.None;
         if (isHotControl)
         {
             GUI.changed           = true;
             GUIUtility.hotControl = 0;
         }
     }
     if (EditMode.editMode != EditMode.SceneViewEditMode.GridSelect &&
         EditMode.editMode != EditMode.SceneViewEditMode.GridMove)
     {
         ClearGridSelection();
     }
 }
Exemplo n.º 3
0
 private void HandleEditModeChange()
 {
     // Handles changes in EditMode while tool is expected to be in the same mode
     if (isPicking && !TilemapEditorTool.IsActive(typeof(PickingTool)))
     {
         m_MarqueeStart = null;
         m_MarqueeType  = MarqueeType.None;
         if (isHotControl)
         {
             GUI.changed           = true;
             GUIUtility.hotControl = 0;
         }
     }
     if (isBoxing && !TilemapEditorTool.IsActive(typeof(BoxTool)))
     {
         m_MarqueeStart = null;
         m_MarqueeType  = MarqueeType.None;
         if (isHotControl)
         {
             GUI.changed           = true;
             GUIUtility.hotControl = 0;
         }
     }
     if (!TilemapEditorTool.IsActive(typeof(SelectTool)) && !TilemapEditorTool.IsActive(typeof(MoveTool)))
     {
         ClearGridSelection();
     }
 }
Exemplo n.º 4
0
        /// <summary>
        ///     Marquees the label on hover.
        /// </summary>
        /// <param name="rect">The rect.</param>
        /// <param name="message">The message.</param>
        /// <param name="marqueeType">Type of the marquee.</param>
        /// <param name="scrollSpeed">The scroll speed.</param>
        public static void MarqueeLabelOnHover(Rect rect, string message, GUIStyle style = null,
                                               MarqueeType marqueeType = MarqueeType.LeftToRight, Vector2 scrollSpeed = default)
        {
            // TODO: isNeeded flag doesn't work correctly
            var isNeeded = (style ?? GUI.skin.label).CalcSize(new GUIContent(message)).x > rect.width;

            if (rect.Contains(Event.current.mousePosition) && isNeeded)
            {
                MarqueeLabel(rect, message, style, marqueeType, scrollSpeed);
            }
            else
            {
                GUILayout.BeginArea(rect);

                if (style == null)
                {
                    GUILayout.Label(message);
                }
                else
                {
                    GUILayout.Label(message, style);
                }

                GUILayout.EndArea();
            }
        }
Exemplo n.º 5
0
        private void HandleBrushPicking()
        {
            Event evt = Event.current;

            if (evt.type == EventType.MouseDown && IsPickingEvent(evt) && !isHotControl)
            {
                m_ModeBeforePicking = EditMode.SceneViewEditMode.GridPainting;
                if (inEditMode && EditMode.editMode != EditMode.SceneViewEditMode.GridPicking)
                {
                    m_ModeBeforePicking = EditMode.editMode;
                    EditMode.ChangeEditMode(EditMode.SceneViewEditMode.GridPicking, GridPaintingState.instance);
                }

                m_MarqueeStart            = mouseGridPosition;
                m_MarqueeType             = MarqueeType.Pick;
                s_LastActivePaintableGrid = this;
                Event.current.Use();
                GUI.changed           = true;
                GUIUtility.hotControl = m_PermanentControlID;
                OnBrushPickStarted();
            }
            if (evt.type == EventType.MouseDrag && isHotControl && m_MarqueeStart.HasValue && m_MarqueeType == MarqueeType.Pick && IsPickingEvent(evt))
            {
                RectInt rect = GridEditorUtility.GetMarqueeRect(m_MarqueeStart.Value, mouseGridPosition);
                OnBrushPickDragged(new BoundsInt(new Vector3Int(rect.xMin, rect.yMin, 0), new Vector3Int(rect.size.x, rect.size.y, 1)));
                Event.current.Use();
                GUI.changed = true;
            }
            if (evt.rawType == EventType.MouseUp && isHotControl && m_MarqueeStart.HasValue && m_MarqueeType == MarqueeType.Pick && IsPickingEvent(evt))
            {
                // Check if event only occurred in the PaintableGrid window as evt.type will filter for this
                if (evt.type == EventType.MouseUp && m_MarqueeType == MarqueeType.Pick)
                {
                    RectInt    rect  = GridEditorUtility.GetMarqueeRect(m_MarqueeStart.Value, mouseGridPosition);
                    Vector2Int pivot = GetMarqueePivot(m_MarqueeStart.Value, mouseGridPosition);
                    PickBrush(new BoundsInt(new Vector3Int(rect.xMin, rect.yMin, 0), new Vector3Int(rect.size.x, rect.size.y, 1)), new Vector3Int(pivot.x, pivot.y, 0));

                    if (inEditMode && EditMode.editMode != m_ModeBeforePicking)
                    {
                        EditMode.ChangeEditMode(m_ModeBeforePicking, GridPaintingState.instance);
                    }

                    GridPaletteBrushes.ActiveGridBrushAssetChanged();
                    s_LastActivePaintableGrid = this;
                    Event.current.Use();
                    GUI.changed = true;
                }
                else
                // Event occurred outside of PaintableGrid window, cancel the pick event
                {
                    OnBrushPickCancelled();
                }
                m_MarqueeType         = MarqueeType.None;
                m_MarqueeStart        = null;
                GUIUtility.hotControl = 0;
                InspectorWindow.RepaintAllInspectors();
            }
        }
Exemplo n.º 6
0
        /// <summary>
        ///     Marquees the label.
        /// </summary>
        /// <param name="rect">The rect.</param>
        /// <param name="enclosingArea">The enclosing area.</param>
        /// <param name="message">The message.</param>
        /// <param name="style">The style.</param>
        /// <param name="marqueeType">Type of the marquee.</param>
        /// <param name="scrollSpeed">The scroll speed.</param>
        /// <param name="withArea">if set to <c>true</c> [with area].</param>
        private static void MarqueeLabel(Rect rect, Rect enclosingArea, string message, GUIStyle style = null,
                                         MarqueeType marqueeType = MarqueeType.LeftToRight, Vector2 scrollSpeed = default, params object[] objs)
        {
            bool withArea  = objs.GetValue <bool>(0);
            Rect hoverRect = objs.GetValue <Rect>(1);

            // Create a default scroll if specified is null
            if (scrollSpeed == default)
            {
                scrollSpeed = new Vector2(30f, 30f);
            }

            // Get rect from dictionary
            var messageRect = marqueePairs.AddAndGet(message, rect);

            //This increments the positions	accordingly
            messageRect.position = ScrollingText(messageRect.position, scrollSpeed, marqueeType);

            // This functions checks to see if the text has gone past the enclosing area
            // If it has, then it resets it
            messageRect = Reset(messageRect, enclosingArea);

            // Display the text...
            if (!withArea)
            {
                if (style == null)
                {
                    GUI.Label(messageRect, message);
                }
                else
                {
                    GUI.Label(messageRect, message, style);
                }
            }
            else
            {
                GUILayout.BeginArea(hoverRect);
                {
                    GUILayout.BeginArea(messageRect);
                    {
                        if (style == null)
                        {
                            GUILayout.Label(message);
                        }
                        else
                        {
                            GUILayout.Label(message, style);
                        }
                    }
                    GUILayout.EndArea();
                }
                GUILayout.EndArea();
            }

            // Update the marquee pair
            marqueePairs[message] = messageRect;
        }
Exemplo n.º 7
0
        private void HandleMoveTool()
        {
            Event evt = Event.current;

            if (evt.type == EventType.MouseDown && evt.button == 0 && !evt.alt && EditMode.editMode == EditMode.SceneViewEditMode.GridMove)
            {
                RegisterUndo();
                Vector3Int mouse3D = new Vector3Int(mouseGridPosition.x, mouseGridPosition.y, GridSelection.position.zMin);
                if (GridSelection.active && GridSelection.position.Contains(mouse3D))
                {
                    GUIUtility.hotControl = m_PermanentControlID;
                    executing             = true;
                    m_MarqueeStart        = null;
                    m_MarqueeType         = MarqueeType.None;
                    m_PreviousMove        = mouseGridPosition;
                    MoveStart(GridSelection.position);
                    s_LastActivePaintableGrid = this;
                }
                Event.current.Use();
            }
            if (evt.type == EventType.MouseDrag && evt.button == 0 && EditMode.editMode == EditMode.SceneViewEditMode.GridMove && isHotControl)
            {
                if (m_MouseGridPositionChanged && m_PreviousMove.HasValue)
                {
                    executing = true;
                    BoundsInt previousRect   = GridSelection.position;
                    BoundsInt previousBounds = new BoundsInt(new Vector3Int(previousRect.xMin, previousRect.yMin, 0), new Vector3Int(previousRect.size.x, previousRect.size.y, 1));

                    Vector2Int direction = mouseGridPosition - m_PreviousMove.Value;
                    BoundsInt  pos       = GridSelection.position;
                    pos.position           = new Vector3Int(pos.x + direction.x, pos.y + direction.y, pos.z);
                    GridSelection.position = pos;
                    Move(previousBounds, pos);
                    m_PreviousMove = mouseGridPosition;
                    Event.current.Use();
                }
            }
            if (evt.type == EventType.MouseUp && evt.button == 0 && m_PreviousMove.HasValue && EditMode.editMode == EditMode.SceneViewEditMode.GridMove && isHotControl)
            {
                if (m_PreviousMove.HasValue)
                {
                    m_PreviousMove = null;
                    MoveEnd(GridSelection.position);
                }
                executing             = false;
                GUIUtility.hotControl = 0;
                Event.current.Use();
            }
        }
Exemplo n.º 8
0
        /// <summary>
        ///     Marquees the label on hover.
        /// </summary>
        /// <param name="rect">The rect.</param>
        /// <param name="hoverRect">The hover rect.</param>
        /// <param name="relPosition">The relative position.</param>
        /// <param name="message">The message.</param>
        /// <param name="style">The style.</param>
        /// <param name="marqueeType">Type of the marquee.</param>
        /// <param name="scrollSpeed">The scroll speed.</param>
        /// <param name="withArea">if set to <c>true</c> [with area].</param>
        /// <exception cref="ArgumentNullException">relPosition</exception>
        public static void MarqueeLabelOnHover(
            Rect rect, Rect hoverRect, Func <Vector2, Vector2> relPosition, string message, GUIStyle style = null,
            MarqueeType marqueeType = MarqueeType.LeftToRight, Vector2 scrollSpeed = default, bool withArea = false)
        {
            if (relPosition == null)
            {
                throw new ArgumentNullException(nameof(relPosition));
            }

            var isNeeded = WillMarquee(hoverRect, relPosition, message, style, IsEditor);

            if (isNeeded)
            {
                MarqueeLabel(rect, rect, message, style, marqueeType, scrollSpeed, withArea, hoverRect);
            }
            else
            {
                if (!withArea)
                {
                    if (style == null)
                    {
                        GUI.Label(rect, message);
                    }
                    else
                    {
                        GUI.Label(rect, message, style);
                    }
                }
                else
                {
                    GUILayout.BeginArea(hoverRect);
                    {
                        if (style == null)
                        {
                            GUILayout.Label(message, GlobalStyles.CenteredLabelStyle);
                        }
                        else
                        {
                            GUILayout.Label(message, style);
                        }
                    }
                    GUILayout.EndArea();
                }
            }
        }
Exemplo n.º 9
0
        private void HandleBoxTool()
        {
            Event evt = Event.current;

            if (evt.type == EventType.MouseDown && evt.button == 0 && !evt.alt && EditMode.editMode == EditMode.SceneViewEditMode.GridBox)
            {
                m_MarqueeStart = mouseGridPosition;
                m_MarqueeType  = MarqueeType.Box;
                Event.current.Use();
                GUI.changed           = true;
                executing             = true;
                GUIUtility.hotControl = m_PermanentControlID;
            }
            if (evt.type == EventType.MouseDrag && evt.button == 0 && EditMode.editMode == EditMode.SceneViewEditMode.GridBox)
            {
                if (isHotControl && m_MarqueeStart.HasValue)
                {
                    Event.current.Use();
                    executing   = true;
                    GUI.changed = true;
                }
            }
            if (evt.type == EventType.MouseUp && evt.button == 0 && EditMode.editMode == EditMode.SceneViewEditMode.GridBox)
            {
                if (isHotControl && m_MarqueeStart.HasValue)
                {
                    RegisterUndo();
                    RectInt rect = GridEditorUtility.GetMarqueeRect(m_MarqueeStart.Value, mouseGridPosition);
                    if (evt.shift)
                    {
                        BoxErase(new BoundsInt(rect.x, rect.y, 0, rect.size.x, rect.size.y, 1));
                    }
                    else
                    {
                        BoxFill(new BoundsInt(rect.x, rect.y, 0, rect.size.x, rect.size.y, 1));
                    }
                    Event.current.Use();
                    executing             = false;
                    GUI.changed           = true;
                    GUIUtility.hotControl = 0;
                }
                m_MarqueeStart = null;
                m_MarqueeType  = MarqueeType.None;
            }
        }
Exemplo n.º 10
0
        private void HandleSelectTool()
        {
            Event evt = Event.current;

            if (evt.type == EventType.MouseDown && evt.button == 0 && !evt.alt &&
                (EditMode.editMode == EditMode.SceneViewEditMode.GridSelect || (EditMode.editMode == EditMode.SceneViewEditMode.GridMove && evt.control)))
            {
                if (EditMode.editMode == EditMode.SceneViewEditMode.GridMove && evt.control)
                {
                    EditMode.ChangeEditMode(EditMode.SceneViewEditMode.GridSelect, GridPaintingState.instance);
                }

                m_PreviousMove = null;
                m_MarqueeStart = mouseGridPosition;
                m_MarqueeType  = MarqueeType.Select;

                s_LastActivePaintableGrid = this;
                GUIUtility.hotControl     = m_PermanentControlID;
                Event.current.Use();
            }
            if (evt.rawType == EventType.MouseUp && evt.button == 0 && !evt.alt && m_MarqueeStart.HasValue && isHotControl && EditMode.editMode == EditMode.SceneViewEditMode.GridSelect)
            {
                // Check if event only occurred in the PaintableGrid window as evt.type will filter for this
                if (evt.type == EventType.MouseUp && m_MarqueeType == MarqueeType.Select)
                {
                    RectInt rect = GridEditorUtility.GetMarqueeRect(m_MarqueeStart.Value, mouseGridPosition);
                    Select(new BoundsInt(new Vector3Int(rect.xMin, rect.yMin, 0), new Vector3Int(rect.size.x, rect.size.y, 1)));
                    Event.current.Use();
                }
                if (evt.control)
                {
                    EditMode.ChangeEditMode(EditMode.SceneViewEditMode.GridMove, GridPaintingState.instance);
                }
                m_MarqueeStart = null;
                m_MarqueeType  = MarqueeType.None;
                InspectorWindow.RepaintAllInspectors();
                GUIUtility.hotControl = 0;
            }
            if (evt.type == EventType.KeyDown && evt.keyCode == KeyCode.Escape && !m_MarqueeStart.HasValue && !m_PreviousMove.HasValue)
            {
                ClearGridSelection();
                Event.current.Use();
            }
        }
 private void BeginAnimation(MarqueeType marqueeType, DoubleAnimation dAnim)
 {
     if (marqueeType == MarqueeType.LeftToRight)
     {
         tbmarquee.BeginAnimation(Canvas.LeftProperty, dAnim);
     }
     else if (marqueeType == MarqueeType.RightToLeft)
     {
         tbmarquee.BeginAnimation(Canvas.RightProperty, dAnim);
     }
     else if (marqueeType == MarqueeType.TopToBottom)
     {
         tbmarquee.BeginAnimation(Canvas.TopProperty, dAnim);
     }
     else if (marqueeType == MarqueeType.BottomToTop)
     {
         tbmarquee.BeginAnimation(Canvas.BottomProperty, dAnim);
     }
 }
Exemplo n.º 12
0
 public void StartMarqueeing(MarqueeType marqueeType)
 {
     if (marqueeType == MarqueeType.LeftToRight)
     {
         LeftToRightMarquee();
     }
     else if (marqueeType == MarqueeType.RightToLeft)
     {
         RightToLeftMarquee();
     }
     else if (marqueeType == MarqueeType.TopToBottom)
     {
         TopToBottomMarquee();
     }
     else if (marqueeType == MarqueeType.BottomToTop)
     {
         BottomToTopMarquee();
     }
 }
Exemplo n.º 13
0
 public void StartMarqueeing(MarqueeType marqueeType)
 {
     if (marqueeType == MarqueeType.LeftToRight)
     {
         LeftToRightMarquee();
     }
     else if (marqueeType == MarqueeType.RightToLeft)
     {
         RightToLeftMarquee();
     }
     else if (marqueeType == MarqueeType.TopToBottom)
     {
         TopToBottomMarquee();
     }
     else if (marqueeType == MarqueeType.BottomToTop)
     {
         BottomToTopMarquee();
     }
 }
Exemplo n.º 14
0
        /// <summary>
        ///     Marquees the label on hover.
        /// </summary>
        /// <param name="rect">The rect.</param>
        /// <param name="message">The message.</param>
        /// <param name="style">The style.</param>
        /// <param name="marqueeType">Type of the marquee.</param>
        /// <param name="scrollSpeed">The scroll speed.</param>
        /// <param name="withArea">if set to <c>true</c> [with area].</param>
        public static void MarqueeLabelOnHover(Rect rect, string message, GUIStyle style = null,
                                               MarqueeType marqueeType = MarqueeType.LeftToRight, Vector2 scrollSpeed = default, bool withArea = false)
        {
            // TODO: isNeeded flag doesn't work correctly
            var isNeeded = (style ?? GUI.skin.label).CalcSize(new GUIContent(message)).x > rect.width;

            //Rect orRect = GUILayoutUtility.GetLastRect();
            // FIX: BeginGroup doesn't work
            if (rect.Contains(Event.current.mousePosition) && isNeeded)
            {
                MarqueeLabel(rect, message, style, marqueeType, scrollSpeed, withArea);
            }
            else
            {
                if (!withArea)
                {
                    if (style == null)
                    {
                        GUI.Label(rect, message, GlobalStyles.CenteredLabelStyle);
                    }
                    else
                    {
                        GUI.Label(rect, message, style);
                    }
                }
                else
                {
                    GUILayout.BeginArea(rect);
                    {
                        if (style == null)
                        {
                            GUILayout.Label(message, GlobalStyles.CenteredLabelStyle);
                        }
                        else
                        {
                            GUILayout.Label(message, style);
                        }
                    }
                    GUILayout.EndArea();
                }
            }
        }
Exemplo n.º 15
0
        /// <summary>
        /// Scrollings the text.
        /// </summary>
        /// <param name="position">The position.</param>
        /// <param name="scrollSpeed">The scroll speed.</param>
        /// <param name="marqueeType">Type of the marquee.</param>
        /// <returns></returns>
        private static Vector2 ScrollingText(Vector2 position, Vector2 scrollSpeed, MarqueeType marqueeType)
        {
            switch (marqueeType)
            {
            case MarqueeType.LeftToRight:
                position.x -= Time.deltaTime * scrollSpeed.x;
                break;

            case MarqueeType.RightToLeft:
                position.x += Time.deltaTime * scrollSpeed.x;
                break;

            case MarqueeType.Upwards:
                position.y += Time.deltaTime * scrollSpeed.y;
                break;

            case MarqueeType.Downwards:
                position.y -= Time.deltaTime * scrollSpeed.y;
                break;
            }

            return(position);
        }
Exemplo n.º 16
0
        private void HandleBrushPicking()
        {
            Event evt = Event.current;

            if (evt.type == EventType.MouseDown && IsPickingEvent(evt) && !isHotControl)
            {
                m_TypeBeforeExecution = typeof(PaintTool);
                if (inEditMode && !TilemapEditorTool.IsActive(typeof(PickingTool)))
                {
                    m_TypeBeforeExecution = UnityEditor.EditorTools.ToolManager.activeToolType;
                    TilemapEditorTool.SetActiveEditorTool(typeof(PickingTool));
                }

                m_MarqueeStart            = mouseGridPosition;
                m_MarqueeType             = MarqueeType.Pick;
                s_LastActivePaintableGrid = this;
                Event.current.Use();
                GUI.changed           = true;
                GUIUtility.hotControl = m_PermanentControlID;
                OnBrushPickStarted();
            }
            if (evt.type == EventType.MouseDrag && isHotControl && m_MarqueeStart.HasValue && m_MarqueeType == MarqueeType.Pick && IsPickingEvent(evt))
            {
                RectInt rect = GridEditorUtility.GetMarqueeRect(m_MarqueeStart.Value, mouseGridPosition);
                OnBrushPickDragged(new BoundsInt(new Vector3Int(rect.xMin, rect.yMin, zPosition), new Vector3Int(rect.size.x, rect.size.y, 1)));
                Event.current.Use();
                GUI.changed = true;
            }
            if (evt.rawType == EventType.MouseUp && isHotControl && m_MarqueeStart.HasValue && m_MarqueeType == MarqueeType.Pick && IsPickingEvent(evt))
            {
                // Check if event only occurred in the PaintableGrid window as evt.type will filter for this
                if (evt.type == EventType.MouseUp && m_MarqueeType == MarqueeType.Pick)
                {
                    RectInt    rect  = GridEditorUtility.GetMarqueeRect(m_MarqueeStart.Value, mouseGridPosition);
                    Vector2Int pivot = GetMarqueePivot(m_MarqueeStart.Value, mouseGridPosition);
                    PickBrush(new BoundsInt(new Vector3Int(rect.xMin, rect.yMin, zPosition), new Vector3Int(rect.size.x, rect.size.y, 1)), new Vector3Int(pivot.x, pivot.y, 0));

                    if (inEditMode && UnityEditor.EditorTools.ToolManager.activeToolType != m_TypeBeforeExecution)
                    {
                        if (PickingIsDefaultTool() &&
                            (m_TypeBeforeExecution == typeof(EraseTool) ||
                             m_TypeBeforeExecution == typeof(MoveTool)))
                        {
                            // If Picking is default, change to a Paint Tool to facilitate editing if previous tool does not allow for painting
                            TilemapEditorTool.SetActiveEditorTool(typeof(PaintTool));
                        }
                        else
                        {
                            TilemapEditorTool.SetActiveEditorTool(m_TypeBeforeExecution);
                        }
                    }

                    GridPaletteBrushes.ActiveGridBrushAssetChanged();
                    s_LastActivePaintableGrid = this;
                    Event.current.Use();
                    GUI.changed = true;
                }
                else
                // Event occurred outside of PaintableGrid window, cancel the pick event
                {
                    OnBrushPickCancelled();
                }
                m_MarqueeType         = MarqueeType.None;
                m_MarqueeStart        = null;
                GUIUtility.hotControl = 0;
                InspectorWindow.RepaintAllInspectors();
            }
        }
Exemplo n.º 17
0
 /// <summary>
 ///     Marquees the label.
 /// </summary>
 /// <param name="rect">The rect.</param>
 /// <param name="message">The message.</param>
 /// <param name="style">The style.</param>
 /// <param name="marqueeType">Type of the marquee.</param>
 /// <param name="scrollSpeed">The scroll speed.</param>
 /// <param name="withArea">if set to <c>true</c> [with area].</param>
 public static void MarqueeLabel(Rect rect, string message, GUIStyle style = null,
                                 MarqueeType marqueeType = MarqueeType.LeftToRight, Vector2 scrollSpeed = default, bool withArea = false)
 {
     MarqueeLabel(rect, rect, message, style, marqueeType, scrollSpeed, withArea);
 }
Exemplo n.º 18
0
 /// <summary>
 ///     Marquees the label.
 /// </summary>
 /// <param name="rect">The rect.</param>
 /// <param name="enclosingArea">The enclosing area.</param>
 /// <param name="message">The message.</param>
 /// <param name="style">The style.</param>
 /// <param name="marqueeType">Type of the marquee.</param>
 /// <param name="scrollSpeed">The scroll speed.</param>
 /// <param name="withArea">if set to <c>true</c> [with area].</param>
 private static void MarqueeLabel(Rect rect, Rect enclosingArea, string message, GUIStyle style = null,
                                  MarqueeType marqueeType = MarqueeType.LeftToRight, Vector2 scrollSpeed = default, bool withArea = false)
 {
     MarqueeLabel(rect, enclosingArea, message, style, marqueeType, scrollSpeed, (object)withArea);
 }
Exemplo n.º 19
0
 /// <summary>
 ///     Marquees the label on hover with area.
 /// </summary>
 /// <param name="rect">The rect.</param>
 /// <param name="message">The message.</param>
 /// <param name="style">The style.</param>
 /// <param name="marqueeType">Type of the marquee.</param>
 /// <param name="scrollSpeed">The scroll speed.</param>
 public static void MarqueeLabelOnHoverWithArea(Rect rect, string message, GUIStyle style = null,
                                                MarqueeType marqueeType = MarqueeType.LeftToRight, Vector2 scrollSpeed = default)
 {
     MarqueeLabelOnHover(rect, message, style, marqueeType, scrollSpeed, true);
 }
Exemplo n.º 20
0
 /// <summary>
 ///     Marquees the label on hover.
 /// </summary>
 /// <param name="rect">The rect.</param>
 /// <param name="hoverRect">The hover rect.</param>
 /// <param name="relPosition">The relative position.</param>
 /// <param name="message">The message.</param>
 /// <param name="style">The style.</param>
 /// <param name="marqueeType">Type of the marquee.</param>
 /// <param name="scrollSpeed">The scroll speed.</param>
 /// <param name="withArea">if set to <c>true</c> [with area].</param>
 /// <exception cref="ArgumentNullException">relPosition</exception>
 public static void MarqueeLabelOnHover(
     Rect rect, Func <Vector2, Vector2> relPosition, string message, GUIStyle style = null,
     MarqueeType marqueeType = MarqueeType.LeftToRight, Vector2 scrollSpeed = default, bool withArea = false)
 {
     MarqueeLabelOnHover(rect, rect, relPosition, message, style, marqueeType, scrollSpeed, withArea);
 }
Exemplo n.º 21
0
        /// <summary>
        /// Marquees the label.
        /// </summary>
        /// <param name="rect">The rect.</param>
        /// <param name="enclosingArea">The enclosing area.</param>
        /// <param name="message">The message.</param>
        /// <param name="marqueeType">Type of the marquee.</param>
        /// <param name="scrollSpeed">The scroll speed.</param>
        public static void MarqueeLabel(Rect rect, Rect enclosingArea, string message, GUIStyle style = null, MarqueeType marqueeType = MarqueeType.LeftToRight, Vector2 scrollSpeed = default(Vector2))
        {
            // Create a default scroll if specified is null
            if (scrollSpeed == default(Vector2))
            {
                scrollSpeed = new Vector2(30f, 30f);
            }

            // Get rect from dictionary
            Rect messageRect = marqueePairs.AddAndGet(message, rect);

            //This increments the positions	accordingly
            messageRect.position = ScrollingText(messageRect.position, scrollSpeed, marqueeType);

            // This functions checks to see if the text has gone past the enclosing area
            // If it has, then it resets it
            messageRect = Reset(messageRect, enclosingArea);

            // Display the text...
            if (style == null)
            {
                GUI.Label(messageRect, message);
            }
            else
            {
                GUI.Label(messageRect, message, style);
            }

            // Update the marquee pair
            marqueePairs[message] = messageRect;
        }
Exemplo n.º 22
0
 /// <summary>
 /// Marquees the label.
 /// </summary>
 /// <param name="rect">The rect.</param>
 /// <param name="message">The message.</param>
 /// <param name="marqueeType">Type of the marquee.</param>
 /// <param name="scrollSpeed">The scroll speed.</param>
 public static void MarqueeLabel(Rect rect, string message, GUIStyle style = null, MarqueeType marqueeType = MarqueeType.LeftToRight, Vector2 scrollSpeed = default(Vector2))
 {
     MarqueeLabel(rect, rect, message, style, marqueeType, scrollSpeed);
 }