Unstable 0.17.1.0
This commit is contained in:
@@ -4,7 +4,6 @@ using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Color = Microsoft.Xna.Framework.Color;
|
||||
|
||||
namespace Barotrauma
|
||||
@@ -127,7 +126,7 @@ namespace Barotrauma
|
||||
Vector2 newPoint = new Vector2(point.X, point.Y);
|
||||
foreach (Vector2 otherPoint in toCheck.Concat(newPoints))
|
||||
{
|
||||
float diffX = Math.Abs(newPoint.X - otherPoint.X),
|
||||
float diffX = Math.Abs(newPoint.X - otherPoint.X),
|
||||
diffY = Math.Abs(newPoint.Y - otherPoint.Y);
|
||||
|
||||
if (diffX <= treshold)
|
||||
@@ -142,7 +141,7 @@ namespace Barotrauma
|
||||
}
|
||||
newPoints.Add(newPoint);
|
||||
}
|
||||
|
||||
|
||||
return newPoints;
|
||||
}
|
||||
|
||||
@@ -275,7 +274,7 @@ namespace Barotrauma
|
||||
return pts;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Convert an RGB value into an HLS value.
|
||||
public static Vector3 RgbToHLS(this Color color)
|
||||
{
|
||||
@@ -320,7 +319,7 @@ namespace Barotrauma
|
||||
if (hue < 240) return q1 + (q2 - q1) * (240 - hue) / 60;
|
||||
return q1;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Convert a RGB value into a HSV value.
|
||||
/// </summary>
|
||||
@@ -329,7 +328,7 @@ namespace Barotrauma
|
||||
/// <returns>
|
||||
/// Vector3 where X is the hue (0-360 or NaN)
|
||||
/// Y is the saturation (0-1)
|
||||
/// Z is the value (0-1)
|
||||
/// Z is the value (0-1)
|
||||
/// </returns>
|
||||
public static Vector3 RGBToHSV(Color color)
|
||||
{
|
||||
@@ -478,7 +477,7 @@ namespace Barotrauma
|
||||
if (b.Build < a.Build) { return false; }
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public static void OpenFileWithShell(string filename)
|
||||
{
|
||||
ProcessStartInfo startInfo = new ProcessStartInfo()
|
||||
@@ -488,5 +487,24 @@ namespace Barotrauma
|
||||
};
|
||||
Process.Start(startInfo);
|
||||
}
|
||||
|
||||
public static Vector2 PaddingSizeParentRelative(RectTransform parent, float padding)
|
||||
{
|
||||
var (sizeX, sizeY) = parent.NonScaledSize.ToVector2();
|
||||
|
||||
float higher = sizeX,
|
||||
lower = sizeY;
|
||||
bool swap = lower > higher;
|
||||
if (swap) { (higher, lower) = (lower, higher); }
|
||||
|
||||
float diffY = lower - lower * padding;
|
||||
|
||||
float paddingX = (higher - diffY) / higher,
|
||||
paddingY = padding;
|
||||
|
||||
if (swap) { (paddingX, paddingY) = (paddingY, paddingX); }
|
||||
|
||||
return new Vector2(paddingX, paddingY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user