playMaker

Author Topic: photon best practice on room list  (Read 4800 times)

invayne

  • Full Member
  • ***
  • Posts: 105
photon best practice on room list
« on: March 08, 2015, 07:11:21 AM »
so i have a room list and i can update it easy enough with the new ui but im having a little issue. to keep it updating i have to loop the create object  and set parent state back into the get next room properties. now this works and itll keep spitting rooms back to me but it will keep creating the list over and over again. now ive tried a int compares like so

if room number is greater than 0   use event get list

also did a 2nd compare where i compare the room number into the room number and have a = event set up to refresh back into the get next room state  but it seems to be ignoring the 2nd compare and just uses the  first compare so im kinda lost on how to stop the same  rooms from being repeatably add to the list. any one have any idea i might be able to try to fix this.

invayne

  • Full Member
  • ***
  • Posts: 105
Re: photon best practice on room list
« Reply #1 on: March 08, 2015, 09:21:14 AM »
ok i got it to stop doign the unlimited adding of the same rooms but it seems the get next  room properties is not working like it should. it dosent update like it should .  ill be posting a vid of this issue once its finished processing. its hard to explain.

invayne

  • Full Member
  • ***
  • Posts: 105
Re: photon best practice on room list
« Reply #2 on: March 08, 2015, 09:45:53 AM »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: photon best practice on room list
« Reply #3 on: March 09, 2015, 03:17:01 AM »
Hi,

Yeah, it's in your logic, the event is being received when a second room is created.

so typically, to solve this you have several options:

1, you remove all ui rows and create them again
2, you create rows that have an fsm, and your manager will dispatch an event for each cell passing the room id for an update ( so that each cell can update the related data). You will also need to account for new rooms or deleted rooms. Maintain this using ArrayMaker for example.
3, each row listen to the photon update and go through each rooms and when it finds the room it's showing update itself, a manager will still be needed to add/delete new and gone rooms.


Prefer option one, then you won't have any issues with new and deleted rooms.

 Bye,

 Jean


invayne

  • Full Member
  • ***
  • Posts: 105
Re: photon best practice on room list
« Reply #4 on: March 09, 2015, 05:24:31 AM »
so basically do something like this  every 5 seconds or so  same concept for what i got goign buy add 2 new states 1 that does a wait state of 5 seconds then another that will delete  the rooms then loop that back into the get next room properties and that should solve my issue?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: photon best practice on room list
« Reply #5 on: March 09, 2015, 06:16:28 AM »
Hi,

 No, only do something when you receive this ROOM UPDATE event, there is no need to do it any other time.

Bye,

 Jean

invayne

  • Full Member
  • ***
  • Posts: 105
Re: photon best practice on room list
« Reply #6 on: March 09, 2015, 06:32:33 AM »
thats what the finished event is for on the get next  room properties. other wise how am i suppose to set it up. i figure if i just keep the loop going it will just keep regenerating the list but ill be destroying it every time.  can always maker the wait longer to.... cause if you loop it it will always generate a list. and that works  so by destroying it then regenerating it every 5 to 10 seconds should work like i need.