Tasharen Entertainment Forum

Support => TNet 3 Support => Topic started by: kreibich on June 21, 2016, 07:18:01 PM

Title: Channel list name - problem
Post by: kreibich on June 21, 2016, 07:18:01 PM
Hi,
 I'm working on online game using TNet 3.0.2 and I have a problem with list of channels.

Before player enterst the channel, I need a table with list of channels, which works great, it shows channel ID, number of players, it says if room has password, but i would like to specify some other things like channel name and channel admin name. So I used channel data, but I cannot view data before I enter the channel. I don't want to enter and leave 100 channels just to read a channel name. Is there any simplier way?

Thank you.
Title: Re: Channel list name - problem
Post by: Bill.Smock on June 22, 2016, 09:19:04 PM
Set the data when the channel is created:

  1.     void OnJoinChannel(int channelID, bool success, string msg)
  2.     {
  3.         if (!TNManager.isHosting)
  4.             return;
  5.  
  6.         TNManager.SetChannelData("ChannelName", "name of channel");
  7.     }
  8.  

Then, when you populate your table, get the data:

  1.     void Start()
  2.     {
  3.         TNManager.GetChannelList(OnListRefresh);
  4.     }
  5.  
  6.     void OnListRefresh(TNList<Channel.Info> list)
  7. {
  8.    // use list[index].data.GetChild<string>("ChannelName");
  9. }
  10.  
Title: Re: Channel list name - problem
Post by: kreibich on June 26, 2016, 04:17:01 PM
It works, thanks a lot!