Ejemplo n.º 1
0
        public void SendPostRequest(string url, string body, Action <bool, string> oncomplete)
        {
            var form = new WWWForm();
            var ps   = body.Split('&');

            foreach (var p in ps)
            {
                var pp = p.Split('=');
                form.AddField(pp[0], pp[1] != null ? pp[1] : "");
            }
            _req = UnityWebRequest.Post(url, form);
            if (!_requesting)
            {
                var runner = DuktapeRunner.GetRunner();
                if (runner != null)
                {
                    _requesting = true;
                    this.ApplyHeaders();
                    runner.StartCoroutine(Run(oncomplete));
                }
            }
            else
            {
                throw new InvalidOperationException();
            }
        }
Ejemplo n.º 2
0
 public void SendPostRequest(string url, string body, Action <bool, string> oncomplete)
 {
     if (!_requesting)
     {
         var runner = DuktapeRunner.GetRunner();
         if (runner != null)
         {
             _req.method = "GET";
             _req.url    = url;
             _requesting = true;
             runner.StartCoroutine(Run(oncomplete));
         }
     }
     else
     {
         throw new InvalidOperationException();
     }
 }
Ejemplo n.º 3
0
        public void Initialize(IO.ByteBufferAllocator byteBufferAllocator, IFileResolver fileResolver, IDuktapeListener listener, int step = 30)
        {
            _byteBufferAllocator = byteBufferAllocator;
            _fileResolver        = fileResolver;
            var runner = DuktapeRunner.GetRunner();

            if (runner != null)
            {
                runner.StartCoroutine(_InitializeStep(listener, step));
            }
            else
            {
                var e = _InitializeStep(listener, step);
                while (e.MoveNext())
                {
                    ;
                }
            }
        }
Ejemplo n.º 4
0
 public void SendGetRequest(string url, Action <bool, string> oncomplete)
 {
     _req = new UnityWebRequest();
     if (!_requesting)
     {
         var runner = DuktapeRunner.GetRunner();
         if (runner != null)
         {
             _req.method = "GET";
             _req.url    = url;
             _requesting = true;
             this.ApplyHeaders();
             runner.StartCoroutine(Run(oncomplete));
         }
     }
     else
     {
         throw new InvalidOperationException();
     }
 }
Ejemplo n.º 5
0
 public void Initialize(IFileSystem fs, IDuktapeListener listener, int step = 30)
 {
     _fileManager = fs;
     DuktapeRunner.GetRunner().StartCoroutine(_InitializeStep(listener, step));
 }