コード例 #1
0
    public override AnimatorTimeline.JSONAction getJSONAction(int frameRate)
    {
        if (endFrame == -1 || !hasTargets() || targetsAreEqual())
        {
            return(null);
        }
        AnimatorTimeline.JSONAction a = new AnimatorTimeline.JSONAction();
        a.method = "camerafade";
        a.delay  = getWaitTime(frameRate, 0f);
        a.time   = getTime(frameRate);
        setupJSONActionEase(a);
        a.ints = new int[] { cameraFadeType, startTargetType, endTargetType };
        List <string> strings = new List <string>();
        List <AnimatorTimeline.JSONColor> colors = new List <AnimatorTimeline.JSONColor>();

        if (startTargetType == 0)
        {
            strings.Add(startCamera.gameObject.name);
            colors.Add(null);
        }
        else
        {
            AnimatorTimeline.JSONColor c = new AnimatorTimeline.JSONColor();
            c.setValue(startColor);
            colors.Add(c);
            strings.Add(null);
        }
        if (endTargetType == 0)
        {
            strings.Add(endCamera.gameObject.name);
            colors.Add(null);
        }
        else
        {
            AnimatorTimeline.JSONColor c = new AnimatorTimeline.JSONColor();
            c.setValue(endColor);
            colors.Add(c);
            strings.Add(null);
        }
        a.strings = strings.ToArray();
        a.colors  = colors.ToArray();
        // reversed, rendertex
        a.bools = new bool[] { isReversed(), !still };
        // textures
        if (AMCameraFade.needsTexture(cameraFadeType))
        {
            a.stringsExtra = new string[] { irisShape.name }
        }
        ;                                                                                                   //hash.Add("texture",irisShape);
        // parameters
        a.floats = cameraFadeParameters.ToArray();
        return(a);
    }
}
コード例 #2
0
    public override AnimatorTimeline.JSONInit getJSONInit()
    {
        if (keys.Count <= 0)
        {
            return(null);
        }
        string _type;

        if ((keys[0] as AMCameraSwitcherKey).type == 0)
        {
            if ((keys[0] as AMCameraSwitcherKey).camera == null)
            {
                return(null);
            }
            _type = "camera";
        }
        else
        {
            _type = "color";
        }
        AnimatorTimeline.JSONInit init = new AnimatorTimeline.JSONInit();
        init.type      = "cameraswitcher";
        init.typeExtra = _type;
        if (_type == "camera")
        {
            init.go = (keys[0] as AMCameraSwitcherKey).camera.gameObject.name;
        }
        else
        {
            AnimatorTimeline.JSONColor c = new AnimatorTimeline.JSONColor();
            c.setValue((keys[0] as AMCameraSwitcherKey).color);
            init._color = c;
        }
        // all cameras
        Camera[] cameras = getAllCameras();
        init.strings = new string[cameras.Length];
        for (int i = 0; i < cameras.Length; i++)
        {
            init.strings[i] = cameras[i].gameObject.name;
        }
        // all textures

        /*Texture[] textures = getAllTextures();
         * init.stringsExtra = new string[textures.Length];
         * for(int i=0; i<textures.Length;i++) {
         *      init.stringsExtra[i] = textures[i].name;
         * }*/
        return(init);
    }
コード例 #3
0
 public override AnimatorTimeline.JSONAction getJSONAction(int frameRate)
 {
     if(endFrame == -1 || !hasTargets() || targetsAreEqual()) return null;
     AnimatorTimeline.JSONAction a = new AnimatorTimeline.JSONAction();
     a.method = "camerafade";
     a.delay = getWaitTime(frameRate,0f);
     a.time = getTime(frameRate);
     setupJSONActionEase(a);
     a.ints = new int[]{cameraFadeType,startTargetType,endTargetType};
     List<string> strings = new List<string>();
     List<AnimatorTimeline.JSONColor> colors = new List<AnimatorTimeline.JSONColor>();
     if(startTargetType == 0) {
         strings.Add(startCamera.gameObject.name);
         colors.Add(null);
     } else {
         AnimatorTimeline.JSONColor c = new AnimatorTimeline.JSONColor();
         c.setValue(startColor);
         colors.Add(c);
         strings.Add(null);
     }
     if(endTargetType == 0) {
         strings.Add(endCamera.gameObject.name);
         colors.Add(null);
     } else {
         AnimatorTimeline.JSONColor c = new AnimatorTimeline.JSONColor();
         c.setValue(endColor);
         colors.Add(c);
         strings.Add(null);
     }
     a.strings = strings.ToArray();
     a.colors = colors.ToArray();
     // reversed, rendertex
     a.bools = new bool[]{isReversed(), !still};
     // textures
     if(AMCameraFade.needsTexture(cameraFadeType)) a.stringsExtra = new string[]{irisShape.name};//hash.Add("texture",irisShape);
     // parameters
     a.floats = cameraFadeParameters.ToArray();
     return a;
 }
コード例 #4
0
    public override AnimatorTimeline.JSONAction getJSONAction(int frameRate)
    {
        if(targetsAreEqual()) return null;
        if((endFrame == -1) || !component || ((fieldInfo == null) && (propertyInfo == null) && (methodInfo == null))) return null;

        AnimatorTimeline.JSONAction a = new AnimatorTimeline.JSONAction();
        a.method = "propertyto";
        a.go = component.gameObject.name;
        a.delay = getWaitTime(frameRate,0f);
        a.time = getTime(frameRate);
        List<string> strings = new List<string>();
        strings.Add(component.GetType().Name);
        if(fieldInfo != null || propertyInfo != null) {
            if(valueType == (int)AMPropertyTrack.ValueType.Integer) {
                strings.Add("integer");
                a.ints = new int[]{Convert.ToInt32(start_val),Convert.ToInt32(end_val)};
            } else if(valueType == (int)AMPropertyTrack.ValueType.Long) {
                strings.Add("long");
                a.longs = new long[]{Convert.ToInt64(start_val),Convert.ToInt64(end_val)};
            } else if(valueType == (int)AMPropertyTrack.ValueType.Float) {
                strings.Add("float");
                a.floats = new float[]{Convert.ToSingle(start_val),Convert.ToSingle(end_val)};
            } else if(valueType == (int)AMPropertyTrack.ValueType.Double) {
                strings.Add("double");
                a.doubles = new double[]{start_val,end_val};
            } else if(valueType == (int)AMPropertyTrack.ValueType.Vector2) {
                strings.Add("vector2");
                AnimatorTimeline.JSONVector2 v1 = new AnimatorTimeline.JSONVector2();
                v1.setValue(start_vect2);
                AnimatorTimeline.JSONVector2 v2 = new AnimatorTimeline.JSONVector2();
                v2.setValue(end_vect2);
                a.vect2s = new AnimatorTimeline.JSONVector2[]{v1,v2};
            } else if(valueType == (int)AMPropertyTrack.ValueType.Vector3) {
                strings.Add("vector3");
                a.setPath(new Vector3[]{start_vect3,end_vect3});
            } else if(valueType == (int)AMPropertyTrack.ValueType.Color) {
                strings.Add("color");
                AnimatorTimeline.JSONColor c1 = new AnimatorTimeline.JSONColor();
                c1.setValue(start_color);
                AnimatorTimeline.JSONColor c2 = new AnimatorTimeline.JSONColor();
                c2.setValue(end_color);
                a.colors = new AnimatorTimeline.JSONColor[]{c1,c2};
            } else if(valueType == (int)AMPropertyTrack.ValueType.Rect) {
                strings.Add("rect");
                AnimatorTimeline.JSONRect r1 = new AnimatorTimeline.JSONRect();
                r1.setValue(start_rect);
                AnimatorTimeline.JSONRect r2 = new AnimatorTimeline.JSONRect();
                r2.setValue(end_rect);
                a.rects = new AnimatorTimeline.JSONRect[]{r1,r2};
            }
            if(fieldInfo != null) {
                strings.Add("fieldinfo");
                strings.Add(fieldInfo.Name);
            } else {
                strings.Add("propertyinfo");
                strings.Add(propertyInfo.Name);
            }

        } else if(methodInfo != null) {
            if(valueType == (int)AMPropertyTrack.ValueType.MorphChannels) {
                strings.Add("morph");
                a.floats = start_morph.ToArray();
                a.floatsExtra = end_morph.ToArray();
            }
        }
        setupJSONActionEase(a);
        a.strings = strings.ToArray();
        return a;
    }
