예제 #1
0
		public void ImportData(Boomlagoon.JSON.JSONObject json_data)
		{
			if(json_data.ContainsKey("m_finish_at_end"))
				m_finish_at_end = json_data["m_finish_at_end"].Boolean;
			else
				m_finish_at_end = false;
			m_delay_first_only = json_data["m_delay_first_only"].Boolean;
			m_end_action_idx = (int) json_data["m_end_action_idx"].Number;
			m_loop_type = (LOOP_TYPE) (int) json_data["m_loop_type"].Number;
			m_number_of_loops = (int) json_data["m_number_of_loops"].Number;
			m_start_action_idx = (int) json_data["m_start_action_idx"].Number;
		}
예제 #2
0
		public void ImportData(Boomlagoon.JSON.JSONObject json_data, string assetNameSuffix = "", float timing_scale = -1)
		{	
			m_action_type = (ACTION_TYPE) (int) json_data["m_action_type"].Number;
			m_ease_type = (EasingEquation) (int) json_data["m_ease_type"].Number;
			m_force_same_start_time = json_data["m_force_same_start_time"].Boolean;
			m_letter_anchor_start = (int) json_data["m_letter_anchor_start"].Number;
			m_letter_anchor_end = (int) json_data["m_letter_anchor_end"].Number;
			m_letter_anchor_2_way = json_data["m_letter_anchor_2_way"].Boolean;
			m_offset_from_last = json_data["m_offset_from_last"].Boolean;
			m_position_axis_ease_data.ImportData(json_data["m_position_axis_ease_data"].Obj);
			m_rotation_axis_ease_data.ImportData(json_data["m_rotation_axis_ease_data"].Obj);
			m_scale_axis_ease_data.ImportData(json_data["m_scale_axis_ease_data"].Obj);

			m_colour_transition_active = json_data.ContainsKey("m_colour_transition_active") ? json_data ["m_colour_transition_active"].Boolean : true;
			m_position_transition_active = json_data.ContainsKey("m_position_transition_active") ? json_data ["m_position_transition_active"].Boolean : true;
			m_local_rotation_transition_active = json_data.ContainsKey("m_local_rotation_transition_active") ? json_data ["m_local_rotation_transition_active"].Boolean : true;
			m_local_scale_transition_active = json_data.ContainsKey("m_local_scale_transition_active") ? json_data ["m_local_scale_transition_active"].Boolean : true;
			m_global_rotation_transition_active = json_data.ContainsKey("m_global_rotation_transition_active") ? json_data ["m_global_rotation_transition_active"].Boolean : true;
			m_global_scale_transition_active = json_data.ContainsKey("m_global_scale_transition_active") ? json_data ["m_global_scale_transition_active"].Boolean : true;


			if(json_data.ContainsKey("m_start_colour"))
				m_start_colour.ImportData(json_data["m_start_colour"].Obj);
			if(json_data.ContainsKey("m_end_colour"))
				m_end_colour.ImportData(json_data["m_end_colour"].Obj);

			if(json_data.ContainsKey("m_start_vertex_colour"))
				m_start_colour.ImportData(json_data["m_start_vertex_colour"].Obj);
			if(json_data.ContainsKey("m_end_vertex_colour"))
				m_start_colour.ImportData(json_data["m_end_vertex_colour"].Obj);

			if(json_data.ContainsKey("m_use_gradient_start"))
				// Legacy setting. Need to check for it for backwards compatibility
				m_start_colour.UseColourGradients = json_data["m_use_gradient_start"].Boolean;

			if(json_data.ContainsKey("m_use_gradient_end"))
				// Legacy setting. Need to check for it for backwards compatibility
				m_end_colour.UseColourGradients = json_data["m_use_gradient_end"].Boolean;

			
			m_start_pos.ImportData(json_data["m_start_pos"].Obj);
			m_end_pos.ImportData(json_data["m_end_pos"].Obj);

			m_start_euler_rotation.ImportData(json_data["m_start_euler_rotation"].Obj);
			m_end_euler_rotation.ImportData(json_data["m_end_euler_rotation"].Obj);
			m_start_scale.ImportData(json_data["m_start_scale"].Obj);
			m_end_scale.ImportData(json_data["m_end_scale"].Obj);

			m_global_start_euler_rotation.ImportData(json_data["m_global_start_euler_rotation"].Obj);
			m_global_end_euler_rotation.ImportData(json_data["m_global_end_euler_rotation"].Obj);
			m_global_start_scale.ImportData(json_data["m_global_start_scale"].Obj);
			m_global_end_scale.ImportData(json_data["m_global_end_scale"].Obj);

			m_duration_progression.ImportData(json_data["m_duration_progression"].Obj);
			m_delay_progression.ImportData(json_data["m_delay_progression"].Obj);

			if(timing_scale != -1)
			{
				// Scale delay easing by the provided timing scale
				if(m_delay_progression.Progression != (int) ValueProgression.Constant)
				{
					float from = m_delay_progression.ValueFrom;
					float to = m_delay_progression.ValueTo;
					float then = m_delay_progression.ValueThen;

					if(m_delay_progression.Progression == (int) ValueProgression.Eased)
					{
						if(m_delay_progression.UsingThirdValue)
							m_delay_progression.SetEased( from * timing_scale, to * timing_scale, then * timing_scale);
						else
							m_delay_progression.SetEased( from * timing_scale, to * timing_scale);
					}
					else if(m_delay_progression.Progression == (int) ValueProgression.EasedCustom)
					{
						m_delay_progression.SetEasedCustom( from * timing_scale, to * timing_scale);
					}
					else if(m_delay_progression.Progression == (int) ValueProgression.Random)
					{
						m_delay_progression.SetRandom( from * timing_scale, to * timing_scale, m_delay_progression.UniqueRandomRaw);
					}
				}
			}
			
			m_audio_effects = new List<AudioEffectSetup>();
			AudioEffectSetup audio_effect;
			foreach(Boomlagoon.JSON.JSONValue audio_data in json_data["AUDIO_EFFECTS_DATA"].Array)
			{
				audio_effect = new AudioEffectSetup();
				audio_effect.ImportData(audio_data.Obj);
				m_audio_effects.Add(audio_effect);
			}
			
			m_particle_effects = new List<ParticleEffectSetup>();
			ParticleEffectSetup particle_effect;
			foreach(Boomlagoon.JSON.JSONValue particle_data in json_data["PARTICLE_EFFECTS_DATA"].Array)
			{
				particle_effect = new ParticleEffectSetup();
				particle_effect.ImportData(particle_data.Obj, assetNameSuffix);
				m_particle_effects.Add(particle_effect);
			}
		}
		public override void ImportData(Boomlagoon.JSON.JSONObject json_data)
		{
			base.ImportData(json_data);
			
			m_force_position_override = json_data["m_force_position_override"].Boolean;
			
			if(json_data.ContainsKey("m_bezier_curve"))
			{
				m_bezier_curve.ImportData(json_data["m_bezier_curve"].Obj);
			}
		}
		protected void ImportBaseData(Boomlagoon.JSON.JSONObject json_data)
		{
			m_progression_idx = (int) json_data["m_progression"].Number;
			m_ease_type = (EasingEquation) (int) json_data["m_ease_type"].Number;
			m_is_offset_from_last = json_data["m_is_offset_from_last"].Boolean;
			m_to_to_bool = json_data["m_to_to_bool"].Boolean;
			m_unique_randoms = json_data["m_unique_randoms"].Boolean;
			m_animate_per = (AnimatePerOptions) (int) json_data["m_animate_per"].Number;
			m_override_animate_per_option = json_data["m_override_animate_per_option"].Boolean;
			if(json_data.ContainsKey("m_custom_ease_curve"))
				m_custom_ease_curve = json_data["m_custom_ease_curve"].Array.JSONtoAnimationCurve();
		}
		public override void ImportData(Boomlagoon.JSON.JSONObject json_data)
		{
			m_from = json_data["m_from"].Obj.JSONtoVertexColour();
			m_to = json_data["m_to"].Obj.JSONtoVertexColour();
			m_to_to = json_data["m_to_to"].Obj.JSONtoVertexColour();

			if(json_data.ContainsKey("m_use_colour_gradients"))
				m_use_colour_gradients = json_data["m_use_colour_gradients"].Boolean;
			else
				m_use_colour_gradients = false;

			if(json_data.ContainsKey("m_override_alpha"))
				m_override_alpha = json_data["m_override_alpha"].Boolean;
			else
				m_override_alpha = false;
			
			ImportBaseData(json_data);
		}
		public override void ImportData(Boomlagoon.JSON.JSONObject json_data)
		{
			m_from = json_data["m_from"].Obj.JSONtoVector3();
			m_to = json_data["m_to"].Obj.JSONtoVector3();
			m_to_to = json_data["m_to_to"].Obj.JSONtoVector3();
			m_ease_curve_per_axis = json_data["m_ease_curve_per_axis"].Boolean;
			if(json_data.ContainsKey("m_custom_ease_curve_y"))
			{
				m_custom_ease_curve_y = json_data["m_custom_ease_curve_y"].Array.JSONtoAnimationCurve();
				m_custom_ease_curve_z = json_data["m_custom_ease_curve_z"].Array.JSONtoAnimationCurve();
			}
			
			ImportBaseData(json_data);
			
		}
