Beispiel #1
0
        private static void Main()
        {
            Console.Title = "EECloud.PlayerIO Test Application";

            do
            {
                Console.CursorVisible = false;
                Console.Write("Testing... (Start time: " + DateTime.Now.ToString("G") + ")");


                // Connecting...
                Watch.Start();
                var client = PlayerIO.Connect("test-szf4hpjepkayftx3jm5wxa", "public", "testuser");
                Watch.Stop();
                WriteElapsedMilliseconds("Connected");

                // Loading a BigDB PlayerData item...
                Watch.Restart();
                var playerObject = client.BigDB.LoadMyPlayerObject();
                var item         = playerObject.Item("11_Object");
                Watch.Stop();
                WriteElapsedMilliseconds("Loaded a BigDB PlayerData item");


                Console.WriteLine(Environment.NewLine +
                                  "Done! Total time elapsed: " + TotalElapsedMilliseconds + "ms");
                TotalElapsedMilliseconds = 0;

                Console.CursorVisible = true;
                Console.ReadKey(true);
                Console.WriteLine();
                Watch.Reset();
            } while (true);
        }
Beispiel #2
0
    void Start()
    {
        PlayerIO.UnityInit(this);

        PlayerIO.Connect("YourGameIDHere", "public", "YourUserIDHere", null, null,
                         delegate(Client c)
        {
            // connected successfully
            client = c;
            Debug.Log("Connected");

            // if we're using the dev server, connect to the local IP
            if (UseDevServer)
            {
                client.Multiplayer.DevelopmentServer = new ServerEndpoint("127.0.0.1", 8184);

                GetRoomList();
            }
        },
                         delegate(PlayerIOError error)
        {
            // did not connect successfully
            Debug.Log(error.Message);
        });
    }
Beispiel #3
0
        public static Task <Client> ConnectAsync(string gameId, string connectionId, string userId, string auth, string partnerId, string[] playerInsightSegments)
        {
            var tcs = new TaskCompletionSource <Client>();

            PlayerIO.Connect(gameId, connectionId, userId, auth, partnerId, playerInsightSegments, tcs.SetResult, tcs.SetException);
            return(tcs.Task);
        }
Beispiel #4
0
 private static Client Authenticate(string gameid, string user, string auth, AuthenticationType type = AuthenticationType.Invalid) =>
 type == AuthenticationType.Facebook ? PlayerIO.QuickConnect.FacebookOAuthConnect(gameid, auth, null, null) :
 type == AuthenticationType.Simple ? PlayerIO.QuickConnect.SimpleConnect(gameid, user, auth, null) :
 type == AuthenticationType.Kongregate ? PlayerIO.QuickConnect.KongregateConnect(gameid, user, auth, null) :
 type == AuthenticationType.ArmorGames ? PlayerIO.Authenticate(gameid, "public", new Dictionary <string, string> {
     { "userId", user }, { "authToken", auth }
 }, null) :
 type == AuthenticationType.Public ? PlayerIO.Connect(gameid, "public", user, auth, null) : null;
Beispiel #5
0
    public World(InputType type, object input, Client client = null)
    {
        if (client == null)
        {
            client = PlayerIO.Connect("everybody-edits-su9rn58o40itdbnw69plyw", "public", "user", "", "");
        }

        switch (type)
        {
        case InputType.DatabaseObject:
            if (!(input is DatabaseObject))
            {
                throw new ArgumentException("input needs to be a DatabaseObject!");
            }

            this._world = (DatabaseObject)input;

            foreach (var property in (DatabaseObject)_world)
            {
                _properties.Add(property.Key, property.Value);
            }

            this.Blocks = Helpers.FromWorldData(_world.GetArray("worlddata"));
            break;

        case InputType.BigDB:
            if (!(input is string))
            {
                throw new ArgumentException("input needs to be a string!");
            }

            this._world = client.BigDB.Load("worlds", (string)input);

            foreach (var property in (DatabaseObject)_world)
            {
                _properties.Add(property.Key, property.Value);
            }

            this.Blocks = Helpers.FromWorldData(_world.GetArray("worlddata"));
            break;

        case InputType.JSON:
            if (!(input is string))
            {
                throw new ArgumentException("input needs to be a string!");
            }

            this._world = JObject.Parse((string)input);

            foreach (var property in _world)
            {
                _properties.Add(property.Name, property.Value);
            }

            this.Blocks = Helpers.FromJsonArray(_world);
            break;
        }
    }