コード例 #5
0
    public override AnimatorTimeline.JSONAction getJSONAction(int frameRate)
    {
        if (targetsAreEqual())
        {
            return(null);
        }
        if ((endFrame == -1) || !component || ((fieldInfo == null) && (propertyInfo == null) && (methodInfo == null)))
        {
            return(null);
        }

        AnimatorTimeline.JSONAction a = new AnimatorTimeline.JSONAction();
        a.method = "propertyto";
        a.go     = component.gameObject.name;
        a.delay  = getWaitTime(frameRate, 0f);
        a.time   = getTime(frameRate);
        List <string> strings = new List <string>();

        strings.Add(component.GetType().Name);
        if (fieldInfo != null || propertyInfo != null)
        {
            if (valueType == (int)AMPropertyTrack.ValueType.Integer)
            {
                strings.Add("integer");
                a.ints = new int[] { Convert.ToInt32(start_val), Convert.ToInt32(end_val) };
            }
            else if (valueType == (int)AMPropertyTrack.ValueType.Long)
            {
                strings.Add("long");
                a.longs = new long[] { Convert.ToInt64(start_val), Convert.ToInt64(end_val) };
            }
            else if (valueType == (int)AMPropertyTrack.ValueType.Float)
            {
                strings.Add("float");
                a.floats = new float[] { Convert.ToSingle(start_val), Convert.ToSingle(end_val) };
            }
            else if (valueType == (int)AMPropertyTrack.ValueType.Double)
            {
                strings.Add("double");
                a.doubles = new double[] { start_val, end_val };
            }
            else if (valueType == (int)AMPropertyTrack.ValueType.Vector2)
            {
                strings.Add("vector2");
                AnimatorTimeline.JSONVector2 v1 = new AnimatorTimeline.JSONVector2();
                v1.setValue(start_vect2);
                AnimatorTimeline.JSONVector2 v2 = new AnimatorTimeline.JSONVector2();
                v2.setValue(end_vect2);
                a.vect2s = new AnimatorTimeline.JSONVector2[] { v1, v2 };
            }
            else if (valueType == (int)AMPropertyTrack.ValueType.Vector3)
            {
                strings.Add("vector3");
                a.setPath(new Vector3[] { start_vect3, end_vect3 });
            }
            else if (valueType == (int)AMPropertyTrack.ValueType.Color)
            {
                strings.Add("color");
                AnimatorTimeline.JSONColor c1 = new AnimatorTimeline.JSONColor();
                c1.setValue(start_color);
                AnimatorTimeline.JSONColor c2 = new AnimatorTimeline.JSONColor();
                c2.setValue(end_color);
                a.colors = new AnimatorTimeline.JSONColor[] { c1, c2 };
            }
            else if (valueType == (int)AMPropertyTrack.ValueType.Rect)
            {
                strings.Add("rect");
                AnimatorTimeline.JSONRect r1 = new AnimatorTimeline.JSONRect();
                r1.setValue(start_rect);
                AnimatorTimeline.JSONRect r2 = new AnimatorTimeline.JSONRect();
                r2.setValue(end_rect);
                a.rects = new AnimatorTimeline.JSONRect[] { r1, r2 };
            }
            if (fieldInfo != null)
            {
                strings.Add("fieldinfo");
                strings.Add(fieldInfo.Name);
            }
            else
            {
                strings.Add("propertyinfo");
                strings.Add(propertyInfo.Name);
            }
        }
        else if (methodInfo != null)
        {
            if (valueType == (int)AMPropertyTrack.ValueType.MorphChannels)
            {
                strings.Add("morph");
                a.floats      = start_morph.ToArray();
                a.floatsExtra = end_morph.ToArray();
            }
        }
        setupJSONActionEase(a);
        a.strings = strings.ToArray();
        return(a);
    }
