boorik / smartfox-haxe-client

haxe openfl client for smartfoxserver
MIT License
18 stars 14 forks source link

Minor changes #10

Closed flashultra closed 7 years ago

flashultra commented 7 years ago

This pull request contains many small changes. About SFSObject.hx , in js Bytes is represent as Array , so to work correctly I change it.

flashultra commented 7 years ago

About IBuddyManager , I agree with you. What exactly is the issue with ByteArray ? I tested on flash and js at the moment and not find any problem. The main problem for me was with Smartfox Javascript API i.e. I found Bytes is just Array in JS API and after change it not have any other issues. In my project I use haxe as3 crypto lib and there have some issues between haxe bytes, as3crypto bytes and openfl bytes , but I resolved it. However, It wasn't connected with Smartfox API .

boorik commented 7 years ago

Can you pull the latest version and modify your pull request or make a new one? Here is a summary.

Modifications I want to keep : com/smartfoxserver/v2/core/SFSBuddyEvent.hx com/smartfoxserver/v2/core/SFSIOHandler.hx com/smartfoxserver/v2/entities/SFSBuddy.hx com/smartfoxserver/v2/entities/SFSUser.hx com/smartfoxserver/v2/entities/data/SFSObject.hx com/smartfoxserver/v2/entities/managers/SFSBuddyManager.hx com/smartfoxserver/v2/requests/BaseRequest.hx com/smartfoxserver/v2/requests/SubscribeRoomGroupRequest.hx com/smartfoxserver/v2/requests/buddylist/BuddyMessageRequest.hx

Modifications I don't want to keep : com/smartfoxserver/v2/SmartFox.hx com/smartfoxserver/v2/entities/managers/SFSBuddyManager.hx ( isInited is a property in both flash and js) com/smartfoxserver/v2/entities/match/IMatcher.hx

flashultra commented 7 years ago

Thank you for merge my request. About bytearray , here is my code for using getByteArray(..) from SFSObject

         #if html5
        var arrInt:Array<Int> =  sfso.getByteArray("d");
        var bt:Bytes = Bytes.alloc(arrInt.length);
        for (i in 0...arrInt.length) 
           bt.set(i, arrInt[i]);
        var ba:BytesData = bt.getData();
        #else
        var ba: ByteArray =  sfso.getByteArray("d");
        #end

Also there is bug for flash target when use Bytes.ofData(ba); https://github.com/HaxeFoundation/haxe/issues/6556 i.e you should use

#if flash
b.endian = flash.utils.Endian.LITTLE_ENDIAN;
#end

after each call of Bytes.ofData(....) Thank you again.

boorik commented 7 years ago

You are welcome. Thank you for getByteArray code. I will try to integrate it to my test project : https://github.com/boorik/smartfox-haxe-mmo This is an adaptation of the SimpleMMOWorld2 example from smarfoxserver site. It's quite messy but I will make it cleaner when everything will work. I will also make a test project to validate app ( maybe some functional tests ) from this mmo project. We need to test on all targets to prevent regression.