using System.Collections; using System.Collections.Generic; using UnityEngine; using LitJson; using System; public class Network { public bool active = false; public string action; public WWWForm data; public string url; private Action failedFun; private Action successFun; /// /// Init the specified action, data, type, success and failed. /// /// Action. /// Data. /// Success. /// Failed. public void init(string action, WWWForm data,Action successFun = null ,Action failedFun = null) { this.action = action; this.data = data; this.successFun = successFun; this.failedFun = failedFun; active = false; this.url = action; } public void scuess(JsonData data) { if (successFun != null) { successFun (data); } } public void failed (string msg) { if (failedFun != null) { failedFun (msg); } } public void error(string msg) { if (failedFun != null) { failedFun (msg); } } }