Ejemplo n.º 1
0
    /// <summary>
    /// 商城格子数据刷新
    /// </summary>
    /// <param name="grid"></param>
    /// <param name="index"></param>
    private void OnUpdateMallGridData(UIGridBase grid, int index)
    {
        if (grid is UIMallGrid)
        {
            if (index >= m_lst_mallDatas.Count)
            {
                Engine.Utility.Log.Error("MallPanel OnUpdateMallGridData faield,m_lst_mallDatas data errir");
                return;
            }

            UIMallGrid mallGrid           = grid as UIMallGrid;
            MallDefine.MallLocalData data = DataManager.Manager <MallManager>().GetMallLocalDataByMallItemId(m_lst_mallDatas[index]);
            if (null == data)
            {
                Engine.Utility.Log.Error("MallPanel OnUpdateMallGridData faield,mall data errir index:{0}", index);
                return;
            }
            mallGrid.SetGridData(data.MallId);
            bool select = (data.MallId == selectMallItemId) ? true : false;
            mallGrid.SetHightLight(select);
        }
        else if (grid is UITabGrid)
        {
            if (index > m_lst_mallTabDatas.Count)
            {
                Engine.Utility.Log.Error("MallPanel OnUpdateMallGridData faield,m_lst_mallTabDatas data errir");
                return;
            }
            int       tabKey     = m_lst_mallTabDatas[index];
            int       startDepth = 2 + m_lst_mallTabDatas.Count * 2 - index * 2;
            UITabGrid tabGrid    = grid as UITabGrid;
            tabGrid.SetName(DataManager.Manager <MallManager>().GetMallTagName((int)activeStore, tabKey));
            tabGrid.SetHightLight(activeTabId == tabKey ? true : false);
            tabGrid.SetGridData(tabKey);
            tabGrid.SetDepth(startDepth);
        }
        else if (grid is UIToggleGrid)
        {
            UIToggleGrid tog      = grid as UIToggleGrid;
            uint         shopID   = DataManager.Manager <Mall_NpcShopManager>().GetNpcShopKey(index);
            string       shopName = DataManager.Manager <Mall_NpcShopManager>().GetNpcShopName(index);
            tog.SetName(shopName);
            tog.SetHightLight((uint)activeStore == shopID?true:false);
            tog.SetGridTab((int)shopID);
        }
    }
Ejemplo n.º 2
0
    /// <summary>
    /// 随身商店格子滑动数据更新回调
    /// </summary>
    /// <param name="data"></param>
    /// <param name="index"></param>
    private void OnCarryShopGridDataUpdate(UIGridBase grid, int index)
    {
        if (grid is UIMallGrid)
        {
            if (index >= m_lst_shopids.Count)
            {
                Engine.Utility.Log.Error("KnapsackPanel OnCarryShopGridDataUpdate faield,mallItemIdsDic data errir");
                return;
            }

            UIMallGrid mallGrid           = grid as UIMallGrid;
            MallDefine.MallLocalData data = DataManager.Manager <MallManager>().GetMallLocalDataByMallItemId(m_lst_shopids[index]);
            if (null == data)
            {
                Engine.Utility.Log.Error("KnapsackPanel OnCarryShopGridDataUpdate faield,mall data errir index:{0}", index);
                return;
            }
            mallGrid.SetGridData(data.MallId);
            bool select = (data.MallId == selectMallItemId) ? true : false;
            mallGrid.SetHightLight(select);
        }
        else if (grid is UITabGrid)
        {
            if (index > m_lst_shoptabs.Count)
            {
                Engine.Utility.Log.Error("KnapsackPanel OnCarryShopGridDataUpdate faield,mallTabDic data errir");
                return;
            }
            int       tabKey     = m_lst_shoptabs[index];
            int       startDepth = 2 + m_lst_shoptabs.Count * 2 - index * 2;
            UITabGrid tabGrid    = grid as UITabGrid;
            tabGrid.SetHightLight(activeTabId == tabKey ? true : false);
            tabGrid.SetGridData(tabKey);
            tabGrid.SetName(DataManager.Manager <MallManager>().GetMallTagName((int)GameCmd.CommonStore.CommonStore_Three, tabKey));
            tabGrid.SetDepth(startDepth);
        }
    }