浏览代码

update

/main
fzhangtj 6 年前
当前提交
153d7f74
共有 2 个文件被更改,包括 1 次插入2 次删除
  1. 2
      README.md
  2. 1
      Samples/UIWidgetSample/HttpRequestSample.cs

2
README.md


```
All the code dealing with UIWidgets (```setState()``` in most case) needs to be in window scope.
This is only needed if the code is in methods
This is needed if the code is in methods
not invoked by UIWidgets. For example, if the code is in ```completed``` callback of ```UnityWebRequest```,
you need to enclose them with window scope.
Please see [HttpRequestSample](./Samples/UIWidgetSample/HttpRequestSample.cs) for detail.

1
Samples/UIWidgetSample/HttpRequestSample.cs


UnityWebRequest www = UnityWebRequest.Get("http://worldclockapi.com/api/json/est/now");
var asyncOperation = www.SendWebRequest();
asyncOperation.completed += operation => {
Debug.Log(www.downloadHandler.text);
var timeData = JsonUtility.FromJson<TimeData>(www.downloadHandler.text);
using(WindowProvider.of(this.widget.gameObjOfUIWidgetsPanel).getScope())
{

正在加载...
取消
保存