Ejemplo n.º 1
0
 public void RegisterLocal(string username, string password, string email)
 {
     player.username          = username;
     player.passwordEncrypted = Postman.Encrypt(password);
     player.emailEncrypted    = Postman.Encrypt(email);
     SavePlayerDetailsLocal();
 }
Ejemplo n.º 2
0
        public void SendPasswordResetEmail(string recipient, Action <bool, string> OnCompletion)
        {
            var data = new Dictionary <string, string>()
            {
                { "recipient", Postman.Encrypt(recipient) },
                { "__address__", ServerURL + "resetup.php" },
            };

            pat.Post(data, OnCompletion);
        }
Ejemplo n.º 3
0
        public void SavePlaythroughRemote(int levelIdx, long score, string matrix, string actions)
        {
            string device = $"{SystemInfo.deviceModel}\n{SystemInfo.deviceName}\n{SystemInfo.deviceType}\n{SystemInfo.deviceUniqueIdentifier}\n{Screen.width}x{Screen.height}\n{SystemInfo.operatingSystem}";
            var    data   = new Dictionary <string, string>()
            {
                { "username", player.username },
                { "password", player.passwordEncrypted },
                { "level_index", levelIdx.ToString() },
                { "datetime_ticks", DateTime.Now.Ticks.ToString() },
                { "score", score.ToString() },
                { "erocs", Postman.Encrypt(score.ToString()) }, // a little protection
                { "matrix", matrix },
                { "actions", actions },
                { "device", device },
                { "__address__", ServerURL + "playthrough.php" },
            };
            Action <bool, string> OnCompletion = (b, s) => { if (!b)
                                                             {
                                                                 SavePost(data);
                                                             }
            };

            pat.Post(data, OnCompletion);
        }
Ejemplo n.º 4
0
        public void LoginRemote(string username, string password, Action <bool, string> OnCompletion)
        {
            string passwordEncrypted = Postman.Encrypt(password);
            var    data = new Dictionary <string, string>()
            {
                { "username", username },
                { "password", passwordEncrypted },
                { "__address__", ServerURL + "login.php" },
            };

            pat.Post(data, (b, s) => { if (b)
                                       {
                                           ParseLogin(s);
                                       }
                                       OnCompletion(b, s); });

            void ParseLogin(string toParse)
            {
                player.username          = username;
                player.passwordEncrypted = passwordEncrypted;
                var details = toParse.Split(';');

                player.team        = (PlayerDetails.Team) int.Parse(details[0]);
                player.reverseDrag = int.Parse(details[1]) == 1? true:false;

                // player.highScores.Clear();
                for (int i = 2; i < details.Length; i++)
                {
                    string[] level = details[i].Split(':');
                    int      idx   = int.Parse(level[0]);
                    long     score = long.Parse(level[1]);
                    SaveHighScoreLocal(idx, score);
                }
                SavePlayerDetailsLocal();
            }
        }