- Input field for rects.
- Input fields for ItemComponent requiredItems. - Added tooltips to a bunch of editable ItemComponent properties. - Misc fixes.
This commit is contained in:
@@ -120,7 +120,10 @@ namespace Barotrauma
|
||||
{
|
||||
base.Rect = value;
|
||||
|
||||
textBlock.Rect = value;
|
||||
if (textBlock != null)
|
||||
{
|
||||
textBlock.Rect = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace Barotrauma
|
||||
base.Rect = value;
|
||||
|
||||
box.Rect = new Rectangle(value.X,value.Y,box.Rect.Width,box.Rect.Height);
|
||||
text.Rect = new Rectangle(box.Rect.Right + 10, box.Rect.Y + 2, 20, box.Rect.Height);
|
||||
text.Rect = new Rectangle(box.Rect.Right, box.Rect.Y + 2, 20, box.Rect.Height);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
}
|
||||
|
||||
[Editable, Serialize(1.0f, true)]
|
||||
[Editable(0.0f, 10.0f), Serialize(1.0f, true)]
|
||||
public float TextScale
|
||||
{
|
||||
get { return textBlock == null ? 1.0f : textBlock.TextScale; }
|
||||
|
||||
@@ -7,7 +7,6 @@ using Microsoft.Xna.Framework.Graphics;
|
||||
using Microsoft.Xna.Framework.Input;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
|
||||
namespace Barotrauma
|
||||
@@ -150,138 +149,54 @@ namespace Barotrauma
|
||||
|
||||
private GUIComponent CreateEditingHUD(bool inGame = false)
|
||||
{
|
||||
/*List<SerializableProperty> editableProperties = inGame ? GetProperties<InGameEditable>() : GetProperties<Editable>();
|
||||
|
||||
int requiredItemCount = 0;
|
||||
if (!inGame)
|
||||
{
|
||||
foreach (ItemComponent ic in components)
|
||||
{
|
||||
requiredItemCount += ic.requiredItems.Count;
|
||||
}
|
||||
}*/
|
||||
|
||||
int width = 450;
|
||||
int height = 150;
|
||||
int x = GameMain.GraphicsWidth / 2 - width / 2, y = 30;
|
||||
/*foreach (var objectProperty in editableProperties)
|
||||
{
|
||||
var editable = objectProperty.Attributes.OfType<Editable>().FirstOrDefault();
|
||||
if (editable != null) height += (int)(Math.Ceiling(editable.MaxLength / 40.0f) * 18.0f) + 5;
|
||||
}*/
|
||||
|
||||
editingHUD = new GUIListBox(new Rectangle(x, y, width, height), "");
|
||||
((GUIListBox)editingHUD).Spacing = 5;
|
||||
editingHUD.UserData = this;
|
||||
|
||||
/*new GUITextBlock(new Rectangle(0, 0, 0, 20), prefab.Name, "",
|
||||
Alignment.TopLeft, Alignment.TopLeft, editingHUD, false, GUI.LargeFont);*/
|
||||
|
||||
new SerializableEntityEditor(this, inGame, editingHUD, true);
|
||||
|
||||
//y += 25;
|
||||
|
||||
/*if (!inGame)
|
||||
|
||||
var itemEditor = new SerializableEntityEditor(this, inGame, editingHUD, true);
|
||||
|
||||
if (!inGame && prefab.IsLinkable)
|
||||
{
|
||||
if (prefab.IsLinkable)
|
||||
{
|
||||
new GUITextBlock(new Rectangle(0, 5, 0, 20), "Hold space to link to another item",
|
||||
"", Alignment.TopRight, Alignment.TopRight, editingHUD).Font = GUI.SmallFont;
|
||||
}
|
||||
foreach (ItemComponent ic in components)
|
||||
{
|
||||
foreach (RelatedItem relatedItem in ic.requiredItems)
|
||||
{
|
||||
new GUITextBlock(new Rectangle(0, y, 100, 15), ic.Name + ": " + relatedItem.Type.ToString() + " required", "", Alignment.TopLeft, Alignment.CenterLeft, editingHUD, false, GUI.SmallFont);
|
||||
GUITextBox namesBox = new GUITextBox(new Rectangle(-10, y, 160, 15), Alignment.Right, "", editingHUD);
|
||||
namesBox.Font = GUI.SmallFont;
|
||||
|
||||
PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(relatedItem);
|
||||
PropertyDescriptor property = properties.Find("JoinedNames", false);
|
||||
|
||||
namesBox.Text = relatedItem.JoinedNames;
|
||||
namesBox.UserData = new SerializableProperty(property, relatedItem);
|
||||
namesBox.OnEnterPressed = EnterProperty;
|
||||
namesBox.OnTextChanged = PropertyChanged;
|
||||
|
||||
y += 20;
|
||||
}
|
||||
}
|
||||
if (requiredItemCount > 0) y += 10;
|
||||
}*/
|
||||
itemEditor.AddCustomContent(new GUITextBlock(new Rectangle(0, 0, 0, 20), "Hold space to link to another item", "", null, GUI.SmallFont), 1);
|
||||
}
|
||||
|
||||
foreach (ItemComponent ic in components)
|
||||
{
|
||||
if (SerializableProperty.GetProperties<Editable>(ic).Count == 0) continue;
|
||||
new SerializableEntityEditor(ic, inGame, editingHUD, false);
|
||||
}
|
||||
|
||||
/*foreach (var objectProperty in editableProperties)
|
||||
{
|
||||
int boxHeight = 18;
|
||||
var editable = objectProperty.Attributes.OfType<Editable>().FirstOrDefault();
|
||||
if (editable != null) boxHeight = (int)(Math.Ceiling(editable.MaxLength / 40.0f) * 18.0f);
|
||||
var componentEditor = new SerializableEntityEditor(ic, inGame, editingHUD, !inGame);
|
||||
|
||||
object value = objectProperty.GetValue();
|
||||
if (inGame) continue;
|
||||
|
||||
if (value is bool)
|
||||
foreach (RelatedItem relatedItem in ic.requiredItems)
|
||||
{
|
||||
GUITickBox propertyTickBox = new GUITickBox(new Rectangle(10, y, 18, boxHeight), objectProperty.Name,
|
||||
Alignment.Left, editingHUD);
|
||||
propertyTickBox.Font = GUI.SmallFont;
|
||||
var textBlock = new GUITextBlock(new Rectangle(0, 0, 0, 20), relatedItem.Type.ToString() + " required", "", Alignment.TopLeft, Alignment.CenterLeft, null, false, GUI.SmallFont);
|
||||
textBlock.Padding = Vector4.Zero;
|
||||
componentEditor.AddCustomContent(textBlock, 1);
|
||||
|
||||
propertyTickBox.Selected = (bool)value;
|
||||
GUITextBox namesBox = new GUITextBox(new Rectangle(0, 0, 180, 20), Alignment.Right, "", textBlock);
|
||||
namesBox.Font = GUI.SmallFont;
|
||||
namesBox.Text = relatedItem.JoinedNames;
|
||||
|
||||
propertyTickBox.UserData = objectProperty;
|
||||
propertyTickBox.OnSelected = EnterProperty;
|
||||
}
|
||||
else if (value.GetType().IsEnum)
|
||||
{
|
||||
new GUITextBlock(new Rectangle(0, y, 100, 18), objectProperty.Name, "", Alignment.TopLeft, Alignment.Left, editingHUD, false, GUI.SmallFont);
|
||||
GUIDropDown enumDropDown = new GUIDropDown(new Rectangle(180, y, 250, boxHeight), "", "", editingHUD);
|
||||
foreach (object enumValue in Enum.GetValues(value.GetType()))
|
||||
namesBox.OnDeselected += (textBox, key) =>
|
||||
{
|
||||
var enumTextBlock = new GUITextBlock(new Rectangle(0, 0, 200, 25), enumValue.ToString(), "", enumDropDown);
|
||||
enumTextBlock.UserData = enumValue;
|
||||
}
|
||||
relatedItem.JoinedNames = textBox.Text;
|
||||
textBox.Text = relatedItem.JoinedNames;
|
||||
};
|
||||
|
||||
enumDropDown.OnSelected += (selected, val) =>
|
||||
namesBox.OnEnterPressed += (textBox, text) =>
|
||||
{
|
||||
objectProperty.TrySetValue(val);
|
||||
relatedItem.JoinedNames = text;
|
||||
textBox.Text = relatedItem.JoinedNames;
|
||||
return true;
|
||||
};
|
||||
|
||||
enumDropDown.SelectItem(value);
|
||||
y += 20;
|
||||
}
|
||||
else
|
||||
{
|
||||
new GUITextBlock(new Rectangle(0, y, 100, 18), objectProperty.Name, "", Alignment.TopLeft, Alignment.Left, editingHUD, false, GUI.SmallFont);
|
||||
|
||||
GUITextBox propertyBox = new GUITextBox(new Rectangle(180, y, 250, boxHeight), "", editingHUD);
|
||||
propertyBox.Font = GUI.SmallFont;
|
||||
if (boxHeight > 18) propertyBox.Wrap = true;
|
||||
|
||||
if (value != null)
|
||||
{
|
||||
if (value is float)
|
||||
{
|
||||
propertyBox.Text = ((float)value).ToString("G", System.Globalization.CultureInfo.InvariantCulture);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
propertyBox.Text = value.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
propertyBox.UserData = objectProperty;
|
||||
propertyBox.OnEnterPressed = EnterProperty;
|
||||
propertyBox.OnTextChanged = PropertyChanged;
|
||||
|
||||
}
|
||||
y = y + boxHeight + 5;
|
||||
}*/
|
||||
|
||||
|
||||
}
|
||||
|
||||
editingHUD.SetDimensions(new Point(editingHUD.Rect.Width, MathHelper.Clamp(editingHUD.children.Sum(c => c.Rect.Height), 50, editingHUD.Rect.Height)));
|
||||
|
||||
return editingHUD;
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace Barotrauma
|
||||
{
|
||||
|
||||
private static readonly string[] vectorComponentLabels = { "X", "Y", "Z", "W" };
|
||||
private static readonly string[] rectComponentLabels = { "X", "Y", "Width", "Height" };
|
||||
private static readonly string[] rectComponentLabels = { "X", "Y", "W", "H" };
|
||||
private static readonly string[] colorComponentLabels = { "R", "G", "B", "A" };
|
||||
|
||||
//private GUIComponent editingHUD;
|
||||
@@ -22,35 +22,15 @@ namespace Barotrauma
|
||||
SerializableProperty.GetProperties<InGameEditable>(entity) :
|
||||
SerializableProperty.GetProperties<Editable>(entity);
|
||||
|
||||
if (parent != null)
|
||||
parent.AddChild(this);
|
||||
|
||||
/*int requiredItemCount = 0;
|
||||
if (!inGame)
|
||||
{
|
||||
foreach (ItemComponent ic in components)
|
||||
{
|
||||
requiredItemCount += ic.requiredItems.Count;
|
||||
}
|
||||
}
|
||||
if (parent != null) parent.AddChild(this);
|
||||
|
||||
foreach (var objectProperty in editableProperties)
|
||||
{
|
||||
var editable = objectProperty.Attributes.OfType<Editable>().FirstOrDefault();
|
||||
if (editable != null) height += (int)(Math.Ceiling(editable.MaxLength / 40.0f) * 18.0f) + 5;
|
||||
}
|
||||
|
||||
editingHUD = new GUIFrame(new Rectangle(0, 0, 0, 0), null, parent);
|
||||
editingHUD.Padding = new Vector4(10, 0, 0, 10);
|
||||
editingHUD.UserData = this;*/
|
||||
|
||||
if (showName)
|
||||
{
|
||||
new GUITextBlock(new Rectangle(0, 0, 100, 20), entity.Name, "",
|
||||
Alignment.TopLeft, Alignment.TopLeft, this, false, GUI.Font);
|
||||
}
|
||||
|
||||
int y = 30, padding = 10;
|
||||
int y = showName ? 30 : 10, padding = 10;
|
||||
foreach (var property in editableProperties)
|
||||
{
|
||||
//int boxHeight = 18;
|
||||
@@ -96,6 +76,10 @@ namespace Barotrauma
|
||||
{
|
||||
propertyField = CreateColorField(entity, property, (Color)value, y, this);
|
||||
}
|
||||
else if (value is Rectangle)
|
||||
{
|
||||
propertyField = CreateRectangleField(entity, property, (Rectangle)value, y, this);
|
||||
}
|
||||
|
||||
if (propertyField != null)
|
||||
{
|
||||
@@ -106,6 +90,26 @@ namespace Barotrauma
|
||||
SetDimensions(new Point(Rect.Width, children.Last().Rect.Bottom - Rect.Y + 10), false);
|
||||
}
|
||||
|
||||
public void AddCustomContent(GUIComponent component, int childIndex)
|
||||
{
|
||||
childIndex = MathHelper.Clamp(childIndex, 0, children.Count);
|
||||
|
||||
AddChild(component);
|
||||
children.Remove(component);
|
||||
children.Insert(childIndex, component);
|
||||
|
||||
if (childIndex > 0 )
|
||||
{
|
||||
component.Rect = new Rectangle(component.Rect.X, children[childIndex - 1].Rect.Bottom, component.Rect.Width, component.Rect.Height);
|
||||
}
|
||||
|
||||
for (int i = childIndex + 1; i < children.Count; i++)
|
||||
{
|
||||
children[i].Rect = new Rectangle(children[i].Rect.X, children[i].Rect.Y + component.Rect.Height, children[i].Rect.Width, children[i].Rect.Height);
|
||||
}
|
||||
SetDimensions(new Point(Rect.Width, children.Last().Rect.Bottom - Rect.Y + 10), false);
|
||||
}
|
||||
|
||||
public override void Draw(SpriteBatch spriteBatch)
|
||||
{
|
||||
base.Draw(spriteBatch);
|
||||
@@ -134,7 +138,7 @@ namespace Barotrauma
|
||||
|
||||
private GUIComponent CreateIntField(ISerializableEntity entity, SerializableProperty property, int value, int yPos, GUIComponent parent)
|
||||
{
|
||||
var label = new GUITextBlock(new Rectangle(0, yPos, 100, 18), property.Name, "", Alignment.TopLeft, Alignment.Left, parent, false, GUI.SmallFont);
|
||||
var label = new GUITextBlock(new Rectangle(0, yPos, 0, 18), property.Name, "", Alignment.TopLeft, Alignment.Left, parent, false, GUI.SmallFont);
|
||||
label.ToolTip = property.GetAttribute<Editable>().ToolTip;
|
||||
GUINumberInput numberInput = new GUINumberInput(new Rectangle(180, yPos, 0, 18), "", GUINumberInput.NumberType.Int, Alignment.Left, parent);
|
||||
numberInput.ToolTip = property.GetAttribute<Editable>().ToolTip;
|
||||
@@ -159,7 +163,7 @@ namespace Barotrauma
|
||||
|
||||
private GUIComponent CreateFloatField(ISerializableEntity entity, SerializableProperty property, float value, int yPos, GUIComponent parent)
|
||||
{
|
||||
var label = new GUITextBlock(new Rectangle(0, yPos, 100, 18), property.Name, "", Alignment.TopLeft, Alignment.Left, parent, false, GUI.SmallFont);
|
||||
var label = new GUITextBlock(new Rectangle(0, yPos, 0, 18), property.Name, "", Alignment.TopLeft, Alignment.Left, parent, false, GUI.SmallFont);
|
||||
label.ToolTip = property.GetAttribute<Editable>().ToolTip;
|
||||
GUINumberInput numberInput = new GUINumberInput(new Rectangle(180, yPos, 0, 18), "", GUINumberInput.NumberType.Float, Alignment.Left, parent);
|
||||
numberInput.ToolTip = property.GetAttribute<Editable>().ToolTip;
|
||||
@@ -184,7 +188,7 @@ namespace Barotrauma
|
||||
|
||||
private GUIComponent CreateEnumField(ISerializableEntity entity, SerializableProperty property, object value, int yPos, GUIComponent parent)
|
||||
{
|
||||
var label = new GUITextBlock(new Rectangle(0, yPos, 100, 18), property.Name, "", Alignment.TopLeft, Alignment.Left, parent, false, GUI.SmallFont);
|
||||
var label = new GUITextBlock(new Rectangle(0, yPos, 0, 18), property.Name, "", Alignment.TopLeft, Alignment.Left, parent, false, GUI.SmallFont);
|
||||
label.ToolTip = property.GetAttribute<Editable>().ToolTip;
|
||||
GUIDropDown enumDropDown = new GUIDropDown(new Rectangle(180, yPos, 0, 18), "", "", Alignment.TopLeft, parent);
|
||||
enumDropDown.ToolTip = property.GetAttribute<Editable>().ToolTip;
|
||||
@@ -215,7 +219,7 @@ namespace Barotrauma
|
||||
var editable = property.GetAttribute<Editable>();
|
||||
boxHeight = (int)(Math.Ceiling(editable.MaxLength / 40.0f) * boxHeight);
|
||||
|
||||
var label = new GUITextBlock(new Rectangle(0, yPos, 100, 18), property.Name, "", Alignment.TopLeft, Alignment.Left, parent, false, GUI.SmallFont);
|
||||
var label = new GUITextBlock(new Rectangle(0, yPos, 0, 18), property.Name, "", Alignment.TopLeft, Alignment.Left, parent, false, GUI.SmallFont);
|
||||
label.ToolTip = property.GetAttribute<Editable>().ToolTip;
|
||||
GUITextBox propertyBox = new GUITextBox(new Rectangle(0, yPos, 250, boxHeight), Alignment.Right, "", parent);
|
||||
propertyBox.ToolTip = editable.ToolTip;
|
||||
@@ -236,7 +240,7 @@ namespace Barotrauma
|
||||
|
||||
private GUIComponent CreateVector2Field(ISerializableEntity entity, SerializableProperty property, Vector2 value, int yPos, GUIComponent parent)
|
||||
{
|
||||
var label = new GUITextBlock(new Rectangle(0, yPos, 100, 18), property.Name, "", Alignment.TopLeft, Alignment.Left, parent, false, GUI.SmallFont);
|
||||
var label = new GUITextBlock(new Rectangle(0, yPos, 0, 18), property.Name, "", Alignment.TopLeft, Alignment.Left, parent, false, GUI.SmallFont);
|
||||
label.ToolTip = property.GetAttribute<Editable>().ToolTip;
|
||||
|
||||
for (int i = 0; i < 2; i++)
|
||||
@@ -245,6 +249,11 @@ namespace Barotrauma
|
||||
GUINumberInput numberInput = new GUINumberInput(new Rectangle(160 + i * 70, yPos, 45, 18), "", GUINumberInput.NumberType.Float, Alignment.Left, parent);
|
||||
numberInput.Font = GUI.SmallFont;
|
||||
|
||||
if (i == 0)
|
||||
numberInput.FloatValue = value.X;
|
||||
else
|
||||
numberInput.FloatValue = value.Y;
|
||||
|
||||
int comp = i;
|
||||
numberInput.OnValueChanged += (numInput) =>
|
||||
{
|
||||
@@ -266,7 +275,7 @@ namespace Barotrauma
|
||||
|
||||
private GUIComponent CreateVector3Field(ISerializableEntity entity, SerializableProperty property, Vector3 value, int yPos, GUIComponent parent)
|
||||
{
|
||||
var label = new GUITextBlock(new Rectangle(0, yPos, 100, 18), property.Name, "", Alignment.TopLeft, Alignment.Left, parent, false, GUI.SmallFont);
|
||||
var label = new GUITextBlock(new Rectangle(0, yPos, 0, 18), property.Name, "", Alignment.TopLeft, Alignment.Left, parent, false, GUI.SmallFont);
|
||||
label.ToolTip = property.GetAttribute<Editable>().ToolTip;
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
@@ -274,6 +283,13 @@ namespace Barotrauma
|
||||
GUINumberInput numberInput = new GUINumberInput(new Rectangle(160 + i * 70, yPos, 45, 18), "", GUINumberInput.NumberType.Float, Alignment.Left, parent);
|
||||
numberInput.Font = GUI.SmallFont;
|
||||
|
||||
if (i == 0)
|
||||
numberInput.FloatValue = value.X;
|
||||
else if (i == 1)
|
||||
numberInput.FloatValue = value.Y;
|
||||
else if (i == 2)
|
||||
numberInput.FloatValue = value.Z;
|
||||
|
||||
int comp = i;
|
||||
numberInput.OnValueChanged += (numInput) =>
|
||||
{
|
||||
@@ -297,7 +313,7 @@ namespace Barotrauma
|
||||
|
||||
private GUIComponent CreateVector4Field(ISerializableEntity entity, SerializableProperty property, Vector4 value, int yPos, GUIComponent parent)
|
||||
{
|
||||
var label = new GUITextBlock(new Rectangle(0, yPos, 100, 18), property.Name, "", Alignment.TopLeft, Alignment.Left, parent, false, GUI.SmallFont);
|
||||
var label = new GUITextBlock(new Rectangle(0, yPos, 0, 18), property.Name, "", Alignment.TopLeft, Alignment.Left, parent, false, GUI.SmallFont);
|
||||
label.ToolTip = property.GetAttribute<Editable>().ToolTip;
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
@@ -305,6 +321,15 @@ namespace Barotrauma
|
||||
GUINumberInput numberInput = new GUINumberInput(new Rectangle(160 + i * 70, yPos, 45, 18), "", GUINumberInput.NumberType.Float, Alignment.Left, parent);
|
||||
numberInput.Font = GUI.SmallFont;
|
||||
|
||||
if (i == 0)
|
||||
numberInput.FloatValue = value.X;
|
||||
else if (i == 1)
|
||||
numberInput.FloatValue = value.Y;
|
||||
else if (i == 2)
|
||||
numberInput.FloatValue = value.Z;
|
||||
else
|
||||
numberInput.FloatValue = value.W;
|
||||
|
||||
int comp = i;
|
||||
numberInput.OnValueChanged += (numInput) =>
|
||||
{
|
||||
@@ -330,7 +355,7 @@ namespace Barotrauma
|
||||
|
||||
private GUIComponent CreateColorField(ISerializableEntity entity, SerializableProperty property, Color value, int yPos, GUIComponent parent)
|
||||
{
|
||||
var label = new GUITextBlock(new Rectangle(0, yPos, 100, 18), property.Name, "", Alignment.TopLeft, Alignment.Left, parent, false, GUI.SmallFont);
|
||||
var label = new GUITextBlock(new Rectangle(0, yPos, 0, 18), property.Name, "", Alignment.TopLeft, Alignment.Left, parent, false, GUI.SmallFont);
|
||||
label.ToolTip = property.GetAttribute<Editable>().ToolTip;
|
||||
|
||||
var colorBoxBack = new GUIFrame(new Rectangle(110 - 1, yPos - 1, 25 + 2, 18 + 2), Color.Black, Alignment.TopLeft, null, parent);
|
||||
@@ -378,6 +403,48 @@ namespace Barotrauma
|
||||
return label;
|
||||
}
|
||||
|
||||
private GUIComponent CreateRectangleField(ISerializableEntity entity, SerializableProperty property, Rectangle value, int yPos, GUIComponent parent)
|
||||
{
|
||||
var label = new GUITextBlock(new Rectangle(0, yPos, 0, 18), property.Name, "", Alignment.TopLeft, Alignment.Left, parent, false, GUI.SmallFont);
|
||||
label.ToolTip = property.GetAttribute<Editable>().ToolTip;
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
new GUITextBlock(new Rectangle(140 + i * 70, yPos, 100, 18), rectComponentLabels[i], "", Alignment.TopLeft, Alignment.CenterLeft, parent, false, GUI.SmallFont);
|
||||
GUINumberInput numberInput = new GUINumberInput(new Rectangle(160 + i * 70, yPos, 45, 18), "", GUINumberInput.NumberType.Int, Alignment.Left, parent);
|
||||
numberInput.Font = GUI.SmallFont;
|
||||
|
||||
if (i == 0)
|
||||
numberInput.IntValue = value.X;
|
||||
else if (i == 1)
|
||||
numberInput.IntValue = value.Y;
|
||||
else if (i == 2)
|
||||
numberInput.IntValue = value.Width;
|
||||
else
|
||||
numberInput.IntValue = value.Height;
|
||||
|
||||
int comp = i;
|
||||
numberInput.OnValueChanged += (numInput) =>
|
||||
{
|
||||
Rectangle newVal = (Rectangle)property.GetValue();
|
||||
if (comp == 0)
|
||||
newVal.X = numInput.IntValue;
|
||||
else if (comp == 1)
|
||||
newVal.Y = numInput.IntValue;
|
||||
else if (comp == 2)
|
||||
newVal.Width = numInput.IntValue;
|
||||
else
|
||||
newVal.Height = numInput.IntValue;
|
||||
|
||||
if (property.TrySetValue(newVal))
|
||||
{
|
||||
TrySendNetworkUpdate(entity, property);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
return label;
|
||||
}
|
||||
|
||||
private void TrySendNetworkUpdate(ISerializableEntity entity, SerializableProperty property)
|
||||
{
|
||||
if (GameMain.Server != null)
|
||||
|
||||
Reference in New Issue
Block a user