예제 #1
0
    public void Receive(FriendView v)
    {
        viewList = pop.viewList;
        if (point > v.data.heartamount && v.data.heartamount > 0)
        {
            C2sSprotoType.recvheart.request obj = new C2sSprotoType.recvheart.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    = v.data.heartamount;
            f.csendtime = t;
            l.Add(f);
            obj.hl          = l;
            obj.totalamount = v.data.heartamount;
            NetworkManager.Instance.ReceviceHeart(obj);

            point = point - v.data.heartamount;
            pop.SetPoint(point);
            UserManager.Instance.AddFriendPoint(v.data.heartamount);
            v.data.isReceive   = false;
            v.data.heartamount = 0;
            v.CheckBtn();
        }
    }
예제 #2
0
 public void ApplyAll()
 {
     viewList = pop.viewList;
     if (viewList.Count > 0)
     {
         C2sSprotoType.applyfriend.request obj = new C2sSprotoType.applyfriend.request();
         List <C2sSprotoType.friendidlist> l   = new List <C2sSprotoType.friendidlist>();
         obj.friendlist = l;
         for (int i = 0; i < viewList.Count; i++)
         {
             FriendView v = viewList[i] as FriendView;
             if (v.data.isApply)
             {
                 C2sSprotoType.friendidlist f = new C2sSprotoType.friendidlist();
                 f.friendid = v.data.id;
                 f.type     = 0;
                 f.signtime = v.data.signtime;
                 l.Add(f);
             }
         }
         NetworkManager.Instance.FriendApply(obj);
         for (int i = 0; i < viewList.Count; i++)
         {
             FriendView v = pop.GetView(i);
             if (v != null)
             {
                 if (v.data.isApply != false)
                 {
                     v.data.isApply = false;
                     v.CheckBtn();
                 }
             }
         }
     }
 }
예제 #3
0
    public void ReceiveAll()
    {
        viewList = pop.viewList;
        int temp = 0;

        if (viewList.Count > 0)
        {
            C2sSprotoType.recvheart.request obj = new C2sSprotoType.recvheart.request();
            List <C2sSprotoType.heartlist>  l   = new List <C2sSprotoType.heartlist>();
            DateTime dt = DateTime.Now;
            string   t  = string.Format("{0:yyyyMMddHHmmss}", dt);
            for (int i = 0; i < viewList.Count; i++)
            {
                FriendView v = viewList[i] as FriendView;
                temp += v.data.heartamount;
                if (v.data.heartamount > 0 && temp < point)
                {
                    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 = temp;

            if (point > temp)
            {
                UserManager.Instance.AddFriendPoint(temp);
                NetworkManager.Instance.ReceviceHeart(obj);
                point = point - temp;
                pop.SetPoint(point);
                for (int i = 0; i < viewList.Count; i++)
                {
                    FriendView v = pop.GetView(i);
                    if (v != null)
                    {
                        if (v.data.isReceive != false)
                        {
                            v.data.isReceive   = false;
                            v.data.heartamount = 0;
                            v.CheckBtn();
                        }
                    }
                }
            }
            else
            {
                ToastManager.Instance.Show("达到领取上线");
            }
        }
    }
예제 #4
0
    public void Apply(FriendView v)
    {
        C2sSprotoType.applyfriend.request obj = new C2sSprotoType.applyfriend.request();
        List <C2sSprotoType.friendidlist> l   = new List <C2sSprotoType.friendidlist>();

        obj.friendlist = l;
        C2sSprotoType.friendidlist f = new C2sSprotoType.friendidlist();
        f.friendid = v.data.id;
        f.type     = 0;
        f.signtime = v.data.signtime;
        l.Add(f);
        NetworkManager.Instance.FriendApply(obj);

        v.data.isApply = false;
        v.CheckBtn();
    }
예제 #5
0
 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();
                 }
             }
         }
     }
 }
예제 #6
0
    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();
    }