Exemplo n.º 1
0
    public IUnit2ConfItem GetNextGradeConfItem(IUnit2ConfItem item)
    {
        Dictionary <int, Dictionary <int, IUnit2ConfItem> > node = GetAllUnitTreeNode();

        if (node.ContainsKey(item.GetUnitId()) && node[item.GetUnitId()] != null && node[item.GetUnitId()].ContainsKey(item.GetGrade() + 1))
        {
            return(node[item.GetUnitId()][item.GetGrade() + 1]);
        }
        return(null);
    }
Exemplo n.º 2
0
 private int GetUnitTreeStartLv(int unitTreeId)
 {
     if (!m_startLvIndex.ContainsKey(unitTreeId))
     {
         int startlv = int.MaxValue;
         foreach (int unitId in GetUnitTreeLine(unitTreeId))
         {
             IUnit2ConfItem confItem = AW.GetSingleton <IDataAdapter>().GetUnit2ConfItem(unitId, 1);
             startlv = Mathf.Min(startlv, confItem.GetUnlockCommandLevel());
         }
         m_startLvIndex.Add(unitTreeId, startlv);
     }
     return(m_startLvIndex[unitTreeId]);
 }
Exemplo n.º 3
0
    public KeyValuePair <int, int> GetUnitTreePosition(int unitTreeId, IUnit2ConfItem confitem)
    {
        KeyValuePair <int, int> confitemNode = new KeyValuePair <int, int>(confitem.GetUnitId(), confitem.GetUnlockCommandLevel());

        if (!m_unitTreePositionIndex.ContainsKey(unitTreeId))
        {
            m_unitTreePositionIndex.Add(unitTreeId, new Dictionary <KeyValuePair <int, int>, KeyValuePair <int, int> >());
        }
        if (!m_unitTreePositionIndex[unitTreeId].ContainsKey(confitemNode))
        {
            List <int> columnList = GetUnitTreeColumn(unitTreeId);
            List <int> lineList   = GetUnitTreeLine(unitTreeId);
            int        key        = lineList.FindIndex(delegate(int id) { return(confitemNode.Key == id); }) + 1;
            int        value      = columnList.FindIndex(delegate(int level) { return(confitemNode.Value == level); }) + 1;
            m_unitTreePositionIndex[unitTreeId].Add(confitemNode, new KeyValuePair <int, int>(key, value));
        }
        return(m_unitTreePositionIndex[unitTreeId][confitemNode]);
    }
Exemplo n.º 4
0
 public Dictionary <int, List <IUnit2ConfItem> > GetUnitTreeNode(int unitTreeId)
 {
     if (!m_unitTreeNodeIndex.ContainsKey(unitTreeId))
     {
         List <int> lines = GetUnitTreeLine(unitTreeId);
         Dictionary <int, List <IUnit2ConfItem> > unitTreeLineIndex = new Dictionary <int, List <IUnit2ConfItem> >();
         foreach (int unitId in lines)
         {
             List <IUnit2ConfItem> items = new List <IUnit2ConfItem>();
             IUnit2ConfItem        item  = AW.GetSingleton <IDataAdapter>().GetUnit2ConfItem(unitId, 1);
             do
             {
                 items.Add(item);
                 item = item.GetUpLevelItem();
             }while (item != null);
             unitTreeLineIndex.Add(unitId, items);
         }
         m_unitTreeNodeIndex.Add(unitTreeId, unitTreeLineIndex);
     }
     return(m_unitTreeNodeIndex[unitTreeId]);
 }