Пример #1
0
 public SkillVar(Type type)
 {
     this.type = SkillVar.GetVariableType(type);
     if (type.get_IsEnum())
     {
         this.EnumType = type;
         return;
     }
     if (type.get_IsArray())
     {
         Type elementType = type.GetElementType();
         this.arrayValue = new SkillArray
         {
             ElementType = SkillVar.GetVariableType(elementType)
         };
         if (elementType.get_IsEnum() || typeof(Object).IsAssignableFrom(elementType))
         {
             this.arrayValue.ObjectType = elementType;
             return;
         }
     }
     else
     {
         if (type.IsSubclassOf(typeof(Object)))
         {
             this.ObjectType = type;
         }
     }
 }
Пример #2
0
 public SkillArray(SkillArray source) : base(source)
 {
     if (source != null)
     {
         this.type       = source.type;
         this.ObjectType = source.ObjectType;
         this.CopyValues(source);
         this.SaveChanges();
     }
 }
Пример #3
0
 public void CopyValues(SkillArray source)
 {
     if (source == null)
     {
         return;
     }
     this.Resize(source.Length);
     object[] array = source.Values;
     for (int i = 0; i < array.Length; i++)
     {
         this.Set(i, array[i]);
     }
     this.SaveChanges();
 }
Пример #4
0
 public void ResetParameters()
 {
     this.BoolParameter       = false;
     this.FloatParameter      = 0f;
     this.IntParameter        = 0;
     this.StringParameter     = "";
     this.GameObjectParameter = new SkillGameObject("");
     this.Vector2Parameter    = new SkillVector2();
     this.Vector3Parameter    = new SkillVector3();
     this.RectParamater       = new SkillRect();
     this.QuaternionParameter = new SkillQuaternion();
     this.ObjectParameter     = new SkillObject();
     this.MaterialParameter   = new SkillMaterial();
     this.TextureParameter    = new SkillTexture();
     this.ColorParameter      = new SkillColor();
     this.EnumParameter       = new SkillEnum();
     this.ArrayParameter      = new SkillArray();
 }
Пример #5
0
 public FunctionCall(FunctionCall source)
 {
     this.FunctionName        = source.FunctionName;
     this.parameterType       = source.parameterType;
     this.BoolParameter       = new SkillBool(source.BoolParameter);
     this.FloatParameter      = new SkillFloat(source.FloatParameter);
     this.IntParameter        = new SkillInt(source.IntParameter);
     this.GameObjectParameter = new SkillGameObject(source.GameObjectParameter);
     this.ObjectParameter     = source.ObjectParameter;
     this.StringParameter     = new SkillString(source.StringParameter);
     this.Vector2Parameter    = new SkillVector2(source.Vector2Parameter);
     this.Vector3Parameter    = new SkillVector3(source.Vector3Parameter);
     this.RectParamater       = new SkillRect(source.RectParamater);
     this.QuaternionParameter = new SkillQuaternion(source.QuaternionParameter);
     this.MaterialParameter   = new SkillMaterial(source.MaterialParameter);
     this.TextureParameter    = new SkillTexture(source.TextureParameter);
     this.ColorParameter      = new SkillColor(source.ColorParameter);
     this.EnumParameter       = new SkillEnum(source.EnumParameter);
     this.ArrayParameter      = new SkillArray(source.ArrayParameter);
 }
Пример #6
0
 public SkillProperty(SkillProperty source)
 {
     this.setProperty         = source.setProperty;
     this.TargetObject        = new SkillObject(source.TargetObject);
     this.TargetTypeName      = source.TargetTypeName;
     this.TargetType          = source.TargetType;
     this.PropertyName        = source.PropertyName;
     this.PropertyType        = source.PropertyType;
     this.BoolParameter       = new SkillBool(source.BoolParameter);
     this.FloatParameter      = new SkillFloat(source.FloatParameter);
     this.IntParameter        = new SkillInt(source.IntParameter);
     this.GameObjectParameter = new SkillGameObject(source.GameObjectParameter);
     this.StringParameter     = new SkillString(source.StringParameter);
     this.Vector2Parameter    = new SkillVector2(source.Vector2Parameter);
     this.Vector3Parameter    = new SkillVector3(source.Vector3Parameter);
     this.RectParamater       = new SkillRect(source.RectParamater);
     this.QuaternionParameter = new SkillQuaternion(source.QuaternionParameter);
     this.ObjectParameter     = new SkillObject(source.ObjectParameter);
     this.MaterialParameter   = new SkillMaterial(source.MaterialParameter);
     this.TextureParameter    = new SkillTexture(source.TextureParameter);
     this.ColorParameter      = new SkillColor(source.ColorParameter);
     this.EnumParameter       = new SkillEnum(source.EnumParameter);
     this.ArrayParameter      = new SkillArray(source.ArrayParameter);
 }
