Fixing items if sufficient skills+tools, choosing server port

This commit is contained in:
Regalis
2015-07-19 23:29:47 +03:00
parent 2dd0a60bc4
commit fb0e8ea54c
19 changed files with 357 additions and 124 deletions
+1 -4
View File
@@ -54,6 +54,7 @@ namespace Subsurface
public Color TextColor
{
get { return textColor; }
set { textColor = value; }
}
public Vector2 CaretPos
@@ -64,16 +65,12 @@ namespace Subsurface
public GUITextBlock(Rectangle rect, string text, GUIStyle style, GUIComponent parent = null, bool wrap = false)
: this(rect, text, style, Alignment.TopLeft, Alignment.TopLeft, parent, wrap)
{
//hoverColor = style.hoverColor;
//selectedColor = style.selectedColor;
}
public GUITextBlock(Rectangle rect, string text, GUIStyle style, Alignment alignment = Alignment.TopLeft, Alignment textAlignment = Alignment.TopLeft, GUIComponent parent = null, bool wrap = false)
: this (rect, text, null, null, alignment, textAlignment, style, parent, wrap)
{
//hoverColor = style.hoverColor;
//selectedColor = style.selectedColor;
}
public GUITextBlock(Rectangle rect, string text, Color? color, Color? textColor, Alignment textAlignment = Alignment.Left, GUIStyle style = null, GUIComponent parent = null, bool wrap = false)
+25 -8
View File
@@ -12,7 +12,18 @@ namespace Subsurface
public delegate bool OnSelectedHandler(object obj);
public OnSelectedHandler OnSelected;
bool selected;
private bool selected;
public bool Selected
{
get { return selected; }
set
{
if (value == selected) return;
selected = value;
state = (selected) ? ComponentState.Selected : ComponentState.None;
}
}
public GUITickBox(Rectangle rect, string label, Alignment alignment, GUIComponent parent)
: base(null)
@@ -20,8 +31,11 @@ namespace Subsurface
if (parent != null)
parent.AddChild(this);
box = new GUIFrame(new Rectangle(rect.X, rect.Y, 30, 30), Color.LightGray, null, this);
text = new GUITextBlock(new Rectangle(rect.X + 40, rect.Y, 200, 30), label, Color.Transparent, Color.White, Alignment.Left | Alignment.CenterY, null, this);
box = new GUIFrame(rect, Color.DarkGray, null, this);
box.HoverColor = Color.Gray;
box.SelectedColor = Color.DarkGray;
text = new GUITextBlock(new Rectangle(rect.X + 40, rect.Y, 200, 30), label, Color.Transparent, Color.White, Alignment.TopLeft, null, this);
}
public override void Update(float deltaTime)
@@ -33,28 +47,31 @@ namespace Subsurface
box.State = ComponentState.Hover;
if (PlayerInput.GetMouseState.LeftButton == ButtonState.Pressed)
box.State = ComponentState.Selected;
{
box.State = ComponentState.Selected;
}
if (PlayerInput.LeftButtonClicked())
{
selected = !selected;
Selected = !Selected;
if (OnSelected != null) OnSelected(this);
}
}
else
{
box.State = ComponentState.None;
}
}
public override void Draw(SpriteBatch spriteBatch)
{
DrawChildren(spriteBatch);
if (selected)
if (Selected)
{
GUI.DrawRectangle(spriteBatch, new Rectangle(box.Rect.X + 5, box.Rect.Y + 5, box.Rect.Width - 10, box.Rect.Height - 10), Color.Green * (color.A / 255.0f), true);
GUI.DrawRectangle(spriteBatch, new Rectangle(box.Rect.X + 2, box.Rect.Y + 2, box.Rect.Width - 4, box.Rect.Height - 4), Color.Green * 0.8f, true);
}
}
}