/// <summary>
    /// 仓库格子点击实现
    /// </summary>
    /// <param name="eventType"></param>
    /// <param name="data"></param>
    /// <param name="param"></param>
    public void OnWareHouseGridUIEvent(UIEventType eventType, object data, object param)
    {
        switch (eventType)
        {
        case UIEventType.Click:
        {
            if (data is UIItemGrid)
            {
                UIItemGrid grid = data as UIItemGrid;
                if (!grid.Empty)
                {
                    DataManager.Manager <KnapsackManager>().MoveItems(grid.Data.QWThisID, GameCmd.PACKAGETYPE.PACKAGETYPE_MAIN);
                }
                else if (grid.IsLock)
                {
                    KnapsackDefine.LocalUnlockInfo unlcokInfo
                        = m_kmgr.GetUnlockInfoByPackageType(m_em_activeWareHouse);
                    int unlockNum = ((int)ItemDefine.TransformServerLocation2Local(grid.Location).Position.y + 1) - unlcokInfo.UnlockNum;
                    if (unlockNum == 0)
                    {
                        Engine.Utility.Log.Warning(CLASS_NAME + "-> unlock grid failed,num = {0} data error!", unlockNum);
                        return;
                    }
                    //解锁格子
                    DoUnlocKnapsackGrid(unlockNum, m_em_activeWareHouse);
                }
            }
            else if (data is UITabGrid)
            {
                UITabGrid tabGrid = data as UITabGrid;
                KnapsackDefine.LocalUnlockInfo localInfo
                    = m_kmgr.GetUnlockInfoByPackageType((GameCmd.PACKAGETYPE)tabGrid.Data);
                if (null != localInfo && localInfo.IsUnlock)
                {
                    SetWareHousePackage((GameCmd.PACKAGETYPE)tabGrid.Data);
                }
                else
                {
                    TipsManager.Instance.ShowTips("购买皇令解锁仓库");
                }
            }
        }
        break;

        case UIEventType.LongPress:
        {
            if (data is UIItemGrid)
            {
                UIItemGrid grid = data as UIItemGrid;
                if (!grid.Empty)
                {
                    imgr.OnUIItemGridClicked(grid.Data.QWThisID);
                }
            }
        }
        break;
        }
    }
 /// <summary>
 /// 随身Sell商店格子UI事件
 /// </summary>
 /// <param name="eventType"></param>
 /// <param name="data"></param>
 /// <param name="param"></param>
 private void OnSellShopGridUIEvent(UIEventType eventType, object data, object param)
 {
     switch (eventType)
     {
     case UIEventType.Click:
     {
         UIItemGrid gird = data as UIItemGrid;
         if (!gird.Empty && sellShopSelectIds.ContainsKey(gird.Data.QWThisID))
         {
             UpdateSellShopSelectData(gird.Data.QWThisID, false);
         }
     }
     break;
     }
 }
    /// <summary>
    /// 仓库数据
    /// </summary>
    /// <param name="grid"></param>
    /// <param name="index"></param>
    public void OnWareHouseGridDataUpdate(UIGridBase grid, int index)
    {
        KnapsackManager knapMgr  = DataManager.Manager <KnapsackManager>();
        uint            location = ItemDefine.TransformLocal2ServerLocation(m_em_activeWareHouse, new Vector2(0, index));
        BaseItem        itemData = (wareHouseItems.Count > index) ? imgr.GetBaseItemByQwThisId(wareHouseItems[index]) : null;
        UIItemGrid      itemGrid = grid as UIItemGrid;

        itemGrid.EnableCheckBox(false);
        if (null == itemData)
        {
            itemGrid.SetLocation(location);
            //清空
        }
        itemGrid.SetLock(!knapMgr.IsGridUnlock(location));
        itemGrid.SetGridData(UIItemInfoGridBase.InfoGridType.None, itemData);
    }
    /// <summary>
    /// 随身Sell商店格子滑动数据更新回调
    /// </summary>
    /// <param name="data"></param>
    /// <param name="index"></param>
    private void OnSellShopGridUpdate(UIGridBase data, int index)
    {
        UIItemGrid itemGrid = data as UIItemGrid;

        if (sellShopSelectIds.ContainsValue(index))
        {
            uint id = 0;
            foreach (KeyValuePair <uint, int> pair in sellShopSelectIds)
            {
                if (pair.Value == index)
                {
                    id = pair.Key;
                    break;
                }
            }
            BaseItem itemData = imgr.GetBaseItemByQwThisId(id);
            itemGrid.SetGridData(UIItemInfoGridBase.InfoGridType.None, itemData);
        }
        else
        {
            itemGrid.SetGridData(UIItemInfoGridBase.InfoGridType.None, null);
        }
    }
Beispiel #5
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);
            }
        }
    }