Esempio n. 1
0
 public void OnAfterDeserialize()
 {
     if (!string.IsNullOrEmpty(_constraint))
     {
         Constraint = VariableHandler.LoadConstraint(ref _constraint, ref _objects);
     }
 }
        protected internal override VariableValue CreateDefault_(VariableConstraint constraint)
        {
            IVariableStore store;

            if (constraint is StoreVariableConstraint storeConstraint && storeConstraint.Schema != null)
            {
                store = new ConstrainedStore(storeConstraint.Schema);
            }
Esempio n. 3
0
 public static ValueDefinition Create(VariableType type, VariableConstraint constraint)
 {
     return(new ValueDefinition
     {
         _type = type,
         _isTypeLocked = type != VariableType.Empty,
         _isConstraintLocked = constraint != null,
         Constraint = constraint
     });
 }
 protected internal override VariableValue CreateDefault_(VariableConstraint constraint)
 {
     if (constraint is StringVariableConstraint stringConstraint)
     {
         return(VariableValue.Create(stringConstraint.Values.Length > 0 ? stringConstraint.Values[0] : string.Empty));
     }
     else
     {
         return(VariableValue.Create(string.Empty));
     }
 }
Esempio n. 5
0
 protected internal override VariableValue CreateDefault_(VariableConstraint constraint)
 {
     if (constraint is IntVariableConstraint intConstraint)
     {
         return(VariableValue.Create(intConstraint.Minimum));
     }
     else
     {
         return(VariableValue.Create(0));
     }
 }
 protected internal override VariableValue CreateDefault_(VariableConstraint constraint)
 {
     if (constraint is EnumVariableConstraint enumConstraint)
     {
         return(VariableValue.Create((Enum)Enum.ToObject(enumConstraint.Type, 0)));
     }
     else
     {
         return(VariableValue.Empty);
     }
 }
        protected internal override void Read(BinaryReader reader, IList <Object> objects, short version)
        {
            ItemType = (VariableType)reader.ReadInt32();

            var constrained = reader.ReadBoolean();

            if (constrained)
            {
                ItemConstraint = VariableHandler.ReadConstraint(reader, objects, version);
            }
        }
 protected internal override VariableValue CreateDefault_(VariableConstraint constraint)
 {
     if (constraint is FloatVariableConstraint floatConstraint)
     {
         return(VariableValue.Create(floatConstraint.Minimum));
     }
     else
     {
         return(VariableValue.Create(0.0f));
     }
 }
Esempio n. 9
0
 public static ValueDefinition Create(VariableType type, VariableConstraint constraint, string tag, Expression initializer, bool isTypeLocked, bool isConstraintLocked)
 {
     return(new ValueDefinition
     {
         _type = type,
         _isTypeLocked = isTypeLocked,
         _isConstraintLocked = isConstraintLocked,
         Constraint = constraint,
         _tag = tag,
         _initializer = initializer
     });
 }
Esempio n. 10
0
        private static string WriteConstraint(VariableType type, VariableConstraint constraint, List <Object> objects)
        {
            using (var stream = new MemoryStream())
            {
                using (var writer = new BinaryWriter(stream))
                {
                    WriteVersion(writer);
                    WriteConstraint(type, constraint, writer, objects);
                }

                return(GetString(stream.ToArray()));
            }
        }
Esempio n. 11
0
 protected internal override VariableValue CreateDefault_(VariableConstraint constraint) => VariableValue.Create(Color.black);
Esempio n. 12
0
 protected internal override VariableValue CreateDefault_(VariableConstraint constraint) => VariableValue.Create(new Bounds());
 protected internal override VariableValue CreateDefault_(VariableConstraint constraint)
 {
     return(VariableValue.Create(new Vector3()));
 }
Esempio n. 14
0
 protected internal override VariableValue CreateDefault_(VariableConstraint constraint) => VariableValue.Create(false);
Esempio n. 15
0
 public static string SaveConstraint(VariableType type, VariableConstraint constraint, ref List <Object> objects)
 {
     objects = new List <Object>();
     return(WriteConstraint(type, constraint, objects));
 }
 protected internal override VariableValue CreateDefault_(VariableConstraint constraint)
 {
     return(VariableValue.Create((Object)null));
 }
 protected internal override VariableValue CreateDefault_(VariableConstraint constraint)
 {
     return(VariableValue.Create(Quaternion.identity));
 }
Esempio n. 18
0
 internal static void WriteConstraint(VariableType type, VariableConstraint constraint, BinaryWriter writer, IList <Object> objects)
 {
     writer.Write((int)type);
     constraint.Write(writer, objects);
 }
Esempio n. 19
0
 protected internal abstract VariableValue CreateDefault_(VariableConstraint constraint);
Esempio n. 20
0
 public static VariableValue CreateDefault(VariableType type, VariableConstraint constraint) => Get(type).CreateDefault_(constraint);