Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class cTest : MonoBehaviour {
- public string conso;
- public string adress;
- // Use this for initialization
- void Start () {
- }
- // Update is called once per frame
- void Update () {
- }
- void OnGUI(){
- if(GUILayout.Button("Connect")){
- TNManager.Connect("I don't wanna show my ip ;) ");
- }
- if(GUILayout.Button("Join Channel")){
- TNManager.JoinChannel(1,"game");
- }
- if(GUILayout.Button("Get Channel List")){
- TNManager.client.BeginSend(Packet.RequestChannelList);
- TNManager.client.EndSend();
- }
- }
- void OnNetworkConnect (bool success, string message) {
- print(success+ message);
- conso=""+success;
- }
- void OnChannelList (Packet response, BinaryReader reader, IPEndPoint source){
- int count = reader.ReadInt32();
- for (int i = 0; i < count; ++i){
- int channelID = reader.ReadInt32();
- int playerCount = reader.ReadInt32();
- bool password = reader.ReadBoolean();
- bool isPersistent = reader.ReadBoolean();
- string level = reader.ReadString();
- // Do something with this information -- add it to a list perhaps? Whatever you need.
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement