Exemple #1
0
    public void MoveWithRoom(CanvasCore roomCore)
    {
        if (roomCore.m_type != ShipBuildType.BuildRoom)
        {
            return;
        }
        TouchMove         tmParent     = PutCanvasM.GetTouchMoveByCore(roomCore);
        List <CanvasCore> childrenCore = PutCanvasM.GetChildByCore(roomCore);

        if (childrenCore.Count == 0 || roomCore.IsDeckRoom)
        {
            return;
        }
        Transform roomShellT = PutCanvasM.GetTransformByCore(roomCore).parent;

        foreach (var childCore in childrenCore)
        {
            TouchMove tm = PutCanvasM.GetTouchMoveByCore(childCore);
            if (tm != null)
            {
                tm.m_OffsetGrid = tmParent.m_orgPosMapGrid - tm.m_orgPosMapGrid;
            }
            if (PutCanvasM.GetTransformByCore(childCore) != null)
            {
                Transform childShellT = PutCanvasM.GetTransformByCore(childCore).parent;
                childShellT.parent = roomShellT;
            }
        }
    }
Exemple #2
0
    /// <summary>
    /// 移动房间完毕后,解除房间内对象的父子关系
    /// </summary>
    public void LeaveRoom()
    {
        if (m_Core.m_type != ShipBuildType.BuildRoom)
        {
            return;
        }
        List <CanvasCore> childrenCore = PutCanvasM.GetChildByCore(m_Core);

        if (childrenCore.Count == 0)
        {
            return;
        }
        if (m_tStart == null)
        {
            return;
        }
        foreach (var childCore in childrenCore)
        {
            TouchMove tm = PutCanvasM.GetTouchMoveByCore(childCore);
            //tm.m_bCanOperate = true;
            Transform childShellT = PutCanvasM.GetTransformByCore(childCore).parent;
            childShellT.parent = m_tStart;
        }
    }