public ElePropGrid(EleBaseRect parent, TextAttrib labelText, int labelSize) { this.parent = parent; this.labelText = labelText.Clone(); this.labelText.fontSize = labelSize; }
public EleGenToggle( EleBaseRect parent, TextAttrib textAttrib, string text, SelectableInfo plateStyle, float toggleWidth, Sprite toggleSprite, UnityEngine.UI.Image.Type icoType, PadRect togglePad, Vector2 size, float separation = 0.0f, string name = "") : base(parent, size, name) { this._Create( parent, textAttrib, text, plateStyle, toggleWidth, toggleSprite, icoType, togglePad, size, separation, name); }
public TextAttrib Clone() { TextAttrib ret = new TextAttrib(); ret.font = this.font; ret.fontSize = this.fontSize; ret.color = this.color; return(ret); }
public ElePropGrid(EleBaseRect parent, TextAttrib labelText) { this.parent = parent; this.labelText = labelText.Clone(); }
protected void _Create( EleBaseRect parent, TextAttrib textAttrib, string text, SelectableInfo plateStyle, float toggleWidth, Sprite toggleSprite, UnityEngine.UI.Image.Type icoType, PadRect togglePad, Vector2 size, float separation, string name) { this.minSize = size; this.separation = separation; this.toggleWidth = toggleWidth; this.padding = togglePad; GameObject go = new GameObject("Checkbox_" + name); go.transform.SetParent(parent.GetContentRect(), false); // this.plate = go.AddComponent <UnityEngine.UI.Image>(); this.plate.type = UnityEngine.UI.Image.Type.Sliced; this.plate.RTQ().TopLeftAnchorsPivot(); // this.toggle = go.AddComponent <ty>(); plateStyle.Apply(this.toggle, this.plate); GameObject goCheckmark = new GameObject("Checkmark_" + name); goCheckmark.transform.SetParent(go.transform, false); this.checkbox = goCheckmark.AddComponent <UnityEngine.UI.Image>(); this.checkbox.sprite = toggleSprite; this.checkbox.type = icoType; if (icoType != UnityEngine.UI.Image.Type.Simple) { this.checkbox. RTQ(). CenterPivot(). ExpandParentFlush(). OffsetMin(togglePad.left, togglePad.bot). OffsetMax(-togglePad.right, -togglePad.top); } else { this.checkbox.RTQ(). CenterPivot(). OffsetMin(0.5f, 0.5f). OffsetMax(0.5f, 0.5f). AnchPos( (togglePad.left - togglePad.right) * 0.5f, (togglePad.bot - togglePad.top) * 0.5f). SizeDelta(toggleSprite.rect.size); } if (textAttrib != null) { GameObject goText = new GameObject("Text_" + name); goText.transform.SetParent(go.transform, false); this.label = goText.AddComponent <UnityEngine.UI.Text>(); this.label.text = text; this.label.horizontalOverflow = HorizontalWrapMode.Overflow; this.label.verticalOverflow = VerticalWrapMode.Overflow; this.label.alignment = TextAnchor.LowerLeft; this.label.RTQ().Pivot(0.0f, 0.0f).BotLeftAnchors(); textAttrib.Apply(this.label); } this.toggle.targetGraphic = this.plate; this.toggle.graphic = this.checkbox; }