void SetupBaseOffsets(TextAnchor anchor, TextDisplayAxis display_axis, TextAlignment alignment, TextSizeData text_data) { if (display_axis == TextDisplayAxis.HORIZONTAL) { m_base_offset += new Vector3(m_x_offset, m_y_offset - text_data.m_line_height_offset, 0); } else { m_base_offset += new Vector3(text_data.m_line_height_offset, 0, 0); } m_base_offset.y -= text_data.m_y_max; // Handle text y offset if (anchor == TextAnchor.MiddleLeft || anchor == TextAnchor.MiddleCenter || anchor == TextAnchor.MiddleRight) { m_base_offset.y += text_data.m_total_text_height / 2; } else if (anchor == TextAnchor.LowerLeft || anchor == TextAnchor.LowerCenter || anchor == TextAnchor.LowerRight) { m_base_offset.y += text_data.m_total_text_height; } float alignment_offset = 0; if (display_axis == TextDisplayAxis.HORIZONTAL) { if (alignment == TextAlignment.Center) { alignment_offset = (text_data.m_total_text_width - text_data.m_text_line_width) / 2; } else if (alignment == TextAlignment.Right) { alignment_offset = (text_data.m_total_text_width - text_data.m_text_line_width); } } else { if (alignment == TextAlignment.Center) { m_base_offset.y -= (text_data.m_total_text_height - text_data.m_text_line_height) / 2; } else if (alignment == TextAlignment.Right) { m_base_offset.y -= (text_data.m_total_text_height - text_data.m_text_line_height); } } // Handle text x offset if (anchor == TextAnchor.LowerRight || anchor == TextAnchor.MiddleRight || anchor == TextAnchor.UpperRight) { m_base_offset.x -= text_data.m_total_text_width - alignment_offset; } else if (anchor == TextAnchor.LowerCenter || anchor == TextAnchor.MiddleCenter || anchor == TextAnchor.UpperCenter) { m_base_offset.x -= (text_data.m_total_text_width / 2) - alignment_offset; } else { m_base_offset.x += alignment_offset; } }
public void SetBaseOffset(TextAnchor anchor, TextDisplayAxis display_axis, TextAlignment alignment, List <TextSizeData> text_datas) { TextSizeData text_data = text_datas[m_progression_variables.m_line_value]; m_base_offsets_setup = true; if (display_axis == TextDisplayAxis.HORIZONTAL) { m_base_offset += new Vector3(m_x_offset, -text_data.m_line_height_offset, 0); } else { m_base_offset += new Vector3(text_data.m_line_height_offset, 0, 0); } // Handle text y offset if (anchor == TextAnchor.MiddleLeft || anchor == TextAnchor.MiddleCenter || anchor == TextAnchor.MiddleRight) { m_text_anchoring_y_offset = (text_data.m_total_text_height / 2) - m_effect_manager_handle.FontBaseLine; } else if (anchor == TextAnchor.LowerLeft || anchor == TextAnchor.LowerCenter || anchor == TextAnchor.LowerRight) { m_text_anchoring_y_offset = text_data.m_total_text_height - text_data.m_text_line_height; } else { m_text_anchoring_y_offset = -m_effect_manager_handle.FontBaseLine; } float alignment_offset = 0; if (display_axis == TextDisplayAxis.HORIZONTAL) { if (alignment == TextAlignment.Center) { alignment_offset = (text_data.m_total_text_width - text_data.m_text_line_width) / 2; } else if (alignment == TextAlignment.Right) { alignment_offset = (text_data.m_total_text_width - text_data.m_text_line_width); } } else { if (alignment == TextAlignment.Center) { m_base_offset.y -= (text_data.m_total_text_height - text_data.m_text_line_height) / 2; } else if (alignment == TextAlignment.Right) { m_base_offset.y -= (text_data.m_total_text_height - text_data.m_text_line_height); } } // Handle text x offset if (anchor == TextAnchor.LowerRight || anchor == TextAnchor.MiddleRight || anchor == TextAnchor.UpperRight) { m_base_offset.x -= text_data.m_total_text_width - alignment_offset; } else if (anchor == TextAnchor.LowerCenter || anchor == TextAnchor.MiddleCenter || anchor == TextAnchor.UpperCenter) { m_base_offset.x -= (text_data.m_total_text_width / 2) - alignment_offset; } else { m_base_offset.x += alignment_offset; } }
void SetupBaseOffsets(TextAnchor anchor, TextDisplayAxis display_axis, TextAlignment alignment, TextSizeData text_data) { if(display_axis == TextDisplayAxis.HORIZONTAL) { m_base_offset += new Vector3(m_x_offset, m_y_offset - text_data.m_line_height_offset, 0); } else { m_base_offset += new Vector3(text_data.m_line_height_offset, 0, 0); } m_base_offset.y -= text_data.m_y_max; // Handle text y offset if(anchor == TextAnchor.MiddleLeft || anchor == TextAnchor.MiddleCenter || anchor == TextAnchor.MiddleRight) { m_base_offset.y += text_data.m_total_text_height / 2; } else if(anchor == TextAnchor.LowerLeft || anchor == TextAnchor.LowerCenter || anchor == TextAnchor.LowerRight) { m_base_offset.y += text_data.m_total_text_height; } float alignment_offset = 0; if(display_axis == TextDisplayAxis.HORIZONTAL) { if(alignment == TextAlignment.Center) { alignment_offset = (text_data.m_total_text_width - text_data.m_text_line_width) / 2; } else if(alignment == TextAlignment.Right) { alignment_offset = (text_data.m_total_text_width - text_data.m_text_line_width); } } else { if(alignment == TextAlignment.Center) { m_base_offset.y -= (text_data.m_total_text_height - text_data.m_text_line_height) / 2; } else if(alignment == TextAlignment.Right) { m_base_offset.y -= (text_data.m_total_text_height - text_data.m_text_line_height); } } // Handle text x offset if(anchor == TextAnchor.LowerRight || anchor == TextAnchor.MiddleRight || anchor == TextAnchor.UpperRight) { m_base_offset.x -= text_data.m_total_text_width - alignment_offset; } else if(anchor == TextAnchor.LowerCenter || anchor == TextAnchor.MiddleCenter || anchor == TextAnchor.UpperCenter) { m_base_offset.x -= (text_data.m_total_text_width/2) - alignment_offset; } else { m_base_offset.x += alignment_offset; } }