/// <summary> /// 获取船上数据 /// </summary> public List <ShipPutInfo> GetShipBuildInfo(ShipBuildType type) { List <ShipPutInfo> l = new List <ShipPutInfo>(); if (type == ShipBuildType.BuildRoom || type == ShipBuildType.All) { if (m_RoomBuildings.Count == 0) //当没有金库时,添加一个 { BuildInfo info = BuildDC.SearchBuilding(1300); if (info != null) { ShipPutInfo Build = new ShipPutInfo(ShipPutInfo.GetNewShipPutId(), info); Build.cyMapGrid = 0; Build.cxMapGrid = 24; AddShipBuildInfo(Build, ShipBuildType.BuildRoom); } } l.AddRange(m_RoomBuildings); } if (type == ShipBuildType.Soldier || type == ShipBuildType.All) { l.AddRange(m_Soldiers); } if (type == ShipBuildType.BuildStair || type == ShipBuildType.All) { l.AddRange(m_StairBuildings); } return(l); }
/// <summary> /// 获取船上数据 /// </summary> public void GetShipLifeObj(ref List <SoldierInfo> lSoldier, ref List <BuildInfo> lBuild, ref List <BuildInfo> lStair) { if (lSoldier == null) { lSoldier = new List <SoldierInfo>(); } lSoldier.Clear(); if (lBuild == null) { lBuild = new List <BuildInfo>(); } lBuild.Clear(); if (lStair == null) { lStair = new List <BuildInfo>(); } lStair.Clear(); if (m_RoomBuildings.Count == 0) //当没有金库时,添加一个 { BuildInfo info = BuildDC.SearchBuilding(1300); if (info != null) { ShipPutInfo Build = new ShipPutInfo(ShipPutInfo.GetNewShipPutId(), info); Build.cyMapGrid = 0; Build.cxMapGrid = 24; AddShipBuildInfo(Build, ShipBuildType.BuildRoom); lBuild.Add(info); } } else { //建筑 foreach (ShipPutInfo r in m_RoomBuildings) { BuildInfo info = r.GetBuildInfo(); if (info != null) { lBuild.Add(r.GetBuildInfo()); } } //炮弹兵 foreach (ShipPutInfo r in m_Soldiers) { SoldierInfo s = new SoldierInfo(); if (r.GetSoldier(ref s) == true) { lSoldier.Add(s); } } //楼梯 foreach (ShipPutInfo r in m_StairBuildings) { lStair.Add(r.GetBuildInfo()); } } }
/// <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(); }