コード例 #1
0
ファイル: LetterAnimation.cs プロジェクト: zynigma/ddgame
        public tfxJSONValue ExportData()
        {
            tfxJSONObject json_data = new tfxJSONObject();

            json_data["m_letters_to_animate"]            = m_letters_to_animate.ExportData();
            json_data["m_letters_to_animate_custom_idx"] = m_letters_to_animate_custom_idx;
            json_data["m_letters_to_animate_option"]     = (int)m_letters_to_animate_option;

            if (m_loop_cycles.Count > 0)
            {
                tfxJSONArray loops_data = new tfxJSONArray();

                foreach (ActionLoopCycle action_loop in m_loop_cycles)
                {
                    loops_data.Add(action_loop.ExportData());
                }

                json_data["LOOPS_DATA"] = loops_data;
            }

            tfxJSONArray actions_data = new tfxJSONArray();

            foreach (LetterAction action in m_letter_actions)
            {
                actions_data.Add(action.ExportData());
            }
            json_data["ACTIONS_DATA"] = actions_data;

            return(new tfxJSONValue(json_data));
        }
コード例 #2
0
        public static AnimationCurve JSONtoAnimationCurve(this tfxJSONArray json_data)
        {
            AnimationCurve anim_curve = new AnimationCurve();

            anim_curve.keys = new Keyframe[0];

            UnityEngine.Keyframe keyframe;
            int frameIndex = 0;

            foreach (tfxJSONValue frame_data in json_data)
            {
                keyframe = new UnityEngine.Keyframe()
                {
                    inTangent  = (float)frame_data.Obj["inTangent"].Number,
                    outTangent = (float)frame_data.Obj["outTangent"].Number,
#if !UNITY_2018_1_OR_NEWER
                    tangentMode = (int)frame_data.Obj["tangentMode"].Number,
#endif
                    time  = (float)frame_data.Obj["time"].Number,
                    value = (float)frame_data.Obj["value"].Number
                };

#if UNITY_2018_1_OR_NEWER && UNITY_EDITOR
                AnimationUtility.SetKeyLeftTangentMode(anim_curve, frameIndex, (AnimationUtility.TangentMode)((int)frame_data.Obj["tangentModeLeft"].Number));
                AnimationUtility.SetKeyRightTangentMode(anim_curve, frameIndex, (AnimationUtility.TangentMode)((int)frame_data.Obj["tangentModeRight"].Number));
#endif

                anim_curve.AddKey(keyframe);

                frameIndex++;
            }

            return(anim_curve);
        }
コード例 #3
0
ファイル: LetterAnimation.cs プロジェクト: poup/ankagaja
        public tfxJSONValue ExportDataAsPresetSection(bool saveSampleTextData = true)
        {
            tfxJSONObject json_data = new tfxJSONObject();

            if (m_loop_cycles.Count > 0)
            {
                tfxJSONArray loops_data = new tfxJSONArray();

                foreach (ActionLoopCycle action_loop in m_loop_cycles)
                {
                    loops_data.Add(action_loop.ExportData());
                }

                json_data["LOOPS_DATA"] = loops_data;
            }

            tfxJSONArray actions_data = new tfxJSONArray();

            foreach (LetterAction action in m_letter_actions)
            {
                actions_data.Add(action.ExportData());
            }
            json_data["ACTIONS_DATA"] = actions_data;

            if (saveSampleTextData)
            {
                json_data["SAMPLE_NUM_LETTERS_ANIMATED"] = m_letters_to_animate.Count;
            }

            return(new tfxJSONValue(json_data));
        }
コード例 #4
0
        public static tfxJSONValue ExportData(this AnimationCurve curve)
        {
            tfxJSONArray key_frame_data = new tfxJSONArray();

            foreach (UnityEngine.Keyframe key_frame in curve.keys)
            {
                key_frame_data.Add(key_frame.ExportData());
            }

            return(key_frame_data);
        }
コード例 #5
0
        public static List <int> JSONtoListInt(this tfxJSONArray json_array)
        {
            List <int> int_list = new List <int>();

            foreach (tfxJSONValue int_val in json_array)
            {
                int_list.Add((int)int_val.Number);
            }

            return(int_list);
        }
コード例 #6
0
        public static tfxJSONArray ExportData(this List <int> list)
        {
            tfxJSONArray json_array = new tfxJSONArray();

            foreach (int num in list)
            {
                json_array.Add(num);
            }

            return(json_array);
        }
