Backend.CDN.Content.Local.Load
public BackendContentReturnObject Backend.CDN.Content.Local.Load();
public void Backend.CDN.Content.Local.Load(Backend.BackendCallback< BackendContentReturnObject > backendCallback);
Description
Loads locally saved charts.
- This method cannot be called via SendQueue.
Example
Synchronous
public void Load()
{
BackEnd.Content.BackendContentReturnObject localCallback = null;
localCallback = Backend.CDN.Content.Local.Load();
if(localCallback.IsSuccess() == false) {
Debug.LogError(localCallback);
return;
}
Dictionary<string, BackEnd.Content.ContentItem> dic = localCallback.GetContentDictionarySortByChartName();
foreach (string keyName in dic.Keys)
{
Debug.Log(dic[keyName].ToString());
}
// When the chart file name is 'Content'
// For contentJson, refer to the success cases below.
if(dic.ContainsKey("Content")) {
LitJson.JsonData json = dic["Content"].contentJson;
foreach(LitJson.JsonData item in json) {
Debug.Log(item["itemID"]);
Debug.Log(item["itemName"]);
Debug.Log(item["hpPower"]);
Debug.Log(item["num"]);
}
}
}
Asynchronous
public void LoadAsync()
{
StartCoroutine(LoadAsyncIEnumerator());
}
IEnumerator LoadAsyncIEnumerator()
{
BackEnd.Content.BackendContentReturnObject callback = null;
Backend.CDN.Content.Local.Load(bro => {
callback = bro;
});
yield return new WaitUntil(() => callback != null);
if (callback.IsSuccess() == false)
{
Debug.LogError("GetContents : Fail : " + callback);
yield break;
}
Dictionary<string, BackEnd.Content.ContentItem> dic = callback.GetContentDictionarySortByChartName();
foreach (string keyName in dic.Keys)
{
Debug.Log(dic[keyName].ToString());
}
// When the probability file name is 'Content'
// For contentJson, refer to the success cases below.
if(dic.ContainsKey("Content")) {
LitJson.JsonData json = dic["Content"].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"
},
...
]