コード例 #6
0
    public AnimatorTimeline.JSONEventParameter toJSON()
    {
        AnimatorTimeline.JSONEventParameter e = new AnimatorTimeline.JSONEventParameter();
        e.valueType = valueType;
        if(valueType == (int) ValueType.Boolean) e.val_bool = val_bool;
        if(valueType == (int) ValueType.String) e.val_string = (val_string/* as object*/);
        if(valueType == (int) ValueType.Char) {
            if(val_string == null || val_string.Length<=0) e.val_string = "\0";
            e.val_string =  ""+val_string[0];
        }
        if(valueType == (int) ValueType.Integer || valueType == (int) ValueType.Long) e.val_int = (val_int/* as object*/);
        if(valueType == (int) ValueType.Float || valueType == (int) ValueType.Double) e.val_float = (val_float/* as object*/);
        if(valueType == (int) ValueType.Vector2) {
            AnimatorTimeline.JSONVector2 v2 = new AnimatorTimeline.JSONVector2();
            v2.setValue(val_vect2);
            e.val_vect2 = v2;
        }
        if(valueType == (int) ValueType.Vector3) {
            AnimatorTimeline.JSONVector3 v3 = new AnimatorTimeline.JSONVector3();
            v3.setValue(val_vect3);
            e.val_vect3 = v3;
        }
        if(valueType == (int) ValueType.Vector4) {
            AnimatorTimeline.JSONVector4 v4 = new AnimatorTimeline.JSONVector4();
            v4.setValue(val_vect4);
            e.val_vect4 = v4;
        }
        if(valueType == (int) ValueType.Color) {
            AnimatorTimeline.JSONColor c = new AnimatorTimeline.JSONColor();
            c.setValue(val_color);
            e.val_color = c;
        }
        if(valueType == (int) ValueType.Rect) {
            AnimatorTimeline.JSONRect r = new AnimatorTimeline.JSONRect();
            r.setValue(val_rect);
            e.val_rect = r;
        }
        if(valueType == (int) ValueType.Object) {
            if(val_obj.GetType() != typeof(GameObject)) {
                // component
                e.val_obj_extra = val_obj.name;
                e.val_obj = val_obj.GetType().Name;
            } else {
                // gameobject
                e.val_obj_extra = null;
                e.val_obj = val_obj.name;
            }

        }
        if(valueType == (int) ValueType.Array && lsArray.Count > 0) {
            AnimatorTimeline.JSONEventParameter[] arr = new AnimatorTimeline.JSONEventParameter[lsArray.Count];
                for(int i=0;i<lsArray.Count;i++){
                    //arrObj[i] = lsArray[i].val_bool;
                    arr[i] = lsArray[i].toJSON();
                }
            e.array = arr;
            /*
            if(lsArray[0].valueType == (int) ValueType.Boolean) {
                //bool[] arrObj = new bool[lsArray.Count];
        //				AnimatorTimeline.JSONEventParameter[] arr = new AnimatorTimeline.JSONEventParameter[lsArray.Count];
        //				for(int i=0;i<lsArray.Count;i++){
        //					//arrObj[i] = lsArray[i].val_bool;
        //					arr[i] = lsArray[i].toJSON();
        //				}
                //return arrObj;
            }
            if(lsArray[0].valueType == (int) ValueType.String) {
                string[] arrObj = new string[lsArray.Count];
                for(int i=0;i<lsArray.Count;i++){
                    arrObj[i] = lsArray[i].val_string;
                }
                return arrObj;
            }
            if(lsArray[0].valueType == (int) ValueType.Char) {
                char[] arrObj = new char[lsArray.Count];
                for(int i=0;i<lsArray.Count;i++){
                    arrObj[i] = lsArray[i].val_string[0];
                }
                return arrObj;
            }
            if(lsArray[0].valueType == (int) ValueType.Integer || lsArray[0].valueType == (int) ValueType.Long) {
                int[] arrObj = new int[lsArray.Count];
                for(int i=0;i<lsArray.Count;i++){
                    arrObj[i] = lsArray[i].val_int;
                }
                return arrObj;
            }
            if(lsArray[0].valueType == (int) ValueType.Float || lsArray[0].valueType == (int) ValueType.Double) {
                float[] arrObj = new float[lsArray.Count];
                for(int i=0;i<lsArray.Count;i++){
                    arrObj[i] = lsArray[i].val_float;
                }
                return arrObj;
            }
            if(lsArray[0].valueType == (int) ValueType.Vector2) {
                Vector2[] arrObj = new Vector2[lsArray.Count];
                for(int i=0;i<lsArray.Count;i++){
                    arrObj[i] = lsArray[i].val_vect2;
                }
                return arrObj;
            }
            if(lsArray[0].valueType == (int) ValueType.Vector3) {
                Vector3[] arrObj = new Vector3[lsArray.Count];
                for(int i=0;i<lsArray.Count;i++){
                    arrObj[i] = lsArray[i].val_vect3;
                }
                return arrObj;
            }
            if(lsArray[0].valueType == (int) ValueType.Vector4) {
                Vector4[] arrObj = new Vector4[lsArray.Count];
                for(int i=0;i<lsArray.Count;i++){
                    arrObj[i] = lsArray[i].val_vect4;
                }
                return arrObj;
            }
            if(lsArray[0].valueType == (int) ValueType.Color) {
                Color[] arrObj = new Color[lsArray.Count];
                for(int i=0;i<lsArray.Count;i++){
                    arrObj[i] = lsArray[i].val_color;
                }
                return arrObj;
            }
            if(lsArray[0].valueType == (int) ValueType.Rect) {
                Rect[] arrObj = new Rect[lsArray.Count];
                for(int i=0;i<lsArray.Count;i++){
                    arrObj[i] = lsArray[i].val_rect;
                }
                return arrObj;
            }
            if(lsArray[0].valueType == (int) ValueType.Object) {
                UnityEngine.Object[] arrObj = new UnityEngine.Object[lsArray.Count];
                for(int i=0;i<lsArray.Count;i++){
                    arrObj[i] = lsArray[i].val_obj;
                }
                return arrObj;
            }*/

        }
        //Debug.LogError("Animator: Type not found for Event Parameter.");
        return e;
    }
コード例 #7
0
    public AnimatorTimeline.JSONEventParameter toJSON()
    {
        AnimatorTimeline.JSONEventParameter e = new AnimatorTimeline.JSONEventParameter();
        e.valueType = valueType;
        if (valueType == (int)ValueType.Boolean)
        {
            e.val_bool = val_bool;
        }
        if (valueType == (int)ValueType.String)
        {
            e.val_string = (val_string /* as object*/);
        }
        if (valueType == (int)ValueType.Char)
        {
            if (val_string == null || val_string.Length <= 0)
            {
                e.val_string = "\0";
            }
            e.val_string = "" + val_string[0];
        }
        if (valueType == (int)ValueType.Integer || valueType == (int)ValueType.Long)
        {
            e.val_int = (val_int /* as object*/);
        }
        if (valueType == (int)ValueType.Float || valueType == (int)ValueType.Double)
        {
            e.val_float = (val_float /* as object*/);
        }
        if (valueType == (int)ValueType.Vector2)
        {
            AnimatorTimeline.JSONVector2 v2 = new AnimatorTimeline.JSONVector2();
            v2.setValue(val_vect2);
            e.val_vect2 = v2;
        }
        if (valueType == (int)ValueType.Vector3)
        {
            AnimatorTimeline.JSONVector3 v3 = new AnimatorTimeline.JSONVector3();
            v3.setValue(val_vect3);
            e.val_vect3 = v3;
        }
        if (valueType == (int)ValueType.Vector4)
        {
            AnimatorTimeline.JSONVector4 v4 = new AnimatorTimeline.JSONVector4();
            v4.setValue(val_vect4);
            e.val_vect4 = v4;
        }
        if (valueType == (int)ValueType.Color)
        {
            AnimatorTimeline.JSONColor c = new AnimatorTimeline.JSONColor();
            c.setValue(val_color);
            e.val_color = c;
        }
        if (valueType == (int)ValueType.Rect)
        {
            AnimatorTimeline.JSONRect r = new AnimatorTimeline.JSONRect();
            r.setValue(val_rect);
            e.val_rect = r;
        }
        if (valueType == (int)ValueType.Object)
        {
            if (val_obj.GetType() != typeof(GameObject))
            {
                // component
                e.val_obj_extra = val_obj.name;
                e.val_obj       = val_obj.GetType().Name;
            }
            else
            {
                // gameobject
                e.val_obj_extra = null;
                e.val_obj       = val_obj.name;
            }
        }
        if (valueType == (int)ValueType.Array && lsArray.Count > 0)
        {
            AnimatorTimeline.JSONEventParameter[] arr = new AnimatorTimeline.JSONEventParameter[lsArray.Count];
            for (int i = 0; i < lsArray.Count; i++)
            {
                //arrObj[i] = lsArray[i].val_bool;
                arr[i] = lsArray[i].toJSON();
            }
            e.array = arr;

            /*
             * if(lsArray[0].valueType == (int) ValueType.Boolean) {
             *      //bool[] arrObj = new bool[lsArray.Count];
             * //				AnimatorTimeline.JSONEventParameter[] arr = new AnimatorTimeline.JSONEventParameter[lsArray.Count];
             * //				for(int i=0;i<lsArray.Count;i++){
             * //					//arrObj[i] = lsArray[i].val_bool;
             * //					arr[i] = lsArray[i].toJSON();
             * //				}
             *      //return arrObj;
             * }
             * if(lsArray[0].valueType == (int) ValueType.String) {
             *      string[] arrObj = new string[lsArray.Count];
             *      for(int i=0;i<lsArray.Count;i++){
             *              arrObj[i] = lsArray[i].val_string;
             *      }
             *      return arrObj;
             * }
             * if(lsArray[0].valueType == (int) ValueType.Char) {
             *      char[] arrObj = new char[lsArray.Count];
             *      for(int i=0;i<lsArray.Count;i++){
             *              arrObj[i] = lsArray[i].val_string[0];
             *      }
             *      return arrObj;
             * }
             * if(lsArray[0].valueType == (int) ValueType.Integer || lsArray[0].valueType == (int) ValueType.Long) {
             *      int[] arrObj = new int[lsArray.Count];
             *      for(int i=0;i<lsArray.Count;i++){
             *              arrObj[i] = lsArray[i].val_int;
             *      }
             *      return arrObj;
             * }
             * if(lsArray[0].valueType == (int) ValueType.Float || lsArray[0].valueType == (int) ValueType.Double) {
             *      float[] arrObj = new float[lsArray.Count];
             *      for(int i=0;i<lsArray.Count;i++){
             *              arrObj[i] = lsArray[i].val_float;
             *      }
             *      return arrObj;
             * }
             * if(lsArray[0].valueType == (int) ValueType.Vector2) {
             *      Vector2[] arrObj = new Vector2[lsArray.Count];
             *      for(int i=0;i<lsArray.Count;i++){
             *              arrObj[i] = lsArray[i].val_vect2;
             *      }
             *      return arrObj;
             * }
             * if(lsArray[0].valueType == (int) ValueType.Vector3) {
             *      Vector3[] arrObj = new Vector3[lsArray.Count];
             *      for(int i=0;i<lsArray.Count;i++){
             *              arrObj[i] = lsArray[i].val_vect3;
             *      }
             *      return arrObj;
             * }
             * if(lsArray[0].valueType == (int) ValueType.Vector4) {
             *      Vector4[] arrObj = new Vector4[lsArray.Count];
             *      for(int i=0;i<lsArray.Count;i++){
             *              arrObj[i] = lsArray[i].val_vect4;
             *      }
             *      return arrObj;
             * }
             * if(lsArray[0].valueType == (int) ValueType.Color) {
             *      Color[] arrObj = new Color[lsArray.Count];
             *      for(int i=0;i<lsArray.Count;i++){
             *              arrObj[i] = lsArray[i].val_color;
             *      }
             *      return arrObj;
             * }
             * if(lsArray[0].valueType == (int) ValueType.Rect) {
             *      Rect[] arrObj = new Rect[lsArray.Count];
             *      for(int i=0;i<lsArray.Count;i++){
             *              arrObj[i] = lsArray[i].val_rect;
             *      }
             *      return arrObj;
             * }
             * if(lsArray[0].valueType == (int) ValueType.Object) {
             *      UnityEngine.Object[] arrObj = new UnityEngine.Object[lsArray.Count];
             *      for(int i=0;i<lsArray.Count;i++){
             *              arrObj[i] = lsArray[i].val_obj;
             *      }
             *      return arrObj;
             * }*/
        }
        //Debug.LogError("Animator: Type not found for Event Parameter.");
        return(e);
    }
