(b948206e8) Merge branch 'dev' of https://github.com/Regalis11/Barotrauma-development into dev
This commit is contained in:
@@ -80,7 +80,6 @@ namespace Barotrauma
|
|||||||
sender.UserData = null;
|
sender.UserData = null;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
clientNameBox.OnTextChanged += RefreshJoinButtonState;
|
|
||||||
|
|
||||||
var filterHolder = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.5f), leftColumn.RectTransform)) { RelativeSpacing = 0.05f };
|
var filterHolder = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.5f), leftColumn.RectTransform)) { RelativeSpacing = 0.05f };
|
||||||
|
|
||||||
@@ -152,58 +151,6 @@ namespace Barotrauma
|
|||||||
Enabled = false
|
Enabled = false
|
||||||
};
|
};
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------------
|
|
||||||
//right column
|
|
||||||
//-------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
var rightColumn = new GUILayoutGroup(new RectTransform(new Vector2(1.0f - leftColumn.RectTransform.RelativeSize.X - 0.017f, 1.0f),
|
|
||||||
paddedFrame.RectTransform, Anchor.CenterRight))
|
|
||||||
{
|
|
||||||
RelativeSpacing = 0.02f,
|
|
||||||
Stretch = true
|
|
||||||
};
|
|
||||||
|
|
||||||
var serverListHolder = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 1.0f), rightColumn.RectTransform)) { Stretch = true, RelativeSpacing = 0.02f };
|
|
||||||
|
|
||||||
serverList = new GUIListBox(new RectTransform(new Vector2(1.0f, 1.0f), serverListHolder.RectTransform, Anchor.Center))
|
|
||||||
{
|
|
||||||
OnSelected = (btn, obj) => {
|
|
||||||
ServerInfo serverInfo = (ServerInfo)obj;
|
|
||||||
|
|
||||||
serverInfo.CreatePreviewWindow(serverPreview);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
serverList.OnSelected += SelectServer;
|
|
||||||
|
|
||||||
serverPreview = new GUIListBox(new RectTransform(new Vector2(1.0f, 1.0f), serverListHolder.RectTransform, Anchor.Center));
|
|
||||||
|
|
||||||
columnRelativeWidth = new float[] { 0.04f, 0.02f, 0.044f, 0.77f, 0.02f, 0.075f, 0.06f };
|
|
||||||
|
|
||||||
var buttonContainer = new GUIFrame(new RectTransform(new Vector2(1.0f, 0.075f), rightColumn.RectTransform), style: null);
|
|
||||||
|
|
||||||
GUIButton button = new GUIButton(new RectTransform(new Vector2(0.25f, 0.9f), buttonContainer.RectTransform, Anchor.TopLeft),
|
|
||||||
TextManager.Get("Back"), style: "GUIButtonLarge")
|
|
||||||
{
|
|
||||||
OnClicked = GameMain.MainMenuScreen.ReturnToMainMenu
|
|
||||||
};
|
|
||||||
|
|
||||||
var refreshButton = new GUIButton(new RectTransform(new Vector2(buttonContainer.Rect.Height / (float)buttonContainer.Rect.Width, 0.9f), buttonContainer.RectTransform, Anchor.Center),
|
|
||||||
"", style: "GUIButtonRefresh") {
|
|
||||||
|
|
||||||
ToolTip = TextManager.Get("ServerListRefresh"),
|
|
||||||
OnClicked = RefreshServers
|
|
||||||
};
|
|
||||||
|
|
||||||
joinButton = new GUIButton(new RectTransform(new Vector2(0.25f, 0.9f), buttonContainer.RectTransform, Anchor.TopRight),
|
|
||||||
TextManager.Get("ServerListJoin"), style: "GUIButtonLarge")
|
|
||||||
{
|
|
||||||
OnClicked = JoinServer,
|
|
||||||
Enabled = false
|
|
||||||
};
|
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
|
||||||
button.SelectedColor = button.Color;
|
button.SelectedColor = button.Color;
|
||||||
|
|||||||
@@ -212,31 +212,36 @@ namespace Barotrauma.Items.Components
|
|||||||
}
|
}
|
||||||
|
|
||||||
private string accessDeniedTxt = TextManager.Get("AccessDenied");
|
private string accessDeniedTxt = TextManager.Get("AccessDenied");
|
||||||
private bool hasIdCard;
|
private string cannotOpenText = TextManager.Get("DoorMsgCannotOpen");
|
||||||
|
private bool hasValidIdCard;
|
||||||
public override bool HasRequiredItems(Character character, bool addMessage, string msg = null)
|
public override bool HasRequiredItems(Character character, bool addMessage, string msg = null)
|
||||||
{
|
{
|
||||||
if (item.Condition <= RepairThreshold) return true; //For repairing
|
if (item.Condition <= RepairThreshold) return true; //For repairing
|
||||||
|
|
||||||
var idCard = character.Inventory.FindItemByIdentifier("idcard");
|
var idCard = character.Inventory.FindItemByIdentifier("idcard");
|
||||||
hasIdCard = requiredItems.Any(ri => ri.Value.Any(r => r.MatchesItem(idCard)));
|
hasValidIdCard = requiredItems.Any(ri => ri.Value.Any(r => r.MatchesItem(idCard)));
|
||||||
Msg = hasIdCard ? "ItemMsgOpen" : "ItemMsgForceOpenCrowbar";
|
Msg = hasValidIdCard ? "ItemMsgOpen" : "ItemMsgForceOpenCrowbar";
|
||||||
ParseMsg();
|
ParseMsg();
|
||||||
|
if (addMessage)
|
||||||
|
{
|
||||||
|
msg = msg ?? (requiredItems.Any(ri => ri.Value.Any(r => r.Identifiers.Contains("idcard"))) ? accessDeniedTxt : cannotOpenText);
|
||||||
|
}
|
||||||
|
|
||||||
//this is a bit pointless atm because if canBePicked is false it won't allow you to do Pick() anyway, however it's still good for future-proofing.
|
//this is a bit pointless atm because if canBePicked is false it won't allow you to do Pick() anyway, however it's still good for future-proofing.
|
||||||
return requiredItems.Any() ? base.HasRequiredItems(character, addMessage, msg ?? accessDeniedTxt) : canBePicked;
|
return requiredItems.Any() ? base.HasRequiredItems(character, addMessage, msg) : canBePicked;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool Pick(Character picker)
|
public override bool Pick(Character picker)
|
||||||
{
|
{
|
||||||
if (item.Condition <= RepairThreshold) { return true; }
|
if (item.Condition <= RepairThreshold) { return true; }
|
||||||
if (HasRequiredItems(picker, false) && hasIdCard) { return false; }
|
if (HasRequiredItems(picker, false) && hasValidIdCard) { return false; }
|
||||||
return base.Pick(picker);
|
return base.Pick(picker);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool OnPicked(Character picker)
|
public override bool OnPicked(Character picker)
|
||||||
{
|
{
|
||||||
if (item.Condition <= RepairThreshold) return true; //repairs
|
if (item.Condition <= RepairThreshold) return true; //repairs
|
||||||
if (requiredItems.Any() && !hasIdCard)
|
if (requiredItems.Any() && !hasValidIdCard)
|
||||||
{
|
{
|
||||||
ForceOpen(ActionType.OnPicked);
|
ForceOpen(ActionType.OnPicked);
|
||||||
}
|
}
|
||||||
@@ -256,7 +261,7 @@ namespace Barotrauma.Items.Components
|
|||||||
//can only be selected if the item is broken
|
//can only be selected if the item is broken
|
||||||
if (item.Condition <= RepairThreshold) return true; //repairs
|
if (item.Condition <= RepairThreshold) return true; //repairs
|
||||||
bool hasRequiredItems = HasRequiredItems(character, false);
|
bool hasRequiredItems = HasRequiredItems(character, false);
|
||||||
if (requiredItems.None() || hasRequiredItems && hasIdCard)
|
if (requiredItems.None() || hasRequiredItems && hasValidIdCard)
|
||||||
{
|
{
|
||||||
float originalPickingTime = PickingTime;
|
float originalPickingTime = PickingTime;
|
||||||
PickingTime = 0;
|
PickingTime = 0;
|
||||||
@@ -283,17 +288,6 @@ namespace Barotrauma.Items.Components
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (item.Connections != null)
|
|
||||||
{
|
|
||||||
if (item.Connections.Any(ic => ic.Recipients.Any()))
|
|
||||||
{
|
|
||||||
SetWired(true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SetWired(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isClosing = false;
|
bool isClosing = false;
|
||||||
if (!isStuck)
|
if (!isStuck)
|
||||||
|
|||||||
@@ -2062,6 +2062,8 @@ namespace Barotrauma
|
|||||||
public virtual void Reset()
|
public virtual void Reset()
|
||||||
{
|
{
|
||||||
SerializableProperties = SerializableProperty.DeserializeProperties(this, Prefab.ConfigElement);
|
SerializableProperties = SerializableProperty.DeserializeProperties(this, Prefab.ConfigElement);
|
||||||
|
Sprite.ReloadXML();
|
||||||
|
SpriteDepth = Sprite.Depth;
|
||||||
components.ForEach(c => c.Reset());
|
components.ForEach(c => c.Reset());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user