public void SendAll() { viewList = pop.viewList; if (viewList.Count > 0) { C2sSprotoType.sendheart.request obj = new C2sSprotoType.sendheart.request(); List <C2sSprotoType.heartlist> l = new List <C2sSprotoType.heartlist>(); DateTime dt = DateTime.Now; string t = string.Format("{0:yyyyMMddHHmmss}", dt); int total = 0; for (int i = 0; i < viewList.Count; i++) { FriendView v = viewList[i] as FriendView; if (v.data.isHeart) { C2sSprotoType.heartlist f = new C2sSprotoType.heartlist(); f.friendid = v.data.id; f.type = 0; f.signtime = v.data.signtime; f.amount = Def.RecHeart; f.csendtime = t; l.Add(f); total += Def.RecHeart; } } obj.hl = l; obj.totalamount = total; NetworkManager.Instance.SendHeart(obj); for (int i = 0; i < viewList.Count; i++) { FriendView v = pop.GetView(i); if (v != null) { if (v.data.isHeart != false) { v.data.isHeart = false; v.CheckBtn(); } } } } }
public void Send(FriendView v) { C2sSprotoType.sendheart.request obj = new C2sSprotoType.sendheart.request(); List <C2sSprotoType.heartlist> l = new List <C2sSprotoType.heartlist>(); DateTime dt = DateTime.Now; string t = string.Format("{0:yyyyMMddHHmmss}", dt); C2sSprotoType.heartlist f = new C2sSprotoType.heartlist(); f.friendid = v.data.id; f.type = 0; f.signtime = v.data.signtime; f.amount = Def.RecHeart; f.csendtime = t; l.Add(f); obj.hl = l; obj.totalamount = Def.RecHeart; NetworkManager.Instance.SendHeart(obj); v.data.isHeart = false; v.CheckBtn(); }