예제 #1
0
        public float DifferencePercentage(Property other)
        {
            object defaultValue  = this.GetDefaultValue();
            object defaultValue2 = other.GetDefaultValue();
            float  range         = this.m_memberBase.GetRange();
            float  num           = 0f;
            float  num2          = 0f;

            if (defaultValue.GetType() == typeof(float))
            {
                num  = (float)defaultValue;
                num2 = (float)defaultValue2;
            }
            else if (defaultValue.GetType() == typeof(long))
            {
                num  = (float)((long)defaultValue);
                num2 = (float)((long)defaultValue2);
            }
            else if (defaultValue.GetType() == typeof(int))
            {
                num  = (float)((int)defaultValue);
                num2 = (float)((int)defaultValue2);
            }
            else if (defaultValue.GetType() == typeof(short))
            {
                num  = (float)((short)defaultValue);
                num2 = (float)((short)defaultValue2);
            }
            else if (defaultValue.GetType() == typeof(sbyte))
            {
                num  = (float)((sbyte)defaultValue);
                num2 = (float)((sbyte)defaultValue2);
            }
            else if (defaultValue.GetType() == typeof(ulong))
            {
                num  = (ulong)defaultValue;
                num2 = (ulong)defaultValue2;
            }
            else if (defaultValue.GetType() == typeof(uint))
            {
                num  = (uint)defaultValue;
                num2 = (uint)defaultValue2;
            }
            else if (defaultValue.GetType() == typeof(ushort))
            {
                num  = (float)((ushort)defaultValue);
                num2 = (float)((ushort)defaultValue2);
            }
            else if (defaultValue.GetType() == typeof(byte))
            {
                num  = (float)((byte)defaultValue);
                num2 = (float)((byte)defaultValue2);
            }
            float num3 = num - num2;

            if (num3 < 0f)
            {
                num3 = -num3;
            }
            return(num3 / range);
        }
예제 #2
0
        public void SetDefaultValue(Property r)
        {
            object defaultValue = r.GetDefaultValue();

            this.SetDefaultValue(defaultValue);
        }
예제 #3
0
 public void SetDefaultValue(Property r)
 {
     object v = r.GetDefaultValue();
     this.SetDefaultValue(v);
 }
예제 #4
0
        public float DifferencePercentage(Property other)
        {
            //return const_cast<CMemberBase*>(this.m_memberBase).DifferencePercentage(this, other);
			object lV = this.GetDefaultValue ();
			object rV = other.GetDefaultValue ();

			float range = this.m_memberBase.GetRange ();

			float leftValue = 0.0f;
			float rightValue = 0.0f;
			if (lV.GetType () == typeof(float)) 
			{
				leftValue = (float)lV;
				rightValue = (float)rV;
			}
			else if (lV.GetType () == typeof(long)) 
			{
				leftValue = (long)lV;
				rightValue = (long)rV;
			}
			else if (lV.GetType () == typeof(int)) 
			{
				leftValue = (int)lV;
				rightValue = (int)rV;
			}
			else if (lV.GetType () == typeof(short)) 
			{
				leftValue = (short)lV;
				rightValue = (short)rV;
			}
			else if (lV.GetType () == typeof(sbyte)) 
			{
				leftValue = (sbyte)lV;
				rightValue = (sbyte)rV;
			}
			else if (lV.GetType () == typeof(ulong)) 
			{
				leftValue = (ulong)lV;
				rightValue = (ulong)rV;
			}
			else if (lV.GetType () == typeof(uint)) 
			{
				leftValue = (uint)lV;
				rightValue = (uint)rV;
			}
			else if (lV.GetType () == typeof(ushort)) 
			{
				leftValue = (ushort)lV;
				rightValue = (ushort)rV;
			}
			else if (lV.GetType () == typeof(byte)) 
			{
				leftValue = (byte)lV;
				rightValue = (byte)rV;
			}

			float d = leftValue - rightValue;
			if (d < 0.0f) 
			{
				d = -d;
			}

            return d / range;
        }