Beispiel #6
0
        private static void Main(string[] args)
        {
            //In the client, you will need to change the password to a space.
            PlayerIO.QuickConnect.SimpleRegister("oldy-l95uohocfu66qcnb6swlma", "whatever", " ", "", "", "", null, "", null);

            //.SimpleRegister("oldy-l95uohocfu66qcnb6swlma", "whatever", "", "*****@*****.**", "", "", null, "", null);
            Client     join = PlayerIO.Connect("oldy-l95uohocfu66qcnb6swlma", "public", "whatever", "", "");
            Connection x    = join.Multiplayer.CreateJoinRoom("0x0", "FlixelWalker1", true, null, null);

            Console.WriteLine("Registered Account.");
            Console.ReadKey();
        }
Beispiel #7
0
        public DownloadWorker(int chunks, string laston, string dbname, string dbindex, string gameid)
        {
            this._chunks  = chunks;
            this._laston  = laston;
            this._dbname  = dbname;
            this._dbindex = dbindex;
            this._gameid  = gameid;

            this._strdb = Database.FromFile($"{dbname}.db");                   ///TODO: custom naming

            this._client = PlayerIO.Connect(gameid, "public", "user", "", ""); ///TODO: more auth handling across games 'n' stuff

            //var problem = new SerializedDBO(this._client.BigDB.Load("PlayerObjects", "fb100002099717266"));
        }
Beispiel #8
0
    void Start()
    {
        PlayerIO.UnityInit(this);

        PlayerIO.Connect("YourGameIDHere", "public", "YourUserIDHere", null, null,
                         delegate(Client c)
        {
            // connected successfully
            client = c;
            Debug.Log("Connected");
        },
                         delegate(PlayerIOError error)
        {
            // did not connect successfully
            Debug.Log(error.Message);
        });
    }
Beispiel #9
0
        /// <summary>
        /// Log in through armorgames
        /// </summary>
        /// <param name="config">The config</param>
        /// <returns>The established client if valid; otherwise null</returns>
        public Client LogIn(Config config)
        {
            string loginCookie = GetArmorgamesLoginCookie();

            if (loginCookie == null)
            {
                return(null);
            }

            ArmorgamesFlashvars flashVars = GetFlashvars(loginCookie);

            if (flashVars == null)
            {
                return(null);
            }

            FluidClient guestClient = new FluidClient(new GuestAuth());

            if (!guestClient.LogIn())
            {
                return(null);
            }

            SecureConnection secureConnection = guestClient.GetSecureConnection();

            if (secureConnection == null)
            {
                return(null);
            }

            secureConnection.SendAuth(flashVars.UserId, flashVars.AuthToken);
            AuthEvent armorGamesAuth = secureConnection.WaitForServerEvent <AuthEvent>();

            if (armorGamesAuth.IsAuthenitcated())
            {
                return(PlayerIO.Connect(config.GameID, "secure", armorGamesAuth.UserID, armorGamesAuth.AuthToken, "armorgames"));
            }
            else
            {
                return(null);
            }
        }
