Exemplo n.º 1
0
        public IEnumerator GetPublication(BS_NoticeRequest req)
        {
            var data = new WWWForm();

            System.Random rad = new System.Random();
            data.AddField("rad", rad.Next(0, 10).ToString());
            float elapsedTime = 0.0f;
            var   www         = new WWW(req.Url, data);

            yield return(www);

            while (!www.isDone)
            {
                elapsedTime += Time.deltaTime;
                if (elapsedTime >= TIMEOUT)
                {
                    break;
                }
                yield return(new WaitForFixedUpdate());
            }

            if (!string.IsNullOrEmpty(www.error) || string.IsNullOrEmpty(www.text))
            {
                req.Result(null);
                yield break;
            }

            var jsonData = JsonMapper.ToObject <BS_NoticeResult>(www.text);

            req.Result(jsonData);
            yield return(null);
        }
Exemplo n.º 2
0
        public void GetNotice(Action <BS_NoticeResult> result)
        {
            //string url = GameApp.GameData.BackStorgeUrl + "/ProxyHandler/User.ashx?action=getNotice";
            string url = GameApp.GameData.BackStorgeUrl + GlobalConst.URL.GetNotice;
            var    req = new BS_NoticeRequest();

            req.Url    = url;
            req.Result = result;
            StartCoroutine("GetPublication", req);
        }