コード例 #1
0
        protected virtual UnityWebRequest GetWebRequest()
        {
            var     address = WebAddress.BuildUrl(PhpFile);
            WWWForm form    = new WWWForm();

            form.AddField("ACTION", "checkSession");
            form.AddField("deviceid", SystemInfo.deviceUniqueIdentifier);
            return(UnityWebRequest.Post(address, form));
        }
コード例 #2
0
        /**
         * Downloads all available and applicable menu files to display on the main manu.
         * Returns them as a MenuCase item
         */
        public void Register(string username, string password, string email)
        {
            var url  = WebAddress.BuildUrl(PhpFile);
            var form = CreateForm(username, password, email);

            var webRequest   = UnityWebRequest.Post(url, form);
            var serverResult = ServerReader.Begin(webRequest);

            serverResult.AddOnCompletedListener(ProcessResults);
        }
コード例 #3
0
        public WaitableTask <User> Login(string username, string email, string password)
        {
            if (string.IsNullOrWhiteSpace(username) && string.IsNullOrWhiteSpace(email))
            {
                return(new WaitableTask <User>(NoUsernameOrEmailException));
            }
            if (string.IsNullOrWhiteSpace(password))
            {
                return(new WaitableTask <User>(NoPasswordException));
            }

            var form = CreateForm(username, email, password);

            var address      = WebAddress.BuildUrl(PhpFile);
            var webRequest   = UnityWebRequest.Post(address, form);
            var serverResult = ServerReader.Begin(webRequest);

            var user = new WaitableTask <User>();

            serverResult.AddOnCompletedListener((result) => ProcessResults(user, result));

            return(user);
        }