Example #1
0
    /// <summary>
    /// 设置选中数据
    /// </summary>
    /// <param name="mallItemId"></param>
    public void SetSelectItemId(uint mallItemId, bool force = false, bool needFocus = false, bool isBackSpacing = false)
    {
        if (this.selectMallItemId == mallItemId && !force)
        {
            return;
        }
        if (null != m_ctor_MallScrollView)
        {
            UIMallGrid grid = m_ctor_MallScrollView.GetGrid <UIMallGrid>(m_lst_mallDatas.IndexOf(selectMallItemId));
            if (null != grid)
            {
                grid.SetHightLight(false);
            }
            grid = m_ctor_MallScrollView.GetGrid <UIMallGrid>(m_lst_mallDatas.IndexOf(mallItemId));
            if (null != grid)
            {
                grid.SetHightLight(true);
            }

            if (needFocus)
            {
                m_ctor_MallScrollView.FocusGrid(m_lst_mallDatas.IndexOf(mallItemId));
            }
        }
        //重置购买数量
        if (!isBackSpacing)
        {
            purchaseNum = 1;
        }
        this.selectMallItemId = mallItemId;
        //检测tag是否变化
        if (null != CurrentMallData)
        {
            CurrentMallData.CheckTagStatus();
        }
        ImmediatelyRefreshLeftTime();
        UpdatePurchaseInfo();
    }
Example #2
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);
        }
    }
Example #3
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);
        }
    }