public void UpdateUIInfo(FriendItem itemInfo, UIFriendItem friendItem, int index) { friendItem.UpdatePlayerInfo(itemInfo); friendItem.UpDateRepresentativeCard(itemInfo.GetItem()); friendItem.SetFriendItemParamID(index); friendItem.ShowWindow(); }
private void SyncFriends(List <FriendItem> contacts) { // List<FriendItem> friends=new List<FriendItem>(); NetCommand.Instance.UserFriends(contacts.ConvertAll(x => x.phone), (str) => { items.Clear(); List <NFriend> fds = Util.Instance.Get <List <NFriend> >(str); foreach (var item in fds) { if (items.Exists(x => x.phone == item.tel)) { FriendItem fi = items.Find(x => x.phone == item.tel); fi.code = item.code > fi.code ? item.code : fi.code; } else { FriendItem fi = new FriendItem(); fi.bases = item.bases; fi.code = item.tel.StartsWith("9")?-2: item.code; fi.name = item.name; fi.phone = item.tel; items.Add(fi); } } items.Sort((x, y) => y.code - x.code); m_pool.Initialize(items.ToArray()); }); }
// 增加格子 index 格子唯一索引 从1开始,x,y为位置 void AddGrid(int index, FriendItem FrienditemInfo) { // 如果存在 则返回 if (m_friendList.ContainsKey(index)) { return; } // 设置 父物体 //friendItem.transform.parent = // 设置大小 //friendItem.transform.localScale = m_item.transform.localScale; //friendItem.gameObject.SetActive(true); // String.Format("{0:00000}", index); //friendItem.gameObject.name = showNumStr; UIFriendItem friendItemcc = new UIFriendItem(); friendItemcc.SetClickFuncHead(OnClickPlayer, OnClickCard, OnClickLongPressPlayer, OnClickLongPressCard); friendItemcc.SetFriendItemClickType(UIFriendItem.ENClickFriendItemType.enFriendList); friendItemcc.Load("UIFriendItem", FindChildComponent <UIGrid>("GridList").transform); friendItemcc.SetFriendItemParamID(index); //UpdateUIInfo(FrienditemInfo, friendItemcc); // UIPanel panel = friendItemcc.WindowRoot.GetComponent<UIPanel>(); m_friendList.Add(index, friendItemcc); }
public void UpdateUIInfo(FriendItem itemInfo, UIFriendItem friendItem, int tmpIndex) { friendItem.UpdatePlayerInfo(itemInfo); friendItem.UpDateRepresentativeCard(itemInfo.GetItem()); friendItem.SetFriendItemParamID(tmpIndex); friendItem.WindowRoot.SetActive(true); }
private void ListViewClick(object sender, AdapterView.ItemClickEventArgs e) { AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.SetTitle("Do you want add to your friends?"); alert.SetPositiveButton("Yes", async(senderAlert, args) => { FriendItem item = new FriendItem { FriendId = users[e.Position].Id, UserId = HomeActivity1.userItem.Id }; await DatabaseManager.DefaultManager.SaveFriendItemAsync(item); users.Remove(users[e.Position]); adapter = new FriendsCustomAdapter(this, users); lstData = FindViewById <ListView>(Resource.Id.listViewFriends); lstData.Adapter = adapter; }); alert.SetNegativeButton("No", (senderAlert, args) => { }); //run the alert in UI thread to display in the screen RunOnUiThread(() => { alert.Show(); }); }
public FriendItem CreateFriendItemData(int index) { FriendItem tmpFriendItem = new FriendItem(); tmpFriendItem.m_id = index; tmpFriendItem.m_level = index; tmpFriendItem.m_choiceCount = index; tmpFriendItem.m_beforLoadTime = 0; tmpFriendItem.m_actorName = index.ToString("00"); CSItem tmpCSItem = new CSItem(); int tmpIndex = 0; // int TableCount = GameTable.HeroInfoTableAsset.m_list.Count; // int randIndex = UnityEngine.Random.Range(0, TableCount); foreach (HeroInfo item in GameTable.HeroInfoTableAsset.m_list.Values) { if (index == tmpIndex) { tmpCSItem.IDInTable = (short)item.ID; break; } tmpIndex++; } // = (short)randIndex; tmpCSItem.Level = index; tmpFriendItem.m_itemData = tmpCSItem; return(tmpFriendItem); }
public void OnFriendItemBtnClick(GameObject go) { FriendItem item = go.GetComponent <FriendItemUI>().ItemInfo; FriendUI.Instance.ShowFriendDes(); FriendUI.Instance.UpdateFriendDes(item.friendHeader, item.friendTitle, item.friendUsername, item.logoutTime); }
private void SetFriendListShow(bool isDirect) { direct_friend_underline.SetActive(isDirect); indirect_friend_underline.SetActive(!isDirect); List <AllData_FriendData_Friend> willBeShow = isDirect ? direct_friend_list : indirect_friend_list; list_titleText.text = isDirect ? direct_title : indirect_title; foreach (var friend in all_friends) { friend.gameObject.SetActive(false); } int willbeShowCount = willBeShow.Count; for (int i = 0; i < willbeShowCount; i++) { if (i > all_friends.Count - 1) { FriendItem newFriend = Instantiate(single_friend_item, single_friend_item.transform.parent).GetComponent <FriendItem>(); all_friends.Add(newFriend); } AllData_FriendData_Friend frinedInfo = willBeShow[i]; all_friends[i].gameObject.SetActive(true); all_friends[i].Init(frinedInfo.user_img, frinedInfo.distance, frinedInfo.user_name, frinedInfo.user_time, frinedInfo.user_level); } }
// Use this for initialization private void Awake() { closeLis = UIEventListener.Get(transform.Find("Buttons/Button-Close").gameObject); applyLis = UIEventListener.Get(transform.Find("Buttons/Button-Apply").gameObject); viewDetailLis = UIEventListener.Get(transform.Find("Buttons/Button-ViewDetail").gameObject); friendItem = GetComponent<FriendItem>(); }
public void InitFriendInfoDic(FriendItem item) { if (!m_friendInfoDic.ContainsKey(item.GetID())) { m_friendInfoDic.Add(item.GetID(), item); } }
/// <summary> /// 加载一页5个好友 /// </summary> /// <param name="page"></param> void ReflashItem(int page) { List <Dictionary <int, PlayerInfo> > instancePages = FriendsInfoModel.Instance.pages; Debug.Log(string.Format("<color=#ffffffff><---{0}-{1}----></color>", page, "test1")); if (instancePages.Count > 0) { Transform parent = FriendsList.transform.Find("page" + page); //刷新朋友页 if (parent != null) { for (int i = 0; i < parent.childCount; i++) { for (int j = 0; j < instancePages.Count; j++) { if (instancePages[page].ContainsKey(int.Parse(parent.transform.GetChild(i).name))) { parent.transform.GetChild(i).GetComponent <FriendItem>().SetData(instancePages[page][int.Parse(parent.transform.GetChild(i).name)]); } } } } else { if (FriendsInfoModel.Instance.pages.Count > page && !FriendsInfoModel.Instance.hasLoadPage.ContainsKey(page)) { GameObject contentPage = new GameObject("page" + page); contentPage.transform.SetParent(FriendsList); List <FriendItem> friends = new List <FriendItem>(); HorizontalLayoutGroup hlg = contentPage.AddComponent <HorizontalLayoutGroup>(); // contentPage.AddComponent<ContentSizeFitter>(); // hlg.childForceExpandHeight = false; // hlg.childForceExpandWidth = false; hlg.spacing = 10; // hlg.childControlWidth = false; // hlg.childControlHeight = false; contentPage.transform.localScale = new Vector3(1, 1, 1); // contentPage.transform.GetComponent<RectTransform>().sizeDelta = new Vector2(517f * FriendsInfoModel.Instance.pages[page].Count / 5, 100); foreach (var friItemInfo in FriendsInfoModel.Instance.pages[page]) { GameObject go = GameObject.Instantiate(friendItem) as GameObject; FriendItem fitem = go.AddComponent <FriendItem>(); fitem.SetData(friItemInfo.Value); // go.AddComponent<LayoutElement>(); go.name = fitem.playerID.ToString(); friends.Add(fitem); go.transform.SetParent(contentPage.transform, false); } //每页对应的好友 FriendsInfoModel.Instance.hasLoadPage.Add(page, friends); } } } }
//测试,创建好友数据 public void CreateFriendList() { for (int i = 9; i >= 0; i--) { FriendItem tmpItem = CreateFriendItemData(i, FriendItemType.enFriend); m_friendInfoDic.Add(tmpItem.GetID(), tmpItem); } }
public void SetFriendInfo(FriendItem friend) { info = friend; name.text = friend.Name; StartCoroutine(GameUtils.Instance._DownloadImage(friend.AvatarUrl, avatar)); }
//测试,创建确认好友列表数据 public void CreateApplyInfoList() { for (int i = 20; i >= 15; i--) { FriendItem tmpItem = CreateFriendItemData(i, FriendItemType.enUntreatedRequest); m_friendInfoDic.Add(tmpItem.GetID(), tmpItem); } }
public void AddInstanceToItemList(FriendItem i)//allows to fill the item list and update fortune value { if (!photonView.IsMine) { photonView.TransferOwnership(myPlayer); } playerItems.Add(i); }
public static UIFriendItem CreateFriendItemPrefab(FriendItem item) { UIFriendItem ui = new UIFriendItem(); ui.SetFriendItem(item); ui.Load("UIFriendItem", null); ui.HideWindow(); return(ui); }
public int Compare(SortableItem tmpx, SortableItem tmpy) { FriendItem friendItemx = (FriendItem)tmpx; // FriendItem friendItemy = (FriendItem)tmpy; CSItem x = friendItemx.GetItem(); CSItem y = friendItemx.GetItem(); return(x.GotTime.CompareTo(y.GotTime)); }
public async Task <Guid> Handle(Command request, CancellationToken cancellationToken) { var friend = new FriendItem(Guid.NewGuid(), request.Name, false); await _repository.SaveAsync(friend); await _mediator.Publish(new FriendCreated(friend.Id)); return(friend.Id); }
private void InstantiateFriendButton(string friendId) { GameObject gameObject = (GameObject)Object.Instantiate(this.FriendListUiItemtoInstantiate); gameObject.gameObject.SetActive(true); FriendItem component = gameObject.GetComponent <FriendItem>(); component.FriendId = friendId; gameObject.transform.SetParent(this.FriendListUiItemtoInstantiate.transform.parent, false); this.friendListItemLUT.set_Item(friendId, component); }
public void GetValue(FriendItem friendItem, ref float stamina) { int value; if (ItemValues.TryGetValue(friendItem, out value)) { float increasedStamina = stamina + value; stamina = Mathf.Clamp(increasedStamina, 0, 99); } }
public void SendAddFriend(object sender, EventArgs e) { if (null == m_insertUIWnd) { return; } FriendItem item = m_insertUIWnd.GetFriendItem(); int friendID = item.m_id; MiniServer.Singleton.SendAddFriend_C2CH(friendID); }
public void OnStatusUpdate(string user, int status, bool gotMessage, object message) { if (friendListItemLUT.ContainsKey(user)) { FriendItem _friendItem = friendListItemLUT[user]; if (_friendItem != null) { _friendItem.OnFriendStatusUpdate(status, gotMessage, message); } } }
public void DeleteFriend(int friendItemID) { FriendItem tmpItem = m_friendInfoDic[friendItemID] as FriendItem; m_friendInfoDic.Remove(friendItemID); if (null != m_sortFriendList) { m_sortFriendList.Remove(tmpItem); } m_friendInfoList.Remove(tmpItem); SortCardUpdateInfo(); }
public void OnStatusUpdate(string user, int status, bool gotMessage, object message) { Debug.LogWarning("status: " + string.Format("{0} is {1}. Msg:{2}", user, status, message)); if (this.friendListItemLUT.ContainsKey(user)) { FriendItem friendItem = this.friendListItemLUT.get_Item(user); if (friendItem != null) { friendItem.OnFriendStatusUpdate(status, gotMessage, message); } } }
private void InstantiateFriendButton(string friendId) { UnityEngine.GameObject fbtn = (UnityEngine.GameObject)Instantiate(this.FriendListUiItemtoInstantiate); fbtn.gameObject.SetActive(true); FriendItem _friendItem = fbtn.GetComponent <FriendItem>(); _friendItem.FriendId = friendId; fbtn.transform.SetParent(this.FriendListUiItemtoInstantiate.transform.parent, false); this.friendListItemLUT[friendId] = _friendItem; }
public ChatViewModel(ServerConnection connection, Navigator navigator, string username, byte[] userKey) : base(connection, navigator) { this.model = new ChatModel(connection, username, userKey); this.lastInvitationStatus = InvitationStatus.NO_INVITATION; this.lastRecivedInvitation = null; this.selectedFriend = null; this.invitationUsername = ""; this.messageToSendText = ""; this.activeConversation = false; updateThread = new Thread(UpdateAsync); updateThread.Start(); }
public void UpdataBlackList() { if (!leftPane.gameObject.activeSelf) { return; } foreach (GameObject o in friendCellList) { friendGrild.RemoveChild(o.transform); o.transform.parent = null; GameObject.Destroy(o); } friendCellList.Clear(); friendGrild.RemoveChild(blackBtn.transform); blackBtn.transform.parent = null; friendGrild.AddChild(blackBtn.transform, 1); //blackBtn.transform.parent = friendGrild.transform; blackBtn.SetActive(true); blackBtn.transform.localScale = Vector3.one; UIManager.SetButtonEventHandler(blackBtn.gameObject, EnumButtonEvent.OnClick, OnInitBlack, 0, 0); int indx = friendGrild.GetIndex(blackBtn.transform); foreach (COM_ContactInfo f in FriendSystem.Instance().blacks_) { GameObject obj = Object.Instantiate(friendCell.gameObject) as GameObject; obj.SetActive(true); FriendItem cellUI = obj.GetComponent <FriendItem>(); cellUI.ContactInfo = f; if (FriendSystem.Instance().ChatDict.ContainsKey(f.name_)) { cellUI.red.gameObject.SetActive(true); } else { cellUI.red.gameObject.SetActive(false); } cellUI.IsBlack(true); cellUI.delCallBack = OnCellDelBlack; friendGrild.AddChild(obj.transform, ++indx); friendCellList.Add(obj); obj.transform.localScale = Vector3.one; } friendGrild.Reposition(); }
private void InstantiateFriendButton(string friendId) { GameObject fbtn = (GameObject)GameObject.Instantiate(this.FriendListUiItemtoInstantiate); fbtn.gameObject.SetActive(true); FriendItem _friendItem = fbtn.GetComponent <FriendItem>(); _friendItem.FriendId = friendId; fbtn.transform.SetParent(this.FriendListUiItemtoInstantiate.transform.parent, false); this.playerListUIItem[friendId] = _friendItem; }
protected virtual void InstantiateFriendButton(string friendId) { GameObject fbtn = Instantiate(FriendListUiItemtoInstantiate); fbtn.gameObject.SetActive(true); FriendItem _friendItem = fbtn.GetComponent <FriendItem>(); _friendItem.FriendId = friendId; fbtn.transform.SetParent(FriendListUiItemtoInstantiate.transform.parent, false); m_friendListItemLUT[friendId] = _friendItem; }
public override void OnStatusUpdate(string user, int status, bool gotMessage, object message) { Debug.LogWarning("Status: " + string.Format("{0} is {1}. Msg:{2}", user, status, message)); if (m_friendListItemLUT.ContainsKey(user)) { FriendItem _friendItem = m_friendListItemLUT[user]; if (_friendItem != null) { _friendItem.OnFriendStatusUpdate(status, gotMessage, message); } } }
/// <summary> /// New status of another user (you get updates for users set in your friends list). /// </summary> /// <param name="user">Name of the user.</param> /// <param name="status">New status of that user.</param> /// <param name="gotMessage">True if the status contains a message you should cache locally. False: This status update does not include a /// message (keep any you have).</param> /// <param name="message">Message that user set.</param> public void OnStatusUpdate(string user, int status, bool gotMessage, object message) { Debug.LogWarning("status: " + string.Format("{0} is {1}. Msg:{2}", user, status, message)); if (playerListUIItem.ContainsKey(user)) { FriendItem _friendItem = playerListUIItem[user]; if (_friendItem != null) { _friendItem.OnFriendStatusUpdate(status); } } }
public UIFriendItem CreateFriendItemPrefab(FriendItem item) { m_foundFriendItem = item;// FoundFriendByID.Singleton.m_findFriendItem;//CreateFriendItemData(0); UIFriendItem friendItem = new UIFriendItem(); friendItem.Load("UIFriendItem", null); int tmpIndex = FriendList.Singleton.GetFriendListCount(); friendItem.SetFriendItemParamID(tmpIndex + 1); UpdateUIInfo(m_foundFriendItem, friendItem, tmpIndex + 1); friendItem.HideWindow(); return(friendItem); }
void Start () { animator = GetComponent<Animator>(); suggestFriends = new List<FriendItem>(); var taskSync = ParseCloud.CallFunctionAsync<IList<IDictionary<string, object>>>("getSuggestFriends", null).ContinueWith(t2 => { var suggestList = t2.Result; for (int i = 0; i < suggestList.Count; i++) { FriendItem friend = new FriendItem(suggestList[i]); suggestFriends.Add(friend); } }); StartCoroutine(_LoadSuggestFriend(taskSync)); }
public float[] GetWholePizza(FriendItem friendItem, float[] staminas) { int value; if (ItemValues.TryGetValue(friendItem, out value)) { int splitedValue = value / 3; for (int i = 0; i < staminas.Length; i++) { float increasedStamina = staminas[i] + splitedValue; staminas[i] = Mathf.Clamp(increasedStamina, 0, 99); } } return staminas; }
public void SetItem(int index) { friendItem = (FriendItem)index; }
public void SetFriendList(IList<IDictionary<string, object>> list) { friends.Clear(); for (int i = 0; i < list.Count; i++) { FriendItem friend = new FriendItem(list[i]); friends.Add(friend.Id, friend); } }