コード例 #7
0
        public static AnimationCurve JSONtoAnimationCurve(this tfxJSONArray json_data)
        {
            AnimationCurve anim_curve = new AnimationCurve();

            anim_curve.keys = new Keyframe[0];

            foreach (tfxJSONValue frame_data in json_data)
            {
                anim_curve.AddKey(frame_data.Obj.JSONtoKeyframe());
            }

            return(anim_curve);
        }
コード例 #8
0
ファイル: TextFxBezierCurve.cs プロジェクト: zynigma/ddgame
        public tfxJSONValue ExportData()
        {
            tfxJSONObject json_data = new tfxJSONObject();

            tfxJSONArray  anchors_data = new tfxJSONArray();
            tfxJSONObject anchor_point_data;

            foreach (BezierCurvePoint anchor_point in m_anchor_points)
            {
                anchor_point_data = new tfxJSONObject();
                anchor_point_data["m_anchor_point"] = anchor_point.m_anchor_point.ExportData();
                anchor_point_data["m_handle_point"] = anchor_point.m_handle_point.ExportData();

                anchors_data.Add(anchor_point_data);
            }

            json_data["ANCHORS_DATA"] = anchors_data;

            return(new tfxJSONValue(json_data));
        }
コード例 #9
0
ファイル: LetterAction.cs プロジェクト: zynigma/ddgame
        public tfxJSONValue ExportData()
        {
            tfxJSONObject json_data = new tfxJSONObject();

            json_data["m_action_type"]             = (int)m_action_type;
            json_data["m_ease_type"]               = (int)m_ease_type;
            json_data["m_use_gradient_start"]      = m_use_gradient_start;
            json_data["m_use_gradient_end"]        = m_use_gradient_end;
            json_data["m_force_same_start_time"]   = m_force_same_start_time;
            json_data["m_letter_anchor_start"]     = m_letter_anchor_start;
            json_data["m_letter_anchor_end"]       = m_letter_anchor_end;
            json_data["m_letter_anchor_2_way"]     = m_letter_anchor_2_way;
            json_data["m_offset_from_last"]        = m_offset_from_last;
            json_data["m_position_axis_ease_data"] = m_position_axis_ease_data.ExportData();
            json_data["m_rotation_axis_ease_data"] = m_rotation_axis_ease_data.ExportData();
            json_data["m_scale_axis_ease_data"]    = m_scale_axis_ease_data.ExportData();

            if (m_use_gradient_start)
            {
                json_data["m_start_vertex_colour"] = m_start_vertex_colour.ExportData();
            }
            else
            {
                json_data["m_start_colour"] = m_start_colour.ExportData();
            }
            json_data["m_start_euler_rotation"] = m_start_euler_rotation.ExportData();
            json_data["m_start_pos"]            = m_start_pos.ExportData();
            json_data["m_start_scale"]          = m_start_scale.ExportData();

            if (m_use_gradient_end)
            {
                json_data["m_end_vertex_colour"] = m_end_vertex_colour.ExportData();
            }
            else
            {
                json_data["m_end_colour"] = m_end_colour.ExportData();
            }
            json_data["m_end_euler_rotation"] = m_end_euler_rotation.ExportData();
            json_data["m_end_pos"]            = m_end_pos.ExportData();
            json_data["m_end_scale"]          = m_end_scale.ExportData();

            json_data["m_delay_progression"]    = m_delay_progression.ExportData();
            json_data["m_duration_progression"] = m_duration_progression.ExportData();


            tfxJSONArray audio_effects_data = new tfxJSONArray();

            foreach (AudioEffectSetup effect_setup in m_audio_effects)
            {
                if (effect_setup.m_audio_clip == null)
                {
                    continue;
                }

                audio_effects_data.Add(effect_setup.ExportData());
            }
            json_data["AUDIO_EFFECTS_DATA"] = audio_effects_data;

            tfxJSONArray particle_effects_data = new tfxJSONArray();

            foreach (ParticleEffectSetup effect_setup in m_particle_effects)
            {
                if (effect_setup.m_legacy_particle_effect == null && effect_setup.m_shuriken_particle_effect == null)
                {
                    continue;
                }

                particle_effects_data.Add(effect_setup.ExportData());
            }
            json_data["PARTICLE_EFFECTS_DATA"] = particle_effects_data;

            return(new tfxJSONValue(json_data));
        }