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 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; }
public static VertexColour JSONtoVertexColour(this Boomlagoon.JSON.JSONObject json_data) { if (json_data.ContainsKey("r")) { // Legacy export data return(new VertexColour(json_data.JSONtoColor())); } return(new VertexColour() { bottom_left = json_data["bottom_left"].Obj.JSONtoColor(), bottom_right = json_data["bottom_right"].Obj.JSONtoColor(), top_left = json_data["top_left"].Obj.JSONtoColor(), top_right = json_data["top_right"].Obj.JSONtoColor() }); }
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++; } } } }