예제 #7
0
		public void ImportData(Boomlagoon.JSON.JSONObject json_data, string assetNameSuffix = "")
		{
			
			m_letters_to_animate = json_data["m_letters_to_animate"].Array.JSONtoListInt();
			m_letters_to_animate_custom_idx = (int) json_data["m_letters_to_animate_custom_idx"].Number;
			m_letters_to_animate_option = (LETTERS_TO_ANIMATE) (int) json_data["m_letters_to_animate_option"].Number;
			
			m_letter_actions = new List<LetterAction>();
			LetterAction letter_action;
			foreach(Boomlagoon.JSON.JSONValue action_data in json_data["ACTIONS_DATA"].Array)
			{
				letter_action = new LetterAction();
				letter_action.ImportData(action_data.Obj, assetNameSuffix);
				m_letter_actions.Add(letter_action);
			}

			m_loop_cycles = new List<ActionLoopCycle>();
			if(json_data.ContainsKey("LOOPS_DATA"))
			{
				ActionLoopCycle loop_cycle;
				
				foreach(Boomlagoon.JSON.JSONValue loop_data in json_data["LOOPS_DATA"].Array)
				{
					loop_cycle = new ActionLoopCycle();
					loop_cycle.ImportData(loop_data.Obj);
					
					// Check for invalid loops
					if(loop_cycle.m_start_action_idx < m_letter_actions.Count && loop_cycle.m_end_action_idx < m_letter_actions.Count)
					{
						m_loop_cycles.Add(loop_cycle);
					}
					
				}
			}
		}
