Exemplo n.º 1
0
    /// <summary>
    /// 加入一个房间。从仓库中加载。或加载方案
    /// </summary>
    /// <param name="Core">核心结构</param>
    /// <param name="TargetPos">格子坐标</param>
    public static void AddNewCore(CanvasCore Core, Int2 TargetPos)
    {
        if (Core == null)
        {
            return;
        }
        ShipPlan P = ShipPlanDC.GetCurShipPlan();

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

        if (Info == null)
        {
            return;
        }

        if (Core.IsNewCreate)
        {
            Info.SetBuildPostion(TargetPos);
            P.AddShipBuildInfo(Info, Core.m_type);
            TouchMoveManager.MoveToShip(Core);
            Core.IsNewCreate = false;
        }
        //
        if (Core.m_type == ShipBuildType.BuildRoom)
        {
            if (Core.IsDeckRoom == false)
            {
                ShapeType Shape = Info.GetPutRoomShape();
                if (Shape == null)
                {
                    return;
                }
                RoomMap.OpenCanvans(Shape.GetShapeData(new Int2(Info.cxMapGrid, Info.cyMapGrid)), Core.m_ID);
                //设置甲板区域
                RoomMap.UpdateDeckRoomGrid();
                //更新金库房间
                if (Info.IsGoldBuild() == true)
                {
                    RoomMap.UpdateGoldRoomGrid(Core.GetPutRoomGridPos());
                }
            }
            else
            {
                RoomMap.AddDeckBuild(Core.m_ID, Core.GetPutRoomGridPos());
            }
        }
        else
        {
            RoomMap.AddMapPosition(Core, RoomMap.GetPutRoomGridPosition(Core));
        }
    }
Exemplo n.º 2
0
    /// <summary>
    /// 创建楼梯
    /// </summary>
    /// <param name="Core"></param>
    public static void CreateStair(CanvasCore Core)
    {
        ShipPlan P = ShipPlanDC.GetCurShipPlan();

        if (P == null)
        {
            return;
        }
        if (Core.m_type != ShipBuildType.BuildRoom && Core.IsDeckRoom)
        {
            return;
        }
        //只有房间变化楼梯才重新创建
        List <Int2> points = RoomMap.GetStairCreatePoint();

        if (points.Count > 0)
        {
            foreach (var grid in points)
            {
                ShipPutInfo Info = new ShipPutInfo();
                Info.id            = ShipPutInfo.GetNewShipPutId();
                Info.objid         = 1201;
                Info.type          = 3;
                Info.cxMapGrid     = grid.Unit;
                Info.cyMapGrid     = grid.Layer;
                Info.shipput_data0 = 0;
                Info.shipput_data1 = 0;
                P.AddShipBuildInfo(Info, ShipBuildType.BuildStair);
                BuildInfo stair = buildingM.GetStartBuildInfo(1201);
                ///// 临时修改,楼梯位置不正确的问题
                //stair.m_type = 1201;
                stair.m_cx           = grid.Unit;
                stair.m_cy           = grid.Layer;
                stair.m_ShipPutdata0 = 0;
                stair.m_ShipPutdata1 = 0;
                ///end
                if (stair != null)
                {
                    BattleEnvironmentM.LoadShipPutStairBuild(Info.id, Info.objid, stair);
                }
            }
        }
        RoomMap.RemoveExcessStair();
    }
Exemplo n.º 3
0
    /// <summary>
    /// 模拟数据
    /// </summary>
    public static void SimulationData()
    {
        List <StaticShipCanvas> l = ShipPlanM.GetAllShipCanvasInfo();

        foreach (StaticShipCanvas v in l)
        {
            m_lShipDesignInfo.Add(v.Id, v);
        }
        //
        ShipPlan p = new ShipPlan();

        p.ID             = 1;
        p.bExitCanvas    = false;
        p.Name           = "我的小船船";
        p.Type           = PlanType.Default;
        p.BlackScienceID = 1;

        p.Canvans      = StageM.GetCounterPartMap(101001);
        p.ShipDesignId = 100005; // 16格大船
        StaticShipCanvas shipInfo = ShipPlanDC.GetShipDesignInfo(p.ShipDesignId);

        if (shipInfo != null)
        {
            p.Canvans.CorrectionShiftError(new Int2(shipInfo.Width, shipInfo.Height));
        }
        // 船只摆设数据
        List <SoldierInfo> lSoldier = null;
        List <BuildInfo>   lBuild   = null;

        StageM.GetCounterPartShipPut(101001, ref lSoldier, ref lBuild);
        // 建筑跟楼梯
        foreach (BuildInfo v in lBuild)
        {
            if (v.BuildType == 1300)
            {
                BuildInfo   gold = BuildDC.GetVaultBuildInfo();
                ShipPutInfo Info = new ShipPutInfo();
                Info.id            = ShipPutInfo.GetNewShipPutId();
                Info.objid         = gold.ID;
                Info.type          = 1;
                Info.cxMapGrid     = v.m_cx;
                Info.cyMapGrid     = v.m_cy;
                Info.shipput_data0 = 0;
                Info.shipput_data1 = 0;
                p.AddShipBuildInfo(Info, ShipBuildType.BuildRoom);
            }
            if (v.BuildType == 1201)
            {
                ShipPutInfo Info = new ShipPutInfo();
                Info.id            = ShipPutInfo.GetNewShipPutId();
                Info.objid         = v.BuildType;
                Info.type          = 3;
                Info.cxMapGrid     = v.m_cx;
                Info.cyMapGrid     = v.m_cy;
                Info.shipput_data0 = 0;
                Info.shipput_data1 = 0;
                p.AddShipBuildInfo(Info, ShipBuildType.BuildStair);
            }
        }

        m_lShipPlan.Add(p.ID, p);
        m_SelPlan = p;
    }