public ParticleEffectInstanceManager(TextFxAnimationManager animation_manager, LetterSetup letter_setup_ref, ParticleEffectSetup effect_setup, AnimationProgressionVariables progression_vars, AnimatePerOptions animate_per, ParticleSystem particle_system = null) #endif { #if !UNITY_5_4_OR_NEWER m_particle_emitter = particle_emitter; #endif m_particle_system = particle_system; m_letter_setup_ref = letter_setup_ref; m_follow_mesh = effect_setup.m_follow_mesh; m_duration = effect_setup.m_duration.GetValue(progression_vars, animate_per); m_delay = effect_setup.m_delay.GetValue(progression_vars, animate_per); m_position_offset = effect_setup.m_position_offset.GetValue(null, progression_vars, animate_per); m_rotation_offset = Quaternion.Euler(effect_setup.m_rotation_offset.GetValue(null, progression_vars, animate_per)); m_rotate_with_letter = effect_setup.m_rotate_relative_to_letter; m_animation_manager = animation_manager; m_active = false; #if !UNITY_5_4_OR_NEWER if (m_particle_emitter != null) { m_transform = m_particle_emitter.transform; m_particle_emitter.emit = true; m_particle_emitter.enabled = false; // Set the layer of the effect if an override is specified if (animation_manager.AnimationInterface.LayerOverride >= 0) { m_particle_emitter.gameObject.layer = animation_manager.AnimationInterface.LayerOverride; } } else #endif if (m_particle_system != null) { m_transform = m_particle_system.transform; #if UNITY_5_5_OR_NEWER ParticleSystem.MainModule mainMod = m_particle_system.main; mainMod.playOnAwake = false; #else m_particle_system.playOnAwake = false; #endif if (m_delay <= 0) { m_particle_system.Play(); } #if !UNITY_3_5 && UNITY_EDITOR p_system_timer = 0; #endif // Set the layer of the effect if an override is specified if (animation_manager.AnimationInterface.LayerOverride >= 0) { m_particle_system.gameObject.layer = animation_manager.AnimationInterface.LayerOverride; } } }
public void PrepareData(TextFxAnimationManager anim_manager, LetterSetup[] letters, ANIMATION_DATA_TYPE what_to_update, int num_words, int num_lines, AnimatePerOptions animate_per) { if (letters == null || letters.Length == 0) { return; } if (m_letters_to_animate == null || what_to_update == ANIMATION_DATA_TYPE.ALL || what_to_update == ANIMATION_DATA_TYPE.ANIMATE_ON) { CalculateLettersToAnimate(letters); } if (what_to_update == ANIMATION_DATA_TYPE.ALL || what_to_update == ANIMATION_DATA_TYPE.COLOUR || m_defaultTextColourProgression == null) { // Set values for default text colour progression VertexColour[] defaultextColours = new VertexColour[m_letters_to_animate.Count]; for (int idx = 0; idx < m_letters_to_animate.Count; idx++) { defaultextColours[idx] = letters[m_letters_to_animate[idx]].BaseColour; } m_defaultTextColourProgression.SetValues(defaultextColours); // Mark as the default colour progression m_defaultTextColourProgression.SetReferenceData(-1, ANIMATION_DATA_TYPE.COLOUR, true); } // Prepare progression data in all actions LetterAction letter_action; LetterAction prev_action = null; bool prev_action_end_state = true; for (int action_idx = 0; action_idx < m_letter_actions.Count; action_idx++) { letter_action = m_letter_actions[action_idx]; letter_action.PrepareData(anim_manager, ref letters, this, action_idx, what_to_update, m_letters_to_animate.Count, m_num_white_space_chars_to_include, num_words, num_lines, prev_action, animate_per, m_defaultTextColourProgression, prev_action_end_state); if (letter_action.m_action_type == ACTION_TYPE.ANIM_SEQUENCE) { // Set default previous action settings prev_action_end_state = true; prev_action = letter_action; } // Check for reverse loops, and how the animation should progress from there foreach (ActionLoopCycle loop_cycle in m_loop_cycles) { if (loop_cycle.m_end_action_idx == action_idx && loop_cycle.m_loop_type == LOOP_TYPE.LOOP_REVERSE && !loop_cycle.m_finish_at_end) { prev_action = m_letter_actions[loop_cycle.m_start_action_idx]; prev_action_end_state = false; } } } }
new void OnEnable() { uguiEffect = (TextFxUGUI)target; animationManager = uguiEffect.AnimationManager; EditorApplication.update += UpdateManager; base.OnEnable(); }
new void OnEnable() { //tmpEffect = (TextFxTextMeshProUGUI) target; animationManager = tmpEffect.AnimationManager; EditorApplication.update += UpdateManager; OnEnable(); }
void OnEnable() { TextFxNative effectInstance = (TextFxNative)target; animationManager = effectInstance.AnimationManager; effectInstance.GetComponent <MeshRenderer>().hideFlags = HideFlags.HideInInspector; effectInstance.GetComponent <MeshFilter>().hideFlags = HideFlags.HideInInspector; EditorApplication.update += UpdateManager; }
bool m_textFxAnimDrawCall = false; // Denotes whether the subsequent OnFillVBO call has been triggered by TextFx or not protected override void OnEnable() { base.OnEnable(); if (m_animation_manager == null) { m_animation_manager = new TextFxAnimationManager(); } m_animation_manager.SetParentObjectReferences(gameObject, transform, this); }
bool m_textFxAnimDrawCall = false; // Denotes whether the subsequent OnFillVBO call has been triggered by TextFx or not protected override void OnEnable() { base.OnEnable(); if (m_animation_manager == null) { m_animation_manager = new TextFxAnimationManager(); } m_animation_manager.SetParentObjectReferences(gameObject, transform, this); m_canvasRendererComp = GetComponent <CanvasRenderer> (); }
void OnSceneGUI() { if (uguiEffect.RenderToCurve && uguiEffect.BezierCurve.EditorVisible) { TextFxAnimationManager animationManager = uguiEffect.AnimationManager; uguiEffect.OnSceneGUIBezier(animationManager.Transform.position, animationManager.Scale * animationManager.AnimationInterface.MovementScale); if (GUI.changed) { RefreshTextCurveData(); } } }
Color[] m_forced_state_cols; // Verts stored for a one time rendering call protected override void OnEnable() { base.OnEnable(); if (m_animation_manager == null) { m_animation_manager = new TextFxAnimationManager(new int[] { 1, 0, 3, 2 }); } m_animation_manager.SetParentObjectReferences(gameObject, transform, this); if (!Application.isPlaying) { // Call to update mesh rendering UpdateGeometry(); } }
protected override void Awake() { base.Awake(); if (m_animation_manager == null) { m_animation_manager = new TextFxAnimationManager(); } m_animation_manager.SetParentObjectReferences(gameObject, transform, this); if (!Application.isPlaying) { return; } m_animation_manager.OnStart(); }
public static void ImportLegacyData(this TextFxAnimationManager effect_manager, string data) { List <object> data_list = data.StringToList(); KeyValuePair <string, string> value_pair; string key, value; int anim_idx = 0; effect_manager.m_master_animations = new List <LetterAnimation> (); for (int idx = 0; idx < data_list.Count; idx++) { value_pair = (KeyValuePair <string, string>)data_list[idx]; key = value_pair.Key; value = value_pair.Value; switch (key) { case "m_animate_per": effect_manager.m_animate_per = (AnimatePerOptions)int.Parse(value); break; case "m_begin_delay": effect_manager.m_begin_delay = float.Parse(value); break; case "m_begin_on_start": effect_manager.m_begin_on_start = bool.Parse(value); break; case "m_on_finish_action": effect_manager.m_on_finish_action = (ON_FINISH_ACTION)int.Parse(value); break; case "m_time_type": effect_manager.m_time_type = (AnimationTime)int.Parse(value); break; case "ANIM_DATA_START": if (anim_idx == effect_manager.NumAnimations) { effect_manager.AddAnimation(); } idx = effect_manager.GetAnimation(anim_idx).ImportLegacyData(data_list, idx + 1); anim_idx++; break; } } }
public static void UpdateManager(TextFxAnimationManager animationManager) { if (animationManager.PreviewingAnimationInEditor && !animationManager.PreviewAnimationPaused) { if (animationManager == null) { animationManager.PreviewingAnimationInEditor = false; return; } if (!animationManager.UpdateAnimation() && animationManager.ParticleEffectManagers.Count == 0) { animationManager.PreviewingAnimationInEditor = false; } animationManager.AnimationInterface.UpdateTextFxMesh(); if (animationManager.ParticleEffectManagers.Count > 0) { SceneView.RepaintAll(); } } }
public float[] GetLetterProgressions(TextFxAnimationManager anim_manager, ref LetterSetup[] letters, TextAlignment alignment = TextAlignment.Left) { float[] letter_progressions = new float[letters.Length]; if (letters.Length == 0) { return(letter_progressions); } if (m_pointData.m_numActiveCurvePoints < 2) { for (int idx = 0; idx < letters.Length; idx++) { letter_progressions[idx] = 0; } return(letter_progressions); } float progress_inc = 1f / NUM_CURVE_SAMPLE_SUBSECTIONS; float progress; Vector3 new_point = new Vector3(); Vector3 last_point = new Vector3(); int letter_idx = 0, line_number = 0; float base_letters_offset = 0, letters_offset = 0; LetterSetup letter = null; float last_line_length = 0, line_length = 0; float curve_length = 0; float renderedTextWidth; // Method to handle offsetting the letter_offset value based on the text alignment setting System.Action offsetBasedOnTextAlignment = () => { if (alignment == TextAlignment.Center || alignment == TextAlignment.Right) { renderedTextWidth = (anim_manager.TextWidthScaled(letter.m_progression_variables.LineValue) < curve_length ? anim_manager.TextWidthScaled(letter.m_progression_variables.LineValue) : curve_length); if (alignment == TextAlignment.Center) { letters_offset += (curve_length / 2) - (renderedTextWidth / 2); } else if (alignment == TextAlignment.Right) { letters_offset += curve_length - renderedTextWidth; } } }; // Grab reference to first letter setup letter = letters[0]; // Calculate the total length of the belzier curve if the text alignment is set to center or right. if (alignment == TextAlignment.Center || alignment == TextAlignment.Right) { for (int curve_idx = 0; curve_idx < m_pointData.m_numActiveCurvePoints - 1; curve_idx++) { curve_length += GetCurveLength(curve_idx); } } // Assign base letter offset value using first letters offset value base_letters_offset = letter.BaseVerticesCenter.x / anim_manager.AnimationInterface.MovementScale - (letter.Width / anim_manager.AnimationInterface.MovementScale) / 2; // Setup letter offset value letters_offset = (letter.Width / anim_manager.AnimationInterface.MovementScale) / 2; // Handle alignment-specific offset values offsetBasedOnTextAlignment(); bool reachedEndOfLetters = false; while (!reachedEndOfLetters) { for (int curve_idx = 0; curve_idx < m_pointData.m_numActiveCurvePoints - 1; curve_idx++) { for (int idx = 0; idx <= NUM_CURVE_SAMPLE_SUBSECTIONS; idx++) { progress = idx * progress_inc; new_point = GetCurvePoint(progress, curve_idx: curve_idx); if (idx > 0) { line_length += (new_point - last_point).magnitude; while (letter_idx < letters.Length && line_length > letters_offset) { // calculate relative progress between the last two points which would represent the next letters offset distance progress = curve_idx + ((idx - 1) * progress_inc) + (((letters_offset - last_line_length) / (line_length - last_line_length)) * progress_inc); letter_progressions [letter_idx] = progress; letter_idx++; // Work out offset value for next letter if (letter_idx < letters.Length && !letters [letter_idx].StubInstance && letters [letter_idx].VisibleCharacter) { letter = letters [letter_idx]; if (letter.m_progression_variables.LineValue > line_number) { line_number = letter.m_progression_variables.LineValue; // Set a new base offset value to that of the first letter of this new line base_letters_offset = letter.BaseVerticesCenter.x / anim_manager.AnimationInterface.MovementScale - (letter.Width / anim_manager.AnimationInterface.MovementScale) / 2; curve_idx = 0; idx = -1; line_length = 0; } // Setup letter offset value letters_offset = ((letter.BaseVerticesCenter.x / anim_manager.AnimationInterface.MovementScale) - base_letters_offset); // Handle alignment-specific offset values offsetBasedOnTextAlignment(); } } if (letter_idx == letters.Length) { reachedEndOfLetters = true; break; } } last_point = new_point; last_line_length = line_length; } } // Handle any letters which didn't have room to fit on the line for (int idx = letter_idx; idx < letters.Length; idx++) { letter = letters[letter_idx]; if (letter.m_progression_variables.LineValue == line_number) { // Force remaining letters to the end of the line letter_progressions [idx] = m_pointData.m_numActiveCurvePoints - 1.001f; } else if (letter.VisibleCharacter && !letter.StubInstance) { line_number = letter.m_progression_variables.LineValue; line_length = 0; // Set a new base offset value to that of the first letter of this new line base_letters_offset = letter.BaseVerticesCenter.x / anim_manager.AnimationInterface.MovementScale - (letter.Width / anim_manager.AnimationInterface.MovementScale) / 2; // Setup letter offset value letters_offset = ((letter.BaseVerticesCenter.x / anim_manager.AnimationInterface.MovementScale) - base_letters_offset); // Handle alignment-specific offset values offsetBasedOnTextAlignment(); break; } letter_idx++; } if (letter_idx == letters.Length) { reachedEndOfLetters = true; break; } } // string progressionsString = ""; // for (int i = 0; i < letter_progressions.Length; i++) // progressionsString += letter_progressions [i] + "\n"; // Debug.Log("Curve Letter Progressions:\n" + progressionsString); return(letter_progressions); }
public bool DrawGUISetting(TextFxAnimationManager animation_manager, float gui_x_offset, ref float gui_y_offset, bool gui_already_changed, int action_start_offset = 0, int loop_start_offset = 0) { LetterAnimation letterAnimation = animation_manager.GetAnimation(m_animation_idx); LetterAction letterAction = letterAnimation != null?letterAnimation.GetAction(m_action_idx + action_start_offset) : null; if (letterAction == null) { return(false); } if ((m_data_type == ANIMATION_DATA_TYPE.POSITION && m_startState && letterAction.m_start_pos.DrawQuickEditorGUI(this, gui_x_offset, ref gui_y_offset, gui_already_changed)) || (m_data_type == ANIMATION_DATA_TYPE.POSITION && !m_startState && letterAction.m_end_pos.DrawQuickEditorGUI(this, gui_x_offset, ref gui_y_offset, gui_already_changed)) || (m_data_type == ANIMATION_DATA_TYPE.LOCAL_ROTATION && m_startState && letterAction.m_start_euler_rotation.DrawQuickEditorGUI(this, gui_x_offset, ref gui_y_offset, gui_already_changed)) || (m_data_type == ANIMATION_DATA_TYPE.LOCAL_ROTATION && !m_startState && letterAction.m_end_euler_rotation.DrawQuickEditorGUI(this, gui_x_offset, ref gui_y_offset, gui_already_changed)) || (m_data_type == ANIMATION_DATA_TYPE.GLOBAL_ROTATION && m_startState && letterAction.m_global_start_euler_rotation.DrawQuickEditorGUI(this, gui_x_offset, ref gui_y_offset, gui_already_changed)) || (m_data_type == ANIMATION_DATA_TYPE.GLOBAL_ROTATION && !m_startState && letterAction.m_global_end_euler_rotation.DrawQuickEditorGUI(this, gui_x_offset, ref gui_y_offset, gui_already_changed)) || (m_data_type == ANIMATION_DATA_TYPE.LOCAL_SCALE && m_startState && letterAction.m_start_scale.DrawQuickEditorGUI(this, gui_x_offset, ref gui_y_offset, gui_already_changed)) || (m_data_type == ANIMATION_DATA_TYPE.LOCAL_SCALE && !m_startState && letterAction.m_end_scale.DrawQuickEditorGUI(this, gui_x_offset, ref gui_y_offset, gui_already_changed)) || (m_data_type == ANIMATION_DATA_TYPE.GLOBAL_SCALE && m_startState && letterAction.m_global_start_scale.DrawQuickEditorGUI(this, gui_x_offset, ref gui_y_offset, gui_already_changed)) || (m_data_type == ANIMATION_DATA_TYPE.GLOBAL_SCALE && !m_startState && letterAction.m_global_end_scale.DrawQuickEditorGUI(this, gui_x_offset, ref gui_y_offset, gui_already_changed)) || (m_data_type == ANIMATION_DATA_TYPE.COLOUR && m_startState && letterAction.m_start_colour.DrawQuickEditorGUI(this, gui_x_offset, ref gui_y_offset, gui_already_changed)) || (m_data_type == ANIMATION_DATA_TYPE.COLOUR && !m_startState && letterAction.m_end_colour.DrawQuickEditorGUI(this, gui_x_offset, ref gui_y_offset, gui_already_changed))) { animation_manager.PrepareAnimationData(m_data_type); if (!animation_manager.Playing) { // Set the current state of the animation to show effect of changes animation_manager.SetAnimationState(m_action_idx, m_startState ? 0 : 1, update_mesh: true); } } else if (m_data_type == ANIMATION_DATA_TYPE.DURATION && letterAction.m_duration_progression.DrawQuickEditorGUI("Lerp Duration", gui_x_offset, ref gui_y_offset, gui_already_changed)) { animation_manager.PrepareAnimationData(m_data_type); animation_manager.PrepareAnimationData(ANIMATION_DATA_TYPE.DELAY); } else if (m_data_type == ANIMATION_DATA_TYPE.DELAY && letterAction.m_delay_progression.DrawQuickEditorGUI("Delay Easing (Seconds)", gui_x_offset, ref gui_y_offset, gui_already_changed)) { animation_manager.PrepareAnimationData(m_data_type); } // else if(m_data_type == ANIMATION_DATA_TYPE.COLOUR_START_END && letterAction.m_start_colour.DrawQuickEditorGUI(this, ref gui_y_offset, gui_already_changed)) // { // // Set end colour to be the same at start colour // if(letterAction.m_start_colour.Progression == (int) ValueProgression.Constant) // letterAction.m_end_colour.SetConstant(letterAction.m_start_colour.ValueFrom); // else if(letterAction.m_start_colour.Progression == (int) ValueProgression.Eased) // { // if(letterAction.m_start_colour.UsingThirdValue) // letterAction.m_end_colour.SetEased(letterAction.m_start_colour.ValueFrom, letterAction.m_start_colour.ValueTo, letterAction.m_start_colour.ValueThen); // else // letterAction.m_end_colour.SetEased(letterAction.m_start_colour.ValueFrom, letterAction.m_start_colour.ValueTo); // } // else if(letterAction.m_start_colour.Progression == (int) ValueProgression.EasedCustom) // letterAction.m_end_colour.SetEasedCustom(letterAction.m_start_colour.ValueFrom, letterAction.m_start_colour.ValueTo); // else if(letterAction.m_start_colour.Progression == (int) ValueProgression.Random) // letterAction.m_end_colour.SetRandom(letterAction.m_start_colour.ValueFrom, letterAction.m_start_colour.ValueTo); // // animation_manager.PrepareAnimationData(ANIMATION_DATA_TYPE.COLOUR_END); // // animation_manager.PrepareAnimationData(ANIMATION_DATA_TYPE.COLOUR_START); // // if(!animation_manager.Playing) // { // // Set the current state of the animation to show effect of changes // animation_manager.SetAnimationState(m_action_idx, Mathf.Clamp(m_action_progress_state_override, 0f, 1f), update_mesh: true); // } // } else if (m_data_type == ANIMATION_DATA_TYPE.EASE_TYPE) { letterAction.m_ease_type = (EasingEquation)EditorGUI.EnumPopup(new Rect(gui_x_offset, gui_y_offset, 350, LINE_HEIGHT), m_setting_name, letterAction.m_ease_type); if (!gui_already_changed && GUI.changed) { animation_manager.PrepareAnimationData(ANIMATION_DATA_TYPE.ALL); } gui_y_offset += LINE_HEIGHT; } else if (m_data_type == ANIMATION_DATA_TYPE.DELAY_EASED_RANDOM_SWITCH) { bool newSelection = EditorGUI.Toggle(new Rect(gui_x_offset, gui_y_offset, 250, LINE_HEIGHT), "Randomised?", letterAction.m_delay_progression.Progression == (int)ValueProgression.Random); if (!gui_already_changed && GUI.changed) { if (newSelection) { letterAction.m_delay_progression.SetRandom(letterAction.m_delay_progression.ValueFrom, letterAction.m_delay_progression.ValueTo, letterAction.m_delay_progression.UniqueRandomRaw); } else { letterAction.m_delay_progression.SetEased(letterAction.m_delay_progression.ValueFrom, letterAction.m_delay_progression.ValueTo); } animation_manager.PrepareAnimationData(ANIMATION_DATA_TYPE.DELAY); } gui_y_offset += LINE_HEIGHT; } else if (m_data_type == ANIMATION_DATA_TYPE.NUM_LOOP_ITERATIONS) { ActionLoopCycle loop_cycle = letterAnimation.GetLoop(m_action_idx + loop_start_offset); if (loop_cycle != null) { loop_cycle.m_number_of_loops = EditorGUI.IntField(new Rect(gui_x_offset, gui_y_offset, 250, LINE_HEIGHT), m_setting_name, loop_cycle.m_number_of_loops); } gui_y_offset += LINE_HEIGHT; } return(!gui_already_changed && GUI.changed); }
public float[] GetLetterProgressions(TextFxAnimationManager anim_manager, ref LetterSetup[] letters, int letter_anchor) { float[] letter_progressions = new float[letters.Length]; if (m_anchor_points == null || m_anchor_points.Count < 2) { for (int idx = 0; idx < letters.Length; idx++) { letter_progressions[idx] = 0; } return(letter_progressions); } float progress_inc = 1f / NUM_CURVE_SAMPLE_SUBSECTIONS; float progress; Vector3 new_point = new Vector3(); Vector3 last_point = new Vector3(); int letter_idx = 0, line_number = 0; float base_letters_offset = 0, letters_offset = 0; LetterSetup letter; float last_line_length = 0, line_length = 0; // float curve_length = 0; // float length_val; // Grab reference to first letter setup letter = letters[letter_idx]; // Calculate the total length of the belzier curve if the text alignment is set to center or right. // if(effect_manager_ref.m_text_alignment == TextAlignment.Center || effect_manager_ref.m_text_alignment == TextAlignment.Right) // { // for(int curve_idx=0; curve_idx < m_anchor_points.Count - 1; curve_idx++) // { // length_val = GetCurveLength(curve_idx); // // curve_length += length_val; // } // } // Assign base letter offset value using first letters offset value base_letters_offset = letter.BaseVerticesCenter.x / anim_manager.AnimationInterface.MovementScale; // Setup letter offset value letters_offset = 0; //GetLetterAnchorOffset(letter, letter_anchor); // Handle alignment-specific offset values // if(effect_manager_ref.m_text_alignment == TextAlignment.Center) // { // letters_offset += ((curve_length/2) - (letter.m_effect_manager_handle.TextDimensions[letter.m_progression_variables.m_line_value].m_text_line_width/2)); // } // else if(effect_manager_ref.m_text_alignment == TextAlignment.Right) // { // letters_offset += (curve_length - letter.m_effect_manager_handle.TextDimensions[letter.m_progression_variables.m_line_value].m_text_line_width); // } for (int curve_idx = 0; curve_idx < m_anchor_points.Count - 1; curve_idx++) { for (int idx = 0; idx <= NUM_CURVE_SAMPLE_SUBSECTIONS; idx++) { progress = idx * progress_inc; new_point = GetCurvePoint(progress, curve_idx: curve_idx); // / anim_manager.AnimationInterface.MovementScale; if (idx > 0) { line_length += (new_point - last_point).magnitude; while (letter_idx < letters.Length && line_length > letters_offset) { // calculate relative progress between the last two points which would represent the next letters offset distance progress = curve_idx + ((idx - 1) * progress_inc) + (((letters_offset - last_line_length) / (line_length - last_line_length)) * progress_inc); letter_progressions[letter_idx] = progress; letter_idx++; if (letter_idx < letters.Length) { letter = letters[letter_idx]; if (letter.m_progression_variables.LineValue > line_number) { line_number = letter.m_progression_variables.LineValue; // Set a new base offset value to that of the first letter of this new line base_letters_offset = letter.BaseVerticesCenter.x / anim_manager.AnimationInterface.MovementScale; curve_idx = 0; idx = -1; line_length = 0; } // Setup letter offset value letters_offset = ((letter.BaseVerticesCenter.x / anim_manager.AnimationInterface.MovementScale) - base_letters_offset); //+ GetLetterAnchorOffset(letter, letter_anchor); // Handle alignment-specific offset values // if(effect_manager_ref.m_text_alignment == TextAlignment.Center) // { // letters_offset += ((curve_length/2) - (letter.m_effect_manager_handle.TextDimensions[letter.m_progression_variables.m_line_value].m_text_line_width/2)); // } // else if(effect_manager_ref.m_text_alignment == TextAlignment.Right) // { // letters_offset += (curve_length - letter.m_effect_manager_handle.TextDimensions[letter.m_progression_variables.m_line_value].m_text_line_width); // } } } if (letter_idx == letters.Length) { break; } } last_point = new_point; last_line_length = line_length; } } // Handle any letters which didn't have room to fit on the line // Currently forces them to all position at the end of the line for (int idx = letter_idx; idx < letters.Length; idx++) { letter_progressions[idx] = m_anchor_points.Count - 1; } return(letter_progressions); }
public ParticleEffectInstanceManager(TextFxAnimationManager animation_manager, LetterSetup letter_setup_ref, ParticleEffectSetup effect_setup, AnimationProgressionVariables progression_vars, AnimatePerOptions animate_per, ParticleEmitter particle_emitter = null, ParticleSystem particle_system = null)
public static void DrawTextFxInspectorSection(ScriptableObject objRef, TextFxAnimationManager animationManager, System.Action curveSettingChangeCallback) { // Check that required assets have been loaded CheckAssetReferences(objRef); EditorGUILayout.BeginHorizontal(m_horizontalLayoutBoxStyle, GUILayout.Height(35)); Color cachedColour = GUI.contentColor; #if UNITY_PRO_LICENSE GUI.contentColor = Color.black; #endif GUILayout.Label(" TextFx", m_textFxInspectorBoxTitleStyle, GUILayout.Width(90)); #if UNITY_PRO_LICENSE GUI.contentColor = cachedColour; #endif EditorGUILayout.BeginHorizontal(GUILayout.Width(120)); if (GUILayout.Button(!animationManager.PreviewingAnimationInEditor || animationManager.PreviewAnimationPaused ? m_play_button_texture : m_pause_button_texture, GUILayout.Width(m_inspectorButtonDims), GUILayout.Height(m_inspectorButtonDims))) { if (animationManager.PreviewingAnimationInEditor) { animationManager.PreviewAnimationPaused = !animationManager.PreviewAnimationPaused; } else { if (animationManager.m_master_animations == null || animationManager.m_master_animations.Count == 0) { // No animation defined yet. Open the animation editor window to point user in the right direction. Debug.LogWarning("You need to setup an animation before you can play anything..."); TextEffectsManager.Init(); } else { animationManager.PlayEditorAnimation(); } } } if (GUILayout.Button(m_reset_button_texture, GUILayout.Width(m_inspectorButtonDims), GUILayout.Height(m_inspectorButtonDims))) { animationManager.ResetEditorAnimation(); } if (animationManager.Playing) { // Continue Past Break Button if (GUILayout.Button(m_continue_button_texture, GUILayout.Width(m_inspectorButtonDims), GUILayout.Height(m_inspectorButtonDims))) { animationManager.ContinuePastBreak(); } // Continue Past Loop Button if (GUILayout.Button(m_continue_past_loop_button_texture, GUILayout.Width(m_inspectorButtonDims), GUILayout.Height(m_inspectorButtonDims))) { animationManager.ContinuePastLoop(); } } EditorGUILayout.EndHorizontal(); GUILayout.FlexibleSpace(); GUI.contentColor = cachedColour; #if UNITY_4_6 || UNITY_4_7 if (GUILayout.Button("Open Animation Editor", m_wrapButton, GUILayout.MaxWidth(150), GUILayout.MinWidth(100), GUILayout.Height(29))) #else if (GUILayout.Button("Open Animation Editor", m_wrapButton, GUILayout.MaxWidth(150), GUILayout.MinWidth(100), GUILayout.Height(32))) #endif { TextEffectsManager.Init(); } EditorGUILayout.EndHorizontal(); GUILayout.Space(10); if (animationManager.AnimationInterface != null && animationManager.AnimationInterface.CurvePositioningEnabled) { bool guiChanged = GUI.changed; animationManager.AnimationInterface.RenderToCurve = EditorGUILayout.Toggle("Render To Curve?", animationManager.AnimationInterface.RenderToCurve); if (animationManager.AnimationInterface.RenderToCurve) { animationManager.AnimationInterface.DrawBezierInspector(); } if (!guiChanged && GUI.changed && curveSettingChangeCallback != null) { curveSettingChangeCallback(); } GUILayout.Space(10); } }
public List <VariableStateListener> GetSettingData(TextFxAnimationManager animation_manager, int action_start_offset = 0, int loop_start_offset = 0) { LetterAnimation letterAnimation = animation_manager.GetAnimation(m_animation_idx); LetterAction letterAction = letterAnimation != null?letterAnimation.GetAction(m_action_idx + action_start_offset) : null; if (letterAction == null) { return(null); } // if((m_data_type == ANIMATION_DATA_TYPE.POSITION && m_startState && letterAction.m_start_pos.DrawQuickEditorGUI(this, gui_x_offset, ref gui_y_offset, gui_already_changed)) || // (m_data_type == ANIMATION_DATA_TYPE.POSITION && !m_startState && letterAction.m_end_pos.DrawQuickEditorGUI(this, gui_x_offset, ref gui_y_offset, gui_already_changed)) || // (m_data_type == ANIMATION_DATA_TYPE.LOCAL_ROTATION && m_startState && letterAction.m_start_euler_rotation.DrawQuickEditorGUI(this, gui_x_offset, ref gui_y_offset, gui_already_changed)) || // (m_data_type == ANIMATION_DATA_TYPE.LOCAL_ROTATION && !m_startState && letterAction.m_end_euler_rotation.DrawQuickEditorGUI(this, gui_x_offset, ref gui_y_offset, gui_already_changed)) || // (m_data_type == ANIMATION_DATA_TYPE.GLOBAL_ROTATION && m_startState && letterAction.m_global_start_euler_rotation.DrawQuickEditorGUI(this, gui_x_offset, ref gui_y_offset, gui_already_changed)) || // (m_data_type == ANIMATION_DATA_TYPE.GLOBAL_ROTATION && !m_startState && letterAction.m_global_end_euler_rotation.DrawQuickEditorGUI(this, gui_x_offset, ref gui_y_offset, gui_already_changed)) || // (m_data_type == ANIMATION_DATA_TYPE.LOCAL_SCALE && m_startState && letterAction.m_start_scale.DrawQuickEditorGUI(this, gui_x_offset, ref gui_y_offset, gui_already_changed)) || // (m_data_type == ANIMATION_DATA_TYPE.LOCAL_SCALE && !m_startState && letterAction.m_end_scale.DrawQuickEditorGUI(this, gui_x_offset, ref gui_y_offset, gui_already_changed)) || // (m_data_type == ANIMATION_DATA_TYPE.GLOBAL_SCALE && m_startState && letterAction.m_global_start_scale.DrawQuickEditorGUI(this, gui_x_offset, ref gui_y_offset, gui_already_changed)) || // (m_data_type == ANIMATION_DATA_TYPE.GLOBAL_SCALE && !m_startState && letterAction.m_global_end_scale.DrawQuickEditorGUI(this, gui_x_offset, ref gui_y_offset, gui_already_changed)) || // (m_data_type == ANIMATION_DATA_TYPE.COLOUR && m_startState && letterAction.m_start_colour.DrawQuickEditorGUI(this, gui_x_offset, ref gui_y_offset, gui_already_changed)) || // (m_data_type == ANIMATION_DATA_TYPE.COLOUR && !m_startState && letterAction.m_end_colour.DrawQuickEditorGUI(this, gui_x_offset, ref gui_y_offset, gui_already_changed))) // { // animation_manager.PrepareAnimationData(m_data_type); // // if(!animation_manager.Playing) // { // // Set the current state of the animation to show effect of changes // animation_manager.SetAnimationState(m_action_idx, // m_startState ? 0 : 1, // update_mesh: true); // } // } // else if(m_data_type == ANIMATION_DATA_TYPE.DURATION && letterAction.m_duration_progression.DrawQuickEditorGUI("Lerp Duration", gui_x_offset, ref gui_y_offset, gui_already_changed)) // { // animation_manager.PrepareAnimationData(m_data_type); // // animation_manager.PrepareAnimationData(ANIMATION_DATA_TYPE.DELAY); // } // else if (m_data_type == ANIMATION_DATA_TYPE.DELAY || m_data_type == ANIMATION_DATA_TYPE.DURATION) { return(GetFloatVariable(m_data_type, letterAction).GetStateListeners()); } else if (m_data_type == ANIMATION_DATA_TYPE.POSITION || m_data_type == ANIMATION_DATA_TYPE.GLOBAL_SCALE || m_data_type == ANIMATION_DATA_TYPE.LOCAL_SCALE || m_data_type == ANIMATION_DATA_TYPE.GLOBAL_ROTATION || m_data_type == ANIMATION_DATA_TYPE.LOCAL_ROTATION) { return(GetVector3Variable(m_data_type, letterAction).GetStateListeners()); } else if (m_data_type == ANIMATION_DATA_TYPE.COLOUR) { return(m_startState ? letterAction.m_start_colour.GetStateListeners() : letterAction.m_end_colour.GetStateListeners()); } else if (m_data_type == ANIMATION_DATA_TYPE.DELAY_EASED_RANDOM_SWITCH) { return(new List <VariableStateListener>() { new VariableStateListener() { m_startToggleValue = letterAction.m_delay_progression.Progression == (int)ValueProgression.Random, m_onToggleStateChangeCallback = (bool state) => { if (state) { letterAction.m_delay_progression.SetRandom(letterAction.m_delay_progression.ValueFrom, letterAction.m_delay_progression.ValueTo, letterAction.m_delay_progression.UniqueRandomRaw); } else { letterAction.m_delay_progression.SetEased(letterAction.m_delay_progression.ValueFrom, letterAction.m_delay_progression.ValueTo); } animation_manager.PrepareAnimationData(ANIMATION_DATA_TYPE.DELAY); } } }); } return(null); }