1 using Microsoft.Xna.Framework;
48 if (value ==
enabled) {
return; }
55 get {
return text.TextColor; }
56 set { text.TextColor = value; }
83 if (text !=
null) text.Font = value;
99 get {
return base.ToolTip; }
102 base.ToolTip = value;
104 text.ToolTip = value;
110 get {
return text.Text; }
111 set { text.Text = value; }
130 },
string.Empty, Color.DarkGray)
136 GUIStyle.Apply(box, style ==
"" ?
"GUITickBox" : style);
137 if (box.RectTransform.MinSize.Y > 0)
142 box.RectTransform.MinSize =
new Point(box.RectTransform.MinSize.Y);
143 box.RectTransform.Resize(box.RectTransform.MinSize);
145 Vector2 textBlockScale =
new Vector2((
float)(
Rect.Width -
Rect.Height) / (
float)Math.Max(
Rect.Width, 1.0), 1.0f);
146 text =
new GUITextBlock(
new RectTransform(textBlockScale, layoutGroup.RectTransform,
Anchor.CenterLeft), label, font: font, textAlignment: Alignment.CenterLeft)
150 GUIStyle.Apply(text,
"GUITextBlock",
this);
161 radioButtonGroup = rbg;
166 Vector2 textBlockScale =
new Vector2(Math.Max(
Rect.Width - box.Rect.Width, 0.0f) / Math.Max(
Rect.Width, 1.0f), 1.0f);
167 text.RectTransform.RelativeSize = textBlockScale;
168 box.RectTransform.MinSize =
new Point(
Rect.Height);
169 box.RectTransform.Resize(box.RectTransform.MinSize);
171 ContentWidth = box.Rect.Width + text.Padding.X + text.TextSize.X + text.Padding.Z;
174 public void SetSelected(
bool selected,
bool callOnSelected =
true)
185 if (selected && radioButtonGroup !=
null)
195 protected override void Update(
float deltaTime)
199 base.Update(deltaTime);
201 if (GUI.MouseOn ==
this &&
Enabled &&
216 if (radioButtonGroup ==
null)
226 SoundPlayer.PlayUISound(SoundType);
virtual ComponentState State
virtual Color SelectedColor
RectTransform RectTransform
delegate bool OnSelectedHandler(GUITickBox obj)
OnSelectedHandler OnSelected
override bool PlaySoundOnSelect
void SetSelected(bool selected, bool callOnSelected=true)
GUITickBox(RectTransform rectT, LocalizedString label, GUIFont font=null, string style="")
override ComponentState State
override void Update(float deltaTime)
override RichString ToolTip
void SetRadioButtonGroup(GUIRadioButtonGroup rbg)