Ejemplo n.º 1
0
        /// <summary>
        /// 物品显示类型按钮点击
        /// </summary>
        /// <param name="obj">Object.</param>
        public void OnShowItemTypeButtonClick(object obj)
        {
            SoundManager.Instance.PlaySoundEffect("Sound_Button_PackageClassification");
            ShowItemBtnType btnType = (ShowItemBtnType)obj;

            AllItemButton.spriteSwithList.ApplyAllItem(P => P.ChangeSprite(btnType == ShowItemBtnType.All?2:1));
            EquiptItemButton.spriteSwithList.ApplyAllItem(P => P.ChangeSprite(btnType == ShowItemBtnType.Equipt?2:1));
            OtherItemButton.spriteSwithList.ApplyAllItem(P => P.ChangeSprite(btnType == ShowItemBtnType.Other?2:1));
            JewelItemButton.spriteSwithList.ApplyAllItem(p => p.ChangeSprite(btnType == ShowItemBtnType.Jewel ? 2 : 1));
            ShowItem(btnType);
        }
Ejemplo n.º 2
0
        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;
                }
            }
        }