예제 #1
0
 /// <summary>
 /// grid点击事件
 /// </summary>
 /// <param name="eventType"></param>
 /// <param name="data"></param>
 /// <param name="param"></param>
 private void OnGridUIEventDlg(UIEventType eventType, object data, object param)
 {
     switch (eventType)
     {
     case UIEventType.Click:
         if (data is UIHomeTradeBuyGrid)
         {
             UIHomeTradeBuyGrid buyGrid = data as UIHomeTradeBuyGrid;
             if (null != buyGrid)
             {
                 SetSelectItem(buyGrid.MallItemId);
             }
         }
         else if (data is UIHomeTradeSellGrid)
         {
             UIHomeTradeSellGrid sellGrid = data as UIHomeTradeSellGrid;
             if (null != sellGrid)
             {
                 SetSelectItem(sellGrid.MallItemId);
             }
         }
         else if (data is UITabGrid)
         {
             UITabGrid tabGrid = data as UITabGrid;
             if (null != tabGrid)
             {
                 SetSelectTab((uint)tabGrid.Data);
             }
         }
         break;
     }
 }
예제 #2
0
    /// <summary>
    /// 选中的商品
    /// </summary>
    /// <param name="id"></param>
    void SetSelectItem(uint id)
    {
        if (m_tradeType == ETradeType.ETradeType_Buy)
        {
            if (null != m_GridCreator)
            {
                UIHomeTradeBuyGrid grid = m_GridCreator.GetGrid <UIHomeTradeBuyGrid>(m_dicMallItem[m_nSelectTabId].IndexOf(m_nSelectMallItemId));
                if (null != grid)
                {
                    grid.SetHightLight(false);
                }
                grid = m_GridCreator.GetGrid <UIHomeTradeBuyGrid>(m_dicMallItem[m_nSelectTabId].IndexOf(id));
                if (null != grid)
                {
                    grid.SetHightLight(true);
                }
            }
        }

        if (m_tradeType == ETradeType.ETradeType_Sell)
        {
            if (null != m_GridCreator)
            {
                UIHomeTradeSellGrid grid = m_GridCreator.GetGrid <UIHomeTradeSellGrid>(m_dicMallItem[m_nSelectTabId].IndexOf(m_nSelectMallItemId));
                if (null != grid)
                {
                    grid.SetHightLight(false);
                }
                grid = m_GridCreator.GetGrid <UIHomeTradeSellGrid>(m_dicMallItem[m_nSelectTabId].IndexOf(id));
                if (null != grid)
                {
                    grid.SetHightLight(true);
                }
            }
        }

        //重置购买数量
        m_nPurchaseNum           = 1;
        this.m_nSelectMallItemId = id;
        UpdatePurchaseInfo();
    }
예제 #3
0
    /// <summary>
    /// 买格子数据刷新
    /// </summary>
    /// <param name="grid"></param>
    /// <param name="index"></param>
    private void OnUpdateGridData(UIGridBase grid, int index)
    {
        //买
        if (grid is UIHomeTradeBuyGrid)
        {
            if (index >= m_dicMallItem[m_nSelectTabId].Count)
            {
                Engine.Utility.Log.Error("Out Of Index !!!");
                return;
            }

            UIHomeTradeBuyGrid buyGrid = grid as UIHomeTradeBuyGrid;
            if (buyGrid == null)
            {
                return;
            }

            HomeTradeDataBase htDb = GameTableManager.Instance.GetTableItem <HomeTradeDataBase>(m_dicMallItem[m_nSelectTabId][index]);//大管家
            if (htDb == null)
            {
                Engine.Utility.Log.Error("Can Not Find Data !!!");
                return;
            }

            SeedAndCubDataBase data = GameTableManager.Instance.GetTableItem <SeedAndCubDataBase>(htDb.itemID);//种子幼崽表中取
            if (data == null)
            {
                Engine.Utility.Log.Error("Can Not Find Data !!!");
                return;
            }

            buyGrid.SetGridData(htDb.indexId);
            buyGrid.SetIcon(data.icon);
            buyGrid.SetName(data.name);
            buyGrid.SetNum(htDb.pileNum);                                    //叠加数量
            buyGrid.SetPrice((GameCmd.MoneyType)htDb.moneyType, htDb.price); //现在的价格
            bool select = (htDb.indexId == m_nSelectMallItemId) ? true : false;
            buyGrid.SetHightLight(select);
            //buyGrid.SetTag("");
        }
        //卖
        else if (grid is UIHomeTradeSellGrid)
        {
            if (index >= m_dicMallItem[m_nSelectTabId].Count)
            {
                Engine.Utility.Log.Error("Out Of Index !!!");
                return;
            }

            UIHomeTradeSellGrid sellGrid = grid as UIHomeTradeSellGrid;
            if (sellGrid == null)
            {
                return;
            }

            HomeTradeDataBase htDb = GameTableManager.Instance.GetTableItem <HomeTradeDataBase>(m_dicMallItem[m_nSelectTabId][index]);
            if (htDb == null)
            {
                Engine.Utility.Log.Error("Can Not Find Data !!!");
                return;
            }

            ItemDataBase data = GameTableManager.Instance.GetTableItem <ItemDataBase>(htDb.itemID);//item表中取
            if (data == null)
            {
                Engine.Utility.Log.Error("Can Not Find Data !!!");
                return;
            }

            CropLivestock cropLivestock = m_dicCropLivestock[data.itemID];

            sellGrid.SetGridData(htDb.indexId);
            sellGrid.SetIcon(data.itemIcon);
            sellGrid.SetName(data.itemName);
            sellGrid.SetNum(htDb.pileNum);                                                                                                             //叠加数量
            sellGrid.SetPrice((GameCmd.MoneyType)htDb.moneyType, (uint)cropLivestock.m_nPrice, cropLivestock.m_fPriceChangeRate, cropLivestock.m_bUp); //现在的价格
            bool select = (htDb.indexId == m_nSelectMallItemId) ? true : false;
            sellGrid.SetHightLight(select);
            //buyGrid.SetTag("");
        }
        //页签
        else if (grid is UITabGrid)
        {
            if (index > m_lstHomeTradeTab.Count)
            {
                Engine.Utility.Log.Error("Can Not Find Data !!!");
                return;
            }

            UITabGrid tabGrid = grid as UITabGrid;
            if (grid == null)
            {
                return;
            }

            tabGrid.SetGridData(m_lstHomeTradeTab[index]);
            tabGrid.SetName(m_dicHomeTradeTab[m_lstHomeTradeTab[index]]);
            bool select = m_lstHomeTradeTab[index] == m_nSelectTabId ? true : false;
            tabGrid.SetHightLight(select);
        }
    }