コード例 #1
0
 /// <summary>
 /// 二级页签刷新回调
 /// </summary>
 /// <param name="grid"></param>
 /// <param name="id"></param>
 /// <param name="index"></param>
 private void OnUpdateSecondTabGrid(UIGridBase grid, object id, int index)
 {
     if (grid is UISecondTypeGrid)
     {
         UISecondTypeGrid sGrid = grid as UISecondTypeGrid;
         sGrid.SetRedPoint(false);
         uint             cid  = (uint)id;
         CategoryTypeData fctd = null;
         if (cid == 0)
         {
             fctd = new CategoryTypeData(0, "可合成");
         }
         else
         {
             fctd = m_mgr.GetCategoryTypeDataByType(CategoryTypeData.CategoryType.First
                                                    , cid);
         }
         CategoryTypeData sctd = m_mgr.GetCategoryTypeDataByType(CategoryTypeData.CategoryType.Second
                                                                 , fctd.GetDataByIndex(index));
         if (null != sctd)
         {
             sGrid.SetData(sctd.m_uint_categoryId
                           , sctd.m_str_categoryName
                           , (m_uint_activeStype == sctd.m_uint_categoryId));
         }
     }
 }
コード例 #2
0
    /// <summary>
    /// 设置选中二级分页
    /// </summary>
    /// <param name="type"></param>
    /// <param name="force"></param>
    private void SetSelectSecondType(uint type, bool force = false)
    {
        if (null == mSecondTabCreator)
        {
            return;
        }
        if (m_uint_activeStype == type && !force)
        {
            return;
        }

        CategoryTypeData ftd   = m_mgr.GetCategoryTypeDataByType(CategoryTypeData.CategoryType.First, m_uint_activeFType);
        UISecondTypeGrid sGrid = null;

        if (null != ftd && m_uint_activeFType != 0)
        {
            sGrid = mSecondTabCreator.GetGrid <UISecondTypeGrid>(mlstFirstTabIds.IndexOf(m_uint_activeFType), ftd.IndexOf(m_uint_activeStype));
            if (null != sGrid)
            {
                sGrid.SetHightLight(false);
            }
        }

        m_uint_activeStype = type;
        if (null != ftd && m_uint_activeFType != 0)
        {
            sGrid = mSecondTabCreator.GetGrid <UISecondTypeGrid>(mlstFirstTabIds.IndexOf(m_uint_activeFType), ftd.IndexOf(m_uint_activeStype));
            if (null != sGrid)
            {
                sGrid.SetHightLight(true);
            }
        }
        BuildComposeList();
        UpdateComposeUI();
    }
コード例 #3
0
ファイル: ComposeManager.cs プロジェクト: zuojiashun/src
    /// <summary>
    /// 获取对应分类下的数据
    /// </summary>
    /// <param name="type">分类类型</param>
    /// <param name="typeId">分类id</param>
    /// <returns></returns>
    public List <uint> GetTypeDatas(CategoryTypeData.CategoryType type, uint typeId)
    {
        List <uint>      datas     = new List <uint>();
        CategoryTypeData cTypeData = GetCategoryTypeDataByType(type, typeId);

        if (null != cTypeData)
        {
            datas.AddRange(cTypeData.GetDatas());
        }
        datas.Sort();
        return(datas);
    }
コード例 #4
0
ファイル: ComposeManager.cs プロジェクト: zuojiashun/src
    /// <summary>
    /// 获取对应分类下的数据
    /// </summary>
    /// <param name="type">分类类型</param>
    /// <param name="typeId">分类id</param>
    /// <returns></returns>
    public CategoryTypeData GetCategoryTypeDataByType(CategoryTypeData.CategoryType type, uint typeId)
    {
        CategoryTypeData ctData = null;

        if (type == CategoryTypeData.CategoryType.First &&
            m_dic_fTypeDatas.TryGetValue(typeId, out ctData))
        {
            return(ctData);
        }
        else if (type == CategoryTypeData.CategoryType.Second &&
                 m_dic_sTypeDatas.TryGetValue(typeId, out ctData))
        {
            return(ctData);
        }
        return(null);
    }
コード例 #5
0
 /// <summary>
 /// shi
 /// </summary>
 /// <param name="composeId"></param>
 public void FocusComposeData(uint composeId)
 {
     table.ComposeDataBase curDB
         = GameTableManager.Instance.GetTableItem <table.ComposeDataBase>(composeId);
     if (null != curDB)
     {
         CategoryTypeData ctd = m_mgr.GetCategoryTypeDataByType(CategoryTypeData.CategoryType.First, curDB.fType);
         if (null != mSecondTabCreator && null != ctd)
         {
             uint secondType = m_mgr.BuildComposeSecondsKey(curDB.fType, curDB.sType);
             SetSelectFirstType(curDB.fType, true);
             SetSelectSecondType(secondType, true);
             mSecondTabCreator.FocusData(mlstFirstTabIds.IndexOf(curDB.fType), ctd.IndexOf(secondType));
         }
         SetSelectId(composeId);
     }
 }