コード例 #8
0
    public override AnimatorTimeline.JSONInit getJSONInit()
    {
        if (!obj || keys.Count <= 0 || cache.Count <= 0)
        {
            return(null);
        }
        AnimatorTimeline.JSONInit init = new AnimatorTimeline.JSONInit();
        init.go = obj.gameObject.name;
        List <string> strings = new List <string>();

        strings.Add(component.GetType().Name);
        if (fieldInfo != null)
        {
            init.typeExtra = "fieldinfo";
            strings.Add(fieldInfo.Name);
        }
        else if (propertyInfo != null)
        {
            init.typeExtra = "propertyinfo";
            strings.Add(propertyInfo.Name);
        }
        else if (methodInfo != null)
        {
            init.typeExtra = "methodinfo";
            strings.Add(methodInfo.Name);
            // parameter types
            foreach (string s in methodParameterTypes)
            {
                strings.Add(s);
            }
        }
        if (valueType == (int)ValueType.MorphChannels)
        {
            init.type   = "propertymorph";
            init.floats = (cache[0] as AMPropertyAction).start_morph.ToArray();
        }
        else if (valueType == (int)ValueType.Integer)
        {
            init.type = "propertyint";
            init._int = Convert.ToInt32((cache[0] as AMPropertyAction).start_val);
        }
        else if (valueType == (int)ValueType.Long)
        {
            init.type  = "propertylong";
            init._long = Convert.ToInt64((cache[0] as AMPropertyAction).start_val);
        }
        else if (valueType == (int)ValueType.Float)
        {
            init.type   = "propertyfloat";
            init.floats = new float[] { Convert.ToSingle((cache[0] as AMPropertyAction).start_val) };
        }
        else if (valueType == (int)ValueType.Double)
        {
            init.type    = "propertydouble";
            init._double = (cache[0] as AMPropertyAction).start_val;
        }
        else if (valueType == (int)ValueType.Vector2)
        {
            init.type = "propertyvect2";
            AnimatorTimeline.JSONVector2 v2 = new AnimatorTimeline.JSONVector2();
            v2.setValue((cache[0] as AMPropertyAction).start_vect2);
            init._vect2 = v2;
        }
        else if (valueType == (int)ValueType.Vector3)
        {
            init.type = "propertyvect3";
            AnimatorTimeline.JSONVector3 v3 = new AnimatorTimeline.JSONVector3();
            v3.setValue((cache[0] as AMPropertyAction).start_vect3);
            init.position = v3;
        }
        else if (valueType == (int)ValueType.Color)
        {
            init.type = "propertycolor";
            AnimatorTimeline.JSONColor c = new AnimatorTimeline.JSONColor();
            c.setValue((cache[0] as AMPropertyAction).start_color);
            init._color = c;
        }
        else if (valueType == (int)ValueType.Rect)
        {
            init.type = "propertyrect";
            AnimatorTimeline.JSONRect r = new AnimatorTimeline.JSONRect();
            r.setValue((cache[0] as AMPropertyAction).start_rect);
            init._rect = r;
        }
        else
        {
            Debug.LogWarning("Animator: Error exporting JSON, unknown Property ValueType " + valueType);
            return(null);
        }
        init.strings = strings.ToArray();
        return(init);
    }
