// Use this for initialization void Start() { try { if (MailDic != null) { MailDic.Clear(); } if (MailStateDic != null) { MailStateDic.Clear(); } if (golist != null) { golist.Clear(); } if (eventlist != null) { eventlist.Clear(); } object eo = ArkCrossEngine.LogicSystem.EventChannelForGfx.Subscribe <List <ArkCrossEngine.MailInfo> >("ge_sync_mail_list", "mail", SyncMailList); if (eo != null) { eventlist.Add(eo); } eo = ArkCrossEngine.LogicSystem.EventChannelForGfx.Subscribe("ge_notify_new_mail", "mail", NewMail); if (eo != null) { eventlist.Add(eo); } eo = ArkCrossEngine.LogicSystem.EventChannelForGfx.Subscribe("ge_ui_unsubscribe", "ui", UnSubscribe); if (eo != null) { eventlist.Add(eo); } ArkCrossEngine.GfxSystem.EventChannelForLogic.Publish("ge_get_mail_list", "lobby"); UIManager.Instance.HideWindowByName("Mail"); } catch (System.Exception ex) { ArkCrossEngine.LogicSystem.LogErrorFromGfx("Exception {0}\n{1}", ex.Message, ex.StackTrace); } }
public void UnSubscribe() { try { if (eventlist != null) { for (int i = 0; i < eventlist.Count; i++) { if (eventlist[i] != null) { ArkCrossEngine.LogicSystem.EventChannelForGfx.Unsubscribe(eventlist[i]); } } } eventlist.Clear(); MailDic.Clear(); MailStateDic.Clear(); golist.Clear(); } catch (Exception ex) { ArkCrossEngine.LogicSystem.LogFromGfx("[Error]:Exception:{0}\n{1}", ex.Message, ex.StackTrace); } }