コード例 #6
0
    /// <summary>
    /// 设置选中第一分页
    /// </summary>
    /// <param name="type"></param>
    private void SetSelectFirstType(uint type, bool force = false)
    {
        if (null == mSecondTabCreator)
        {
            return;
        }
        if (m_uint_activeFType == type && !force)
        {
            mSecondTabCreator.DoToggle(mlstFirstTabIds.IndexOf(m_uint_activeFType), true, true);
            return;
        }
        m_uint_activeFType = type;
        mSecondTabCreator.Open(mlstFirstTabIds.IndexOf(m_uint_activeFType), true);
        CategoryTypeData ctd = m_mgr.GetCategoryTypeDataByType(CategoryTypeData.CategoryType.First, m_uint_activeFType);
        uint             selectSecondsKey = 0;

        if (null != ctd && ctd.GetDatas().Count != 0)
        {
            selectSecondsKey = ctd.GetDatas()[0];
        }
        SetSelectSecondType(selectSecondsKey, m_uint_activeStype == 0);
    }
コード例 #7
0
 /// <summary>
 /// 格子更新
 /// </summary>
 /// <param name="gridBase"></param>
 /// <param name="index"></param>
 private void OnGridUpdate(UIGridBase gridBase, int index)
 {
     if (gridBase is UIComposeGrid)
     {
         UIComposeGrid cGrid = gridBase as UIComposeGrid;
         if (m_list_composeDatas.Count > index)
         {
             cGrid.SetGridData(m_list_composeDatas[index]);
             cGrid.SetHightLight(m_uint_composeId == m_list_composeDatas[index]);
         }
     }
     else if (gridBase is UICtrTypeGrid)
     {
         if (index < mlstFirstTabIds.Count)
         {
             UICtrTypeGrid    ctg  = gridBase as UICtrTypeGrid;
             CategoryTypeData fctd = null;
             if (index == 0)
             {
                 fctd = new CategoryTypeData(0, "可合成");
                 ctg.EnableArrow(false);
             }
             else
             {
                 ctg.SetRedPointStatus(false);
                 fctd = m_mgr.GetCategoryTypeDataByType(CategoryTypeData.CategoryType.First
                                                        , mlstFirstTabIds[index]);
             }
             if (null != fctd)
             {
                 ctg.SetData(fctd.m_uint_categoryId
                             , fctd.m_str_categoryName
                             , fctd.Count);
             }
         }
     }
 }
