using System.Collections.Generic; using Blue; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using UnityEngine; public class SignallingService : ISignallingService { public void OnInit() { this.RegisterEvent(GetContactsSuccess); } public void GetContacts() { CoroutineSystem.Instance.StartCoroutine( HttpTool.Instance.SendHttp(HttpActionLang.signal_contact, "", message => { JObject jobject = JObject.Parse(message); if (jobject["code"].ToString() == "200" && !string.IsNullOrWhiteSpace(jobject["data"].ToString()) && !string.IsNullOrEmpty(jobject["data"]["list"].ToString())) { this.SendEvent(new GetContactsSuccessEvent() { jsonString = jobject["data"]["list"].ToString() }); } }, "application/x-www-form-urlencoded")); } #region 事件 private void GetContactsSuccess(GetContactsSuccessEvent e) { List mContactsInfoList = JsonConvert.DeserializeObject>(e.jsonString); Debug.LogError($"获取联系人:{e.jsonString}"); } #endregion }