duplicate event fire

Post here your questions about the Unity / .Net / Mono / Windows 8 / Windows Phone 8 API for SFS2X

Moderators: Lapo, Bax

steve13627
Posts: 50
Joined: 06 Dec 2016, 06:27

duplicate event fire

Postby steve13627 » 06 Feb 2018, 11:21

Hi All,

There is a trange problem I was encount, the client receive twice same event . Is there any people face this issue before?
steve13627
Posts: 50
Joined: 06 Dec 2016, 06:27

Re: duplicate event fire

Postby steve13627 » 06 Feb 2018, 11:23

To solve this problem, I also add the user variable update event hanlder in server side, but it fires once, is there any thing wrong?
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: duplicate event fire

Postby Lapo » 06 Feb 2018, 15:44

Hi,
can you please describe what event is being fired twice? And show the code that generates such event?

Is it possible you've added two listeners for the same event? Thus generating two calls?
Also, please specify the client API platform and version in use.

Thanks
Lapo
--
gotoAndPlay()
...addicted to flash games
steve13627
Posts: 50
Joined: 06 Dec 2016, 06:27

Re: duplicate event fire

Postby steve13627 » 07 Feb 2018, 03:45

Please refer the code as below:

Code: Select all

 UserVariable uv=new SFSUserVariable("cards", null);
 this.getApi().setUserVariables(user,Arrays.asList(uv),true,true);


after this code, I am trying to reset this variable like below:

Code: Select all

  SFSArray sfsarray = (SFSArray) existingCardList.getValue();
    existingCardList = SFSUserVariable.newInstance(VariableConfig.CARDS_VARIABLE, sfsarray);


    ArrayList<UserVariable> list = new ArrayList<UserVariable>();
    list.add(existingCardList);
    api.setUserVariables(user, list,true,isfireClient);


But it seems the client didn't receive the clear cmd but twice set cmd. That's the problem. The api which is using in client is version "1.7.0".The server side is "1.6.0". Now I am going to comment the first block code to make it works
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: duplicate event fire

Postby Lapo » 07 Feb 2018, 09:47

If you're setting twice in your code, you will get two events. This is expected.
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X C# API”

Who is online

Users browsing this forum: No registered users and 25 guests