コード例 #9
0
 public override AnimatorTimeline.JSONInit getJSONInit()
 {
     if(keys.Count <= 0) return null;
     string _type;
     if((keys[0] as AMCameraSwitcherKey).type == 0) {
         if((keys[0] as AMCameraSwitcherKey).camera == null) return null;
         _type = "camera";
     } else {
         _type = "color";
     }
     AnimatorTimeline.JSONInit init = new AnimatorTimeline.JSONInit();
     init.type = "cameraswitcher";
     init.typeExtra = _type;
     if(_type == "camera") init.go = (keys[0] as AMCameraSwitcherKey).camera.gameObject.name;
     else {
         AnimatorTimeline.JSONColor c = new AnimatorTimeline.JSONColor();
         c.setValue((keys[0] as AMCameraSwitcherKey).color);
         init._color = c;
     }
     // all cameras
     Camera[] cameras = getAllCameras();
     init.strings = new string[cameras.Length];
     for(int i=0; i<cameras.Length;i++) {
         init.strings[i] = cameras[i].gameObject.name;
     }
     // all textures
     /*Texture[] textures = getAllTextures();
     init.stringsExtra = new string[textures.Length];
     for(int i=0; i<textures.Length;i++) {
         init.stringsExtra[i] = textures[i].name;
     }*/
     return init;
 }
