Esempio n. 1
0
        private static bool TryGetPrefabGUID(UnityEngine.Object gameObject, out string assetGUID)
        {
            PrefabType prefabType = PrefabUtility.GetPrefabType(gameObject);

            UnityEngine.Object @object = null;
            if (prefabType == PrefabType.PrefabInstance)
            {
                @object = PrefabUtility.GetPrefabParent(gameObject);
            }
            else if (prefabType == PrefabType.Prefab)
            {
                @object = gameObject;
            }
            bool result = false;

            if (@object == null)
            {
                assetGUID = string.Empty;
            }
            else
            {
                result = AssetAccess.TryGetAssetGUIDFromDatabase(@object, out assetGUID);
            }
            return(result);
        }
Esempio n. 2
0
        public static bool TryGetSoftlockCount(UnityEngine.Object objectWithGUID, out int count)
        {
            string assetGuid = null;

            AssetAccess.TryGetAssetGUIDFromObject(objectWithGUID, out assetGuid);
            return(SoftLockData.TryGetSoftlockCount(assetGuid, out count));
        }
Esempio n. 3
0
        public static bool TryHasSoftLocks(UnityEngine.Object objectWithGUID, out bool hasSoftLocks)
        {
            string assetGuid = null;

            AssetAccess.TryGetAssetGUIDFromObject(objectWithGUID, out assetGuid);
            return(SoftLockData.TryHasSoftLocks(assetGuid, out hasSoftLocks));
        }
Esempio n. 4
0
        public static List <string> GetLockNamesOnObject(UnityEngine.Object objectWithGUID)
        {
            string assetGuid = null;

            AssetAccess.TryGetAssetGUIDFromObject(objectWithGUID, out assetGuid);
            return(SoftLockUIData.GetLocksNamesOnAsset(assetGuid));
        }
        // Provides the number of additional users editing the given object.
        // Failure: assigns 0 to count, return false.
        // Success: assigns a value in [0, n] to count, returns true.
        public static bool TryGetSoftlockCount(UnityEngine.Object objectWithGUID, out int count)
        {
            string assetGUID = null;

            AssetAccess.TryGetAssetGUIDFromObject(objectWithGUID, out assetGUID);
            bool success = TryGetSoftlockCount(assetGUID, out count);

            return(success);
        }
        // The usernames of additional people editing the given 'objectWithGUID'.
        // Defaults to an empty list.
        public static List <string> GetLockNamesOnObject(UnityEngine.Object objectWithGUID)
        {
            string assetGUID = null;

            AssetAccess.TryGetAssetGUIDFromObject(objectWithGUID, out assetGUID);
            List <string> names = GetLocksNamesOnAsset(assetGUID);

            return(names);
        }
        public static bool IsPrefab(string assetGUID)
        {
            bool isPrefab = false;

            UnityEngine.Object unityObject;
            if (AssetAccess.TryGetAssetFromGUID(assetGUID, out unityObject))
            {
                isPrefab = IsPrefab(unityObject);
            }
            return(isPrefab);
        }
Esempio n. 8
0
        public static bool IsPrefab(string assetGUID)
        {
            bool result = false;

            UnityEngine.Object unityObject;
            if (AssetAccess.TryGetAssetFromGUID(assetGUID, out unityObject))
            {
                result = SoftLockData.IsPrefab(unityObject);
            }
            return(result);
        }
        private static bool TryGetLocksOnObject(UnityEngine.Object objectWithGUID, out List <SoftLock> softLocks)
        {
            bool   success   = false;
            string assetGUID = null;

            if (AssetAccess.TryGetAssetGUIDFromObject(objectWithGUID, out assetGUID))
            {
                success = TryGetLocksOnAssetGUID(assetGUID, out softLocks);
            }
            else
            {
                softLocks = new List <SoftLock>();
            }
            return(success);
        }
Esempio n. 10
0
        private static bool TryGetLocksOnObject(UnityEngine.Object objectWithGUID, out List <SoftLock> softLocks)
        {
            bool   result    = false;
            string assetGuid = null;

            if (AssetAccess.TryGetAssetGUIDFromObject(objectWithGUID, out assetGuid))
            {
                result = SoftLockData.TryGetLocksOnAssetGUID(assetGuid, out softLocks);
            }
            else
            {
                softLocks = new List <SoftLock>();
            }
            return(result);
        }
Esempio n. 11
0
        public static bool TryGetAssetGUIDFromObject(UnityEngine.Object objectWithGUID, out string assetGUID)
        {
            if (objectWithGUID == null)
            {
                throw new ArgumentNullException("objectWithGuid");
            }
            bool result = false;

            if (objectWithGUID.GetType() == typeof(SceneAsset))
            {
                result = AssetAccess.TryGetAssetGUIDFromDatabase(objectWithGUID, out assetGUID);
            }
            else if (objectWithGUID.GetType() == typeof(GameObject))
            {
                result = AssetAccess.TryGetPrefabGUID(objectWithGUID, out assetGUID);
            }
            else
            {
                assetGUID = string.Empty;
            }
            return(result);
        }