예제 #1
0
        public static CursorManagerData Load()
        {
            string            path = "CoreScript/Cursor";
            CursorManagerData cursorManagerData = Resources.Load <CursorManagerData>(path + "/CursorManagerData");

            if (cursorManagerData != null)
            {
                return(cursorManagerData);
            }
#if UNITY_EDITOR
            string additionalPath = Application.dataPath + "/Resources/" + path;
            cursorManagerData = CreateInstance <CursorManagerData>();

            if (!Directory.Exists(additionalPath))
            {
                Directory.CreateDirectory(additionalPath);
            }

            UnityEditor.AssetDatabase.CreateAsset(cursorManagerData, "Assets/Resources/" + path + "/CursorManagerData.asset");
            UnityEditor.AssetDatabase.SaveAssets();
            UnityEditor.AssetDatabase.Refresh();
            Debug.LogWarning("Could not find CursorManagerData asset. Will use default settings instead.");
            return(cursorManagerData);
#else
            return(null);
#endif
        }
예제 #2
0
        public void SetActiveCursorAnimation(CursorType cursorType, bool isUI = false)
        {
            if (onUI && !isUI)
            {
                return;
            }

            CursorManagerData.SetActiveCursorAnimation(cursorType);
            CurrentCursorAnimation = CursorManagerData.CurrentCursorAnimation;
            timer = CursorManagerData.CurrentCursorAnimation.FrameRate;
            Cursor.SetCursor(CursorManagerData.CurrentCursorAnimation[0], CursorManagerData.CurrentCursorAnimation.HotSpot, CursorMode.Auto);
        }
예제 #3
0
        public static bool OpenEditor(int instanceId, int line)
        {
            CursorManagerData obj = EditorUtility.InstanceIDToObject(instanceId) as CursorManagerData;

            if (obj == null)
            {
                return(false);
            }

            CursorManagerDataEditor.Open(obj);
            return(true);
        }
예제 #4
0
        public static void Open(CursorManagerData cursorManagerData)
        {
            // Get existing open window or if none, make a new one:
            CursorManagerDataEditor window = (CursorManagerDataEditor)GetWindow(typeof(CursorManagerDataEditor));

            window.CursorManagerData = cursorManagerData;
            window.serializedObject  = new SerializedObject(cursorManagerData);

            if (cursorManagerData.CurrentCursorAnimation != null)
            {
                window.timer = cursorManagerData.CurrentCursorAnimation.FrameRate;
            }
            window.cursorTypeName = "";
            window.Show();
        }