// Parses an effect's starting tag, and adds it to the stack // NEEDS TO ALSO PARSE PARAMETERS void parseEffectStart(int start_pos, string text, StringBuilder parsed, DialogueBox d_box) { int end_pos = text.IndexOf('|', start_pos) - 1; string fx_name = text.Substring(start_pos, end_pos - start_pos + 1); FXTextEffect text_effect = text_effect_map[fx_name].clone(d_box.fx_text.gameObject); text_effect.font = d_box.fx_text.font; text_effect.initEffect(); // TEMP; should read options from tag text_effect.chars = new int[2] { parsed.Length, -1 }; effect_stack.Push(text_effect); }
// Parses an effect's ending tag, and matches with top of effect stack void parseEffectEnd(int start_pos, string text, DialogueItem d_item, StringBuilder parsed) { int end_pos = text.IndexOf('\\', start_pos) - 1; string fx_name = text.Substring(start_pos, end_pos - start_pos + 1); FXTextEffect top = effect_stack.Pop(); if (text_effect_map [fx_name].GetType() != top.GetType()) { Debug.LogException(new System.Exception("Mismatched FXTextEffect tags:" + fx_name)); } top.chars [1] = parsed.Length; d_item.fx_text_effects.Add(top); }
// adds a new effect public void addEffect(FXTextEffect text_effect) { text_effect.font = font; effect_list.Add(text_effect); }
// removes specific effect public void removeEffect(FXTextEffect fx) { effect_list.Remove(fx); }