예제 #8
0
		public void ImportPresetSectionData(Boomlagoon.JSON.JSONObject json_data, LetterSetup[] letters, int action_insert_index, int loop_insert_index, ref int num_actions_added, ref int num_loops_added, string assetNameSuffix = "")
		{
			if(m_letter_actions == null)
				m_letter_actions = new List<LetterAction>();

			float timing_scale = -1;

			if(m_letters_to_animate == null || m_letters_to_animate.Count == 0)
			{
				CalculateLettersToAnimate(letters);
			}

			if(json_data.ContainsKey("SAMPLE_NUM_LETTERS_ANIMATED") && m_letters_to_animate != null && m_letters_to_animate.Count > 0)
			{
				timing_scale = m_letters_to_animate.Count / ((float) json_data["SAMPLE_NUM_LETTERS_ANIMATED"].Number);
			}


			LetterAction letter_action;
			num_actions_added = 0;
			foreach(Boomlagoon.JSON.JSONValue action_data in json_data["ACTIONS_DATA"].Array)
			{
				letter_action = new LetterAction();
				letter_action.ImportData(action_data.Obj, assetNameSuffix, timing_scale: timing_scale);

				if(num_actions_added == 0 && action_insert_index > 0)
				{
					// Inserting new actions into the middle of the animation. Set first action to continue from last
					letter_action.m_offset_from_last = true;
				}

				InsertAction(action_insert_index + num_actions_added, letter_action);

				num_actions_added++;
			}


			if (m_loop_cycles == null)
				m_loop_cycles = new List<ActionLoopCycle>();


			num_loops_added = 0;

			if(json_data.ContainsKey("LOOPS_DATA"))
			{
				ActionLoopCycle loop_cycle;
				
				foreach(Boomlagoon.JSON.JSONValue loop_data in json_data["LOOPS_DATA"].Array)
				{
					loop_cycle = new ActionLoopCycle();
					loop_cycle.ImportData(loop_data.Obj);
					loop_cycle.m_start_action_idx += action_insert_index;
					loop_cycle.m_end_action_idx += action_insert_index;

					// Check for invalid loops
					if(loop_cycle.m_start_action_idx < m_letter_actions.Count && loop_cycle.m_end_action_idx < m_letter_actions.Count)
					{
						m_loop_cycles.Insert(loop_insert_index + num_loops_added, loop_cycle);
						
						num_loops_added++;
					}
				}
			}
		}