コード例 #1
0
		/// <summary>
		/// 通过[物品ID]二分快速查表
		/// </summary>
		/// <param name="ID">物品ID</param>
		/// <returns></returns>
		public static ConsignmentCanSellItem Query(this List<ConsignmentCanSellItem> sorted, uint ID)
		{
			var key = new ConsignmentCanSellItem() { ID = ID };
			var comparer = new Comparer1();
			var index = sorted.BinarySearch(key, comparer);
			return index >= 0 ? sorted[index] : default(ConsignmentCanSellItem);
		}
コード例 #2
0
    protected override void OnJump(UIPanelBase.PanelJumpData jumpData)
    {
        base.OnJump(jumpData);
        if (null == jumpData)
        {
            jumpData = new PanelJumpData();
        }
        int firstTabData = -1;

        int secondTabData = -1;

        if (null != jumpData.Tabs && jumpData.Tabs.Length > 0)
        {
            firstTabData = jumpData.Tabs[0];
            if (jumpData.Tabs.Length > 1)
            {
                m_saleUIToggle = (ConsignmentItemMode)jumpData.Tabs[1];
            }
        }
        else
        {
            firstTabData = 1;
        }
        UIFrameManager.Instance.OnCilckTogglePanel(this.PanelId, 1, firstTabData);
        if (jumpData.Param is uint && m_saleUIToggle == ConsignmentItemMode.Buy)
        {
            uint itemID = (uint)jumpData.Param;
            ConsignmentCanSellItem table     = GameTableManager.Instance.GetTableItem <ConsignmentCanSellItem>(itemID);
            ItemDataBase           itemTable = GameTableManager.Instance.GetTableItem <ItemDataBase>(itemID);
            if (table != null)
            {
                uint m_firstType  = table.FirstType;
                uint m_secondType = table.SecondTyoe;
                if (m_firstType != 0 && m_secondType != 0)
                {
                    SetSelectFirstType(m_firstType, true);
                    SetSelectSecondType(m_secondType, true);
                    mSecondTabCreator.FocusData(mlstFirstTabIds.IndexOf(m_firstType), m_uintDic[m_firstType].IndexOf(m_secondType));
                    ReturnBackUIMsg data = new ReturnBackUIMsg();
                    if (itemTable != null)
                    {
                        data.param = itemTable.itemName;
                        DataManager.Manager <UIPanelManager>().SendMsg(PanelID.ConsignmentPanel, UIMsgID.eShowUI, data);
                    }
                }
                else
                {
                    Engine.Utility.Log.Error("寄售表格中的物品ID为{0}的大类ID或小类ID有误", itemID);
                }
            }
        }
        else if (jumpData.Param is uint && m_saleUIToggle == ConsignmentItemMode.Sell && canConsignItemList.Count > 0)
        {
            int index = 0;
            for (int i = 0; i < canConsignItemList.Count; i++)
            {
                if (canConsignItemList[i] == (uint)jumpData.Param)
                {
                    index = i;
                }
            }
            UIItemGrid itemGrid = m_ctor_ItemGridScrollView.GetGrid <UIItemGrid>(index);
            if (itemGrid != null)
            {
                SetSelectSellItem(itemGrid);
            }
        }
    }