Esempio n. 1
0
    /// <summary>
    /// 根据id 获得某个收集品
    /// </summary>
    /// <returns>The collection info.</returns>
    /// <param name="id">Identifier.</param>
    public BCCollectionInfo GetCollectionInfo(int id)
    {
        BCCollectionInfo bc = null;

        dicCollection.TryGetValue(id, out bc);
        return(bc);
    }
Esempio n. 2
0
    public void FreshSellGroupWithID(int id1, int id2, int id3, int max)
    {
        maxCount = max;
        itemID1  = id1;
        itemID2  = id2;
        itemID3  = id3;
        WGDataController _dataCtrl = WGDataController.Instance;

        col1       = _dataCtrl.GetCollectionInfo(itemID1);
        col2       = _dataCtrl.GetCollectionInfo(itemID2);
        col3       = _dataCtrl.GetCollectionInfo(itemID3);
        mSellCount = max;
        freshSellView();
    }
    public void InitScrollView()
    {
        if (bInit)
        {
            return;
        }
        bInit     = true;
        _dataCtrl = WGDataController.Instance;


        Dictionary <int, List <int> > dicCollections = new Dictionary <int, List <int> >();

        for (int i = 0; i < _dataCtrl.szCollectionObj.Count; i++)
        {
            BCObj            obj = _dataCtrl.szCollectionObj[i];
            BCCollectionInfo col = _dataCtrl.GetCollectionInfo(obj.ID);
            List <int>       szTemp;
            if (dicCollections.TryGetValue(col.groupID, out szTemp))
            {
                szTemp.Add(obj.ID);
            }
            else
            {
                szTemp = new List <int>();
                szTemp.Add(obj.ID);
                dicCollections.Add(col.groupID, szTemp);
            }
        }
        int index = 0;

        foreach (KeyValuePair <int, List <int> > kvp in dicCollections)
        {
            CItemCollectionCell cell = CItemCollectionCell.CreateCollectionCell();
            cell.transform.parent        = this.transform;
            cell.transform.localScale    = Vector3.one;
            cell.transform.localPosition = new Vector3(0, 200 - index * 236, 0);

            szCollectionCell.Add(cell);

            Color color = Color.gray;
            if (index <= szColors.Length)
            {
                color = szColors[index];
            }
            cell.freshWithCollections(kvp.Value.ToArray(), szColors[index]);
            cell.SetDragCamera(dragCamera);
            index++;
        }
    }
Esempio n. 4
0
    public void freshItem()
    {
        WGDataController _dataCtrl = WGDataController.Instance;


        Dictionary <int, List <int> > dicCollections = new Dictionary <int, List <int> >();

        for (int i = 0; i < _dataCtrl.szCollectionObj.Count; i++)
        {
            BCObj            obj = _dataCtrl.szCollectionObj[i];
            BCCollectionInfo col = _dataCtrl.GetCollectionInfo(obj.ID);
            List <int>       szTemp;
            if (dicCollections.TryGetValue(col.groupID, out szTemp))
            {
                szTemp.Add(obj.ID);
            }
            else
            {
                szTemp = new List <int>();
                szTemp.Add(obj.ID);
                dicCollections.Add(col.groupID, szTemp);
            }
        }
        int  index    = 0;
        bool showTips = false;

        foreach (KeyValuePair <int, List <int> > kvp in dicCollections)
        {
            int [] ids = kvp.Value.ToArray();
            if (ids.Length >= 3)
            {
                int left   = _dataCtrl.GetCollectionOwnNum(ids[0]);
                int center = _dataCtrl.GetCollectionOwnNum(ids[1]);
                int right  = _dataCtrl.GetCollectionOwnNum(ids[2]);
                if (Mathf.Min(left, center, right) > 0)
                {
                    showTips = true;
                    break;
                }
            }
        }
        spItemComplet.ESetActive(showTips);
    }
    void freshWithThreeCollection(int id1, int id2, int id3, Color color)
    {
        mObjID1 = id1;
        mObjID2 = id2;
        mObjID3 = id3;

        spTitleBackground.color = color;
        WGDataController _dataCtrl = WGDataController.Instance;
        int numleft   = _dataCtrl.GetCollectionOwnNum(id1);
        int numMiddle = _dataCtrl.GetCollectionOwnNum(id2);
        int numRight  = _dataCtrl.GetCollectionOwnNum(id3);

        mCanSellNum = Mathf.Min(numleft, numMiddle, numRight);

        BCCollectionInfo bci = WGDataController.Instance.GetCollectionInfo(id1);

        labGroupName.text = bci.groupdes;
        labGroupNum.text  = mCanSellNum.ToString();

        CItemCollectionCellView leftCell = CItemCollectionCellView.CreateCollectionCellView();

        AddCell(leftCell.gameObject, goLeft);
        leftCell.freshWithCollectionID(id1, color);
        szItemColCell.Add(leftCell);

        CItemCollectionCellView middelCell = CItemCollectionCellView.CreateCollectionCellView();

        AddCell(middelCell.gameObject, goMiddel);
        middelCell.freshWithCollectionID(id2, color);
        szItemColCell.Add(middelCell);

        CItemCollectionCellView rightCell = CItemCollectionCellView.CreateCollectionCellView();

        AddCell(rightCell.gameObject, goRight);
        rightCell.freshWithCollectionID(id3, color);
        szItemColCell.Add(rightCell);
    }