Пример #7
0
        public void SetVariable(NamedVariable variable)
        {
            if (variable == null)
            {
                this.ResetParameters();
                return;
            }
            switch (variable.VariableType)
            {
            case VariableType.Unknown:
                return;

            case VariableType.Float:
                this.FloatParameter = (variable as SkillFloat);
                return;

            case VariableType.Int:
                this.IntParameter = (variable as SkillInt);
                return;

            case VariableType.Bool:
                this.BoolParameter = (variable as SkillBool);
                return;

            case VariableType.GameObject:
                this.GameObjectParameter = (variable as SkillGameObject);
                return;

            case VariableType.String:
                this.StringParameter = (variable as SkillString);
                return;

            case VariableType.Vector2:
                this.Vector2Parameter = (variable as SkillVector2);
                return;

            case VariableType.Vector3:
                this.Vector3Parameter = (variable as SkillVector3);
                return;

            case VariableType.Color:
                this.ColorParameter = (variable as SkillColor);
                return;

            case VariableType.Rect:
                this.RectParamater = (variable as SkillRect);
                return;

            case VariableType.Material:
                this.MaterialParameter = (variable as SkillMaterial);
                return;

            case VariableType.Texture:
                this.TextureParameter = (variable as SkillTexture);
                return;

            case VariableType.Quaternion:
                this.QuaternionParameter = (variable as SkillQuaternion);
                return;

            case VariableType.Object:
                this.ObjectParameter = (variable as SkillObject);
                return;

            case VariableType.Array:
                this.ArrayParameter = (variable as SkillArray);
                return;

            case VariableType.Enum:
                this.EnumParameter = (variable as SkillEnum);
                return;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Пример #8
0
        public void GetValueFrom(INamedVariable variable)
        {
            if (variable == null)
            {
                return;
            }
            switch (this.type)
            {
            case VariableType.Unknown:
                return;

            case VariableType.Float:
                this.floatValue = ((SkillFloat)variable).Value;
                return;

            case VariableType.Int:
                this.intValue = ((SkillInt)variable).Value;
                return;

            case VariableType.Bool:
                this.boolValue = ((SkillBool)variable).Value;
                return;

            case VariableType.GameObject:
                this.objectReference = ((SkillGameObject)variable).Value;
                return;

            case VariableType.String:
                this.stringValue = ((SkillString)variable).Value;
                return;

            case VariableType.Vector2:
                this.vector2Value = ((SkillVector2)variable).Value;
                return;

            case VariableType.Vector3:
                this.vector3Value = ((SkillVector3)variable).Value;
                return;

            case VariableType.Color:
                this.colorValue = ((SkillColor)variable).Value;
                return;

            case VariableType.Rect:
                this.rectValue = ((SkillRect)variable).Value;
                return;

            case VariableType.Material:
                this.objectReference = ((SkillMaterial)variable).Value;
                return;

            case VariableType.Texture:
                this.objectReference = ((SkillTexture)variable).Value;
                return;

            case VariableType.Quaternion:
                this.quaternionValue = ((SkillQuaternion)variable).Value;
                return;

            case VariableType.Object:
                this.objectReference = ((SkillObject)variable).Value;
                return;

            case VariableType.Array:
                this.arrayValue = new SkillArray((SkillArray)variable);
                return;

            case VariableType.Enum:
                this.EnumValue = ((SkillEnum)variable).Value;
                return;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Пример #9
0
        private void InitNamedVar()
        {
            switch (this.type)
            {
            case VariableType.Unknown:
                this.namedVar     = null;
                this.namedVarType = null;
                return;

            case VariableType.Float:
                this.namedVar = new SkillFloat(this.variableName)
                {
                    Value = this.floatValue
                };
                break;

            case VariableType.Int:
                this.namedVar = new SkillInt(this.variableName)
                {
                    Value = this.intValue
                };
                break;

            case VariableType.Bool:
                this.namedVar = new SkillBool(this.variableName)
                {
                    Value = this.boolValue
                };
                break;

            case VariableType.GameObject:
                this.namedVar = new SkillGameObject(this.variableName)
                {
                    Value = this.gameObjectValue
                };
                break;

            case VariableType.String:
                this.namedVar = new SkillString(this.variableName)
                {
                    Value = this.stringValue
                };
                break;

            case VariableType.Vector2:
                this.namedVar = new SkillVector2(this.variableName)
                {
                    Value = this.vector2Value
                };
                break;

            case VariableType.Vector3:
                this.namedVar = new SkillVector3(this.variableName)
                {
                    Value = this.vector3Value
                };
                break;

            case VariableType.Color:
                this.namedVar = new SkillColor(this.variableName)
                {
                    Value = this.colorValue
                };
                break;

            case VariableType.Rect:
                this.namedVar = new SkillRect(this.variableName)
                {
                    Value = this.rectValue
                };
                break;

            case VariableType.Material:
                this.namedVar = new SkillMaterial(this.variableName)
                {
                    Value = this.materialValue
                };
                break;

            case VariableType.Texture:
                this.namedVar = new SkillTexture(this.variableName)
                {
                    Value = this.textureValue
                };
                break;

            case VariableType.Quaternion:
                this.namedVar = new SkillQuaternion(this.variableName)
                {
                    Value = this.quaternionValue
                };
                break;

            case VariableType.Object:
                this.namedVar = new SkillObject(this.variableName)
                {
                    ObjectType = this.ObjectType,
                    Value      = this.objectReference
                };
                break;

            case VariableType.Array:
            {
                SkillArray fsmArray = new SkillArray(this.variableName)
                {
                    ElementType = this.arrayValue.ElementType,
                    ObjectType  = this.arrayValue.ObjectType
                };
                fsmArray.CopyValues(this.arrayValue);
                fsmArray.SaveChanges();
                this.namedVar = fsmArray;
                break;
            }

            case VariableType.Enum:
                this.namedVar = new SkillEnum(this.variableName)
                {
                    EnumType = this.EnumType,
                    Value    = this.EnumValue
                };
                break;

            default:
                throw new ArgumentOutOfRangeException("Type");
            }
            if (this.namedVar != null)
            {
                this.namedVarType         = this.namedVar.GetType();
                this.namedVar.UseVariable = this.useVariable;
            }
        }