mirror of
https://github.com/sinai-dev/UnityExplorer.git
synced 2025-01-06 01:23:31 +08:00
Go back to previous panel transform saving, no need to change
This commit is contained in:
parent
a673c39f4a
commit
f26371f95f
@ -339,7 +339,7 @@ namespace UnityExplorer.UI.Panels
|
||||
if (!rect)
|
||||
throw new ArgumentNullException("rect");
|
||||
|
||||
return string.Format(CultureInfo.CurrentCulture, "{0} {1} {2} {3}", new object[]
|
||||
return string.Format(CultureInfo.InvariantCulture, "{0},{1},{2},{3}", new object[]
|
||||
{
|
||||
rect.anchorMin.x,
|
||||
rect.anchorMin.y,
|
||||
@ -353,16 +353,20 @@ namespace UnityExplorer.UI.Panels
|
||||
if (string.IsNullOrEmpty(stringAnchors))
|
||||
throw new ArgumentNullException("stringAnchors");
|
||||
|
||||
var split = stringAnchors.Split(' ');
|
||||
if (stringAnchors.Contains(" "))
|
||||
// outdated save data, not worth recovering just reset it.
|
||||
throw new Exception("invalid save data, resetting.");
|
||||
|
||||
var split = stringAnchors.Split(',');
|
||||
|
||||
if (split.Length != 4)
|
||||
throw new Exception($"stringAnchors split is unexpected length: {split.Length}");
|
||||
|
||||
Vector4 anchors;
|
||||
anchors.x = float.Parse(split[0], CultureInfo.CurrentCulture);
|
||||
anchors.y = float.Parse(split[1], CultureInfo.CurrentCulture);
|
||||
anchors.z = float.Parse(split[2], CultureInfo.CurrentCulture);
|
||||
anchors.w = float.Parse(split[3], CultureInfo.CurrentCulture);
|
||||
anchors.x = float.Parse(split[0], CultureInfo.InvariantCulture);
|
||||
anchors.y = float.Parse(split[1], CultureInfo.InvariantCulture);
|
||||
anchors.z = float.Parse(split[2], CultureInfo.InvariantCulture);
|
||||
anchors.w = float.Parse(split[3], CultureInfo.InvariantCulture);
|
||||
|
||||
panel.anchorMin = new Vector2(anchors.x, anchors.y);
|
||||
panel.anchorMax = new Vector2(anchors.z, anchors.w);
|
||||
@ -373,7 +377,7 @@ namespace UnityExplorer.UI.Panels
|
||||
if (!rect)
|
||||
throw new ArgumentNullException("rect");
|
||||
|
||||
return string.Format(CultureInfo.CurrentCulture, "{0} {1}", new object[]
|
||||
return string.Format(CultureInfo.InvariantCulture, "{0},{1}", new object[]
|
||||
{
|
||||
rect.localPosition.x, rect.localPosition.y
|
||||
});
|
||||
@ -381,14 +385,21 @@ namespace UnityExplorer.UI.Panels
|
||||
|
||||
internal static void SetPositionFromString(this RectTransform rect, string stringPosition)
|
||||
{
|
||||
var split = stringPosition.Split(' ');
|
||||
if (string.IsNullOrEmpty(stringPosition))
|
||||
throw new ArgumentNullException(stringPosition);
|
||||
|
||||
if (stringPosition.Contains(" "))
|
||||
// outdated save data, not worth recovering just reset it.
|
||||
throw new Exception("invalid save data, resetting.");
|
||||
|
||||
var split = stringPosition.Split(',');
|
||||
|
||||
if (split.Length != 2)
|
||||
throw new Exception($"stringPosition split is unexpected length: {split.Length}");
|
||||
|
||||
Vector3 vector = rect.localPosition;
|
||||
vector.x = float.Parse(split[0], CultureInfo.CurrentCulture);
|
||||
vector.y = float.Parse(split[1], CultureInfo.CurrentCulture);
|
||||
vector.x = float.Parse(split[0], CultureInfo.InvariantCulture);
|
||||
vector.y = float.Parse(split[1], CultureInfo.InvariantCulture);
|
||||
rect.localPosition = vector;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user