Beispiel #1
0
    /// <summary>
    /// 移除一个房间
    /// </summary>
    public static void RemoveBuildRoom(CanvasCore Core)
    {
        if (Core == null)
        {
            return;
        }
        ShipPlan P = ShipPlanDC.GetCurShipPlan();

        if (P == null)
        {
            return;
        }
        ShipPutInfo Info = P.GetShipBuildInfo(Core);

        if (Info == null)
        {
            return;
        }

        if (Core.m_type == ShipBuildType.BuildRoom)
        {
            if (Core.IsDeckRoom == false)
            {
                if (Info.GetPutRoomShape() != null)
                {
                    List <CanvasCore> l = PutCanvasM.GetChildByCore(Core);
                    foreach (CanvasCore c in l)
                    {
                        ShipPutInfo II = P.GetShipBuildInfo(c);
                        if (II != null)
                        {
                            P.RemoveShipBuildInfo(II, c.m_type);
                        }
                    }
                    RoomMap.CloseCanvans(Core.GetPutRoomGridPos());
                    //设置甲板区域
                    RoomMap.UpdateDeckRoomGrid();
                }
            }
            else
            {
                List <Int2> l = Core.GetPutRoomGridPos();
                RoomMap.RemoveDeckBuild(l);
            }
        }
        else
        {
            RoomMap.RemoveMapPosition(Core, RoomMap.GetPutRoomGridPosition(Core));
        }
        P.RemoveShipBuildInfo(Info, Core.m_type);
    }