(af16ecdfa) Merge branch 'dev' into human-ai
This commit is contained in:
@@ -15,6 +15,10 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
private GUIFrame selectedItemFrame;
|
||||
|
||||
public GUIButton ActivateButton
|
||||
{
|
||||
get { return activateButton; }
|
||||
}
|
||||
private GUIButton activateButton;
|
||||
|
||||
private GUITextBox itemFilterBox;
|
||||
@@ -22,6 +26,10 @@ namespace Barotrauma.Items.Components
|
||||
private GUIComponent inputInventoryHolder, outputInventoryHolder;
|
||||
private GUICustomComponent inputInventoryOverlay, outputInventoryOverlay;
|
||||
|
||||
public FabricationRecipe SelectedItem
|
||||
{
|
||||
get { return selectedItem; }
|
||||
}
|
||||
private FabricationRecipe selectedItem;
|
||||
|
||||
private GUIComponent inSufficientPowerWarning;
|
||||
@@ -73,7 +81,31 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
CanBeFocused = false
|
||||
};
|
||||
|
||||
|
||||
CreateRecipes();
|
||||
|
||||
activateButton = new GUIButton(new RectTransform(new Vector2(0.8f, 0.07f), paddedFrame.RectTransform),
|
||||
TextManager.Get("FabricatorCreate"), style: "GUIButtonLarge")
|
||||
{
|
||||
OnClicked = StartButtonClicked,
|
||||
UserData = selectedItem,
|
||||
Enabled = false
|
||||
};
|
||||
|
||||
inSufficientPowerWarning = new GUITextBlock(new RectTransform(Vector2.One, activateButton.RectTransform), TextManager.Get("FabricatorNoPower"),
|
||||
textColor: Color.Orange, textAlignment: Alignment.Center, color: Color.Black, style: "OuterGlow")
|
||||
{
|
||||
HoverColor = Color.Black,
|
||||
IgnoreLayoutGroups = true,
|
||||
Visible = false,
|
||||
CanBeFocused = false
|
||||
};
|
||||
}
|
||||
|
||||
partial void CreateRecipes()
|
||||
{
|
||||
itemList.Content.RectTransform.ClearChildren();
|
||||
|
||||
foreach (FabricationRecipe fi in fabricationRecipes)
|
||||
{
|
||||
GUIFrame frame = new GUIFrame(new RectTransform(new Point(itemList.Rect.Width, 30), itemList.Content.RectTransform), style: null)
|
||||
@@ -101,23 +133,6 @@ namespace Barotrauma.Items.Components
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
activateButton = new GUIButton(new RectTransform(new Vector2(0.8f, 0.07f), paddedFrame.RectTransform),
|
||||
TextManager.Get("FabricatorCreate"), style: "GUIButtonLarge")
|
||||
{
|
||||
OnClicked = StartButtonClicked,
|
||||
UserData = selectedItem,
|
||||
Enabled = false
|
||||
};
|
||||
|
||||
inSufficientPowerWarning = new GUITextBlock(new RectTransform(Vector2.One, activateButton.RectTransform), TextManager.Get("FabricatorNoPower"),
|
||||
textColor: Color.Orange, textAlignment: Alignment.Center, color: Color.Black, style: "OuterGlow")
|
||||
{
|
||||
HoverColor = Color.Black,
|
||||
IgnoreLayoutGroups = true,
|
||||
Visible = false,
|
||||
CanBeFocused = false
|
||||
};
|
||||
}
|
||||
|
||||
partial void OnItemLoadedProjSpecific()
|
||||
@@ -241,6 +256,7 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawOutputOverLay(SpriteBatch spriteBatch, GUICustomComponent overlayComponent)
|
||||
{
|
||||
overlayComponent.RectTransform.SetAsLastChild();
|
||||
@@ -363,6 +379,29 @@ namespace Barotrauma.Items.Components
|
||||
return true;
|
||||
}
|
||||
|
||||
public void HighlightRecipe(string identifier, Color color)
|
||||
{
|
||||
foreach (GUIComponent child in itemList.Content.Children)
|
||||
{
|
||||
FabricationRecipe recipe = child.UserData as FabricationRecipe;
|
||||
if (recipe?.DisplayName == null) { continue; }
|
||||
if (recipe.TargetItem.Identifier == identifier)
|
||||
{
|
||||
if (child.FlashTimer > 0.0f) return;
|
||||
child.Flash(color, 1.5f, false);
|
||||
|
||||
for (int i = 0; i < child.CountChildren; i++)
|
||||
{
|
||||
var grandChild = child.GetChild(i);
|
||||
if (grandChild is GUITextBlock) continue;
|
||||
grandChild.Flash(color, 1.5f, false);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool StartButtonClicked(GUIButton button, object obj)
|
||||
{
|
||||
if (selectedItem == null) { return false; }
|
||||
|
||||
Reference in New Issue
Block a user