@Akshay嗨,你所有的設置,只是試試這個...
,如果你有一個圖像列表,然後將它們添加在IList中,獲取它,並使用texture2D inOrder將這些圖像顯示爲滾動視圖。看看這個,我認爲它的答案...
public void OnSuccess(object responseFromServer)
{
File imageObj = (File)responseFromServer;
IList<File.Image> imageList = imageObj.GetFileList();
for (int i = 0; i < imageList.Count; i++)
{
Debug.Log ("Downloaded Image Url Is : " + imageList[i].GetUrl());
// just add this in your callBack response. ClassName shoud be where you want to show your // images i.e OnGUI defined..
(Your_MonoBehaviour_ClassName).GetInstance().ExecuteShow(imageList[i].GetUrl());
}
}
現在寫在你的主類此restcall從那裏你要添加這些圖片滾動型......這實在是很簡單..
private static Your_class_Name con = null;
public static Your_class_Name GetInstance()
{
if (con == null) {
con = (new GameObject ("Your_class_Name")).AddComponent<Your_class_Name>();
return con;
} else {
return con;
}
}
public string ExecuteShow (string url)
{
string responseFromServer = null;
StartCoroutine (ShowAllImages (url));
return responseFromServer;
}
IEnumerator ShowAllImages (string uri)
{
IEnumerator e = executeShowAll (uri);
while (e.MoveNext())
{
yield return e.Current;
}
}
IEnumerator executeShowAll (string url)
{
WWW www = new WWW (url);
while (!www.isDone)
{
yield return null;
}
if (www.isDone)
{
listOfImages.Add(www.texture);
}
}
現在你正在尋找什麼是listOfImages ..這只是一個「IList listOfImages = new List();」 ,這背後的目的..看到..
//========Setting Up ScrollView====================================================
scrollPosition = GUILayout.BeginScrollView(scrollPosition, GUILayout.Width(155));
if(listOfImages.Count > 1)
{
for(int i=0; i<listOfImages.Count; i++)
{
Texture2D myImage = (Texture2D)listOfImages[i];
GUILayout.Label(myImage,GUILayout.Height(100),GUILayout.Width(100));
}
}
GUILayout.EndScrollView();
//========ScrollView===============================================================
我想,你有這...怎麼我在它的工作..第二它是reallly很簡單..