Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Codes for EE to connect with ArmorGrames, the function blocks the current thread in which it was started in, maximal 6 seconds
- Client cli; //client set after ArmorConnect() ran
- void ArmorConnect(string userID, string gameAuthToken) {
- int done = 1;
- Client cli_ = PlayerIO.QuickConnect.SimpleConnect("everybody-edits-su9rn58o40itdbnw69plyw", "guest", "guest");
- Connection con_ = cli_.Multiplayer.CreateJoinRoom(null, "Auth" + version, false, null, null);
- con_.OnMessage += delegate(object sender, PlayerIOClient.Message m) {
- if (m.Type == "auth") {
- if (m.Count != 0) {
- cli = PlayerIO.Connect(gameId, "secure", m.GetString(0), m.GetString(1), "armorgames");
- done -= 100;
- } else {
- cli = null;
- }
- }
- };
- con_.Send("auth", userID, gameAuthToken);
- while (done > 0 && done < 24) {
- Thread.Sleep(250);
- done++;
- }
- if (con_ != null) {
- if (con_.Connected) {
- con_.Disconnect();
- }
- }
- Thread.Sleep(500);
- con_ = null;
- if (done > 5) {
- throw new Exception("Cant Connect");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement