(ce8e185aa) Merge branch 'dev' of https://github.com/Regalis11/Barotrauma-development into dev

This commit is contained in:
Joonas Rikkonen
2019-04-16 17:12:09 +03:00
parent bd07acf26d
commit 6262b3ea54
96 changed files with 1972 additions and 825 deletions
@@ -41,8 +41,6 @@ namespace Barotrauma
{
get { return activeSprite; }
}
public float SpriteRotation;
private GUITextBlock itemInUseWarning;
private GUITextBlock ItemInUseWarning
@@ -103,9 +101,22 @@ namespace Barotrauma
return color;
}
partial void SetActiveSprite()
partial void SetActiveSpriteProjSpecific()
{
activeSprite = prefab.sprite;
Holdable holdable = GetComponent<Holdable>();
if (holdable != null && holdable.Attached)
{
foreach (ContainedItemSprite containedSprite in Prefab.ContainedSprites)
{
if (containedSprite.UseWhenAttached)
{
activeSprite = containedSprite.Sprite;
return;
}
}
}
if (Container != null)
{
foreach (ContainedItemSprite containedSprite in Prefab.ContainedSprites)
@@ -175,8 +186,7 @@ namespace Barotrauma
Color color = isHighlighted && !GUI.DisableItemHighlights && Screen.Selected != GameMain.GameScreen ? Color.Orange : GetSpriteColor();
//if (IsSelected && editing) color = Color.Lerp(color, Color.Gold, 0.5f);
Sprite activeSprite = prefab.sprite;
BrokenItemSprite fadeInBrokenSprite = null;
float fadeInBrokenSpriteAlpha = 0.0f;
if (condition < Prefab.Health)
@@ -567,8 +577,13 @@ namespace Barotrauma
}
var componentEditor = new SerializableEntityEditor(listBox.Content.RectTransform, ic, inGame, showName: !inGame);
if (inGame) continue;
if (inGame)
{
ic.CreateEditingHUD(componentEditor);
componentEditor.Recalculate();
continue;
}
foreach (var kvp in ic.requiredItems)
{
@@ -602,6 +617,10 @@ namespace Barotrauma
}
}
ic.CreateEditingHUD(componentEditor);
componentEditor.Recalculate();
}
PositionEditingHUD();
SetHUDLayout();
@@ -784,7 +803,7 @@ namespace Barotrauma
{
if (!ic.CanBeSelected) { continue; }
bool useAlternativeLayout = ic.Item != this;
bool useAlternativeLayout = activeHUDs.Count > 1;
bool wasUsingAlternativeLayout = ic.UseAlternativeLayout;
ic.UseAlternativeLayout = useAlternativeLayout;
needsLayoutUpdate |= ic.UseAlternativeLayout != wasUsingAlternativeLayout;
@@ -818,14 +837,28 @@ namespace Barotrauma
case NetEntityEvent.Type.ComponentState:
{
int componentIndex = msg.ReadRangedInteger(0, components.Count - 1);
(components[componentIndex] as IServerSerializable).ClientRead(type, msg, sendingTime);
if (components[componentIndex] is IServerSerializable serverSerializable)
{
serverSerializable.ClientRead(type, msg, sendingTime);
}
else
{
throw new Exception("Failed to read component state - " + components[componentIndex].GetType() + " is not IServerSerializable.");
}
}
break;
case NetEntityEvent.Type.InventoryState:
{
{
int containerIndex = msg.ReadRangedInteger(0, components.Count - 1);
(components[containerIndex] as ItemContainer).Inventory.ClientRead(type, msg, sendingTime);
if (components[containerIndex] is ItemContainer container)
{
container.Inventory.ClientRead(type, msg, sendingTime);
}
else
{
throw new Exception("Failed to read inventory state - " + components[containerIndex].GetType() + " is not an ItemContainer.");
}
}
break;
case NetEntityEvent.Type.Status: