Ejemplo n.º 1
0
    /// <summary>
    /// 对楼梯点上层裁剪掉
    /// </summary>
    public void SetStairMap(List <Int2> lStairPoint, XYmode mode)
    {
        if (lStairPoint == null || lStairPoint.Count <= 0)
        {
            return;
        }
        List <List <int> > l = GetMap();

        foreach (Int2 CutPos in lStairPoint)
        {
            int unit  = CutPos.Unit;
            int layer = CutPos.Layer;
            if (mode == XYmode.Save2Edit)
            {
                unit  = CutPos.Unit - shift_cx / MapGrid.m_UnitRoomGridNum;
                layer = CutPos.Layer - shift_cy;
            }
            if (l.Count <= layer || layer < 0)
            {
                return;
            }
            if (l[layer].Count <= unit || unit < 0)
            {
                return;
            }
            if (l[layer][unit] == 1)
            {
                l[layer][unit] = 2;
            }
        }

        SetMap(l);
    }
Ejemplo n.º 2
0
    /// <summary>
    /// 修正船只建筑物坐标。生成船只用。
    /// </summary>
    public void ReCalcShipBuildInfoXY(XYmode mode)
    {
        Mode = mode;


        int value = 1;

        if (mode == XYmode.Edit2Save)
        {
            value = -1;
        }
        else
        {
            value = 1;
        }

        Int2 Start           = Canvans.GetStart();
        List <ShipPutInfo> l = GetShipBuildInfo(ShipBuildType.BuildRoom);

        foreach (ShipPutInfo Info in l)
        {
            Info.LinkTransgatePointRoom(l);
        }
        foreach (ShipPutInfo Info in l)
        {
            Info.cxMapGrid += Start.Unit * value;
            Info.cyMapGrid += Start.Layer * value;
        }

        l = GetShipBuildInfo(ShipBuildType.Soldier);
        foreach (ShipPutInfo Info in l)
        {
            Info.cxMapGrid += Start.Unit * value;
            Info.cyMapGrid += Start.Layer * value;
        }
        l = GetShipBuildInfo(ShipBuildType.BuildStair);
        foreach (ShipPutInfo Info in l)
        {
            Info.cxMapGrid += Start.Unit * value;
            Info.cyMapGrid += Start.Layer * value;
        }

        l = GetShipBuildInfo(ShipBuildType.BuildRoom);
        foreach (ShipPutInfo Info in l)
        {
            Info.UpdateTransgateRoomParam(Start.Unit * value, Start.Layer * value);
        }
    }