123456789101112131415161718192021222324252627282930313233343536 |
- using System.Collections.Generic;
- using Blue;
- using Newtonsoft.Json;
- using Newtonsoft.Json.Linq;
- using UnityEngine;
- public class SignallingService : ISignallingService
- {
- public void OnInit()
- {
- this.RegisterEvent<GetContactsSuccessEvent>(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<ContactsInfo> mContactsInfoList = JsonConvert.DeserializeObject<List<ContactsInfo>>(e.jsonString);
- Debug.LogError($"获取联系人:{e.jsonString}");
- }
- #endregion
- }
|