Esempio n. 1
0
        public static ITweakable MakeTweakableFromInfo <T>(TweakableInfo <T> info, out object virtualFieldRef)
        {
            VirtualField <T> virtualField = new VirtualField <T>();
            ITweakable       result       = new BaseTweakable <T>(info, virtualField);

            virtualFieldRef = virtualField;
            return(result);
        }
Esempio n. 2
0
 public StepTweakable(BaseTweakable <T> baseTweakable)
 {
     this.baseTweakable = baseTweakable;
     if (TweakableType.IsPrimitive)
     {
         addMethod      = typeof(PrimitiveHelper).GetMethod("Add", BindingFlags.Static | BindingFlags.Public);
         subtractMethod = typeof(PrimitiveHelper).GetMethod("Subtract", BindingFlags.Static | BindingFlags.Public);
     }
     else
     {
         addMethod      = TweakableType.GetMethod("op_Addition", BindingFlags.Static | BindingFlags.Public);
         subtractMethod = TweakableType.GetMethod("op_Subtraction", BindingFlags.Static | BindingFlags.Public);
     }
     if (addMethod == null)
     {
         throw new StepTweakableInvalidException(baseTweakable.Name, "No 'operator +' could be found on type '" + TweakableType.FullName + "'");
     }
     if (subtractMethod == null)
     {
         throw new StepTweakableInvalidException(baseTweakable.Name, "No 'operator -' could be found on type '" + TweakableType.FullName + "'");
     }
 }
 public ToggleTweakable(BaseTweakable <T> baseTweakable)
 {
     this.baseTweakable = baseTweakable;
     tweakableInfo      = baseTweakable.TweakableInfo;
     currentIndex       = GetIndexOfValue(baseTweakable.GetValue());
 }