Beispiel #10
0
    void Connect()
    {
        // we need some monobehavior in the scene for player.io to work, but it can be any monobehavior so we’ll just put our NetworkUtils component on it.
        if (GameObject.Find(“_playerIO”) == null)
        {
            GameObject go = new GameObject(“_playerIO”);
            go.AddComponent <NetworkUtils>();
            DontDestroyOnLoad(go);
            PlayerIO.UnityInit(go.GetComponent <NetworkUtils>());
        }

        PlayerIO.Connect("YourGameIDHere", "public", playerName, null, null,
                         delegate(Client client)
        {
            Debug.Log("Connected");

            // store client for later retrieval
            NetworkUtils.client = client;

            // load player object
            client.BigDB.LoadMyPlayerObject(
                delegate(DatabaseObject playerObj)
            {
                // store player object for later retrieval
                NetworkUtils.playerObj = playerObj;

                // read stats from player object
                botsKilled = playerObj.GetInt("Kills", 0);
                botsLost   = playerObj.GetInt("Deaths", 0);
            },
                delegate(PlayerIOError error)
            {
                Debug.Log("Failed loading player object: " + error.Message);
            });
        },
                         delegate(PlayerIOError error)
        {
            Debug.Log("Failed to connect: " + error.Message);
        });
    }
Beispiel #11
0
 public static void GenerateOldEEClient(string GameId)
 {
     OldEEClient = PlayerIO.Connect(GameId, "public", "whatever", "", "");
 }
Beispiel #12
0
 public MinimapBenchmark()
 {
     client = PlayerIO.Connect("everybody-edits-su9rn58o40itdbnw69plyw", "public", "user", "", "");
     world  = new World(World.InputType.BigDB, "PW01", client);
 }
Beispiel #13
0
    public void connectToServer()
    {
        emailLogin = emailLogin.Replace("@", " ");
        if (!connected)
        {
            PlayerIO.Connect(
                "shooter-gpmw9uiee0uxk34a7hzp7w",
                "Public",
                emailLogin,
                null,
                null,
                null,
                delegate(Client cl) {
                connected = true;
                client    = cl;
                Debug.Log("Подключились к серверу");
                client.BigDB.LoadSingle(
                    "users",
                    "email",
                    new object[] { emailLogin },
                    delegate(DatabaseObject value) {
                    if (value != null)
                    {
                        Debug.Log("Авторизация успешна!");
                        Settings.email = emailLogin;
                        SceneManager.LoadScene("main_menu");
                    }
                    else
                    {
                        Debug.Log("Неправильный пароль!");
                    }
                },
                    delegate(PlayerIOError err) {
                    Debug.Log("Пользователь не найден!");
                }
                    );
            }, delegate(PlayerIOError err) {
                Debug.Log("Ошибка подключения: " + err);
            }
                );
        }

        /*PlayerIO.Connect(
         *  "shooter-gpmw9uiee0uxk34a7hzp7w",
         *  "Public",
         *  email,
         *  null,
         *  null,
         *  null,
         *  delegate (Client cl) {
         *      Debug.Log("Authenticate");
         *      this.client = client;
         *      client.Multiplayer.DevelopmentServer = new ServerEndpoint("localhost", 8184);
         *      this.client.Multiplayer.CreateJoinRoom(
         *          null,
         *          "LobbyRoom",
         *          true,
         *          null,
         *          null,
         *          delegate (Connection connection)
         *          {
         *              connection.Send("Login");
         *              connection.OnMessage += handlemessage;
         *          },
         *          delegate (PlayerIOError error)
         *          {
         *              Debug.Log("Error Joining Room: " + error.ToString());
         *          }
         *      );
         *  }
         * );*/
        else
        {
            client.BigDB.LoadSingle(
                "users",
                "email",
                new object[] { emailLogin },
                delegate(DatabaseObject value) {
                if (value != null)
                {
                    if (string.Equals(value.GetString("password"), password))
                    {
                        Debug.Log("Авторизация успешна!");
                        Settings.email = emailLogin;
                        SceneManager.LoadScene("main_menu");
                    }
                    else
                    {
                        Debug.Log("Неправильный пароль!" + value.GetString("password"));
                    }
                }
                else
                {
                    Debug.Log("Пользователь не найден!" + value.GetString("password"));
                }
            },
                delegate(PlayerIOError err) {
                Debug.Log("Пользователь не найден!");
            }
                );
        }
    }