Advertisement
Guest User

Untitled

a guest
Mar 8th, 2013
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class cTest : MonoBehaviour {
  5. public string conso;
  6. public string adress;
  7. // Use this for initialization
  8. void Start () {
  9. }
  10.  
  11. // Update is called once per frame
  12. void Update () {
  13.  
  14. }
  15. void OnGUI(){
  16. if(GUILayout.Button("Connect")){
  17. TNManager.Connect("I don't wanna show my ip ;) ");
  18. }
  19. if(GUILayout.Button("Join Channel")){
  20. TNManager.JoinChannel(1,"game");
  21. }
  22. if(GUILayout.Button("Get Channel List")){
  23. TNManager.client.BeginSend(Packet.RequestChannelList);
  24. TNManager.client.EndSend();
  25. }
  26. }
  27. void OnNetworkConnect (bool success, string message) {
  28. print(success+ message);
  29. conso=""+success;
  30. }
  31. void OnChannelList (Packet response, BinaryReader reader, IPEndPoint source){
  32. int count = reader.ReadInt32();
  33.  
  34. for (int i = 0; i < count; ++i){
  35. int channelID = reader.ReadInt32();
  36. int playerCount = reader.ReadInt32();
  37. bool password = reader.ReadBoolean();
  38. bool isPersistent = reader.ReadBoolean();
  39. string level = reader.ReadString();
  40.  
  41. // Do something with this information -- add it to a list perhaps? Whatever you need.
  42. }
  43. }
  44.  
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement