private void LoadTexture () { WWWClient wwwClient = new WWWClient (this, "https://dl.dropboxusercontent.com/u/32529846/gold.png"); wwwClient.SetTimeOutInterval (120.0f); wwwClient.OnSuccess = (WWW www) => { logoTexture.mainTexture = www.texture; }; wwwClient.GetData (); }
void Awake () { Debug.Log ("check login"); WWWClient wwwClient = new WWWClient (this, URL); wwwClient.OnSuccess = (WWW www) => { Dictionary<string,object> dic = (Dictionary<string,object>)Json.Deserialize (www.text); double unixTime = (double)dic ["st"]; DateTime dtNow = UNIX_EPOCH.AddSeconds ((long)unixTime).ToLocalTime (); string loginDate = PrefsManager.Instance.LoginDate; if (string.IsNullOrEmpty (loginDate)) { ApplyBonus(dtNow); return; } DateTime dtLogin = DateTime.Parse (loginDate); TimeSpan ts = dtNow - dtLogin; if (ts.Days >= 1) { ApplyBonus(dtNow); } }; wwwClient.GetData (); }
void Start () { mPostCountData = PrefsManager.Instance.GetPostCountData (); WWWClient wwwClient = new WWWClient (this, URL); wwwClient.OnSuccess = (WWW www) => { Dictionary<string,object> dic = (Dictionary<string,object>)Json.Deserialize (www.text); double unixTime = (double)dic ["st"]; DateTime dtNow = UNIX_EPOCH.AddSeconds ((long)unixTime).ToLocalTime (); if (string.IsNullOrEmpty (mPostCountData.PostDate)) { mPostCountData.PostDate = dtNow.ToString (); PrefsManager.Instance.SavePostCountData (mPostCountData); return; } DateTime dtPost = DateTime.Parse (mPostCountData.PostDate); TimeSpan ts = dtNow - dtPost; if (ts.Days >= 1) { // reset postData mPostCountData.PostCount = 0; mPostCountData.PostDate = dtNow.ToString (); PrefsManager.Instance.SavePostCountData (mPostCountData); } }; wwwClient.GetData (); }
public void InitQuizList () { Debug.Log ("url = " + SelectedQuiz.instance.quizUrl); if (allQuizList == null) { WWWClient wwwClient = new WWWClient (this,SelectedQuiz.instance.quizUrl); wwwClient.OnSuccess = (WWW www) => { sJsonString = www.text; sJsonString = sJsonString.Replace ("'", ""); IDictionary jsonObject = (IDictionary)Json.Deserialize (sJsonString); allQuizList = (IList)jsonObject ["updated_quiz"]; mSeriesList = (IList)jsonObject ["series_orderd"]; Debug.Log ("count = " + allQuizList.Count); loadSucceedEvent (); }; wwwClient.OnFail = (WWW www) => { loadFailedEvent (); }; wwwClient.OnTimeOut = () => { loadFailedEvent (); }; wwwClient.GetData (); } else { loadSucceedEvent (); } }