void _Packet(ScSystemBulletinExpire p)//任务关闭 { InitClickInfo(p.bulletinId); bool have = notClick.Exists(a => a == p.bulletinId); if (have) { notClick.Remove(p.bulletinId); } PBulletin Ahave = activeList.Find(a => a.id == p.bulletinId); if (Ahave != null) { activeList.Remove(Ahave); DispatchModuleEvent(EventAccCloseNotice, 0); } PBulletin Nhave = noticeList.Find(a => a.id == p.bulletinId); if (Nhave != null) { noticeList.Remove(Nhave); DispatchModuleEvent(EventAccCloseNotice, 1); } if (notClick.Count <= 0) { moduleHome.UpdateIconState(HomeIcons.Notice, false); } }
private void Onclick(RectTransform rt, PBulletin Info) { if (Info == null) { return; } m_rectContent.anchoredPosition = Vector3.zero; ChangeList(Info); }
private void UpdateInfo(PBulletin Info, List <PBulletin> ListInfo, DataSource <PBulletin> m_typeData) { if (Info == null) { return; } var index = ListInfo.FindIndex(a => a.id == Info.id); m_typeData.UpdateItem(index); }
private void InitClickInfo(int infoId) { if (PInfo == null) { return; } if (PInfo.id == infoId) { PInfo = null; } }
private void SetPlaneInfo(PBulletin info)//获取所有信息 传进plane 显示具体信息 { if (info == null) { return; } foreach (Transform item in Title_back_img.transform) { item.SafeSetActive(false); } UIDynamicImage.LoadImage(Title_back_img.transform, info.icon, null, true); conTmgTxt.SafeSetActive(!string.IsNullOrEmpty(info.icon)); Util.SetText(Subtitle_txt, string.Format(" {0}", info.conTitle)); Util.SetText(conTmgTxt, info.iconDesc); Contxt_one.text = info.content; Contxt_one.Set(); RectTransform rt = conTmgTxt.GetComponentDefault <RectTransform>(); rt.anchoredPosition = new Vector3(info.positionX, info.positionY, 0); var openWindow = -1; var openLable = -1; if (!info.turnPage.Contains("-")) { var type = Util.Parse <int>(info.turnPage); Go_btn.gameObject.SetActive(type > 0); openWindow = Util.Parse <int>(info.turnPage); } else { Go_btn.SafeSetActive(true); string[] str = info.turnPage.Split('-'); openWindow = Util.Parse <int>(str[0]); openLable = Util.Parse <int>(str[1]); } Go_btn.onClick.RemoveAllListeners(); Go_btn.onClick.AddListener(delegate { moduleAnnouncement.OpenWindow(openWindow, openLable); }); }
void _Packet(ScSystemBulletin p)//上线所有消息 { ScSystemBulletin Info = p.Clone(); if (Info == null || Info?.bulletins == null) { return; } PInfo = null; activeList.Clear(); noticeList.Clear(); notClick.Clear(); for (int i = 0; i < Info.bulletins.Length; i++) { PBulletin thisInfo = Info.bulletins[i]; if (thisInfo != null) { if (thisInfo.type == 0) { activeList.Add(thisInfo); } else if (thisInfo.type == 1) { noticeList.Add(thisInfo); } } } LocalSelect(noticeList); LocalSelect(activeList); if (activeList.Count > 0) { PInfo = ActiveList[0]; } DispatchModuleEvent(EventAccAllInfo); if (notClick.Count > 0) { moduleHome.UpdateIconState(HomeIcons.Notice, true); } }
private void ChangeList(PBulletin Info) { if (Info == null) { return; } Infoplane.gameObject.SetActive(true); PBulletin Last = moduleAnnouncement.PInfo; moduleAnnouncement.PInfo = Info; string date_now = Util.GetServerLocalTime().ToString(); string idm = "ment" + Info.id.ToString() + modulePlayer.roleInfo.roleId.ToString(); PlayerPrefs.SetString(idm, date_now); bool isshow = moduleAnnouncement.NotClick.Exists(a => a == Info.id); if (isshow) { moduleAnnouncement.NotClick.Remove(Info.id); } if (Info.type == 0) { UpdateInfo(Info, moduleAnnouncement.ActiveList, m_activeInfo); } else if (Info.type == 1) { UpdateInfo(Info, moduleAnnouncement.NoticeList, m_noticeInfo); } if (Last != null) { UpdateInfo(Last, moduleAnnouncement.ActiveList, m_activeInfo); UpdateInfo(Last, moduleAnnouncement.NoticeList, m_noticeInfo); } SetPlaneInfo(Info); HintShow(); }
void _Packet(ScSystemNewBulletin p)//在线接到新任务 { PBulletin info = p.Clone().bulletin; //获得新的公告活着活动推送 if (info == null) { return; } if (info.type == 0) { var active = activeList.Find(a => a.id == info.id); if (active != null) { activeList.Remove(active); } activeList.Add(info); } else if (info.type == 1) { var notice = noticeList.Find(a => a.id == info.id); if (notice != null) { noticeList.Remove(notice); } noticeList.Add(info); } var click = notClick.Exists(a => a == info.id); if (click) { notClick.Remove(info.id); } if (info.menuHot != 0) { notClick.Add(info.id); moduleHome.UpdateIconState(HomeIcons.Notice, true); } DispatchModuleEvent(EventAccNewNotice, info.type); }
private void SetAllInfo(RectTransform rt, PBulletin Info) { if (Info == null) { return; } TweenColor txtmain = rt.transform.Find("txt/TXT").GetComponent <TweenColor>(); var txtother = rt.transform.Find("txt/TXT2"); Text Title1 = txtmain?.GetComponent <Text>(); Text Title2 = txtother?.GetComponent <Text>(); if (Title1 != null) { Util.SetText(Title1, Info.title); } if (Title2 != null && txtother != null) { txtother.gameObject.SetActive(!string.IsNullOrEmpty(Info.subTitle)); Util.SetText(Title2, Info.subTitle); } GameObject SelectOn = rt.transform.Find("selectbox")?.gameObject; Image NewImg = rt.transform.Find("new_img")?.GetComponent <Image>(); bool isshow = moduleAnnouncement.NotClick.Exists(a => a == Info.id); NewImg.SafeSetActive(isshow); var select = Info.id == moduleAnnouncement.PInfo?.id; SelectOn?.gameObject.SetActive(select); if (select) { txtmain.Play(); } else { txtmain.PlayReverse(); } }