public static void Main(string[] args) { try { Console.WriteLine("EE Midi Bot - Copyright (C) 2016 Andrew Story"); Console.WriteLine("This program comes with ABSOLUTELY NO WARRANTY. As this is free software, you"); Console.WriteLine("are welcome to redistribute it under the conditions of the GNU General Public"); Console.WriteLine("License (version 3)."); Console.WriteLine("See http://www.gnu.org/licenses/gpl.html for details."); Console.Write("\n\nWelcome to the EE midi bot.\n\n" + "What login method would you like to use?\n" + "1) Simple\n" + "2) Facebook\n" + "3) Kongregate\n\n"); Console.Write("Enter your choice: "); string response = Console.ReadLine(); int value = 0; value = Convert.ToInt32(response); PlayerIOClient.Client client = DoLogin(value); Console.Write("Room ID to join: "); string roomid = Console.ReadLine(); Console.WriteLine("\n"); PlayerIOClient.Connection con = client.Multiplayer.JoinRoom(roomid, new Dictionary <string, string> ()); MyConnection = con; HandleConnection(con); } catch (PlayerIOError e) { System.Console.WriteLine(e.Message); return; } catch (Exception e) { System.Console.WriteLine(e.Message); return; } while (Console.KeyAvailable) { Console.ReadKey(); } Console.WriteLine("Press any key to continue"); Console.ReadKey(); }
void SuccessfullConnect(Client client) { Debug.Log("Successfully connected to Player.IO"); if (developmentServer) { client.Multiplayer.DevelopmentServer = new ServerEndpoint(System.String.IsNullOrEmpty(ipDevServ) ? "192.168.1.96" : ipDevServ, 8184); } if (localhost) { client.Multiplayer.DevelopmentServer = new ServerEndpoint("127.0.0.1", 8184); } // Create or join the room string roomId = "Fortress"; if (string.IsNullOrEmpty(roomId)) { roomId = userId; } client.Multiplayer.CreateJoinRoom( roomId, //Room is the Alliance of the player "NemesisFortress", //The room type started on the server false, //Should the room be visible in the lobby? null, null, delegate(Connection connection) { Debug.Log("Joined Room : " + roomId); // We successfully joined a room so set up the message handler pioConnection = connection; pioConnection.OnMessage += HandleMessage; pioConnection.OnDisconnect += Disconnected; joinedRoom = true; }, delegate(PlayerIOError error) { Debug.LogError("Error Joining Room: " + error.ToString()); } ); pioClient = client; }
void successfullConnect(Client client) { Debug.Log("Successfully connected to Player.IO"); if (developmentServer) { client.Multiplayer.DevelopmentServer = new ServerEndpoint(System.String.IsNullOrEmpty(ipDevServ) ? "192.168.1.96" : ipDevServ, 8184); } if (localhost) { client.Multiplayer.DevelopmentServer = new ServerEndpoint("127.0.0.1", 8184); } //Create or join the room string roomId = "RoomId"; if (string.IsNullOrEmpty(roomId)) { roomId = userId; } client.Multiplayer.CreateJoinRoom( roomId, //Room is the Alliance of the player "Lobby", //The room type started on the server visible: false, //Should the room be visible in the lobby? roomData: null, joinData: null, successCallback: delegate(Connection connection) { Debug.Log("Joined Room : " + roomId); if (m_SplashScreenScript != null) { m_SplashScreenScript.EnableConnectionUI(); } // We successfully joined a room so set up the message handler pioconnection = connection; pioconnection.OnMessage += handlemessage; pioconnection.OnDisconnect += disconnected; //joinedroom = true; }, errorCallback: delegate(PlayerIOError error) { Debug.LogError("Error Joining Room: " + error.ToString()); } ); pioclient = client; }
private static PlayerIOClient.Client DoLogin(int method) { PlayerIOClient.Client client = null; switch (method) { case 1: { Console.Write("Username: "******"Password: "******"everybody-edits-su9rn58o40itdbnw69plyw", name, pass, new string[0]); } break; case 2: { Console.Write("OAuth Token: "); string name = Console.ReadLine(); client = PlayerIO.QuickConnect.FacebookOAuthConnect("everybody-edits-su9rn58o40itdbnw69plyw", name, "", new string[0]); } break; case 3: { Console.Write("User ID: "); string name = Console.ReadLine(); Console.Write("Auth Token: "); string pass = Console.ReadLine(); client = PlayerIO.QuickConnect.KongregateConnect("everybody-edits-su9rn58o40itdbnw69plyw", name, pass, new string[0]); } break; default: throw new InvalidDataException("Unknown login method for input \"" + method.ToString() + "\"."); } return(client); }