public void RestDelFriend(FriendView v) { Destroy(v.gameObject); table.Reposition(); scroll.ResetPosition(); table.repositionNow = true; }
public void ShowAllUser() { _panel.Controls.Clear(); List <UsersInfoViewModel> usersList = JsonConvert.DeserializeObject <List <UsersInfoViewModel> >( RequestController.HttpGet(MainForm.ServerUrl + "/api/User/GetAllUser", MainForm.Token).Result); foreach (var ul in usersList) { FriendView friend = new FriendView() { UserId = ul.UserId, FirstName = ul.FirstName, SecondName = ul.SecondName, LastName = ul.LastName, DateOfBirthd = ul.DateOfBith, Photo = byteArrayToImage(ul.Photo), }; if (Friends.FirstOrDefault(x => x.UserId == friend.UserId) != null) { friend.button1.Enabled = false; } _panel.Controls.Add(friend); } }
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(); } } } } }
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(); } }
public void Refuse(FriendView v) { C2sSprotoType.refusefriend.request obj = new C2sSprotoType.refusefriend.request(); obj.friendlist = GetFriendidList(v); NetworkManager.Instance.FriendRefuse(obj); pop.RemoveFriendView(v); }
public void RemoveFriendView(FriendView v) { curList.Remove(v.data); Destroy(v.gameObject); table.Reposition(); scroll.ResetPosition(); table.repositionNow = true; }
public void Accept(FriendView v) { C2sSprotoType.recvfriend.request obj = new C2sSprotoType.recvfriend.request(); obj.friendlist = GetFriendidList(v); NetworkManager.Instance.FriendAccept(obj); pop.SetLive(1); pop.RemoveFriendView(v); }
public void UpdateUI() { _ = Dispatcher.RunAsync (Windows.UI.Core.CoreDispatcherPriority.Normal, new Windows.UI.Core.DispatchedHandler(() => { FriendView.UpdateList(); GroupView.UpdateList(); })); }
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("达到领取上线"); } } }
public List <C2sSprotoType.friendidlist> GetFriendidList(FriendView v) { List <C2sSprotoType.friendidlist> l = new List <C2sSprotoType.friendidlist>(); C2sSprotoType.friendidlist f = new C2sSprotoType.friendidlist(); f.friendid = v.data.id; f.type = 0; f.signtime = v.data.signtime; l.Add(f); return(l); }
public void InitData(FriendView v) { view = v; data = view.data; name.text = data.name; level.text = data.level.ToString(); vip.text = data.vip.ToString(); power.text = data.power.ToString(); time.text = data.time; qian.text = data.qian; uid.text = data.id.ToString(); }
public void RemoveAllView() { for (int i = 0; i < viewList.Count; i++) { FriendView v = GetView(i); if (v != null) { curList.Remove(GetView(i).data); Destroy(GetView(i).gameObject); } } }
public void OpenFriendDel(FriendView v) { if (MainUI.Instance.GetPopState(MainUI.PopType.FriendDel) != true) { MainUI.Instance.SetPopState(MainUI.PopType.FriendDel, true); GameObject obj = Instantiate(pop.popPrefab); obj.SetActive(true); DelFriendPop p = obj.GetComponent <DelFriendPop>(); p.InitData(v); p.transform.parent = pop.transform.parent; p.transform.position = Vector3.zero; p.transform.localScale = Vector3.one; } }
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(); }
public List <C2sSprotoType.friendidlist> GetFriendidList(Hashtable list) { List <C2sSprotoType.friendidlist> l = new List <C2sSprotoType.friendidlist>(); System.Collections.IDictionaryEnumerator enumerator = list.GetEnumerator(); while (enumerator.MoveNext()) { C2sSprotoType.friendidlist f = new C2sSprotoType.friendidlist(); FriendView v = list[enumerator.Key] as FriendView; f.friendid = v.data.id; f.type = 0; f.signtime = v.data.signtime; l.Add(f); } return(l); }
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 ShowAllFolowers() { _panel.Controls.Clear(); foreach (var ul in Followers) { FriendView friend = new FriendView() { UserId = ul.UserId, Email = ul.Email, FirstName = ul.FirstName, SecondName = ul.SecondName, LastName = ul.LastName, DateOfBirthd = ul.DateOfBith, Photo = byteArrayToImage(ul.Photo) }; friend.button1.Click -= friend.button1_Click; friend.button1.Click += friend.button1_Click2; _panel.Controls.Add(friend); } }
/// <summary> /// 更新显示 /// </summary> public void UpdateView(PlayerDto playerDto) { nameText.text = playerDto.Name; lvText.text = playerDto.Lv.ToString(); expBar.value = playerDto.Exp / (playerDto.Lv * 100.0f); //加载好友列表 FriendDto[] friendDtos = playerDto.Friends; friendViews.Clear(); GameObject go = null; foreach (FriendDto friendDto in friendDtos) { go = Instantiate(friendPrefab); go.transform.SetParent(friendSpawn); go.transform.localScale = Vector3.one; FriendView friendView = go.GetComponent <FriendView>(); friendView.InitView(friendDto.ID, friendDto.Name, friendDto.IsOnline); friendViews.Add(friendView); } }
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(); }
/// <summary> /// 更新显示 /// </summary> public void UpdateView(PlayerDto player) { txtName.text = player.name; barExp.value = (float)player.exp / (player.lv * 100); Friend[] friends = player.friends; friendList.Clear(); for (int i = 0; i < friendTran.childCount; i++) { GameObject children = friendTran.GetChild(i).gameObject; GameObject.Destroy(children); } for (int i = 0; i < friends.Length; i++) { Friend friend = friends[i]; GameObject go = Instantiate(UIFriend); go.transform.SetParent(friendTran, false); FriendView fv = go.GetComponent <FriendView>(); fv.InitView(friend.Id, friend.Name, friend.IsOnLine); friendList.Add(fv); } }
/// <summary> /// 更新显示 /// </summary> public void UpdateView(PlayerDto player) { txtName.text = player.name; barExp.value = (float)player.exp / (player.lv * 100); //加载好友列表 Friend[] friends = player.friends; friendList.Clear(); GameObject go = null; foreach (Friend item in friends) { if (item == null) { continue; } go = Instantiate(UIFriend); go.transform.SetParent(friendTran); FriendView fv = go.GetComponent <FriendView>(); fv.InitView(item.Id, item.Name, item.isOnline); friendList.Add(fv); } }
public void SetList(List <FriendData> list) { curList = list; if (table != null) { while (table.transform.childCount > 0) { DestroyImmediate(table.transform.GetChild(0).gameObject); } } viewList = new Hashtable(); if (curList != null) { if (curTab == FriendTab.Friend) { livefr = list.Count; liveNum.text = livefr.ToString(); } for (int i = 0; i < curList.Count; i++) { //设置格子 curList[i].time = Comm.NowDateDiff(curList[i].time); GameObject obj = Instantiate(itemPrefab); obj.SetActive(true); FriendView pop = obj.GetComponent <FriendView>(); pop.InitData(this, curList[i], i, curTab); pop.transform.parent = table.transform; pop.transform.position = Vector3.zero; pop.transform.localScale = Vector3.one; viewList.Add(i, pop); } table.Reposition(); scroll.ResetPosition(); } }
public static List <FriendView> GetFriendViewByType(ApplicationDbContext db, Guid appUserId, LevelEnum type) { List <FriendView> list = new List <FriendView>(); List <Friend> friendList = null; //Depending on type passed through will depend on what level of friends we are collecting switch (type) { case LevelEnum.User: friendList = FriendHelpers.GetFriendsCreatedByUser(db, appUserId); break; case LevelEnum.Branch: friendList = FriendHelpers.GetFriendsCreatedByUserBranches(db, appUserId); break; case LevelEnum.Company: friendList = FriendHelpers.GetFriendsCreatedByUserCompany(db, appUserId); break; } foreach (Friend friend in friendList) { //get the user/branch/company names depending on the block type string nameBy = ""; string nameOn = ""; switch (friend.Type) { case LevelEnum.User: nameBy = AppUserHelpers.GetAppUserName(db, friend.RequestedById); nameOn = AppUserHelpers.GetAppUserName(db, friend.RequestedOfId); break; case LevelEnum.Branch: nameBy = BranchHelpers.GetBranchNameTownPostCode(db, friend.RequestedById); nameOn = BranchHelpers.GetBranchNameTownPostCode(db, friend.RequestedOfId); break; case LevelEnum.Company: nameBy = CompanyHelpers.GetCompanyNameTownPostCode(db, friend.RequestedById); nameOn = CompanyHelpers.GetCompanyNameTownPostCode(db, friend.RequestedOfId); break; } string friendedByUserName = AppUserHelpers.GetAppUserName(db, friend.RequestedByUserId); bool friendedByLoggedInUser = false; if (friend.RequestedByUserId == appUserId) { friendedByLoggedInUser = true; } FriendView view = new FriendView() { FriendId = friend.FriendId, Type = friend.Type, RequestedByName = nameBy, RequestedByUserName = friendedByUserName, RequestedOfName = nameOn, Status = friend.Status, RequestedOn = friend.RequestedOn, AccceptedOn = friend.AccceptedOn, RejectedOn = friend.RequestedOn, ClosedOn = friend.ClosedOn, ClosedBy = friend.ClosedBy, FriendedByLoggedInUser = friendedByLoggedInUser }; list.Add(view); } return(list); }
public static Friend EntityMap(this FriendView model) { return(Mapper.Map <FriendView, Friend>(model)); }