SingleItemLineArea GetNewSingleItemLineArea(int index) { SingleItemLineArea newItemLineArea = CreatObjectToNGUI.InstantiateObj(SingleItemLineAreaPrefab, Grid).GetComponent <SingleItemLineArea>(); newItemLineArea.transform.localPosition = new Vector3(0, 120 - 120 * index, 0); return(newItemLineArea); }
/// <summary> /// 收到解锁新背包格消息 /// </summary> void ReciveUnLockPackMsg(object obj) { SingleItemLineArea lockItemArea = MyItemLineAreaList.FirstOrDefault(P => P.IsLock); if (lockItemArea != null) { int newIndex = MyItemLineAreaList.Count; lockItemArea.UnLockMySelf(); // 包裹的最大数目是 80, if (newIndex < 80 / 4) { SingleItemLineArea newItemLineArea = GetNewSingleItemLineArea(newIndex); newItemLineArea.Init(newIndex, newIndex, true, this, NoticeToDragSlerp); MyItemLineAreaList.Add(newItemLineArea); } } }
void ShowItem(ShowItemBtnType shotItemType) { CurrentShowType = shotItemType; GetBestItemList(); //BestItemList.ApplyAllItem(P=>TraceUtil.Log(String.Format("BestItem:{0},{1}",P.Key,LanguageTextManager.GetString(P.Value.LocalItemData._szGoodsName)))); MyItemLineAreaList.ApplyAllItem(P => Destroy(P.gameObject)); MyItemLineAreaList.Clear(); switch (shotItemType) { case ShowItemBtnType.All: MyPackItemList = ContainerInfomanager.Instance.GetPackItemList(); break; case ShowItemBtnType.Equipt: MyPackItemList = ContainerInfomanager.Instance.GetPackItemList().FindAll(P => P.LocalItemData._GoodsClass == 1 && P.LocalItemData._GoodsSubClass <= 6); break; case ShowItemBtnType.Other: MyPackItemList = ContainerInfomanager.Instance.GetPackItemList().FindAll(P => P.LocalItemData._GoodsClass == 2 || (P.LocalItemData._GoodsClass == 3 && P.LocalItemData._GoodsSubClass != 3)); break; case ShowItemBtnType.Jewel: MyPackItemList = ContainerInfomanager.Instance.GetPackItemList().FindAll(P => (P.LocalItemData._GoodsClass == 3 && P.LocalItemData._GoodsSubClass == 3)); break; } MyPackItemList.Sort((left, right) => { if (left.sSyncContainerGoods_SC.nPlace < right.sSyncContainerGoods_SC.nPlace) { return(-1); } else if (left.sSyncContainerGoods_SC.nPlace == right.sSyncContainerGoods_SC.nPlace) { return(0); } else { return(1); } }); int allPackNum = ContainerInfomanager.Instance.GetAllPackMaxNum(); int itemLineAreaNum = allPackNum / 4 + (allPackNum % 4 > 0 ? 1 : 0); m_shouldMove = itemLineAreaNum > 3; for (int i = 0; i <= itemLineAreaNum; i++) { // 等于最大的包裹数时,不需要解锁栏 if (i >= 80 / 4) { break; } bool isLock = i == itemLineAreaNum; SingleItemLineArea newItemLineArea = GetNewSingleItemLineArea(i); newItemLineArea.Init(i, itemLineAreaNum, isLock, this, NoticeToDragSlerp); MyItemLineAreaList.Add(newItemLineArea); } ResetItemListPanelPosition(); if (m_noticeToDragAmount != 0) { StartCoroutine(DragAmountSlerp(m_noticeToDragAmount)); m_noticeToDragAmount = 0; } else { if (HasGuideArrow) { m_dragPanelComp.LockDraggable = true; } else { m_dragPanelComp.LockDraggable = false; } } }
public void Init(SingleItemLineArea myParent) { this.MyParent = myParent; }