A game about forced loneliness, made by TACStudios
at master 67 lines 2.6 kB view raw
1using UnityEngine; 2 3namespace UnityEditor.Tilemaps 4{ 5 internal class TilePaletteMouseCursorUtility 6 { 7 internal static class MouseStyles 8 { 9 // The following paths match the enums in OperatingSystemFamily 10 public static readonly string[] mouseCursorOSPath = 11 { 12 "", // Other OS 13 "Cursors/macOS", 14 "Cursors/Windows", 15 "Cursors/Linux", 16 }; 17 // The following paths match the enums in OperatingSystemFamily 18 public static readonly Vector2[] mouseCursorOSHotspot = 19 { 20 Vector2.zero, // Other OS 21 new Vector2(6f, 4f), 22 new Vector2(6f, 4f), 23 new Vector2(6f, 4f), 24 }; 25 // The following paths match the enums in sceneViewEditModes above 26 public static readonly string[] mouseCursorTexturePaths = 27 { 28 "", 29 "Grid.MoveTool.png", 30 "Grid.PaintTool.png", 31 "Grid.BoxTool.png", 32 "Grid.PickingTool.png", 33 "Grid.EraserTool.png", 34 "Grid.FillTool.png", 35 }; 36 public static readonly Texture2D[] mouseCursorTextures; 37 38 public static readonly GridBrushBase.Tool[] sceneViewEditModes = 39 { 40 GridBrushBase.Tool.Select, 41 GridBrushBase.Tool.Move, 42 GridBrushBase.Tool.Paint, 43 GridBrushBase.Tool.Box, 44 GridBrushBase.Tool.Pick, 45 GridBrushBase.Tool.Erase, 46 GridBrushBase.Tool.FloodFill 47 }; 48 49 static MouseStyles() 50 { 51 mouseCursorTextures = new Texture2D[mouseCursorTexturePaths.Length]; 52 int osIndex = (int)SystemInfo.operatingSystemFamily; 53 for (int i = 0; i < mouseCursorTexturePaths.Length; ++i) 54 { 55 if ((mouseCursorOSPath[osIndex] != null && mouseCursorOSPath[osIndex].Length > 0) 56 && (mouseCursorTexturePaths[i] != null && mouseCursorTexturePaths[i].Length > 0)) 57 { 58 string cursorPath = Utils.Paths.Combine(mouseCursorOSPath[osIndex], mouseCursorTexturePaths[i]); 59 mouseCursorTextures[i] = EditorGUIUtility.LoadRequired(cursorPath) as Texture2D; 60 } 61 else 62 mouseCursorTextures[i] = null; 63 } 64 } 65 } 66 } 67}