Example #1
0
        private IEnumerator GetRaceDescriptionResult(string url)
        {
            RaceDescriptionResult res = null;
            var www = new WWW(url);

            yield return(www);

            var errorMsg = "获取数据失败";

            if (www.error != null)
            {
                var errLog = www.error;
                MyLog.ErrorWithFrame("huData", "GetRaceDescriptionResult fail :" + errLog);

                res = new RaceDescriptionResult(RaceDescriptionResult.Error, errorMsg, null);
                _raceDescriptionResult.Write(res, Time.time);

                www.Dispose();
                yield break;
            }

            var data = www.text;

            MyLog.InfoWithFrame("huData", "RaceDescriptionResult data is :" + data);

            try
            {
                res = JsonUtility.FromJson <RaceDescriptionResult>(data);
            }
            catch (Exception e)
            {
                res = new RaceDescriptionResult(RaceDescriptionResult.Error, errorMsg, null);
            }

            www.Dispose();
            _raceDescriptionResult.Write(res, Time.time);
        }
Example #2
0
 public void Apply(RaceConfig raceConfig, RaceDescriptionResult raceData)
 {
     _raceConfig = raceConfig;
     _raceData   = raceData;
     RefreshContent();
 }