ketoo / NoahGameFrame

A fast, scalable, distributed game server engine/framework for C++, include the actor library, network library, can be used as a real time multiplayer game engine ( MMO RPG/MOBA ), which support C#/Lua script/ Unity3d, Cocos2dx and plan to support Unreal.
https://github.com/ketoo/NoahGameFrame/wiki
Apache License 2.0
3.97k stars 1.09k forks source link

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

Closed ehWasilii closed 4 years ago

ehWasilii commented 4 years ago

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:

UnitySDK with empty login and password gives: unitsdk

is it something im doing wrong? thanks!

ketoo commented 4 years ago

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 4 years ago

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