public void ResfresMyFriendItemData(List <FriendInfo> dataList, long playerId) { myFriendScrollView.gameObject.SetActive(true); myFriendScrollView.InitializeWithData(dataList); myFriendScrollView.GoTop(); int index = 0; for (int i = 0; i < dataList.Count; i++) { if (dataList [i].friendId == playerId) { index = i; break; } } myFriendScrollView.ShowItemByDataIndex(index); MyFriendItem myFriendItem = myFriendScrollView.FindMyFriendItemByPlayerId(playerId); myFriendItem.selectedMyFriendItemIndex = myFriendItem.GetPlayerId(); OnClickMyFriendItemCallBack(myFriendItem); friendNumberInfoText.text = string.Format("{0}/{1}", controller.GetFriendOnLineNumber(), dataList.Count); myFriendScrollView.UpdateScrollView(Vector2.zero); }
public override GameObject InstantiateCell() { MyFriendItem item = base.InstantiateCell().AddComponent <MyFriendItem>(); myFriendItemList.Add(item); if (OnCreateItemHandler != null) { OnCreateItemHandler(item); } return(item.gameObject); }
private void OnClickMyFriendItemCallBack(MyFriendItem item) { if (lastSelectedMyFriendItem != item && lastSelectedMyFriendItem != null) { lastSelectedMyFriendItem.CancelSelected(); } item.SelectedItem(); lastSelectedMyFriendItem = item; ShowPrivateChatScrollView(item.GetPlayerId()); selectedMyFriendItemId = item.GetPlayerId(); friendNameText.text = item.GetPlayerName(); ResfresPrivateChatItemData(controller.GetPrivateChatData(selectedMyFriendItemId)); }
private void OnCreateFriendtem(MyFriendItem item) { item.onClickItemHandle = OnClickMyFriendItemCallBack; }