/// <summary> /// 房间置换 /// </summary> void DoRoomExchange(Int2 mapGrid) { if (m_Core.m_type == ShipBuildType.BuildStair) { return; } if (!m_Core.IsNewCreate) { TouchMove tmCurExchange = m_ExchangeTouch; if (null != tmCurExchange) { if (m_ExchangeTouch.MyCore().IsDeckRoom == MyCore().IsDeckRoom&& m_ExchangeTouch.MyCore().m_type == ShipBuildType.BuildRoom && MyCore().m_type == ShipBuildType.BuildRoom) { PutCanvasM.ExchangeRoom(m_ExchangeTouch.MyCore(), m_ExchangeTouch.m_orgPosMapGrid, MyCore(), m_orgPosMapGrid); } else { m_ExchangeTouch.MoveShipBuilding(m_ExchangeTouch.m_orgPosMapGrid); MoveShipBuilding(m_orgPosMapGrid); } } CanvasCore core = RoomMap.FindCanvasCore(mapGrid, m_Core.m_type); if (core != null && core.m_ID != m_Core.m_ID) { bool b = PutCanvasM.CheckExchange(m_Core, core); if (b) { TouchMove tmNew = PutCanvasM.GetTouchMoveByCore(core); if (tmNew != null) { m_ExchangeTouch = tmNew; if (m_ExchangeTouch.MyCore().IsDeckRoom == MyCore().IsDeckRoom&& m_ExchangeTouch.MyCore().m_type == ShipBuildType.BuildRoom && MyCore().m_type == ShipBuildType.BuildRoom) { PutCanvasM.ExchangeRoom(m_ExchangeTouch.MyCore(), m_orgPosMapGrid, MyCore(), m_posMapGrid); } else { m_ExchangeTouch.MoveShipBuilding(m_orgPosMapGrid); MoveShipBuilding(m_posMapGrid); } if (m_ExchangeTouch != tmCurExchange) { m_ExchangeTouch.ExchangeAnimation(m_orgPosMapGrid); } } } else { m_ExchangeTouch = null; } } else { m_ExchangeTouch = null; } if (null != tmCurExchange && m_ExchangeTouch != tmCurExchange) { //MoveShipBuilding (m_posMapGrid); tmCurExchange.MoveShipBuilding(tmCurExchange.m_orgPosMapGrid); tmCurExchange.ResetExchangePos(); } } }