コード例 #10
0
    public virtual AnimatorTimeline.JSONEventParameter toJSON()
    {
        AnimatorTimeline.JSONEventParameter e = new AnimatorTimeline.JSONEventParameter();
        e.valueType = valueType;
        if(valueType == (int)ValueType.Boolean) e.val_bool = val_bool;
        if(valueType == (int)ValueType.String) e.val_string = (val_string/* as object*/);
        if(valueType == (int)ValueType.Char) {
            if(val_string == null || val_string.Length <= 0) e.val_string = "\0";
            e.val_string = "" + val_string[0];
        }
        if(valueType == (int)ValueType.Integer || valueType == (int)ValueType.Long) e.val_int = (val_int/* as object*/);
        if(valueType == (int)ValueType.Float || valueType == (int)ValueType.Double) e.val_float = (val_float/* as object*/);
        if(valueType == (int)ValueType.Vector2) {
            AnimatorTimeline.JSONVector2 v2 = new AnimatorTimeline.JSONVector2();
            v2.setValue(val_vect2);
            e.val_vect2 = v2;
        }
        if(valueType == (int)ValueType.Vector3) {
            AnimatorTimeline.JSONVector3 v3 = new AnimatorTimeline.JSONVector3();
            v3.setValue(val_vect3);
            e.val_vect3 = v3;
        }
        if(valueType == (int)ValueType.Vector4) {
            AnimatorTimeline.JSONVector4 v4 = new AnimatorTimeline.JSONVector4();
            v4.setValue(val_vect4);
            e.val_vect4 = v4;
        }
        if(valueType == (int)ValueType.Color) {
            AnimatorTimeline.JSONColor c = new AnimatorTimeline.JSONColor();
            c.setValue(val_color);
            e.val_color = c;
        }
        if(valueType == (int)ValueType.Rect) {
            AnimatorTimeline.JSONRect r = new AnimatorTimeline.JSONRect();
            r.setValue(val_rect);
            e.val_rect = r;
        }
        if(valueType == (int)ValueType.Object) {
            if(val_obj.GetType() != typeof(GameObject)) {
                // component
                e.val_obj_extra = val_obj.name;
                e.val_obj = val_obj.GetType().Name;
            }
            else {
                // gameobject
                e.val_obj_extra = null;
                e.val_obj = val_obj.name;
            }

        }
        //Debug.LogError("Animator: Type not found for Event Parameter.");
        return e;
    }
コード例 #11
0
 public override AnimatorTimeline.JSONInit getJSONInit()
 {
     if(!obj || keys.Count <= 0 || cache.Count <= 0) return null;
     AnimatorTimeline.JSONInit init = new AnimatorTimeline.JSONInit();
     init.go = obj.gameObject.name;
     List<string> strings = new List<string>();
     strings.Add(component.GetType().Name);
     if(fieldInfo != null) {
         init.typeExtra = "fieldinfo";
         strings.Add(fieldInfo.Name);
     } else if(propertyInfo != null) {
         init.typeExtra = "propertyinfo";
         strings.Add(propertyInfo.Name);
     } else if(methodInfo != null) {
         init.typeExtra = "methodinfo";
         strings.Add(methodInfo.Name);
         // parameter types
         foreach(string s in methodParameterTypes) {
             strings.Add(s);
         }
     }
     if(valueType == (int)ValueType.MorphChannels) {
         init.type = "propertymorph";
         init.floats = (cache[0] as AMPropertyAction).start_morph.ToArray();
     } else if(valueType == (int)ValueType.Integer) {
         init.type = "propertyint";
         init._int = Convert.ToInt32((cache[0] as AMPropertyAction).start_val);
     } else if(valueType == (int)ValueType.Long) {
         init.type = "propertylong";
         init._long = Convert.ToInt64((cache[0] as AMPropertyAction).start_val);
     } else if(valueType == (int)ValueType.Float) {
         init.type = "propertyfloat";
         init.floats = new float[]{Convert.ToSingle((cache[0] as AMPropertyAction).start_val)};
     } else if(valueType == (int)ValueType.Double) {
         init.type = "propertydouble";
         init._double = (cache[0] as AMPropertyAction).start_val;
     } else if(valueType == (int)ValueType.Vector2) {
         init.type = "propertyvect2";
         AnimatorTimeline.JSONVector2 v2 = new AnimatorTimeline.JSONVector2();
         v2.setValue((cache[0] as AMPropertyAction).start_vect2);
         init._vect2 = v2;
     } else if(valueType == (int)ValueType.Vector3) {
         init.type = "propertyvect3";
         AnimatorTimeline.JSONVector3 v3 = new AnimatorTimeline.JSONVector3();
         v3.setValue((cache[0] as AMPropertyAction).start_vect3);
         init.position = v3;
     } else if(valueType == (int)ValueType.Color) {
         init.type = "propertycolor";
         AnimatorTimeline.JSONColor c = new AnimatorTimeline.JSONColor();
         c.setValue((cache[0] as AMPropertyAction).start_color);
         init._color = c;
     } else if(valueType == (int)ValueType.Rect) {
         init.type = "propertyrect";
         AnimatorTimeline.JSONRect r = new AnimatorTimeline.JSONRect();
         r.setValue((cache[0] as AMPropertyAction).start_rect);
         init._rect = r;
     } else {
         Debug.LogWarning("Animator: Error exporting JSON, unknown Property ValueType "+valueType);
         return null;
     }
     init.strings = strings.ToArray();
     return init;
 }