ketoo/NoahGameFrame

Error parsing float and can't login with NFClient or Unity SDK

ehWasilii opened this issue · 2 comments

Hey,

I've found a minor issue with float.Parse in NFElementModule.cs. It can't parse float with decimal point. Caused by system globalization settings.
NFElementModule.cs, lines 189-196

case NFDataList.VARIANT_TYPE.VTYPE_FLOAT:
 {
    NFDataList.TData xValue = new NFDataList.TData(NFDataList.VARIANT_TYPE.VTYPE_FLOAT);
    xValue.Set(float.Parse(xAttribute.Value));
    NFIProperty property = xElement.GetPropertyManager().AddProperty(xAttribute.Name, xValue);
    property.SetUpload(xProperty.GetUpload());
  }
break;

Changed to this

case NFDataList.VARIANT_TYPE.VTYPE_FLOAT:
  {
     NFDataList.TData xValue = new NFDataList.TData(NFDataList.VARIANT_TYPE.VTYPE_FLOAT);
     xValue.Set(float.Parse(xAttribute.Value, System.Globalization.NumberStyles.Float, System.Globalization.NumberFormatInfo.InvariantInfo));
     NFIProperty property = xElement.GetPropertyManager().AddProperty(xAttribute.Name, xValue);
     property.SetUpload(xProperty.GetUpload());
  }
break;

And now, after struggling with compiling server (not all dependencies were downloaded like concurrentqueue and ajson. had to pull them from github), I'm facing a problem with login. Tried both NFClient (git with cocos and unity) and UnitySDK. Not sure, probably something like
#107

NFClient with empty login and password give this:

  • 3,493965 StartConnect 127.0.0.1 14001
  • 3,57158 Connected
  • Login SUCCESS
  • WorldList ServerId: 7 Name: WorldServer_1 Status: EST_NARMAL
  • OnWorldList1
  • 4,21306 StartConnect 127.0.0.1 15001
  • 4,225384 Connected
    and nothing happens.

UnitySDK with empty login and password gives:
unitsdk

is it something im doing wrong? thanks!

ketoo commented

For issue 1, normally we don't use float type to save the value about money, use integer may be better.

For issue 2, did you run the Redis database? Please have a look at the log, you will know what has happened.

ketoo commented

Please use the latest client: https://github.com/ketoo/NFUnitySDK