예제 #5
0
파일: Properties.cs 프로젝트: i17c/behaviac
        public void SetDefaultValue(Property r)
        {
            object v = r.GetDefaultValue();

            this.SetDefaultValue(v);
        }
예제 #6
0
파일: Properties.cs 프로젝트: i17c/behaviac
        public float DifferencePercentage(Property other)
        {
            //return const_cast<CMemberBase*>(this.m_memberBase).DifferencePercentage(this, other);
            object lV = this.GetDefaultValue();
            object rV = other.GetDefaultValue();

            float range = this.m_memberBase.GetRange();

            float leftValue  = 0.0f;
            float rightValue = 0.0f;

            if (lV.GetType() == typeof(float))
            {
                leftValue  = (float)lV;
                rightValue = (float)rV;
            }
            else if (lV.GetType() == typeof(long))
            {
                leftValue  = (long)lV;
                rightValue = (long)rV;
            }
            else if (lV.GetType() == typeof(int))
            {
                leftValue  = (int)lV;
                rightValue = (int)rV;
            }
            else if (lV.GetType() == typeof(short))
            {
                leftValue  = (short)lV;
                rightValue = (short)rV;
            }
            else if (lV.GetType() == typeof(sbyte))
            {
                leftValue  = (sbyte)lV;
                rightValue = (sbyte)rV;
            }
            else if (lV.GetType() == typeof(ulong))
            {
                leftValue  = (ulong)lV;
                rightValue = (ulong)rV;
            }
            else if (lV.GetType() == typeof(uint))
            {
                leftValue  = (uint)lV;
                rightValue = (uint)rV;
            }
            else if (lV.GetType() == typeof(ushort))
            {
                leftValue  = (ushort)lV;
                rightValue = (ushort)rV;
            }
            else if (lV.GetType() == typeof(byte))
            {
                leftValue  = (byte)lV;
                rightValue = (byte)rV;
            }

            float d = leftValue - rightValue;

            if (d < 0.0f)
            {
                d = -d;
            }

            return(d / range);
        }
예제 #7
0
        public float DifferencePercentage(Property other)
        {
            object defaultValue = this.GetDefaultValue();
            object obj3         = other.GetDefaultValue();
            float  range        = this.m_memberBase.GetRange();
            float  num2         = 0f;
            float  num3         = 0f;

            if (defaultValue.GetType() == typeof(float))
            {
                num2 = (float)defaultValue;
                num3 = (float)obj3;
            }
            else if (defaultValue.GetType() == typeof(long))
            {
                num2 = (long)defaultValue;
                num3 = (long)obj3;
            }
            else if (defaultValue.GetType() == typeof(int))
            {
                num2 = (int)defaultValue;
                num3 = (int)obj3;
            }
            else if (defaultValue.GetType() == typeof(short))
            {
                num2 = (short)defaultValue;
                num3 = (short)obj3;
            }
            else if (defaultValue.GetType() == typeof(sbyte))
            {
                num2 = (sbyte)defaultValue;
                num3 = (sbyte)obj3;
            }
            else if (defaultValue.GetType() == typeof(ulong))
            {
                num2 = (ulong)defaultValue;
                num3 = (ulong)obj3;
            }
            else if (defaultValue.GetType() == typeof(uint))
            {
                num2 = (uint)defaultValue;
                num3 = (uint)obj3;
            }
            else if (defaultValue.GetType() == typeof(ushort))
            {
                num2 = (ushort)defaultValue;
                num3 = (ushort)obj3;
            }
            else if (defaultValue.GetType() == typeof(byte))
            {
                num2 = (byte)defaultValue;
                num3 = (byte)obj3;
            }
            float num4 = num2 - num3;

            if (num4 < 0f)
            {
                num4 = -num4;
            }
            return(num4 / range);
        }