Skip to main content
Version: 5.18.17

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.GetContentDictionarySortByChartId();


foreach (string keyName in dic.Keys)
{
Debug.Log(dic[keyName].ToString());
}

// If the chart 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"]);
}
}
}

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.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.

image

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