Esempio n. 1
0
    /// <summary>
    /// 填充建造类型数据
    /// </summary>
    public void FillData(ShipBuildType type)
    {
        m_shipBuildType = type;
        switch (type)
        {
        case ShipBuildType.BuildRoom:
            warehouseBuildList = BuildDC.GetBuildingList(AttributeType.ALL);
            break;

        case ShipBuildType.Soldier:
            SoldierDC.GetSoldiers(ref soldierList, CombatLoactionType.ALL);
            break;

        default:
            break;
        }
    }
Esempio n. 2
0
    /// <summary>
    /// 设置建筑数据
    /// </summary>
    public void UpdateData()
    {
        m_Build.Clear();
        m_CannotSumBuild.Clear();
        m_CanSumBuild.Clear();
        List <BuildInfo> s_allBuild = buildingM.GetAllBuildInfo();

        foreach (BuildInfo item in s_allBuild)
        {
            if (item.BuildType == 1201 || item.BuildType >= 9990)
            {
                continue;
            }

            BuildInfo exitInfo = BuildDC.SearchBuilding(item.BuildType);
            if (exitInfo == null)
            {
                bool canSum = buildingM.CheckCanSummon(item.BuildType);
                if (canSum)
                {
                    m_CanSumBuild.Add(item);
                }
                else
                {
                    m_CannotSumBuild.Add(item);
                }
            }
        }
        List <BuildInfo> lWareInfo = BuildDC.GetBuildingList(AttributeType.ALL);

        foreach (BuildInfo Ware in lWareInfo)
        {
            if (Ware == null || Ware.BuildType == 1201)
            {
                continue;
            }
            m_Build.Add(Ware);
        }

        BuildDC.SortBuildList(ref m_Build);
        BuildDC.SortBuildList(ref m_CanSumBuild);
        BuildDC.SortCanNotExitBuildList(ref m_CannotSumBuild);
        //更新UI
        SetUI();
    }
Esempio n. 3
0
 /// <summary>
 /// 填充陷阱和兵数据
 /// </summary>
 private void FillTrapData(AttributeType type)
 {
     warehouseBuildList = BuildDC.GetBuildingList(type);
 }
Esempio n. 4
0
 /// <summary>
 /// 获取<船上或仓库>建筑、士兵和楼梯数据 (最核心的一个接口)
 /// </summary>
 public ShipPutInfo GetShipBuildInfo(CanvasCore Core)
 {
     if (Core == null)
     {
         return(null);
     }
     if (!Core.IsNewCreate)
     {
         List <ShipPutInfo> l = new List <ShipPutInfo>();
         if (Core.m_type == ShipBuildType.Soldier)
         {
             l = m_Soldiers;
             for (int i = 0; i < l.Count; i++)
             {
                 if (l[i].id == Core.m_ID)
                 {
                     return(l[i]);
                 }
             }
         }
         else if (Core.m_type == ShipBuildType.BuildRoom)
         {
             l = m_RoomBuildings;
             for (int i = 0; i < l.Count; i++)
             {
                 if (l[i].id == Core.m_ID)
                 {
                     return(l[i]);
                 }
             }
         }
         else if (Core.m_type == ShipBuildType.BuildStair)
         {
             l = m_StairBuildings;
             for (int i = 0; i < l.Count; i++)
             {
                 if (l[i].id == Core.m_ID)
                 {
                     return(l[i]);
                 }
             }
         }
     }
     else
     {
         if (Core.m_type == ShipBuildType.Soldier)
         {
             return(new ShipPutInfo(Core.m_ID, Core.m_DataID));
         }
         else if (Core.m_type == ShipBuildType.BuildRoom)
         {
             List <BuildInfo> l = BuildDC.GetBuildingList(AttributeType.ALL);
             for (int i = 0; i < l.Count; i++)
             {
                 if (l[i].ID == Core.m_DataID)
                 {
                     return(new ShipPutInfo(Core.m_ID, l[i]));
                 }
             }
         }
     }
     return(null);
 }