Significant Digits Hotfix

Formatting code was consuming the sigdigs whenever it was used. Whoops!
This commit is contained in:
Reinier Vens 2021-04-13 02:16:03 +01:00
commit b171b940dc
5 changed files with 12 additions and 12 deletions

View file

@ -86,7 +86,7 @@ Material:
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _Scale: 0.5
- _Scale: 1.441227
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1

View file

@ -487,8 +487,7 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: Slider FieldSlider FieldSlider FieldSlider FieldSlider FieldSlider FieldSlider
FieldSlider Field
m_text: Slider Field
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 53555f7a2d5e745428813f1b1118734f, type: 2}
m_sharedMaterial: {fileID: -2804126062856497447, guid: 53555f7a2d5e745428813f1b1118734f,

View file

@ -802,8 +802,8 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 741153267}
m_LocalRotation: {x: 0.0155069195, y: 0.9502416, z: -0.30741316, w: 0.047933277}
m_LocalPosition: {x: -117.52002, y: -77.087425, z: 149.09026}
m_LocalRotation: {x: 0.015506903, y: 0.9502416, z: -0.30741313, w: 0.04793323}
m_LocalPosition: {x: -117.51999, y: -77.08743, z: 149.09026}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 412917866}
@ -1234,8 +1234,8 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 965376321}
m_LocalRotation: {x: 0.0155069195, y: 0.9502416, z: -0.30741316, w: 0.047933277}
m_LocalPosition: {x: -117.52002, y: -77.087425, z: 149.09026}
m_LocalRotation: {x: 0.015506903, y: 0.9502416, z: -0.30741313, w: 0.04793323}
m_LocalPosition: {x: -117.51999, y: -77.08743, z: 149.09026}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}

View file

@ -36,10 +36,11 @@ public class PlayerSettings
public string Format(float d)
{
var magnitude = d == 0.0f ? 0 : (int)Math.Floor(Math.Log10(Math.Abs(d))) + 1;
SignificantDigits -= magnitude;
if (SignificantDigits < 0)
SignificantDigits = 0;
var strdec = d.ToString($"N{SignificantDigits}");
var digits = SignificantDigits;
digits -= magnitude;
if (digits < 0)
digits = 0;
var strdec = d.ToString($"N{digits}");
var dec = Convert.ToChar(CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator);
return strdec.Contains(CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator) ? strdec.TrimEnd('0').TrimEnd(dec) : strdec;
}

BIN
GameData/PlayerSettings.msgpack (Stored with Git LFS)

Binary file not shown.