public dfMarkupStyle(dfDynamicFont Font, int FontSize, UnityEngine.FontStyle FontStyle) { this.Host = null; this.Atlas = null; this.Font = Font; this.FontSize = FontSize; this.FontStyle = FontStyle; this.Align = dfMarkupTextAlign.Left; this.VerticalAlign = dfMarkupVerticalAlign.Baseline; this.Color = UnityEngine.Color.white; this.BackgroundColor = UnityEngine.Color.clear; this.TextDecoration = dfMarkupTextDecoration.None; this.PreserveWhitespace = false; this.Preformatted = false; this.WordSpacing = 0; this.CharacterSpacing = 0; this.lineHeight = 0; this.Opacity = 1f; }
private void doVerticalAlignment() { if (this.children.Count != 0) { float minValue = float.MinValue; float maxValue = float.MaxValue; float a = float.MinValue; this.Baseline = (int)(this.Size.y * 0.95f); for (int i = 0; i < this.children.Count; i++) { dfMarkupBox box = this.children[i]; a = Mathf.Max(a, box.Position.y + box.Baseline); } for (int j = 0; j < this.children.Count; j++) { dfMarkupBox box2 = this.children[j]; dfMarkupVerticalAlign verticalAlign = box2.Style.VerticalAlign; Vector2 position = box2.Position; if (verticalAlign == dfMarkupVerticalAlign.Baseline) { position.y = a - box2.Baseline; } box2.Position = position; } for (int k = 0; k < this.children.Count; k++) { dfMarkupBox box3 = this.children[k]; Vector2 vector2 = box3.Position; Vector2 size = box3.Size; maxValue = Mathf.Min(maxValue, vector2.y); minValue = Mathf.Max(minValue, vector2.y + size.y); } for (int m = 0; m < this.children.Count; m++) { dfMarkupBox box4 = this.children[m]; dfMarkupVerticalAlign align2 = box4.Style.VerticalAlign; Vector2 vector4 = box4.Position; Vector2 vector5 = box4.Size; switch (align2) { case dfMarkupVerticalAlign.Top: vector4.y = maxValue; break; case dfMarkupVerticalAlign.Bottom: vector4.y = minValue - vector5.y; break; case dfMarkupVerticalAlign.Middle: vector4.y = (this.Size.y - vector5.y) * 0.5f; break; } box4.Position = vector4; } int num8 = 0x7fffffff; for (int n = 0; n < this.children.Count; n++) { num8 = Mathf.Min(num8, (int)this.children[n].Position.y); } for (int num10 = 0; num10 < this.children.Count; num10++) { Vector2 vector6 = this.children[num10].Position; vector6.y -= num8; this.children[num10].Position = vector6; } } }
public dfMarkupStyle( dfDynamicFont Font, int FontSize, FontStyle FontStyle ) { Host = null; Atlas = null; this.Font = Font; this.FontSize = FontSize; this.FontStyle = FontStyle; Align = dfMarkupTextAlign.Left; VerticalAlign = dfMarkupVerticalAlign.Baseline; Color = UnityEngine.Color.white; BackgroundColor = UnityEngine.Color.clear; TextDecoration = dfMarkupTextDecoration.None; PreserveWhitespace = false; Preformatted = false; WordSpacing = 0; CharacterSpacing = 0; lineHeight = 0; Opacity = 1f; }
private void doVerticalAlignment() { if (this.children.Count == 0) { return; } float single = Single.MinValue; float single1 = Single.MaxValue; float single2 = Single.MinValue; this.Baseline = (int)(this.Size.y * 0.95f); for (int i = 0; i < this.children.Count; i++) { dfMarkupBox item = this.children[i]; single2 = Mathf.Max(single2, item.Position.y + (float)item.Baseline); } for (int j = 0; j < this.children.Count; j++) { dfMarkupBox _dfMarkupBox = this.children[j]; dfMarkupVerticalAlign verticalAlign = _dfMarkupBox.Style.VerticalAlign; Vector2 position = _dfMarkupBox.Position; if (verticalAlign == dfMarkupVerticalAlign.Baseline) { position.y = single2 - (float)_dfMarkupBox.Baseline; } _dfMarkupBox.Position = position; } for (int k = 0; k < this.children.Count; k++) { dfMarkupBox item1 = this.children[k]; Vector2 vector2 = item1.Position; Vector2 size = item1.Size; single1 = Mathf.Min(single1, vector2.y); single = Mathf.Max(single, vector2.y + size.y); } for (int l = 0; l < this.children.Count; l++) { dfMarkupBox _dfMarkupBox1 = this.children[l]; dfMarkupVerticalAlign _dfMarkupVerticalAlign = _dfMarkupBox1.Style.VerticalAlign; Vector2 position1 = _dfMarkupBox1.Position; Vector2 size1 = _dfMarkupBox1.Size; if (_dfMarkupVerticalAlign == dfMarkupVerticalAlign.Top) { position1.y = single1; } else if (_dfMarkupVerticalAlign == dfMarkupVerticalAlign.Bottom) { position1.y = single - size1.y; } else if (_dfMarkupVerticalAlign == dfMarkupVerticalAlign.Middle) { position1.y = (this.Size.y - size1.y) * 0.5f; } _dfMarkupBox1.Position = position1; } int num = 2147483647; for (int m = 0; m < this.children.Count; m++) { num = Mathf.Min(num, (int)this.children[m].Position.y); } for (int n = 0; n < this.children.Count; n++) { Vector2 vector21 = this.children[n].Position; vector21.y = vector21.y - (float)num; this.children[n].Position = vector21; } }