Exemplo n.º 1
0
    /// <summary>
    /// 设置方案画布
    /// </summary>
    public void SetPlanCanvans(canvasedit.ShipCanvasInfo Info)
    {
        if (Info == null)
        {
            return;
        }
        ID             = Info.id;
        Name           = Info.name;
        Type           = (PlanType)Info.type;
        BlackScienceID = Info.bs_id;
        //
        m_Canvans.width    = Info.width;
        m_Canvans.height   = Info.height;
        m_Canvans.map      = Info.map;
        m_Canvans.shape    = Info.shape;
        m_Canvans.shift_cx = Info.shift_cx;
        m_Canvans.shift_cy = Info.shift_cy;
        m_shipDesignId     = Info.designid;
        StaticShipCanvas shipInfo = ShipPlanDC.GetShipDesignInfo(m_shipDesignId);

        if (shipInfo != null)
        {
            m_Canvans.CorrectionShiftError(new Int2(shipInfo.Width, shipInfo.Height));
        }
    }
Exemplo n.º 2
0
    public static string [] GetDesignShape(int shipDesignID)
    {
        StaticShipCanvas canvas = ShipPlanDC.GetShipDesignInfo(shipDesignID);

        if (canvas != null)
        {
            return(canvas.Shape.Split(','));
        }
        return(null);
    }
Exemplo n.º 3
0
    /// <summary>
    /// 获取当前方案最大的格子数.
    /// </summary>
    /// <returns>The end position by shape.</returns>
    /// <param name="ShipCanvasTypeId">Ship canvas type identifier.</param>
    public static Int2 GetEndPosByShape(int shipDesignID)
    {
        StaticShipCanvas canvas = ShipPlanDC.GetShipDesignInfo(shipDesignID);

        if (canvas != null)
        {
            Int2 endPos = new Int2();
            endPos.Layer = canvas.Height;
            endPos.Unit  = canvas.Width;
            return(endPos);
        }
        return(RoomMap.RealMapSize);
    }
Exemplo n.º 4
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;
    }