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); } } } }
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++; } } } }