11using UnityEngine ;
22using System . Collections ;
3+ using System . Globalization ;
34
45public class ParameterGroup
56{
@@ -81,14 +82,14 @@ public string getString(string parameterNameString) {
8182 //===================================================================
8283 public float getFloat ( string parameterNameString ) {
8384 int results = System . Array . FindIndex ( parameterName , s => s . Equals ( parameterNameString ) ) ;
84- return ( float . Parse ( parameterValue [ results ] ) ) ;
85+ return ( float . Parse ( parameterValue [ results ] , CultureInfo . InvariantCulture ) ) ;
8586 }
8687 //===================================================================
8788
8889 //===================================================================
8990 public int getInteger ( string parameterNameString ) {
9091 int results = System . Array . FindIndex ( parameterName , s => s . Equals ( parameterNameString ) ) ;
91- return ( int . Parse ( parameterValue [ results ] ) ) ;
92+ return ( int . Parse ( parameterValue [ results ] , CultureInfo . InvariantCulture ) ) ;
9293 }
9394 //===================================================================
9495
@@ -121,7 +122,7 @@ public Vector2 getVector2(string parameterNameString)
121122 string [ ] resultsString = parameterValue [ results ] . Split ( ' ' ) ;
122123 resultsString [ 0 ] = resultsString [ 0 ] . Remove ( 0 , 1 ) ;
123124 resultsString [ 1 ] = resultsString [ 1 ] . Remove ( resultsString [ 1 ] . Length - 1 ) ;
124- Vector2 resultValue = new Vector2 ( float . Parse ( resultsString [ 0 ] ) , float . Parse ( resultsString [ 1 ] ) ) ;
125+ Vector2 resultValue = new Vector2 ( float . Parse ( resultsString [ 0 ] , CultureInfo . InvariantCulture ) , float . Parse ( resultsString [ 1 ] , CultureInfo . InvariantCulture ) ) ;
125126 return resultValue ;
126127 }
127128
@@ -140,13 +141,13 @@ public Color getColor(string parameterNameString)
140141 resultsString [ 0 ] = resultsString [ 0 ] . Remove ( 0 , 1 ) ;
141142 resultsString [ 3 ] = resultsString [ 3 ] . Remove ( resultsString [ 3 ] . Length - 1 ) ;
142143
143- float r = float . Parse ( resultsString [ 0 ] ) / 255f ;
144+ float r = float . Parse ( resultsString [ 0 ] , CultureInfo . InvariantCulture ) / 255f ;
144145
145- float g = float . Parse ( resultsString [ 1 ] ) / 255f ;
146+ float g = float . Parse ( resultsString [ 1 ] , CultureInfo . InvariantCulture ) / 255f ;
146147
147- float b = float . Parse ( resultsString [ 2 ] ) / 255f ;
148+ float b = float . Parse ( resultsString [ 2 ] , CultureInfo . InvariantCulture ) / 255f ;
148149
149- float a = float . Parse ( resultsString [ 3 ] ) / 255f ;
150+ float a = float . Parse ( resultsString [ 3 ] , CultureInfo . InvariantCulture ) / 255f ;
150151
151152 Color color = new Color ( r , g , b , a ) ;
152153 return color ;
@@ -165,11 +166,11 @@ public Vector2 GetRange(string parameterNameString)
165166 {
166167 resultsString [ 0 ] = resultsString [ 0 ] . Remove ( 0 , 1 ) ;
167168 resultsString [ 1 ] = resultsString [ 1 ] . Remove ( resultsString [ 1 ] . Length - 1 ) ;
168- resultValue = new Vector3 ( float . Parse ( resultsString [ 0 ] ) , float . Parse ( resultsString [ 1 ] ) ) ;
169+ resultValue = new Vector3 ( float . Parse ( resultsString [ 0 ] , CultureInfo . InvariantCulture ) , float . Parse ( resultsString [ 1 ] , CultureInfo . InvariantCulture ) ) ;
169170 }
170171 else
171172 {
172- resultValue = new Vector3 ( float . Parse ( resultsString [ 0 ] ) , float . Parse ( resultsString [ 0 ] ) ) ;
173+ resultValue = new Vector3 ( float . Parse ( resultsString [ 0 ] , CultureInfo . InvariantCulture ) , float . Parse ( resultsString [ 0 ] , CultureInfo . InvariantCulture ) ) ;
173174 }
174175
175176 return resultValue ;
0 commit comments