Example #1
0
    /// <summary>
    /// 目的区域是否是图形区域内.
    /// </summary>
    /// <returns><c>true</c>, if in shape was built, <c>false</c> otherwise.</returns>
    /// <param name="roomPosGrid">Room position grid.</param>
    public static bool BuildInShape(Int2 roomPosGrid)
    {
        StaticShipCanvas canvas = ShipPlanDC.GetCurShipDesignInfo();

        if (canvas != null)
        {
            string[] ShapeList = canvas.Shape.Split(',');
            //是否在设计图宽高内.
            if (roomPosGrid.Layer >= RoomMap.Mapv2Start.Layer && roomPosGrid.Layer < canvas.Height)
            {
                if (roomPosGrid.Unit >= RoomMap.Mapv2Start.Unit && roomPosGrid.Unit < canvas.Width)
                {
                    //设计图对应的位置是否能摆放
                    if (ShapeList.Length > 0 && ShapeList.Length <= canvas.Height && ShapeList[roomPosGrid.Layer].Length <= canvas.Width)
                    {
                        if (ShapeList[roomPosGrid.Layer][roomPosGrid.Unit] == '0')
                        {
                            return(false);
                        }
                    }

                    return(true);
                }
            }
        }
        return(false);
    }
Example #2
0
    public static bool CheckIsDeckGrid(Int2 GridPos)
    {
        StaticShipCanvas canvas = ShipPlanDC.GetCurShipDesignInfo();

        if (canvas != null)
        {
            string[] l = canvas.Shape.Split(',');
            return(CheckIsDeckGrid(l, GridPos.Layer, GridPos.Unit));
        }
        return(false);
    }
Example #3
0
    public static Vector3 GetDiffenceDisignCameraPos()
    {
        float            OffsetX = 0f;
        Int2             grid    = new Int2();
        StaticShipCanvas canva   = ShipPlanDC.GetCurShipDesignInfo();

        if (canva != null)
        {
            grid.Layer = canva.Height;
            grid.Unit  = canva.Width;
            OffsetX    = (RoomMap.MaxUnit - canva.Width) / 2 * 3f;
        }
        Vector3 pos = GetMainCameraPos(grid);

        pos.x = -OffsetX;
        return(pos);
    }
Example #4
0
    public void LoadShipDesign()
    {
        U3DUtil.DestroyAllChild(MyHead.ShipDesignParent, false);
        StaticShipCanvas canvas = ShipPlanDC.GetCurShipDesignInfo();

        if (canvas != null)
        {
            GameObject go = NDLoad.LoadWndItem("ShipDesignItem", MyHead.ShipDesignParent.transform);
            if (go != null)
            {
                go.transform.localScale = new Vector3(0.8f, 0.8f, 1f);
                ShipDesignItem item = go.GetComponent <ShipDesignItem>();
                if (item != null)
                {
                    item.SetData(canvas, false, ShipPlanDC.CurShipDesignID);
                    EventDelegate.Add(item.BtnSelect.onClick, BtnSelectChange);
                }
            }
        }
    }