/// <summary>
        /// Triggered when the user drops a new resource onto the field, or clears the current value.
        /// </summary>
        /// <param name="newValue">New resource to reference.</param>
        private void OnFieldValueChanged(RRefBase newValue)
        {
            Resource res = Resources.Load <Resource>(newValue.UUID);

            property.SetValue(res);
            state = InspectableState.Modified;
        }
예제 #2
0
 /// <summary>
 /// Triggered by the runtime when the value of the field changes.
 /// </summary>
 /// <param name="newValue">New resource referenced by the field.</param>
 private void DoOnChanged(RRefBase newValue)
 {
     if (OnChanged != null)
     {
         OnChanged(newValue);
     }
 }
예제 #3
0
파일: Resources.cs 프로젝트: nanze81/bsf
        /// <summary>
        /// Returns the loading progress of a resource that's being asynchronously loaded.
        /// </summary>
        /// <param name="resource">Resource whose load progress to check.</param>
        /// <param name="includeDependencies">If false the progress will reflect the load progress only for this individual
        ///                                   resource. If true the progress will reflect load progress of this resource
        ///                                   and all of its dependencies.</param>
        /// <returns>Load progress in range [0, 1].</returns>
        public static float GetLoadProgress(RRefBase resource, bool includeDependencies = true)
        {
            if (resource == null)
            {
                return(0.0f);
            }

            return(Internal_GetLoadProgress(resource.GetCachedPtr(), includeDependencies));
        }
예제 #4
0
파일: Resources.cs 프로젝트: nanze81/bsf
        /// <summary>
        /// Releases an internal reference to the resource held by the resources system. This allows the resource
        ///	to be unloaded when it goes out of scope, if the resource was loaded with "keepLoaded" parameter.
        ///
        /// Alternatively you can also skip manually calling <see cref="Release(RRefBase)"/> and call <see cref="UnloadUnused"/>
        /// which will unload all resources that do not have any external references, but you lose the fine grained control
        /// of what will be unloaded.
        /// </summary>
        /// <param name="resource">Resource to release</param>
        public static void Release(RRefBase resource)
        {
            if (resource == null)
            {
                return;
            }

            Internal_ReleaseRef(resource.GetCachedPtr());
        }
예제 #5
0
        /// <summary>
        /// Triggered when the user drops a new resource onto the field, or clears the current value.
        /// </summary>
        /// <param name="newValue">New resource to reference.</param>
        private void OnFieldValueChanged(RRefBase newValue)
        {
            if (newValue != null && !newValue.IsLoaded && style.StyleFlags.HasFlag(InspectableFieldStyleFlags.LoadOnAssign))
            {
                Resources.Load <Resource>(newValue.UUID);
            }

            property.SetValue(newValue);
            state = InspectableState.Modified;
        }
예제 #6
0
        public bool Equals(RRefBase other)
        {
            if (ReferenceEquals(other, null))
            {
                return(false);
            }

            Internal_GetUUID(mCachedPtr, out var lhs);
            Internal_GetUUID(other.mCachedPtr, out var rhs);

            return(lhs.Equals(rhs));
        }
        /// <summary>
        /// Triggered when the user drops a new resource onto the field, or clears the current value.
        /// </summary>
        /// <param name="newValue">New resource to reference.</param>
        private void OnFieldValueChanged(RRefBase newValue)
        {
            if (property.Type == SerializableProperty.FieldType.Resource)
            {
                property.SetValue(newValue.GenericValue);
            }
            else
            {
                property.SetValue(newValue);
            }

            state = InspectableState.Modified;
        }
예제 #8
0
        /// <inheritdoc/>
        public override bool Equals(object other)
        {
            if (ReferenceEquals(other, null))
            {
                return(false);
            }

            if (!(other is RRefBase))
            {
                return(false);
            }

            RRefBase otherRef = (RRefBase)other;

            Internal_GetUUID(mCachedPtr, out var lhs);
            Internal_GetUUID(otherRef.mCachedPtr, out var rhs);

            return(lhs.Equals(rhs));
        }
예제 #9
0
 /// <summary>
 /// Triggered when the user drops a new resource onto the field, or clears the current value.
 /// </summary>
 /// <param name="newValue">New resource to reference.</param>
 private void OnFieldValueChanged(RRefBase newValue)
 {
     property.SetValue(newValue);
     state = InspectableState.Modified;
 }
예제 #10
0
 private static extern void Internal_SetValueRef(IntPtr nativeInstance, RRefBase value);