private void OnChoose(TitleComponent com, long id) { if (m_curTitleMsg != null) { m_curTitleMsg.OnUnToggle(); } m_curTitleMsg = com; }
public override void OnHide() { base.OnHide(); MessageHandler.UnRegisterMessageHandler(MessageDefine.SCTitleResponse, OnRespone); GameEvents.UIEvents.UI_PlayerTitle_Event.OnChoose -= OnChoose; m_close_btn.RemoveClickCallBack(OnClose); m_chooseID = -1; m_curTitleMsg = null; //m_chooseTitle = null; }
private void OnRespone(object obj) { if (obj == null) { return; } if (obj is SCTitleResponse) { SCTitleResponse res = (SCTitleResponse)obj; if (res.Status == null) { ////后面优化吧 List <ConfTitle> titleArray = CompareTitle(res); //List<ConfTitle> titleArray = ConfTitle.array; //m_grid_con.Clear(); m_grid_con.EnsureSize <TitleComponent>(titleArray.Count); for (int i = 0; i < titleArray.Count; i++) { TitleComponent title = m_grid_con.GetChild <TitleComponent>(i); title.Visible = true; bool isLock = true; TitleMsg titleMsg = null; bool isChoose = false; for (int j = 0; j < res.Titles.Count; j++) { if (titleArray[i].id == res.Titles[j].TitleId) { isLock = false; titleMsg = res.Titles[j]; if (titleMsg.TitleId == m_chooseID) { isChoose = true; m_curTitleMsg = title; } break; } } title.SetData(titleArray[i], titleMsg, isChoose, isLock); } } } }