-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…ing in some cultures
- Loading branch information
Showing
1 changed file
with
12 additions
and
4 deletions.
There are no files selected for viewing
16 changes: 12 additions & 4 deletions
16
Packages/RosettaUI.UIToolkit/Runtime/UnityInternalAccess/UnityEditor/EditorGUI.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,27 @@ | ||
namespace RosettaUI.UIToolkit.UnityInternalAccess | ||
using System.Globalization; | ||
|
||
namespace RosettaUI.UIToolkit.UnityInternalAccess | ||
{ | ||
public sealed class EditorGUI | ||
{ | ||
internal static string kFloatFieldFormatString = "g7"; | ||
// internal static readonly string s_AllowedCharactersForFloat = "inftynaeINFTYNAE0123456789.,-*/+%^()cosqrludxvRL=pP#"; | ||
internal static readonly string s_AllowedCharactersForFloat = "0123456789.-+"; | ||
|
||
public static void StringToDouble(string str, out double num) | ||
|
||
// ref: https://github.com/Unity-Technologies/UnityCsReference/blob/79d86f859b8454fcacc96962eb6e455cf6cd4f45/Runtime/Export/ExpressionEvaluator.cs#L508 | ||
public static bool StringToDouble(string str, out double num) | ||
{ | ||
double.TryParse(str, out num); | ||
return double.TryParse(str, NumberStyles.Float, CultureInfo.InvariantCulture.NumberFormat, out num); | ||
} | ||
|
||
internal static string kIntFieldFormatString = "#######0"; | ||
internal static readonly string s_AllowedCharactersForInt = "0123456789-+"; | ||
|
||
internal static bool StringToLong(string str, out long value) => long.TryParse(str, out value); | ||
// ref: https://github.com/Unity-Technologies/UnityCsReference/blob/79d86f859b8454fcacc96962eb6e455cf6cd4f45/Runtime/Export/ExpressionEvaluator.cs#L514 | ||
internal static bool StringToLong(string str, out long value) | ||
{ | ||
return long.TryParse(str, NumberStyles.Integer, CultureInfo.InvariantCulture.NumberFormat, out value); | ||
} | ||
} | ||
} |