using Newtonsoft.Json;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Threading.Tasks;
using UnityEngine;
///
/// 端口-删除
///
public class DeletePort : MonoBehaviour
{
public Body mybody;
public Root URlreturn;
private IEnumerator SaveJsonCoroutine()
{
yield return StartCoroutine(saveJson());
if (URlreturn != null && URlreturn.message == "操作成功")
{
yield return StartCoroutine(Succeed());
Array.ForEach(GameManager.Inst.pop_ups.ToArray(), (itme) =>
{
itme.gameObject.SetActive(false);
});
}
else
{
}
}
public IEnumerator Succeed()
{
yield return StartCoroutine(GameManager.Inst.Initialize());
}
public IEnumerator saveJson()
{
var newData = JsonConvert.SerializeObject(mybody);
yield return StartCoroutine(
CombineJSON.UpdateJson_POST(GameManager.Inst.Jk_URL.dk_sc, GameManager.Inst.arguments.token, newData, (jsonResult) =>
{
try
{
URlreturn = JsonConvert.DeserializeObject(jsonResult);
}
catch (System.Exception e)
{
Debug.Log("删除端口错误:" + e.Message);
}
})
);
}
#region JSON
[System.Serializable]
public class Body
{
///
/// id
///
public List ids;
}
[System.Serializable]
public class Root
{
///
///
///
public string code;
///
/// 反馈结果
///
public string message;
///
/// 返回内容
///
public string data;
///
///
///
public string serverTime;
}
#endregion
}