Backend.CDN.Content.Get
public BackendContentReturnObject Backend.CDN.Content.Get(List< ContentTableItem > contentTableList);
public void Backend.CDN.Content.Get(List< ContentTableItem > contentTableList, ContentProgressDelegate contentProgressDelegate, Backend.BackendCallback< BackendContentReturnObject > backendCallback);
Parameters
| Value | Type | Description |
|---|---|---|
| contentTableList | List< ContentTableItem > | Can be called using Backend.CDN.Content.Table.Get(). |
| contentProgressDelegate | ContentProgressDelegate | Delegate method to show file download progress |
Description
Loads the content of probabilities registered to List< ContentTableItem >, which has been loaded usingBackend.CDN.Content.Table.Get().
- This method cannot be called via SendQueue.
Upon a successful return value of 204, you can check the file's value in JSON format at List< ContentItem > GetContentList(), which exists in BackendContentReturnObject.
ContentProgressDelegate
public delegate void ContentProgressDelegate(int totalCount, int remainCount, string downloadFile);
This 'delegate' method is called whenever the next file download starts after completing the download within the method.
The method can be used to display the current download progress.
It can be used as shown below:
private void GetProgress(int totalCount, int remainCount, string fileName)
{
Debug.Log("Total number of files : " + totalCount);
Debug.Log("Remaining number of files : " + remainCount);
Debug.Log("Name of file to be currently downloaded : " + fileName);
}
Backend.CDN.Content.Get(callback.GetContentTableItemList(), GetProgress, bro =>
{
Debug.Log(bro);
});
BackendContentReturnObject
namespace BackEnd.Content
{
public class ContentItem
{
public string chartName;
public string chartId;
public string createdDate;
public string selectedChartFileId;
public string errorString; // The value is assigned when an error occurs upon file download.
public string contentString { get; internal set; }
public LitJson.JsonData contentJson
{
get
{
if (contentJson == null)
{
contentJson = new LitJson.JsonData(contentString);
}
return contentJson;
}
private set => contentJson = value;
}
}
public class BackendContentReturnObject : BackendReturnObject
{
public Dictionary<string, ContentItem> GetContentDictionarySortByChartId();
public List<ContentItem> GetContentList();
}
}
Example
Synchronous
void GetContent()
{
BackEnd.Content.BackendContentTableReturnObject callback;
// Load chart table
callback = Backend.CDN.Content.Table.Get();
if(callback.IsSuccess() == false) {
Debug.LogError(callback);
return;
}
BackEnd.Content.BackendContentReturnObject callback2 = null;
// Look up content of loaded chart
callback2 = Backend.CDN.Content.Get(callback.GetContentTableItemList());
if (callback2.IsSuccess() == false)
{
Debug.LogError("GetContents : Fail : " + callback2);
return;
}
// Upon success, convert into Dictionary format
Dictionary<string, BackEnd.Content.ContentItem> dic = callback2.GetContentDictionarySortByChartId();
// Check content
foreach (string keyName in dic.Keys)
{
Debug.Log(dic[keyName].ToString());
}
// For contentJson, refer to the Success Cases below
if(dic.ContainsKey("Input ChartID")) //Enter the Chart ID *Caution: Not Chart File ID*
{
LitJson.JsonData json = LitJson.JsonMapper.ToObject(dic["Input ChartID"].contentJson);
foreach(LitJson.JsonData item in json) {
Debug.Log(item["itemID"]);
Debug.Log(item["itemName"]);
Debug.Log(item["hpPower"]);
Debug.Log(item["num"]);
}
}
}
Asynchronous
private void GetProgress(int totalCount, int remainCount, string fileName)
{
Debug.Log("totalCount : " + totalCount + " remainCount : " + remainCount + " fileName : " + fileName);
}
public void GetAsync()
{
StartCoroutine(GetAsyncIEnumerator());
}
IEnumerator GetAsyncIEnumerator()
{
BackEnd.Content.BackendContentTableReturnObject callback = null;
Backend.CDN.Content.Table.Get(bro =>
{
callback = bro;
});
yield return new WaitUntil(() => callback != null);
if(callback.IsSuccess() == false) {
Debug.LogError(callback);
yield break;
}
BackEnd.Content.BackendContentReturnObject callback2 = null;
Backend.CDN.Content.Get(callback.GetContentTableItemList(), GetProgress, bro =>
{
callback2 = bro;
});
yield return new WaitUntil(() => callback2 != null);
if (callback2.IsSuccess() == false)
{
Debug.LogError("GetContents : Fail : " + callback2);
yield break;
}
Dictionary<string, BackEnd.Content.ContentItem> dic = callback2.GetContentDictionarySortByChartId();
foreach (string keyName in dic.Keys)
{
Debug.Log(dic[keyName].ToString());
}
// If the probability file name is 'Content'
// For contentJson, refer to the Success Cases below
if(dic.ContainsKey("Input ChartID")) //Enter the Chart ID *Caution: Not Chart File ID*
{
LitJson.JsonData json = LitJson.JsonMapper.ToObject(dic["Input ChartID"].contentJson);
foreach(LitJson.JsonData item in json) {
Debug.Log(item["itemID"]);
Debug.Log(item["itemName"]);
Debug.Log(item["hpPower"]);
Debug.Log(item["num"]);
}
}
}
ReturnCase
Success cases
When the lookup is successful
statusCode : 204
message : Success
In the case of success, check the GetContentDictionary() method.
ContentJson
In the example chart shown below, LitJson.JsonData contentJson of the ContentItem class is displayed according to the following.

[
{
"itemID": "i101",
"itemName": "Item1",
"hpPower": "1",
"num": "1"
},
{
"itemID": "i102",
"itemName": "Item2",
"hpPower": "2",
"num": "2"
},
...
]