void RemoveAlert(TDBaseAlertData alert) { BaseAlertItem tempAlert = ActiveItems.Find((x) => { return(x.DataIndex == alert.ID); }); if (tempAlert == null) { return; } tempAlert.Show(false); ActiveItems.Remove(tempAlert); }
void AddAlert(TDBaseAlertData alert) { GameObject go = GOPool.Spawn(); BaseAlertItem alertItem = go.GetComponent <BaseAlertItem>(); alertItem.Init(new BaseButtonData { IconStr = alert.Icon, BgStr = alert.Bg, OnClick = alert.OnClick, OnShow = OnAlertShow, }); alertItem.Show(true); alertItem.RectTrans.position = StartPos.position; ActiveItems.Add(alertItem); }