跳转到主要内容

发放道具

向玩家邮箱发放道具。

调用信息

// 向自己的邮箱发放道具时
public void SendItem (string tableCode, List<ItemValueModel> items, List<MessageValueModel> messages, int period, PlayNANOODelegate callback);

// 向其他玩家邮箱发放(赠送)道具时
public void SendItemPlayer (string tableCode, string playerId, List<ItemValueModel> items, List<MessageValueModel> messages, int period, PlayNANOODelegate callback);

调用详细信息

参数说明类型
tableCode表代码string
playerId玩家识别IDstring
items发放道具信息List<PlayNANOO.Inbox.ItemValueModel>
messages道具消息信息。输入消息信息时,默认语言 (Configure.PN_LANG_CODE_DEFAULT) 为必填项。List<PlayNANOO.Inbox.MessageValueModel>
period道具持有期限。道具持有期限以天为单位。integer
callback通信结果PlayNANOODelegate

源代码

using PlayNANOO;

public class PlayNANOOExample : MonoBehaviour
{
Plugin plugin;

void Awake()
{
plugin = Plugin.GetInstance();
}

// 向自己的邮箱发放道具时
public void ItemSend()
{
string tableCode = "TABLE_CODE";
int period = 365;

List<PlayNANOO.Inbox.ItemValueModel> items = new List<PlayNANOO.Inbox.ItemValueModel>();
List<PlayNANOO.Inbox.MessageValueModel> messages = new List<PlayNANOO.Inbox.MessageValueModel>();

items.Add(new PlayNANOO.Inbox.ItemValueModel { item_code = "ITEM_CODE_1", item_count = 10 });
items.Add(new PlayNANOO.Inbox.ItemValueModel { item_code = "ITEM_CODE_2", item_count = 20 });

// 默认语言 Configure.PN_LANG_CODE_DEFAULT 为必填项。
messages.Add(new PlayNANOO.Inbox.MessageValueModel { language = Configure.PN_LANG_CODE_DEFAULT, title = "TEST", content = "TEST" });
messages.Add(new PlayNANOO.Inbox.MessageValueModel { language = Configure.PN_LANG_CODE_KO, title = "TEST", content = "TEST" });

plugin.InboxManager.SendItem(tableCode, items, messages, period, (status, error, jsonString, values) =>
{
if(state.Equals(Configure.PN_API_STATE_SUCCESS)) {
Debug.Log("Success");
} else {
Debug.Log("Fail");
}
});
}

// 向其他玩家邮箱发放(赠送)道具时
public void ItemSendPlayer()
{
string tableCode = "TABLE_CODE";
string playerId = "PLAYER_ID";
int period = 365;

List<PlayNANOO.Inbox.ItemValueModel> items = new List<PlayNANOO.Inbox.ItemValueModel>();
List<PlayNANOO.Inbox.MessageValueModel> messages = new List<PlayNANOO.Inbox.MessageValueModel>();

items.Add(new PlayNANOO.Inbox.ItemValueModel { item_code = "ITEM_CODE_1", item_count = 10 });
items.Add(new PlayNANOO.Inbox.ItemValueModel { item_code = "ITEM_CODE_2", item_count = 20 });

// 默认语言 Configure.PN_LANG_CODE_DEFAULT 为必填项。
messages.Add(new PlayNANOO.Inbox.MessageValueModel { language = Configure.PN_LANG_CODE_DEFAULT, title = "TEST", content = "TEST" });
messages.Add(new PlayNANOO.Inbox.MessageValueModel { language = Configure.PN_LANG_CODE_KO, title = "TEST", content = "TEST" });

plugin.InboxManager.SendItemPlayer(tableCode, playerId, items, messages, period, (status, error, jsonString, values) =>
{
if(state.Equals(Configure.PN_API_STATE_SUCCESS)) {
Debug.Log("Success");
} else {
Debug.Log("Fail");
}
});
}
}

通信结果

HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
{
"status": "success"
}

通信结果详细信息

数据键说明类型
status处理结果string