public static Cursor GetCursor(CursorSet cursorSet)
        {
            if (cursorInstance == null)
                cursorInstance = LoadCursors();

            return CursorLibrary.cursorInstance[(int)cursorSet];
        }
Exemple #2
0
        private CursorSet AddSet(string name)
        {
            CursorSet set = CursorSet.Empty();

            set.name = name;
            string[] paths, guids;
            FindTextures(out paths, out guids, 2);
            string path = CursorFolderName.ToLower() + name.ToLower() + "/";

            for (int i = 0; i < set.cursors.Length; ++i)
            {
                Cursor c           = set.cursors[i];
                string textureName = path + c.name.ToLower();
                int    index       = Array.FindIndex(paths, s => s.ToLower().StartsWith(textureName));
                if (index >= 0)
                {
                    Texture2D t = (Texture2D)UnityEditor.AssetDatabase.LoadAssetAtPath(
                        UnityEditor.AssetDatabase.GUIDToAssetPath(guids[index]), typeof(Texture2D));
                    c.texture = t;
                }
                else
                {
                    Debug.Log(textureName + " not found");
                }
            }
            Array.Resize(ref cursors, cursors.Length + 1);
            cursors[cursors.Length - 1] = set;
            return(set);
        }
Exemple #3
0
        public static Cursor GetCursor(CursorSet cursorSet)
        {
            if (cursorInstance == null)
            {
                cursorInstance = LoadCursors();
            }

            return(CursorLibrary.cursorInstance[(int)cursorSet]);
        }
Exemple #4
0
            private void SetCurrentState(State newState)
            {
                if (newState == this.currentState)
                {
                    return; // No state changes
                }
                // Exiting from current state
                if (State.None != this.currentState)
                {
                    switch (this.currentState)
                    {
                    case State.WindowSelection:
                        CancelWindowSelection();
                        break;

                    case State.Connection:
                        CancelConnection();
                        break;
                    }
                }

                // Entering into a new state
                CursorSet cursorToUse = CursorSet.Pointer;

                switch (newState)
                {
                case State.WindowSelection:
                    cursorToUse = CursorSet.RectangularSelection;
                    owningWorkspace.IsCursorForced = true;
                    break;

                case State.Connection:
                    cursorToUse = CursorSet.ArcAdding;
                    owningWorkspace.IsCursorForced = true;
                    break;

                case State.PanMode:
                    cursorToUse = CursorSet.HandPan;
                    owningWorkspace.IsCursorForced = true;
                    break;

                case State.OrbitMode:
                    cursorToUse = CursorSet.HandPan;
                    owningWorkspace.IsCursorForced = true;
                    break;

                case State.None:
                    cursorToUse = CursorSet.Pointer;
                    owningWorkspace.IsCursorForced = false;
                    break;
                }

                owningWorkspace.CurrentCursor = CursorLibrary.GetCursor(cursorToUse);
                this.currentState             = newState; // update state
            }
Exemple #5
0
            public static CursorSet Empty()
            {
                CursorSet set = new CursorSet {
                    name = "cursors", cursors = new Cursor[Enum.GetValues(typeof(CursorType)).Length]
                };

                for (int i = 0; i < set.cursors.Length; ++i)
                {
                    set.cursors[i] = new Cursor {
                        name = ((CursorType)i).ToString(), hotspot = new Vector2(11, 11)
                    };
                }
                set.cursors[((int)CursorType.Add)].hotspot      = Vector2.zero;
                set.cursors[((int)CursorType.Subtract)].hotspot = Vector2.zero;
                set.cursors[((int)CursorType.Shortcut)].hotspot = Vector2.zero;
                return(set);
            }
Exemple #6
0
        /// <summary>
        /// Gets the cursor.
        /// </summary>
        /// <returns>Cursor.</returns>
        public Cursor GetCursor()
        {
            if (_cursor == null)
            {
                _cursor = string.Empty;
            }

            if (CursorSet.ContainsKey(_cursor))
            {
                return(CursorSet[_cursor]);
            }
            else if (CursorSet.ContainsKey("default"))
            {
                return(CursorSet["default"]);
            }

            return(null);
        }
 public CursorSetViewModel(CursorSet model, string tag) : base(model, tag)
 {
 }
