(902225da6) More automatic text scaling in places where texts are likely to overflow
This commit is contained in:
@@ -121,90 +121,7 @@ namespace Barotrauma
|
|||||||
MainLimb.PullJointWorldAnchorB = Collider.SimPosition;
|
MainLimb.PullJointWorldAnchorB = Collider.SimPosition;
|
||||||
MainLimb.PullJointEnabled = true;
|
MainLimb.PullJointEnabled = true;
|
||||||
}
|
}
|
||||||
character.SelectedConstruction = character.MemState[0].SelectedItem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (character.MemState[0].Animation == AnimController.Animation.CPR)
|
|
||||||
{
|
|
||||||
character.AnimController.Anim = AnimController.Animation.CPR;
|
|
||||||
}
|
|
||||||
else if (character.AnimController.Anim == AnimController.Animation.CPR)
|
|
||||||
{
|
|
||||||
character.AnimController.Anim = AnimController.Animation.None;
|
|
||||||
}
|
|
||||||
|
|
||||||
Vector2 newVelocity = Collider.LinearVelocity;
|
|
||||||
Vector2 newPosition = Collider.SimPosition;
|
|
||||||
float newRotation = Collider.Rotation;
|
|
||||||
float newAngularVelocity = Collider.AngularVelocity;
|
|
||||||
Collider.CorrectPosition(character.MemState, out newPosition, out newVelocity, out newRotation, out newAngularVelocity);
|
|
||||||
|
|
||||||
newVelocity = newVelocity.ClampLength(100.0f);
|
|
||||||
if (!MathUtils.IsValid(newVelocity)) { newVelocity = Vector2.Zero; }
|
|
||||||
overrideTargetMovement = newVelocity.LengthSquared() > 0.01f ? newVelocity : Vector2.Zero;
|
|
||||||
|
|
||||||
Collider.LinearVelocity = newVelocity;
|
|
||||||
Collider.AngularVelocity = newAngularVelocity;
|
|
||||||
|
|
||||||
float distSqrd = Vector2.DistanceSquared(newPosition, Collider.SimPosition);
|
|
||||||
float errorTolerance = character.AllowInput ? 0.01f : 0.2f;
|
|
||||||
if (distSqrd > errorTolerance)
|
|
||||||
{
|
|
||||||
if (distSqrd > 10.0f || !character.AllowInput)
|
|
||||||
{
|
|
||||||
Collider.TargetRotation = newRotation;
|
|
||||||
SetPosition(newPosition, lerp: distSqrd < 5.0f, ignorePlatforms: false);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Collider.TargetRotation = newRotation;
|
|
||||||
Collider.TargetPosition = newPosition;
|
|
||||||
Collider.MoveToTargetPosition(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//unconscious/dead characters can't correct their position using AnimController movement
|
|
||||||
// -> we need to correct it manually
|
|
||||||
if (!character.AllowInput)
|
|
||||||
{
|
|
||||||
float mainLimbDistSqrd = Vector2.DistanceSquared(MainLimb.PullJointWorldAnchorA, Collider.SimPosition);
|
|
||||||
float mainLimbErrorTolerance = 0.1f;
|
|
||||||
//if the main limb is roughly at the correct position and the collider isn't moving (much at least),
|
|
||||||
//don't attempt to correct the position.
|
|
||||||
if (mainLimbDistSqrd > mainLimbErrorTolerance || Collider.LinearVelocity.LengthSquared() > 0.05f)
|
|
||||||
{
|
|
||||||
MainLimb.PullJointWorldAnchorB = Collider.SimPosition;
|
|
||||||
MainLimb.PullJointEnabled = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
character.MemLocalState.Clear();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//remove states with a timestamp (there may still timestamp-based states
|
|
||||||
//in the list if the controlled character switches from timestamp-based interpolation to ID-based)
|
|
||||||
character.MemState.RemoveAll(m => m.Timestamp > 0.0f);
|
|
||||||
|
|
||||||
for (int i = 0; i < character.MemLocalState.Count; i++)
|
|
||||||
{
|
|
||||||
if (character.Submarine == null)
|
|
||||||
{
|
|
||||||
//transform in-sub coordinates to outside coordinates
|
|
||||||
if (character.MemLocalState[i].Position.Y > lowestSubPos)
|
|
||||||
{
|
|
||||||
character.MemLocalState[i].TransformInToOutside();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (currentHull?.Submarine != null)
|
|
||||||
{
|
|
||||||
//transform outside coordinates to in-sub coordinates
|
|
||||||
if (character.MemLocalState[i].Position.Y < lowestSubPos)
|
|
||||||
{
|
|
||||||
character.MemLocalState[i].TransformOutToInside(currentHull.Submarine);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
character.MemLocalState.Clear();
|
character.MemLocalState.Clear();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -657,13 +657,15 @@ namespace Barotrauma
|
|||||||
{ Stretch = true, RelativeSpacing = 0.02f };
|
{ Stretch = true, RelativeSpacing = 0.02f };
|
||||||
|
|
||||||
var inputNames = Enum.GetValues(typeof(InputType));
|
var inputNames = Enum.GetValues(typeof(InputType));
|
||||||
|
var inputNameBlocks = new List<GUITextBlock>();
|
||||||
for (int i = 0; i < inputNames.Length; i++)
|
for (int i = 0; i < inputNames.Length; i++)
|
||||||
{
|
{
|
||||||
var inputContainer = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.06f),(i <= (inputNames.Length / 2.2f) ? inputColumnLeft : inputColumnRight).RectTransform))
|
var inputContainer = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.06f),(i <= (inputNames.Length / 2.2f) ? inputColumnLeft : inputColumnRight).RectTransform))
|
||||||
{ Stretch = true, IsHorizontal = true, RelativeSpacing = 0.05f, Color = new Color(12, 14, 15, 215) };
|
{ Stretch = true, IsHorizontal = true, RelativeSpacing = 0.05f, Color = new Color(12, 14, 15, 215) };
|
||||||
new GUITextBlock(new RectTransform(new Vector2(0.3f, 1.0f), inputContainer.RectTransform, Anchor.TopLeft) { MinSize = new Point(150, 0) },
|
var inputName = new GUITextBlock(new RectTransform(new Vector2(0.5f, 1.0f), inputContainer.RectTransform, Anchor.TopLeft) { MinSize = new Point(150, 0) },
|
||||||
TextManager.Get("InputType." + ((InputType)i)) + ": ", font: GUI.SmallFont) { ForceUpperCase = true };
|
TextManager.Get("InputType." + ((InputType)i)) + ": ", font: GUI.SmallFont) { ForceUpperCase = true };
|
||||||
var keyBox = new GUITextBox(new RectTransform(new Vector2(0.7f, 1.0f), inputContainer.RectTransform),
|
inputNameBlocks.Add(inputName);
|
||||||
|
var keyBox = new GUITextBox(new RectTransform(new Vector2(0.5f, 1.0f), inputContainer.RectTransform),
|
||||||
text: keyMapping[i].ToString(), font: GUI.SmallFont)
|
text: keyMapping[i].ToString(), font: GUI.SmallFont)
|
||||||
{
|
{
|
||||||
UserData = i
|
UserData = i
|
||||||
@@ -672,12 +674,14 @@ namespace Barotrauma
|
|||||||
keyBox.SelectedColor = Color.Gold * 0.3f;
|
keyBox.SelectedColor = Color.Gold * 0.3f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GUITextBlock.AutoScaleAndNormalize(inputNameBlocks);
|
||||||
|
|
||||||
var resetControlsHolder = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.07f), controlsLayoutGroup.RectTransform), isHorizontal: true)
|
var resetControlsHolder = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.07f), controlsLayoutGroup.RectTransform), isHorizontal: true)
|
||||||
{
|
{
|
||||||
RelativeSpacing = 0.02f
|
RelativeSpacing = 0.02f
|
||||||
};
|
};
|
||||||
|
|
||||||
new GUIButton(new RectTransform(new Vector2(0.3f, 1.0f), resetControlsHolder.RectTransform), TextManager.Get("SetDefaultBindings"))
|
var defaultBindingsButton = new GUIButton(new RectTransform(new Vector2(0.3f, 1.0f), resetControlsHolder.RectTransform), TextManager.Get("SetDefaultBindings"))
|
||||||
{
|
{
|
||||||
ToolTip = TextManager.Get("SetDefaultBindingsToolTip"),
|
ToolTip = TextManager.Get("SetDefaultBindingsToolTip"),
|
||||||
OnClicked = (button, data) =>
|
OnClicked = (button, data) =>
|
||||||
@@ -687,7 +691,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
new GUIButton(new RectTransform(new Vector2(0.3f, 1.0f), resetControlsHolder.RectTransform), TextManager.Get("SetLegacyBindings"))
|
var legacyBindingsButton = new GUIButton(new RectTransform(new Vector2(0.3f, 1.0f), resetControlsHolder.RectTransform), TextManager.Get("SetLegacyBindings"))
|
||||||
{
|
{
|
||||||
ToolTip = TextManager.Get("SetLegacyBindingsToolTip"),
|
ToolTip = TextManager.Get("SetLegacyBindingsToolTip"),
|
||||||
OnClicked = (button, data) =>
|
OnClicked = (button, data) =>
|
||||||
@@ -697,6 +701,8 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
GUITextBlock.AutoScaleAndNormalize(defaultBindingsButton.TextBlock, legacyBindingsButton.TextBlock);
|
||||||
|
|
||||||
//spacing
|
//spacing
|
||||||
new GUIFrame(new RectTransform(new Vector2(1.0f, 0.02f), generalLayoutGroup.RectTransform), style: null);
|
new GUIFrame(new RectTransform(new Vector2(1.0f, 0.02f), generalLayoutGroup.RectTransform), style: null);
|
||||||
|
|
||||||
|
|||||||
@@ -295,7 +295,7 @@ namespace Barotrauma.Networking
|
|||||||
OnClicked = SelectSettingsTab
|
OnClicked = SelectSettingsTab
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
GUITextBlock.AutoScaleAndNormalize(tabButtons.Select(b => b.TextBlock));
|
||||||
SelectSettingsTab(tabButtons[0], 0);
|
SelectSettingsTab(tabButtons[0], 0);
|
||||||
|
|
||||||
//"Close"
|
//"Close"
|
||||||
|
|||||||
@@ -317,10 +317,11 @@ namespace Barotrauma
|
|||||||
Stretch = true
|
Stretch = true
|
||||||
};
|
};
|
||||||
|
|
||||||
new GUIButton(new RectTransform(new Vector2(1.0f, 1.0f), tabButtonHolder.RectTransform), TextManager.Get("MapEntityCategory.All"), style: "GUITabButton")
|
entityCategoryButtons.Add(
|
||||||
{
|
new GUIButton(new RectTransform(new Vector2(1.0f, 1.0f), tabButtonHolder.RectTransform), TextManager.Get("MapEntityCategory.All"), style: "GUITabButton")
|
||||||
OnClicked = (btn, userdata) => { ClearFilter(); return true; }
|
{
|
||||||
};
|
OnClicked = (btn, userdata) => { ClearFilter(); return true; }
|
||||||
|
});
|
||||||
|
|
||||||
foreach (MapEntityCategory category in Enum.GetValues(typeof(MapEntityCategory)))
|
foreach (MapEntityCategory category in Enum.GetValues(typeof(MapEntityCategory)))
|
||||||
{
|
{
|
||||||
@@ -337,6 +338,8 @@ namespace Barotrauma
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GUITextBlock.AutoScaleAndNormalize(entityCategoryButtons.Select(b => b.TextBlock));
|
||||||
|
|
||||||
entityList = new GUIListBox(new RectTransform(new Vector2(1.0f, 0.9f), entityListHolder.RectTransform, Anchor.BottomCenter))
|
entityList = new GUIListBox(new RectTransform(new Vector2(1.0f, 0.9f), entityListHolder.RectTransform, Anchor.BottomCenter))
|
||||||
{
|
{
|
||||||
OnSelected = SelectPrefab,
|
OnSelected = SelectPrefab,
|
||||||
|
|||||||
Reference in New Issue
Block a user