public T Resolve(IExposedPropertyTable resolver)
 {
     if (resolver != null)
     {
         bool   flag;
         Object referenceValue = resolver.GetReferenceValue(this.exposedName, out flag);
         if (flag)
         {
             return(referenceValue as T);
         }
     }
     return(this.defaultValue as T);
 }
Ejemplo n.º 2
0
        public T Resolve(IExposedPropertyTable resolver)
        {
            if (resolver != null)
            {
                bool   isValid;
                Object result = resolver.GetReferenceValue(exposedName, out isValid);
                if (isValid)
                {
                    return(result as T);
                }
            }

            return(defaultValue as T);
        }
Ejemplo n.º 3
0
        public static void CloneExposedReferences(ScriptableObject clone, IExposedPropertyTable sourceTable, IExposedPropertyTable destTable)
        {
            var cloneObject         = new SerializedObject(clone);
            SerializedProperty prop = cloneObject.GetIterator();

            while (prop.Next(true))
            {
                if (prop.propertyType == SerializedPropertyType.ExposedReference)
                {
                    var exposedNameProp = prop.FindPropertyRelative("exposedName");
                    var sourceKey       = exposedNameProp.stringValue;
                    var destKey         = sourceKey;

                    if (!IsExposedReferenceExplicitlyNamed(sourceKey))
                    {
                        destKey = GenerateExposedReferenceName();
                    }

                    exposedNameProp.stringValue = destKey;

                    var requiresCopy = sourceTable != destTable || sourceKey != destKey;
                    if (requiresCopy && sourceTable != null && destTable != null)
                    {
                        var valid  = false;
                        var target = sourceTable.GetReferenceValue(sourceKey, out valid);
                        if (valid && target != null)
                        {
                            var existing = destTable.GetReferenceValue(destKey, out valid);
                            if (!valid || existing != target)
                            {
                                var destTableObj = destTable as UnityEngine.Object;
                                if (destTableObj != null)
                                {
                                    TimelineUndo.PushUndo(destTableObj, "Create Clip");
                                }
                                destTable.SetReferenceValue(destKey, target);
                            }
                        }
                    }
                }
            }
            cloneObject.ApplyModifiedPropertiesWithoutUndo();
        }
Ejemplo n.º 4
0
        public T Resolve(IExposedPropertyTable resolver)
        {
            bool flag = resolver != null;
            T    result;

            if (flag)
            {
                bool   flag2;
                Object referenceValue = resolver.GetReferenceValue(this.exposedName, out flag2);
                bool   flag3          = flag2;
                if (flag3)
                {
                    result = (referenceValue as T);
                    return(result);
                }
            }
            result = (this.defaultValue as T);
            return(result);
        }
Ejemplo n.º 5
0
    protected UnityEngine.Object Resolve(PropertyName exposedPropertyName, IExposedPropertyTable exposedPropertyTable, UnityEngine.Object defaultValue, out BaseExposedPropertyDrawer.OverrideState currentOverrideState)
    {
        UnityEngine.Object @object = null;
        bool flag  = false;
        bool flag2 = !PropertyName.IsNullOrEmpty(exposedPropertyName);

        currentOverrideState = BaseExposedPropertyDrawer.OverrideState.DefaultValue;
        if (exposedPropertyTable != null)
        {
            @object = exposedPropertyTable.GetReferenceValue(exposedPropertyName, out flag);
            if (flag)
            {
                currentOverrideState = BaseExposedPropertyDrawer.OverrideState.Overridden;
            }
            else if (flag2)
            {
                currentOverrideState = BaseExposedPropertyDrawer.OverrideState.MissingOverride;
            }
        }
        return((currentOverrideState != BaseExposedPropertyDrawer.OverrideState.Overridden) ? defaultValue : @object);
    }
    public static int GetReferenceValue(IntPtr l)
    {
        int result;

        try
        {
            IExposedPropertyTable exposedPropertyTable = (IExposedPropertyTable)LuaObject.checkSelf(l);
            PropertyName          id;
            LuaObject.checkValueType <PropertyName>(l, 2, out id);
            bool b;
            UnityEngine.Object referenceValue = exposedPropertyTable.GetReferenceValue(id, out b);
            LuaObject.pushValue(l, true);
            LuaObject.pushValue(l, referenceValue);
            LuaObject.pushValue(l, b);
            result = 3;
        }
        catch (Exception e)
        {
            result = LuaObject.error(l, e);
        }
        return(result);
    }
Ejemplo n.º 7
0
        protected Object Resolve(PropertyName exposedPropertyName, IExposedPropertyTable exposedPropertyTable,
                                 Object defaultValue, out OverrideState currentOverrideState)
        {
            Object @object = null;
            bool   idValid = false;
            bool   flag    = !PropertyName.IsNullOrEmpty(exposedPropertyName);

            currentOverrideState = OverrideState.DefaultValue;
            if (exposedPropertyTable != null)
            {
                @object = exposedPropertyTable.GetReferenceValue(exposedPropertyName, out idValid);
                if (idValid)
                {
                    currentOverrideState = OverrideState.Overridden;
                }
                else if (flag)
                {
                    currentOverrideState = OverrideState.MissingOverride;
                }
            }

            return((currentOverrideState == OverrideState.Overridden) ? @object : defaultValue);
        }
    protected Object Resolve(PropertyName exposedPropertyName, IExposedPropertyTable exposedPropertyTable, Object defaultValue, out OverrideState currentOverrideState)
    {
        Object objReference         = null;
        bool   propertyFoundInTable = false;
        var    propertyIsNamed      = !PropertyName.IsNullOrEmpty(exposedPropertyName);

        currentOverrideState = OverrideState.DefaultValue;

        if (exposedPropertyTable != null)
        {
            objReference = exposedPropertyTable.GetReferenceValue(exposedPropertyName, out propertyFoundInTable);

            if (propertyFoundInTable)
            {
                currentOverrideState = OverrideState.Overridden;
            }
            else if (propertyIsNamed)
            {
                currentOverrideState = OverrideState.MissingOverride;
            }
        }

        return(currentOverrideState == OverrideState.Overridden ? objReference : defaultValue);
    }