Exemple #8
0
        private static Colors Read_Colors(Stream s, Flags flags, ColorOffsets offsets)
        {
            var colors = new Colors();

            using (var br = new BinaryReader(s, Encoding.ASCII, true))
            {
                // Top Solid
#if SKIP_COLOR_NOT_SET
                if (flags.TopDrawType == TopDrawType.SolidColor || flags.TopDrawType == TopDrawType.SolidColorTexture)
#endif
                {
                    s.Position = offsets.TopBackground;
                    var sevenBytes = flags.TopDrawType == TopDrawType.SolidColorTexture;
                    colors.TopBackground = TopBackgroundSet.Read(br, sevenBytes);
                }
#if SKIP_COLOR_NOT_SET
                else
                {
                    colors.TopBackground = new TopBackgroundSet();
                }
#endif

                // Cursor
#if SKIP_COLOR_NOT_SET
                if (flags.CursorColor)
#endif

                {
                    s.Position    = offsets.Cursor;
                    colors.Cursor = CursorSet.Read(br);
                }
#if SKIP_COLOR_NOT_SET
                else
                {
                    colors.Cursor = new CursorSet();
                }
#endif

                // 3D Folder
#if SKIP_COLOR_NOT_SET
                if (flags.FolderColor)
#endif

                {
                    s.Position    = offsets.Folder;
                    colors.Folder = FolderSet.Read(br);
                }
#if SKIP_COLOR_NOT_SET
                else
                {
                    colors.Folder = new FolderSet();
                }
#endif

                // 3D File
#if SKIP_COLOR_NOT_SET
                if (flags.FileColor)
#endif

                {
                    s.Position  = offsets.File;
                    colors.File = FileSet.Read(br);
                }
#if SKIP_COLOR_NOT_SET
                else
                {
                    colors.File = new FileSet();
                }
#endif

                // Arrow Button
#if SKIP_COLOR_NOT_SET
                if (flags.ArrowButtonColor)
#endif

                {
                    s.Position         = offsets.ArrowButton;
                    colors.ArrowButton = ArrowButtonSet.Read(br);
                }
#if SKIP_COLOR_NOT_SET
                else
                {
                    colors.ArrowButton = new ArrowButtonSet();
                }
#endif

                // Arrows
#if SKIP_COLOR_NOT_SET
                if (flags.ArrowColor)
#endif

                {
                    s.Position   = offsets.Arrow;
                    colors.Arrow = ArrowSet.Read(br);
                }
#if SKIP_COLOR_NOT_SET
                else
                {
                    colors.Arrow = new ArrowSet();
                }
#endif

                // Open Button
#if SKIP_COLOR_NOT_SET
                if (flags.OpenCloseColor)
#endif

                {
                    s.Position  = offsets.Open;
                    colors.Open = OpenCloseSet.Read(br);

                    s.Position   = offsets.Close;
                    colors.Close = OpenCloseSet.Read(br);
                }
#if SKIP_COLOR_NOT_SET
                else
                {
                    colors.Open  = new OpenCloseSet();
                    colors.Close = new OpenCloseSet();
                }
#endif

                // Game Text
#if SKIP_COLOR_NOT_SET
                if (flags.GameTextDrawType)
#endif

                {
                    s.Position      = offsets.GameText;
                    colors.GameText = GameTextSet.Read(br);
                }
#if SKIP_COLOR_NOT_SET
                else
                {
                    colors.GameText = new GameTextSet();
                }
#endif

                // Bottom Solid
#if SKIP_COLOR_NOT_SET
                if (flags.BottomBackgroundInnerColor)
#endif

                {
                    s.Position = offsets.BottomSolid;
                    colors.BottomBackgroundInner = BottomBackgroundInnerSet.Read(br);
                }
#if SKIP_COLOR_NOT_SET
                else
                {
                    colors.BottomBackgroundInner = new BottomBackgroundInnerSet();
                }
#endif

                // Bottom Outer
#if SKIP_COLOR_NOT_SET
                if (flags.BottomBackgroundOuterColor)
#endif

                {
                    s.Position = offsets.BottomOuter;
                    colors.BottomBackgroundOuter = BottomBackgroundOuterSet.Read(br);
                }
#if SKIP_COLOR_NOT_SET
                else
                {
                    colors.BottomBackgroundOuter = new BottomBackgroundOuterSet();
                }
#endif

                // Folder BG
#if SKIP_COLOR_NOT_SET
                if (flags.FolderBackgroundColor)
#endif

                {
                    s.Position = offsets.FolderBackground;
                    colors.FolderBackground = BottomBackgroundInnerSet.Read(br);
                }
#if SKIP_COLOR_NOT_SET
                else
                {
                    colors.FolderBackground = new BottomBackgroundInnerSet();
                }
#endif

                // Folder Arr
#if SKIP_COLOR_NOT_SET
                if (flags.FolderArrowColor)
#endif

                {
                    s.Position         = offsets.FolderArrow;
                    colors.FolderArrow = FolderArrowSet.Read(br);
                }
#if SKIP_COLOR_NOT_SET
                else
                {
                    colors.FolderArrow = new FolderArrowSet();
                }
#endif

                // Bottom Corner
#if SKIP_COLOR_NOT_SET
                if (flags.BottomCornerButtonColor)
#endif

                {
                    s.Position = offsets.BottomCornerButton;
                    colors.BottomCornerButton = BottomCorner.Read(br);
                }
#if SKIP_COLOR_NOT_SET
                else
                {
                    colors.BottomCornerButton = new BottomCorner();
                }
#endif

                // Top Corner
#if SKIP_COLOR_NOT_SET
                if (flags.TopCornerButtonColor)
#endif

                {
                    s.Position             = offsets.TopCornerButton;
                    colors.TopCornerButton = TopCornerSet.Read(br);
                }
#if SKIP_COLOR_NOT_SET
                else
                {
                    colors.TopCornerButton = new TopCornerSet();
                }
#endif

                // Demo Text
#if SKIP_COLOR_NOT_SET
                if (flags.DemoTextColor)
#endif

                {
                    s.Position      = offsets.DemoText;
                    colors.DemoText = DemoTextSet.Read(br);
                }
#if SKIP_COLOR_NOT_SET
                else
                {
                    colors.DemoText = new DemoTextSet();
                }
#endif
            }
            return(colors);
        }