コード例 #8
0
    /// <summary>
    /// 初始化
    /// </summary>
    private void InitWidgets()
    {
        if (initWidgets)
        {
            return;
        }
        initWidgets = true;

        m_mgr = DataManager.Manager <ComposeManager>();
        Transform clone = null;

        if (null != m_trans_UIIFGTarget && null == m_targetNeedGrid)
        {
            clone = m_trans_UIIFGTarget.GetChild(0);
            if (null != clone)
            {
                m_targetNeedGrid = clone.GetComponent <UIComposeNeedGrid>();
                if (null == m_targetNeedGrid)
                {
                    m_targetNeedGrid = clone.gameObject.AddComponent <UIComposeNeedGrid>();
                }
            }
            m_targetNeedGrid.RegisterUIEventDelegate(OnGridEventDlg);
        }

        if (null != m_trans_UIIFGCost1 && null == m_costNeedGrid1)
        {
            clone = m_trans_UIIFGCost1.GetChild(0);
            if (null != clone)
            {
                Util.AddChildToTarget(m_trans_UIIFGCost1, clone);
                m_costNeedGrid1 = clone.GetComponent <UIComposeNeedGrid>();
                if (null == m_costNeedGrid1)
                {
                    m_costNeedGrid1 = clone.gameObject.AddComponent <UIComposeNeedGrid>();
                }
            }
            m_costNeedGrid1.RegisterUIEventDelegate(OnGridEventDlg);
        }

        if (null != m_trans_UIIFGCost2 && null == m_costNeedGrid2)
        {
            clone = m_trans_UIIFGCost2.GetChild(0);
            if (null != clone)
            {
                Util.AddChildToTarget(m_trans_UIIFGCost2, clone);
                m_costNeedGrid2 = clone.GetComponent <UIComposeNeedGrid>();
                if (null == m_costNeedGrid2)
                {
                    m_costNeedGrid2 = clone.gameObject.AddComponent <UIComposeNeedGrid>();
                }
            }
            m_costNeedGrid2.RegisterUIEventDelegate(OnGridEventDlg);
        }

        if (null != m_trans_UIIFGCost3 && null == m_costNeedGrid3)
        {
            clone = m_trans_UIIFGCost3.GetChild(0);
            if (null != clone)
            {
                Util.AddChildToTarget(m_trans_UIIFGCost3, clone);
                m_costNeedGrid3 = clone.GetComponent <UIComposeNeedGrid>();
                if (null == m_costNeedGrid3)
                {
                    m_costNeedGrid3 = clone.gameObject.AddComponent <UIComposeNeedGrid>();
                }
            }
            m_costNeedGrid3.RegisterUIEventDelegate(OnGridEventDlg);
        }

        if (null != m_trans_UIIFGCost4 && null == m_costNeedGrid4)
        {
            clone = m_trans_UIIFGCost4.GetChild(0);
            if (null != clone)
            {
                Util.AddChildToTarget(m_trans_UIIFGCost4, clone);
                m_costNeedGrid4 = clone.GetComponent <UIComposeNeedGrid>();
                if (null == m_costNeedGrid4)
                {
                    m_costNeedGrid4 = clone.gameObject.AddComponent <UIComposeNeedGrid>();
                }
            }
            m_costNeedGrid4.RegisterUIEventDelegate(OnGridEventDlg);
        }

        if (null != m_trans_UIIFGCost5 && null == m_costNeedGrid5)
        {
            clone = m_trans_UIIFGCost5.GetChild(0);
            if (null != clone)
            {
                Util.AddChildToTarget(m_trans_UIIFGCost5, clone);
                m_costNeedGrid5 = clone.GetComponent <UIComposeNeedGrid>();
                if (null == m_costNeedGrid5)
                {
                    m_costNeedGrid5 = clone.gameObject.AddComponent <UIComposeNeedGrid>();
                }
            }
            m_costNeedGrid5.RegisterUIEventDelegate(OnGridEventDlg);
        }

        if (null != m_trans_SingleCompoundCurrency && null == m_composeSingleC)
        {
            m_composeSingleC = m_trans_SingleCompoundCurrency.GetComponent <UICurrencyGrid>();
            if (null == m_composeSingleC)
            {
                m_composeSingleC = m_trans_SingleCompoundCurrency.gameObject.AddComponent <UICurrencyGrid>();
            }
        }
        if (null != m_trans_CompoundAllCurrency && null == m_composeAllC)
        {
            m_composeAllC = m_trans_CompoundAllCurrency.GetComponent <UICurrencyGrid>();
            if (null == m_composeAllC)
            {
                m_composeAllC = m_trans_CompoundAllCurrency.gameObject.AddComponent <UICurrencyGrid>();
            }
        }


        //构建1级2级分类页签
        if (null != m_scrollview_TypeScrollView && null == mSecondTabCreator)
        {
            mSecondTabCreator = m_scrollview_TypeScrollView.GetComponent <UISecondTabCreatorBase>();
            if (null != mSecondTabCreator)
            {
                GameObject cloneFTemp = UIManager.GetResGameObj(GridID.Uictrtypegrid) as GameObject;
                GameObject cloneSTemp = UIManager.GetResGameObj(GridID.Uisecondtypegrid) as GameObject;
                mSecondTabCreator.Initialize <UISecondTypeGrid>(cloneFTemp, cloneSTemp
                                                                , OnGridUpdate, OnUpdateSecondTabGrid, OnGridEventDlg);
            }
        }

        if (null == mlstFirstTabIds)
        {
            mlstFirstTabIds = new List <uint>();
        }
        mlstFirstTabIds.Clear();

        List <CategoryTypeData> firstTabDatas = new List <CategoryTypeData>();

        firstTabDatas = m_mgr.GetCategoryTypeDatasByFirstType();
        if (null == firstTabDatas ||
            firstTabDatas.Count == 0)
        {
            Engine.Utility.Log.Error("ComposePanel InitWidgets Error,get cateoryTypeData null");
            return;
        }

        firstTabDatas.Sort((left, right) =>
        {
            return((int)left.m_uint_categoryId - (int)right.m_uint_categoryId);
        });
        List <int>       secondTabsNums = new List <int>();
        CategoryTypeData ctData         = null;
        int num = 0;

        for (int i = 0; i < firstTabDatas.Count; i++)
        {
            ctData = firstTabDatas[i];
            num    = (null != ctData) ? ctData.Count : 0;
            secondTabsNums.Add(num);
            if (!mlstFirstTabIds.Contains(firstTabDatas[i].m_uint_categoryId))
            {
                mlstFirstTabIds.Add(firstTabDatas[i].m_uint_categoryId);
            }
        }

        if (null != mSecondTabCreator)
        {
            mSecondTabCreator.CreateGrids(secondTabsNums);
        }

        SetSelectFirstType(0, true);
        UpdateCanComposeRedPoint();
    }