(cb01ae2fe) Small adjustments to Sub Editor entity list
This commit is contained in:
@@ -68,14 +68,81 @@ namespace Barotrauma
|
|||||||
|
|
||||||
Point scrollButtonSize = new Point((int)(200 * GUI.Scale), (int)(30 * GUI.Scale));
|
Point scrollButtonSize = new Point((int)(200 * GUI.Scale), (int)(30 * GUI.Scale));
|
||||||
|
|
||||||
var characterInfo = new CharacterInfo(subElement);
|
crewArea = new GUIFrame(HUDLayoutSettings.ToRectTransform(HUDLayoutSettings.CrewArea, guiFrame.RectTransform), "", Color.Transparent)
|
||||||
characterInfos.Add(characterInfo);
|
{
|
||||||
foreach (XElement invElement in subElement.Elements())
|
CanBeFocused = false
|
||||||
|
};
|
||||||
|
toggleCrewButton = new GUIButton(new RectTransform(new Point((int)(30 * GUI.Scale), HUDLayoutSettings.CrewArea.Height), guiFrame.RectTransform)
|
||||||
|
{ AbsoluteOffset = HUDLayoutSettings.CrewArea.Location },
|
||||||
|
"", style: "UIToggleButton");
|
||||||
|
toggleCrewButton.OnClicked += (GUIButton btn, object userdata) =>
|
||||||
|
{
|
||||||
|
toggleCrewAreaOpen = !toggleCrewAreaOpen;
|
||||||
|
foreach (GUIComponent child in btn.Children)
|
||||||
{
|
{
|
||||||
if (invElement.Name.ToString().ToLowerInvariant() != "inventory") continue;
|
child.SpriteEffects = toggleCrewAreaOpen ? SpriteEffects.None : SpriteEffects.FlipHorizontally;
|
||||||
characterInfo.InventoryData = invElement;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
characterListBox = new GUIListBox(new RectTransform(new Point(100, (int)(crewArea.Rect.Height - scrollButtonSize.Y * 1.6f)), crewArea.RectTransform, Anchor.CenterLeft), false, Color.Transparent, null)
|
||||||
|
{
|
||||||
|
//Spacing = (int)(3 * GUI.Scale),
|
||||||
|
ScrollBarEnabled = false,
|
||||||
|
ScrollBarVisible = false,
|
||||||
|
CanBeFocused = false
|
||||||
|
};
|
||||||
|
|
||||||
|
scrollButtonUp = new GUIButton(new RectTransform(scrollButtonSize, crewArea.RectTransform, Anchor.TopLeft, Pivot.TopLeft), "", Alignment.Center, "GUIButtonVerticalArrow")
|
||||||
|
{
|
||||||
|
Visible = false,
|
||||||
|
UserData = -1,
|
||||||
|
OnClicked = ScrollCharacterList
|
||||||
|
};
|
||||||
|
scrollButtonDown = new GUIButton(new RectTransform(scrollButtonSize, crewArea.RectTransform, Anchor.BottomLeft, Pivot.BottomLeft), "", Alignment.Center, "GUIButtonVerticalArrow")
|
||||||
|
{
|
||||||
|
Visible = false,
|
||||||
|
UserData = 1,
|
||||||
|
OnClicked = ScrollCharacterList
|
||||||
|
};
|
||||||
|
scrollButtonDown.Children.ForEach(c => c.SpriteEffects = SpriteEffects.FlipVertically);
|
||||||
|
|
||||||
|
if (isSinglePlayer)
|
||||||
|
{
|
||||||
|
chatBox = new ChatBox(guiFrame, isSinglePlayer: true)
|
||||||
|
{
|
||||||
|
OnEnterMessage = (textbox, text) =>
|
||||||
|
{
|
||||||
|
if (Character.Controlled?.Info == null)
|
||||||
|
{
|
||||||
|
textbox.Deselect();
|
||||||
|
textbox.Text = "";
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
textbox.TextColor = ChatMessage.MessageColor[(int)ChatMessageType.Default];
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(text))
|
||||||
|
{
|
||||||
|
string msgCommand = ChatMessage.GetChatMessageCommand(text, out string msg);
|
||||||
|
AddSinglePlayerChatMessage(
|
||||||
|
Character.Controlled.Info.Name,
|
||||||
|
msg,
|
||||||
|
((msgCommand == "r" || msgCommand == "radio") && ChatMessage.CanUseRadio(Character.Controlled)) ? ChatMessageType.Radio : ChatMessageType.Default,
|
||||||
|
Character.Controlled);
|
||||||
|
var headset = GetHeadset(Character.Controlled, true);
|
||||||
|
if (headset != null && headset.CanTransmit())
|
||||||
|
{
|
||||||
|
headset.TransmitSignal(stepsTaken: 0, signal: msg, source: headset.Item, sender: Character.Controlled, sendToChat: false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
textbox.Deselect();
|
||||||
|
textbox.Text = "";
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
chatBox.InputBox.OnTextChanged += chatBox.TypingChatMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
var reports = Order.PrefabList.FindAll(o => o.TargetAllCharacters && o.SymbolSprite != null);
|
var reports = Order.PrefabList.FindAll(o => o.TargetAllCharacters && o.SymbolSprite != null);
|
||||||
@@ -114,12 +181,14 @@ namespace Barotrauma
|
|||||||
Visible = false
|
Visible = false
|
||||||
};
|
};
|
||||||
|
|
||||||
var img = new GUIImage(new RectTransform(Vector2.One, btn.RectTransform), order.Prefab.SymbolSprite, scaleToFit: true)
|
var characterInfo = new CharacterInfo(subElement);
|
||||||
|
characterInfos.Add(characterInfo);
|
||||||
|
foreach (XElement invElement in subElement.Elements())
|
||||||
{
|
{
|
||||||
Color = order.Color,
|
if (invElement.Name.ToString().ToLowerInvariant() != "inventory") continue;
|
||||||
HoverColor = Color.Lerp(order.Color, Color.White, 0.5f),
|
characterInfo.InventoryData = invElement;
|
||||||
ToolTip = order.Name
|
break;
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
screenResolution = new Point(GameMain.GraphicsWidth, GameMain.GraphicsHeight);
|
screenResolution = new Point(GameMain.GraphicsWidth, GameMain.GraphicsHeight);
|
||||||
|
|||||||
@@ -175,6 +175,63 @@ namespace Barotrauma.Items.Components
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ApplyTo(RectTransform target)
|
||||||
|
{
|
||||||
|
if (RelativeOffset.HasValue)
|
||||||
|
{
|
||||||
|
target.RelativeOffset = RelativeOffset.Value;
|
||||||
|
}
|
||||||
|
else if (AbsoluteOffset.HasValue)
|
||||||
|
{
|
||||||
|
target.AbsoluteOffset = AbsoluteOffset.Value;
|
||||||
|
}
|
||||||
|
if (RelativeSize.HasValue)
|
||||||
|
{
|
||||||
|
target.RelativeSize = RelativeSize.Value;
|
||||||
|
}
|
||||||
|
else if (AbsoluteSize.HasValue)
|
||||||
|
{
|
||||||
|
target.NonScaledSize = AbsoluteSize.Value;
|
||||||
|
}
|
||||||
|
if (Anchor.HasValue)
|
||||||
|
{
|
||||||
|
target.Anchor = Anchor.Value;
|
||||||
|
}
|
||||||
|
if (Pivot.HasValue)
|
||||||
|
{
|
||||||
|
target.Pivot = Pivot.Value;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
target.Pivot = RectTransform.MatchPivotToAnchor(target.Anchor);
|
||||||
|
}
|
||||||
|
target.RecalculateChildren(true, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public GUIFrame GuiFrame { get; protected set; }
|
||||||
|
|
||||||
|
[Serialize(false, false)]
|
||||||
|
public bool AllowUIOverlap
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ItemComponent linkToUIComponent;
|
||||||
|
[Serialize("", false)]
|
||||||
|
public string LinkUIToComponent
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
}
|
||||||
|
|
||||||
|
[Serialize(0, false)]
|
||||||
|
public int HudPriority
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
private set;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool shouldMuffleLooping;
|
private bool shouldMuffleLooping;
|
||||||
|
|||||||
@@ -279,7 +279,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
var paddedTab = new GUIFrame(new RectTransform(new Vector2(1.0f, 1.0f), EntityMenu.RectTransform, Anchor.Center), style: null);
|
var paddedTab = new GUIFrame(new RectTransform(new Vector2(1.0f, 1.0f), EntityMenu.RectTransform, Anchor.Center), style: null);
|
||||||
|
|
||||||
var filterArea = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.1f), paddedTab.RectTransform), isHorizontal: true)
|
var filterArea = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.1f), paddedTab.RectTransform) { AbsoluteOffset = new Point(0, 10) }, isHorizontal: true)
|
||||||
{
|
{
|
||||||
Color = secondaryColor,
|
Color = secondaryColor,
|
||||||
Stretch = true,
|
Stretch = true,
|
||||||
@@ -294,7 +294,7 @@ namespace Barotrauma
|
|||||||
OnClicked = (btn, userdata) => { ClearFilter(); entityFilterBox.Flash(Color.White); return true; }
|
OnClicked = (btn, userdata) => { ClearFilter(); entityFilterBox.Flash(Color.White); return true; }
|
||||||
};
|
};
|
||||||
|
|
||||||
var entityListHolder = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.85f), paddedTab.RectTransform, Anchor.Center) { RelativeOffset = new Vector2(0.0f, 0.05f) });
|
var entityListHolder = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.85f), paddedTab.RectTransform, Anchor.Center) { RelativeOffset = new Vector2(0.0f, 0.06f) });
|
||||||
|
|
||||||
var tabButtonHolder = new GUILayoutGroup(new RectTransform(new Vector2(0.9f, 0.1f), entityListHolder.RectTransform, Anchor.TopRight, Pivot.BottomRight),
|
var tabButtonHolder = new GUILayoutGroup(new RectTransform(new Vector2(0.9f, 0.1f), entityListHolder.RectTransform, Anchor.TopRight, Pivot.BottomRight),
|
||||||
isHorizontal: true)
|
isHorizontal: true)
|
||||||
|
|||||||
+1
-1
@@ -161,7 +161,7 @@ namespace Barotrauma
|
|||||||
private void OperateRepairTool(float deltaTime)
|
private void OperateRepairTool(float deltaTime)
|
||||||
{
|
{
|
||||||
character.CursorPosition = Item.Position;
|
character.CursorPosition = Item.Position;
|
||||||
if (repairTool.Item.RequireAimToUse)
|
if (Item.RequireAimToUse)
|
||||||
{
|
{
|
||||||
character.SetInput(InputType.Aim, false, true);
|
character.SetInput(InputType.Aim, false, true);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user