Exemplo n.º 1
0
    //获取当前可以显示的美人列表,当前阵上的那个美人单独处理
    public List <SelectBelleData> GetSelectBelleListByBelleId()
    {
        List <SelectBelleData> selectBelleDataList = new List <SelectBelleData>();

        foreach (int belleId in TableManager.GetBelle().Keys)
        {
            if (BelleData.OwnedBelleMap.ContainsKey(belleId))
            {
                SelectBelleData selectBelleData = new SelectBelleData();
                selectBelleData.CleanUp();
                selectBelleData.belleID  = belleId;
                selectBelleData.matrixId = BelleData.OwnedBelleMap[belleId].matrixID;
                BelleData.OwnedBelleMap[belleId].UpdateAttrMap();
                selectBelleData.combatValue = BelleData.GetPowerNum(BelleData.OwnedBelleMap[belleId].attrMap);
                bool isAdd = true;
                for (int i = 0; i < hasInMatirxBelles.Count; i++)
                {
                    //已经在当前阵上上阵的就不添加了。
                    if (hasInMatirxBelles[i] == belleId)
                    {
                        isAdd = false;
                    }
                    //羁绊关系添加
                    Tab_Belle _belleTab = TableManager.GetBelleByID(hasInMatirxBelles[i], 0);
                    if (null != _belleTab)
                    {
                        for (int j = 0; j < _belleTab.getAffectionConditonTypeCount(); j++)
                        {
                            if (BELLE_AFFECTION_TYPE == _belleTab.GetAffectionConditonTypebyIndex(j))
                            {
                                int belleIdRelation = _belleTab.GetAffectionConditonValuebyIndex(j);
                                if (belleIdRelation == belleId)
                                {
                                    selectBelleData.isRelationship = true;
                                }
                            }
                        }
                    }
                }
                if (isAdd)
                {
                    selectBelleDataList.Add(selectBelleData);
                }
            }
        }
        selectBelleDataList.Sort();
        return(selectBelleDataList);
    }
Exemplo n.º 2
0
    public List <SelectBelleData> GetSelectBellelistByBelleIds(List <int> belleIds)
    {
        List <SelectBelleData> selectBelleDataList = new List <SelectBelleData>();

        if (belleIds == null && belleIds.Count == 0)
        {
            return(selectBelleDataList);
        }
        foreach (int belleId in TableManager.GetBelle().Keys)
        {
            if (BelleData.OwnedBelleMap.ContainsKey(belleId))
            {
                SelectBelleData selectBelleData = new SelectBelleData();
                selectBelleData.CleanUp();
                selectBelleData.belleID     = belleId;
                selectBelleData.matrixId    = BelleData.OwnedBelleMap[belleId].matrixID;
                selectBelleData.combatValue = BelleData.GetPowerNum(BelleData.OwnedBelleMap[belleId].attrMap);
                for (int i = 0; i < belleIds.Count; i++)
                {
                    Tab_Belle _belleTab = TableManager.GetBelleByID(belleIds[i], 0);
                    if (null != _belleTab)
                    {
                        for (int j = 0; j < _belleTab.getAffectionConditonTypeCount(); j++)
                        {
                            if (BELLE_AFFECTION_TYPE == _belleTab.GetAffectionConditonTypebyIndex(j))
                            {
                                int belleIdRelation = _belleTab.GetAffectionConditonValuebyIndex(j);
                                if (belleIdRelation == belleId)
                                {
                                    selectBelleData.isRelationship = true;
                                }
                            }
                        }
                    }
                }

                selectBelleDataList.Add(selectBelleData);
            }
        }
        selectBelleDataList.Sort();
        return(selectBelleDataList);
    }
Exemplo n.º 3
0
    public List <RecommondBelleData> GetRecommondBellesByBelleId(List <int> belleIds)
    {
        List <int> retBelles = new List <int>();
        List <RecommondBelleData> RecommBelleDataList = new List <RecommondBelleData>();

        if (belleIds == null || belleIds.Count == 0)
        {
            return(RecommBelleDataList);
        }

        //find has relationship belleIds with belleIds that has in Matrix and is owned!
        HashSet <int> hasRelationShipSets = new HashSet <int>();

        for (int i = 0; i < belleIds.Count; i++)
        {
            Tab_Belle _belleTab = TableManager.GetBelleByID(belleIds[i], 0);
            if (null != _belleTab)
            {
                for (int j = 0; j < _belleTab.getAffectionConditonTypeCount(); j++)
                {
                    if (BELLE_AFFECTION_TYPE == _belleTab.GetAffectionConditonTypebyIndex(j))
                    {
                        int belleId = _belleTab.GetAffectionConditonValuebyIndex(j);
                        if (BelleData.OwnedBelleMap.ContainsKey(belleId) && !retBelles.Contains(belleId) && !belleIds.Contains(belleId))
                        {
                            retBelles.Add(belleId);
                            if (!hasRelationShipSets.Contains(belleId))
                            {
                                hasRelationShipSets.Add(belleId);
                            }
                        }
                    }
                }
            }
        }

        //在加上那些跟当前美人没有亲密关系,但拥有的美人但没有上阵的
        foreach (var belle in BelleData.OwnedBelleMap)
        {
            if (!retBelles.Contains(belle.Value.id) && !belleIds.Contains(belle.Value.id) && belle.Value.matrixID == -1 && belle.Value.matrixIndex == -1)
            {
                retBelles.Add(belle.Value.id);
            }
        }

        //Debug 一下数据////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        string str = "";

        for (int i = 0; i < retBelles.Count; i++)
        {
            str += retBelles[i] + " ";
        }
        LogModule.DebugLog(str);
        if (retBelles.Count > 0)
        {
            for (int i = 0; i < retBelles.Count; i++)
            {
                if (BelleData.OwnedBelleMap.ContainsKey(retBelles[i]))
                {
                    RecommondBelleData _recommonData = new RecommondBelleData();
                    _recommonData.CleanUp();
                    Belle _belle = BelleData.OwnedBelleMap[retBelles[i]];
                    _recommonData.BelleID         = _belle.id;
                    _recommonData.isMatrix        = _belle.matrixID != -1 ? 1 : 0;
                    _recommonData.hasRelationship = hasRelationShipSets.Contains(retBelles[i])? 1 : 0;
                    _belle.UpdateAttrMap();
                    _recommonData.combatValue = BelleData.GetPowerNum(_belle.attrMap);
                    if (!RecommBelleDataList.Contains(_recommonData))
                    {
                        RecommBelleDataList.Add(_recommonData);
                    }
                }
            }
        }
        RecommBelleDataList.Sort();
        return(RecommBelleDataList);
    }