Author Topic: OnChangeHost event  (Read 5877 times)

Noi14

  • Jr. Member
  • **
  • Thank You
  • -Given: 10
  • -Receive: 0
  • Posts: 57
    • View Profile
OnChangeHost event
« on: March 02, 2014, 10:10:41 AM »
Hi,
I'm trying to launch a client's function, at the change of the host, I try in this way:

  1. void Start()
  2. {
  3.         TNManager.client.packetHandlers[(byte)Packet.ResponseSetHost] = MyOnSetHost;
  4. }
  5. void MyOnSetHost(Packet response, BinaryReader reader, IPEndPoint source)
  6. {
  7.         Debug.Log ("ONSETHOST");
  8. }

But the MyOneSetHost function doesn't been called. How can I do it?

ldw-bas

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 2
  • Posts: 32
    • View Profile
Re: OnChangeHost event
« Reply #1 on: March 02, 2014, 04:59:55 PM »
I had the same issue a week ago: http://www.tasharen.com/forum/index.php?topic=8218.0

TNManager.client.onSetHost

Noi14

  • Jr. Member
  • **
  • Thank You
  • -Given: 10
  • -Receive: 0
  • Posts: 57
    • View Profile
Re: OnChangeHost event
« Reply #2 on: March 02, 2014, 05:09:09 PM »
Thank you so much.
I have a question, boolean parameter is true if client is choosen as host and false if is it assigned to another cliet?

  1. void MyOnSetHost(bool host)
  2. {
  3. Debug.Log ("ONSETHOSTTTTTTTTTTTTTTTTTTTT");
  4. }

ldw-bas

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 2
  • Posts: 32
    • View Profile
Re: OnChangeHost event
« Reply #3 on: March 02, 2014, 05:11:59 PM »
yes that is what the boolean is for

Noi14

  • Jr. Member
  • **
  • Thank You
  • -Given: 10
  • -Receive: 0
  • Posts: 57
    • View Profile
Re: OnChangeHost event
« Reply #4 on: March 02, 2014, 05:12:23 PM »
Thank you :D