Ejemplo n.º 1
0
    /// <summary>
    /// 加载船的画布表现
    /// </summary>
    public static void LoadShipCanvans(int shipDesignID)
    {
        Transform parent = GetLifeMBornNode(true);

        if (parent != null)
        {
            GameObjectLoader.LoadPath("Prefabs/Others/", "PlaneCollider", parent);
            Int2      n2Pos     = new Int2(0, 0);
            Int2      nEndPos   = GetEndPosByShape(shipDesignID);
            string [] ShapeList = GetDesignShape(shipDesignID);

            if (ShapeList == null || ShapeList.Length != nEndPos.Layer)
            {
                NGUIUtil.DebugLog(" low version");
                return;
            }
            RoomMap.RealMapSize = nEndPos;

            for (n2Pos.Layer = RoomMap.Mapv2Start.Layer; n2Pos.Layer < nEndPos.Layer; n2Pos.Layer++)
            {
                for (n2Pos.Unit = RoomMap.Mapv2Start.Unit; n2Pos.Unit < nEndPos.Unit; n2Pos.Unit++)
                {
                    if (ShapeList.Length > 0 && ShapeList.Length <= nEndPos.Layer && ShapeList[n2Pos.Layer].Length <= nEndPos.Unit)
                    {
                        bool bDeck = CheckIsDeckGrid(ShapeList, n2Pos.Layer, n2Pos.Unit);
                        if (ShapeList[n2Pos.Layer][n2Pos.Unit] == '0' && !bDeck)
                        {
                            continue;
                        }
                    }
                    GameObject go = GameObjectLoader.LoadPath("Prefabs/Others/", "CanvasUnitBG", parent);
                    go.name = string.Format("[{0},{1}]", n2Pos.Layer, n2Pos.Unit);
                    go.transform.localPosition = new Vector3(3.0f * n2Pos.Unit, (3.0f + 0.3f) * n2Pos.Layer, 8.1f);
                    CanvasUnitBG bk = go.GetComponent <CanvasUnitBG>();
                    if (bk != null)
                    {
                        TouchMoveManager.JoinCanvasUnitBk(n2Pos, bk);
                    }
                }
            }
        }
        TouchMoveManager.SetAllGridBgStates(CanvasUnitState.Normal);
        TouchMoveManager.ShowCanvas(true);
        Vector3 pos = MainCameraM.GetDiffenceDisignCameraPos();

        MainCameraM.s_Instance.SetCameraLimitParam(MainCameraM.s_reaLimitPyramidBoatView);
        MainCameraM.s_Instance.AutoMoveTo(pos, 0f);
    }