(9f5c9fbcb) Make sure lazy-loaded sprites load their texture when creating a GUIImage, because the image needs to know the size of the texture to scale itself correctly. Fixes location portraits not being visible in the campaign menu when a location is selected for the first time.

This commit is contained in:
Joonas Rikkonen
2019-04-04 11:08:18 +03:00
parent 7491b06a5d
commit d4752bb6a0
56 changed files with 854 additions and 572 deletions
@@ -235,30 +235,6 @@ namespace Barotrauma
set { /*do nothing*/ }
}
/// <summary>
/// Should the item's Use method be called with the "Use" or with the "Shoot" key?
/// </summary>
[Serialize(false, false)]
public bool IsShootable { get; set; }
/// <summary>
/// If true, the user has to hold the "aim" key before use is registered. False by default.
/// </summary>
[Serialize(false, false)]
public bool RequireAimToUse
{
get; set;
}
/// <summary>
/// If true, the user has to hold the "aim" key before secondary use is registered. True by default.
/// </summary>
[Serialize(true, false)]
public bool RequireAimToSecondaryUse
{
get; set;
}
public Color Color
{
get { return spriteColor; }
@@ -1151,6 +1127,12 @@ namespace Barotrauma
return;
}
float forceFactor = 1.0f;
if (CurrentHull != null)
{
return;
}
float forceFactor = 1.0f;
if (CurrentHull != null)
{
@@ -1395,40 +1377,20 @@ namespace Barotrauma
}
else
{
if (picker.IsKeyDown(InputType.Aim))
if (forceSelectKey)
{
pickHit = false;
selectHit = false;
if (ic.PickKey == InputType.Select) pickHit = true;
if (ic.SelectKey == InputType.Select) selectHit = true;
}
else if (forceActionKey)
{
if (ic.PickKey == InputType.Use) pickHit = true;
if (ic.SelectKey == InputType.Use) selectHit = true;
}
else
{
if (forceSelectKey)
{
if (ic.PickKey == InputType.Select) pickHit = true;
if (ic.SelectKey == InputType.Select) selectHit = true;
}
else if (forceActionKey)
{
if (ic.PickKey == InputType.Use) pickHit = true;
if (ic.SelectKey == InputType.Use) selectHit = true;
}
else
{
pickHit = picker.IsKeyHit(ic.PickKey);
selectHit = picker.IsKeyHit(ic.SelectKey);
#if CLIENT
//if the cursor is on a UI component, disable interaction with the left mouse button
//to prevent accidentally selecting items when clicking UI elements
if (picker == Character.Controlled && GUI.MouseOn != null)
{
if (GameMain.Config.KeyBind(ic.PickKey).MouseButton == 0) pickHit = false;
if (GameMain.Config.KeyBind(ic.SelectKey).MouseButton == 0) selectHit = false;
}
#endif
}
}
}
pickHit = picker.IsKeyHit(ic.PickKey);
selectHit = picker.IsKeyHit(ic.SelectKey);
#if CLIENT
//if the cursor is on a UI component, disable interaction with the left mouse button
@@ -1442,6 +1404,9 @@ namespace Barotrauma
}
}
if (!pickHit && !selectHit) continue;
if (!ic.HasRequiredSkills(picker, out Skill tempRequiredSkill)) hasRequiredSkills = false;
bool showUiMsg = false;
@@ -1491,6 +1456,7 @@ namespace Barotrauma
return true;
}
public void Use(float deltaTime, Character character = null, Limb targetLimb = null)
{
if (RequireAimToUse && !character.IsKeyDown(InputType.Aim))
@@ -1641,6 +1607,8 @@ namespace Barotrauma
GameMain.NetworkMember != null && (GameMain.NetworkMember.IsServer || Character.Controlled == dropper))
{
parentInventory.CreateNetworkEvent();
//send frequent updates after the item has been dropped
PositionUpdateInterval = 0.0f;
}
}