public Vector2 GetWallSideCrossPos(WallSideData side1, WallSideData side2) { float c1 = side1.forward == true ? side1.targetWall.c1 : side1.targetWall.c2; float c2 = side2.forward == true ? side2.targetWall.c1 : side2.targetWall.c2; Vector2 pos = side1.forward == true ? side1.targetWall.point2.pos : side1.targetWall.point1.pos; return(linefunc.GetTwoLineCrossPoint(side1.targetWall.a, side1.targetWall.b, c1, side2.targetWall.a, side2.targetWall.b, c2, pos)); }
/// <summary> /// 获取side边的前一个边 /// </summary> public WallSideData LastSide(WallSideData side) { int index = sideList.IndexOf(side); if (index == -1) { return(null); } return(sideList[(index - 1) % sideList.Count]); }
public void SetData(WallSideData wallside) { this.data = wallside; text.text = wallFunc.GetSideLength(wallside).ToString(); Vector3 center = wallFunc.GetPos(wallside); center = prefabs.mainCamera.WorldToScreenPoint(center); center = (Vector2)prefabs.uiCamera.ScreenToWorldPoint((Vector2)center); transform.position = center; }
public RoomData WallSideOnRoom(WallSideData side) { for (int i = 0; i < roomList.Count; i++) { if (roomList[i].sideList.Contains(side)) { return roomList[i]; } } return null; }
public Vector3 GetPos(WallSideData wallside) { WallData wall = wallside.targetWall; List <Vector2> v2s = GetWallVerticesPos(wall); Vector2 v21 = wallside.forward == true ? v2s[1] : v2s[4]; Vector2 v22 = wallside.forward == true ? v2s[2] : v2s[5]; float c = wallside.forward == true ? wall.c5 : wall.c6; Vector3 v2start = linefunc.GetDisPoint(wall.a, wall.b, c, v21.x, v21.y); Vector3 v2end = linefunc.GetDisPoint(wall.a, wall.b, c, v22.x, v22.y); return((v2start + v2end) / 2); }
/// <summary> /// 内边界网格数据 /// </summary> /// <param name="room"></param> /// <returns></returns> private List <Vector2> GetSideVertices(RoomData room) { List <Vector2> tempList = new List <Vector2>(); int len = room.sideList.Count; for (int i = 0; i < len; i++) { WallSideData side1 = room.sideList[i]; WallSideData side2 = room.sideList[(i + 1) % len]; Vector2 v2 = wallfunc.GetWallSideCrossPos(side1, side2); tempList.Add(v2); } return(tempList); }
public WallSideData GetNearSide(RoomData side1OnRoom, WallSideData fromSide, bool FOrT) { int index = side1OnRoom.sideList.IndexOf(fromSide); if (FOrT == true) { index -= 1; } else { index += 1; } return(side1OnRoom.sideList[(index + side1OnRoom.sideList.Count) % side1OnRoom.sideList.Count]); }
private bool IsRoomComeFrom(RoomData room, RoomData oldRoom) { for (int i = 0; i < oldRoom.sideList.Count; i++) { WallSideData oldSide = oldRoom.sideList[i]; if (room.sideList.Contains(oldSide)) { return(true); } //WallData oldWall = oldSide.targetWall; } return(false); }
public float GetSideLength(WallSideData wallside) { WallData wall = wallside.targetWall; List <Vector2> v2s = GetWallVerticesPos(wall); Vector2 v21 = wallside.forward == true ? v2s[1] : v2s[4]; Vector2 v22 = wallside.forward == true ? v2s[2] : v2s[5]; float c = wallside.forward == true ? wall.c5 : wall.c6; Vector3 v2start = linefunc.GetDisPoint(wall.a, wall.b, c, v21.x, v21.y); Vector3 v2end = linefunc.GetDisPoint(wall.a, wall.b, c, v22.x, v22.y); float angle = linefunc.GetAngle(v2end - v2start); float dis = Mathf.RoundToInt(Vector2.Distance(v2start, v2end) * 1000); dis = dis * (int)defaultSettings.DefaultUnit / 1000; return(dis); }
public RoomData GetRoom(WallSideData side) { for (int i = 0; i < roomList.Count; i++) { RoomData room = roomList[i]; for (int k = 0; k < room.sideList.Count; k++) { if (side == room.sideList[k]) { return room; } } } return null; }
public WallSideData GetNearCrossSide(RoomData room, WallSideData fromSide, bool FOrT, List <Point> list) { WallSideData firstnearSide = GetNearSide(room, fromSide, FOrT); WallSideData nearSide = firstnearSide; temp.Clear(); Point fromPoint; if (fromSide.forward == FOrT) { fromPoint = fromSide.targetWall.point1; } else { fromPoint = fromSide.targetWall.point2; } temp.Add(fromPoint); while (wallfunc.IsParallel(nearSide.targetWall, fromSide.targetWall) == true) { Point toPos = nearSide.targetWall.GetOtherPoint(fromPoint); if (toPos == null) { int index = room.pointList.IndexOf(fromPoint); toPos = room.pointList[(index + 1) % room.pointList.Count]; if (toPos == null) { Debug.Log("to pos also null"); break; } } fromPoint = toPos; temp.Add(fromPoint); nearSide = GetNearSide(room, nearSide, FOrT); if (nearSide == fromSide) { Debug.LogError("IsParallel死循环"); break; } } if (FOrT == true) { temp.Reverse(); } list.InsertRange(list.Count, temp); return(nearSide); }
public RoomData GetRoom(Point point1, Point point2) { WallData wall = GetWall(point1, point2); if (wall == null) return null; bool right = point1 == wall.point1; WallSideData side = right == true ? wall.point1To2Data : wall.point2To1Data; for (int i = 0; i < roomList.Count; i++) { RoomData room = roomList[i]; for (int k = 0; k < room.sideList.Count; k++) { if (side == room.sideList[k]) { return room; } } } return null; }
private bool RoomListContainWallSide(List <RoomData> list, Point pointFrom, Point pointTo) { for (int i = 0; i < list.Count; i++) { for (int j = 0; j < list[i].sideList.Count; j++) { WallSideData side = list[i].sideList[j]; if (side.forward == true && side.targetWall.point1 == pointFrom && side.targetWall.point2 == pointTo) { //Debug.LogTest("room"+i + " contins" + pointFrom.id + pointTo.id); return(true); } if (side.forward == false && side.targetWall.point2 == pointFrom && side.targetWall.point1 == pointTo) { //Debug.LogTest("room" + i + " contins" + pointFrom.id + pointTo.id); return(true); } } } return(false); }
public override void enter() { base.enter(); if (target == null) { inputMachine.setState(FreeState2D.NAME); return; } undoHelper.save(); for (int i = 0; i < target.sideList.Count; i++) { WallSideData side = target.sideList[i]; WallData wall = side.targetWall; RoomData room = data.WallSideOnRoom(wall.point1To2Data == side ? wall.point2To1Data : wall.point1To2Data); if (room == null) { data.RemoveWall(wall); } } roomfunc.ForceRefreshRoomData(data); RefreshView(); inputMachine.setState(FreeState2D.NAME); }
public override void RefreshView() { //Debug.Log("view2D RefreshView"); RefreshGameObjs(); base.RefreshView(); #region room for (int i = 0; i < data.roomList.Count; i++) { GameObject obj = floors[i]; RoomView view = obj.GetComponent <RoomView>(); RoomData room = data.roomList[i]; view.SetData(room); List <Vector2> v2s = roomfunc.SetMesh(obj, room); Vector2 v2 = v2s[0]; obj.transform.localPosition = new Vector3(v2.x, v2.y, obj.transform.localPosition.z); for (int k = 0; k < v2s.Count; k++) { v2s[k] = v2s[k] - v2; } MaterialData floor = room.floor; List <List <Vector2> > list = linefunc.SetMesh(v2s, obj, floor.offsetX, floor.offsetY, floor.rotation, floor.tileSize_x, floor.tileSize_y, true); if (list != null) { roomfunc.SetArea(areas[i], list, v2); } if (selectObjData == room) { if (selectRoom == null) { selectRoom = prefabs.GetNewInstance_selectRoom().gameObject; } selectRoom.transform.localPosition = obj.transform.localPosition - Vector3.forward; linefunc.SetMesh(v2s, selectRoom, floor.offsetX, floor.offsetY, floor.rotation, floor.tileSize_x, floor.tileSize_y, true); selectRoom.SetActive(true); } Transform tran = areas[i].transform.FindChild("name"); TextMesh textmesh = tran.GetComponent <TextMesh>(); textmesh.text = room.type; } if ((selectObjData == null || selectObjData is RoomData == false) && selectRoom != null) { selectRoom.SetActive(false); } #endregion #region wall for (int i = 0; i < data.wallList.Count; i++) { WallData walldata = data.wallList[i]; GameObject wallline = wallLines[i]; GameObject wallLeft = wallsideLines[2 * i]; GameObject wallRight = wallsideLines[2 * i + 1]; GameObject wallLeftEnd = wallEndLines[2 * i]; GameObject wallRightEnd = wallEndLines[2 * i + 1]; if (walldata.hide == true) { wallline.SetActive(false); wallLeft.SetActive(false); wallRight.SetActive(false); wallLeftEnd.SetActive(false); wallRightEnd.SetActive(false); showLenLines[2 * i + 1].SetActive(false); showLenPoints[4 * i + 2].SetActive(false); showLenPoints[4 * i + 3].SetActive(false); showWords[2 * i + 1].SetActive(false); showLenLines[2 * i].SetActive(false); showLenPoints[4 * i].SetActive(false); showLenPoints[4 * i + 1].SetActive(false); showWords[2 * i].SetActive(false); continue; } else { wallline.SetActive(true); wallLeft.SetActive(true); wallRight.SetActive(true); //wallLeftEnd.SetActive(true); //wallRightEnd.SetActive(true); //showLenLines[2 * i + 1].SetActive(true); //showLenPoints[4 * i + 2].SetActive(true); //showLenPoints[4 * i + 3].SetActive(true); //showWords[2 * i + 1].SetActive(true); //showLenLines[2 * i].SetActive(true); //showLenPoints[4 * i].SetActive(true); //showLenPoints[4 * i + 1].SetActive(true); //showWords[2 * i].SetActive(true); } List <Vector2> tempList; SetObjWithData(walldata, wallline, wallLeft, wallRight, wallLeftEnd, wallRightEnd, out tempList); RoomData side1OnRoom = data.WallSideOnRoom(walldata.point1To2Data); RoomData side2OnRoom = data.WallSideOnRoom(walldata.point2To1Data); if (side2OnRoom != null) { ///左侧显示 GameObject showline = showLenLines[2 * i + 1]; GameObject showLeft = showLenPoints[4 * i + 2]; GameObject showRight = showLenPoints[4 * i + 3]; GameObject showWord = showWords[2 * i + 1]; SetShowObjWithData(walldata, showline, showLeft, showRight, showWord, tempList[4], tempList[5], walldata.c4); } if (side1OnRoom != null || side2OnRoom == null) { ///右侧显示 GameObject showline = showLenLines[2 * i]; GameObject showLeft = showLenPoints[4 * i]; GameObject showRight = showLenPoints[4 * i + 1]; GameObject showWord = showWords[2 * i]; SetShowObjWithData(walldata, showline, showLeft, showRight, showWord, tempList[1], tempList[2], walldata.c3); } } if ((selectObjData == null || selectObjData is WallData == false) && selectWall != null) { selectWall.SetActive(false); } if ((selectObjData is ProductData == false || selectGoodsdisedWalldata == null) && selectDisedwall != null) { selectDisedwall.SetActive(false); } #endregion #region point for (int i = 0; i < data.pointList.Count; i++) { Point p = data.pointList[i]; Vector2 pos = p.pos; //Debug.LogWarning("show "+ pos); wallPoints[i].transform.localPosition = new Vector3(pos.x, pos.y, wallPoints[i].transform.localPosition.z); wallPoints[i].name = "Point " + p.guid; PointView view = wallPoints[i].GetComponent <PointView>(); if (view == null) { Debug.LogWarning("wallPoints[i].GetComponent<PointView>() == null"); continue; } view.SetData(p); if (selectObjData == p) { if (selectPoint == null) { selectPoint = prefabs.GetNewInstance_selectPoint().gameObject; } selectPoint.transform.localPosition = wallPoints[i].transform.localPosition - Vector3.forward; selectPoint.SetActive(true); } } if ((selectObjData == null || selectObjData is Point == false) && selectPoint != null) { selectPoint.SetActive(false); } #endregion #region setWallLength for (int i = 0; i < inputWallLengths.Count; i++) { inputWallLengths[i].SetActive(false); } if (selectObjData is WallData) { WallData wall = selectObjData as WallData; int wallIndex = data.wallList.IndexOf(wall); RoomData side1OnRoom = data.WallSideOnRoom(wall.point1To2Data); RoomData side2OnRoom = data.WallSideOnRoom(wall.point2To1Data); if (side1OnRoom != null) { tempSideList = new List <Point>(); GameObject goF = inputWallLengths[3]; SetLengthHandleView viewF = goF.GetComponent <SetLengthHandleView>(); WallSideData indexF1 = roomfunc.GetNearCrossSide(side1OnRoom, wall.point1To2Data, true, tempSideList); viewF.SetData(indexF1); goF.SetActive(true); GameObject goT = inputWallLengths[4]; SetLengthHandleView viewT = goT.GetComponent <SetLengthHandleView>(); WallSideData indexT1 = roomfunc.GetNearCrossSide(side1OnRoom, wall.point1To2Data, false, tempSideList); viewT.SetData(indexT1); goT.SetActive(true); viewF.otherdata = indexT1; viewT.otherdata = indexF1; viewF.ForT = true; viewT.ForT = false; viewF.isParallelPointList = tempSideList; viewT.isParallelPointList = tempSideList; } if (side2OnRoom != null) { tempSideList = new List <Point>(); GameObject goF = inputWallLengths[1]; SetLengthHandleView viewF = goF.GetComponent <SetLengthHandleView>(); WallSideData indexF2 = roomfunc.GetNearCrossSide(side2OnRoom, wall.point2To1Data, true, tempSideList); viewF.SetData(indexF2); goF.SetActive(true); GameObject goT = inputWallLengths[2]; SetLengthHandleView viewT = goT.GetComponent <SetLengthHandleView>(); WallSideData indexT2 = roomfunc.GetNearCrossSide(side2OnRoom, wall.point2To1Data, false, tempSideList); viewT.SetData(indexT2); goT.SetActive(true); viewF.otherdata = indexT2; viewT.otherdata = indexF2; viewF.ForT = true; viewT.ForT = false; viewF.isParallelPointList = tempSideList; viewT.isParallelPointList = tempSideList; } GameObject go = inputWallLengths[0]; if (side1OnRoom == null && side2OnRoom == null) { WallSideData side = wall.point1To2Data; SetLengthHandleView view = go.GetComponent <SetLengthHandleView>(); view.SetData(side); view.otherdata = null; go.SetActive(true); } else { go.SetActive(false); } } #endregion }
public override void enter() { base.enter(); RoomData room = data.GetRoom(target); if (room == null) { return; } Save(); for (int i = 0; i < room.sideList.Count; i++) { WallSideData side = room.sideList[i]; side.tBaseboard.hide = target.tBaseboard.hide; side.tBaseboard.type = target.tBaseboard.type; side.tBaseboard.width = target.tBaseboard.width; side.tBaseboard.height = target.tBaseboard.height; side.tBaseboard.disRoot = target.tBaseboard.disRoot; MaterialData tMaterialData = side.tBaseboard.materialData; if (target.tBaseboard.materialData != null) { if (tMaterialData == null) { tMaterialData = new MaterialData(); } tMaterialData.textureURI = target.tBaseboard.materialData.textureURI; tMaterialData.id = target.tBaseboard.materialData.id; tMaterialData.guid = target.tBaseboard.materialData.guid; tMaterialData.seekId = target.tBaseboard.materialData.seekId; tMaterialData.color = target.tBaseboard.materialData.color; tMaterialData.tileSize_x = target.tBaseboard.materialData.tileSize_x; tMaterialData.tileSize_y = target.tBaseboard.materialData.tileSize_y; tMaterialData.rotation = target.tBaseboard.materialData.rotation; tMaterialData.offsetX = target.tBaseboard.materialData.offsetX; tMaterialData.offsetY = target.tBaseboard.materialData.offsetY; } else { tMaterialData = null; } side.tBaseboard.materialData = tMaterialData; side.tBaseboard.index = target.tBaseboard.index; //top side.topBaseboard.hide = target.topBaseboard.hide; side.topBaseboard.type = target.topBaseboard.type; side.topBaseboard.width = target.topBaseboard.width; side.topBaseboard.height = target.topBaseboard.height; side.topBaseboard.disRoot = target.topBaseboard.disRoot; MaterialData topMaterialData = side.topBaseboard.materialData; if (target.topBaseboard.materialData != null) { if (topMaterialData == null) { topMaterialData = new MaterialData(); } topMaterialData.textureURI = target.topBaseboard.materialData.textureURI; topMaterialData.id = target.topBaseboard.materialData.id; topMaterialData.guid = target.topBaseboard.materialData.guid; topMaterialData.seekId = target.topBaseboard.materialData.seekId; topMaterialData.color = target.topBaseboard.materialData.color; topMaterialData.tileSize_x = target.topBaseboard.materialData.tileSize_x; topMaterialData.tileSize_y = target.topBaseboard.materialData.tileSize_y; topMaterialData.rotation = target.topBaseboard.materialData.rotation; topMaterialData.offsetX = target.topBaseboard.materialData.offsetX; topMaterialData.offsetY = target.topBaseboard.materialData.offsetY; } else { topMaterialData = null; } side.topBaseboard.materialData = topMaterialData; side.topBaseboard.index = target.topBaseboard.index; } RefreshView(); }
/// <summary> /// 保存一次数据 使用方法:应该先使用保存 再更改变化 /// </summary> public void save() { //Debug.Log("Saved"); if (undoDatas.Count > 100) { undoDatas.RemoveAt(0); } currentData.data.ResetId(); currentData.SaveId++; ///新保存的数据 TotalData inputdata = new TotalData(); inputdata.SaveId = currentData.SaveId; inputdata.schemeManifest = currentData.schemeManifest; for (int i = 0; i < currentData.data.wallList.Count; i++) { WallData wall = currentData.data.wallList[i]; WallData newWall = new WallData(); newWall.guid = wall.guid; newWall.height = wall.height; newWall.width = wall.width; Point p1 = getPointById(wall.point1.guid, inputdata.data); if (p1 == null) { p1 = new Point(); p1.guid = wall.point1.guid; p1.pos = wall.point1.pos; inputdata.data.AddPoint(p1); } newWall.point1 = p1; Point p2 = getPointById(wall.point2.guid, inputdata.data); if (p2 == null) { p2 = new Point(); p2.guid = wall.point2.guid; p2.pos = wall.point2.pos; inputdata.data.AddPoint(p2); } newWall.point2 = p2; WallSideData newSide1 = new WallSideData(); newSide1.guid = wall.point1To2Data.guid; newSide1.forward = wall.point1To2Data.forward; MaterialData materialData = new MaterialData(); materialData.textureURI = wall.point1To2Data.materialData.textureURI; materialData.id = wall.point1To2Data.materialData.id; materialData.guid = wall.point1To2Data.materialData.guid; materialData.seekId = wall.point1To2Data.materialData.seekId; materialData.color = wall.point1To2Data.materialData.color; materialData.tileSize_x = wall.point1To2Data.materialData.tileSize_x; materialData.tileSize_y = wall.point1To2Data.materialData.tileSize_y; materialData.rotation = wall.point1To2Data.materialData.rotation; materialData.offsetX = wall.point1To2Data.materialData.offsetX; materialData.offsetY = wall.point1To2Data.materialData.offsetY; newSide1.materialData = materialData; //newSide1.texture = wall.point1To2Data.texture; //newSide1.mesh = wall.point1To2Data.mesh; newSide1.targetWall = newWall; TBaseboard newTBaseboard = new TBaseboard(true); newTBaseboard.guid = wall.point1To2Data.tBaseboard.guid; newTBaseboard.id = wall.point1To2Data.tBaseboard.id; newTBaseboard.hide = wall.point1To2Data.tBaseboard.hide; newTBaseboard.isT = wall.point1To2Data.tBaseboard.isT; newTBaseboard.type = wall.point1To2Data.tBaseboard.type; newTBaseboard.width = wall.point1To2Data.tBaseboard.width; newTBaseboard.height = wall.point1To2Data.tBaseboard.height; newTBaseboard.disRoot = wall.point1To2Data.tBaseboard.disRoot; if (wall.point1To2Data.tBaseboard.materialData != null) { MaterialData tMaterialData = new MaterialData(); tMaterialData.textureURI = wall.point1To2Data.tBaseboard.materialData.textureURI; tMaterialData.id = wall.point1To2Data.tBaseboard.materialData.id; tMaterialData.guid = wall.point1To2Data.tBaseboard.materialData.guid; tMaterialData.seekId = wall.point1To2Data.tBaseboard.materialData.seekId; tMaterialData.color = wall.point1To2Data.tBaseboard.materialData.color; tMaterialData.tileSize_x = wall.point1To2Data.tBaseboard.materialData.tileSize_x; tMaterialData.tileSize_y = wall.point1To2Data.tBaseboard.materialData.tileSize_y; tMaterialData.rotation = wall.point1To2Data.tBaseboard.materialData.rotation; tMaterialData.offsetX = wall.point1To2Data.tBaseboard.materialData.offsetX; tMaterialData.offsetY = wall.point1To2Data.tBaseboard.materialData.offsetY; newTBaseboard.materialData = tMaterialData;//wall.point1To2Data.tBaseboard.materialData; } newSide1.tBaseboard = newTBaseboard; TBaseboard newTopBaseboard = new TBaseboard(true); newTopBaseboard.guid = wall.point1To2Data.topBaseboard.guid; newTopBaseboard.id = wall.point1To2Data.topBaseboard.id; newTopBaseboard.hide = wall.point1To2Data.topBaseboard.hide; newTopBaseboard.isT = wall.point1To2Data.topBaseboard.isT; newTopBaseboard.type = wall.point1To2Data.topBaseboard.type; newTopBaseboard.width = wall.point1To2Data.topBaseboard.width; newTopBaseboard.height = wall.point1To2Data.topBaseboard.height; newTopBaseboard.disRoot = wall.point1To2Data.topBaseboard.disRoot; if (wall.point1To2Data.topBaseboard.materialData != null) { MaterialData topMaterialData = new MaterialData(); topMaterialData.textureURI = wall.point1To2Data.topBaseboard.materialData.textureURI; topMaterialData.id = wall.point1To2Data.topBaseboard.materialData.id; topMaterialData.guid = wall.point1To2Data.topBaseboard.materialData.guid; topMaterialData.seekId = wall.point1To2Data.topBaseboard.materialData.seekId; topMaterialData.color = wall.point1To2Data.topBaseboard.materialData.color; topMaterialData.tileSize_x = wall.point1To2Data.topBaseboard.materialData.tileSize_x; topMaterialData.tileSize_y = wall.point1To2Data.topBaseboard.materialData.tileSize_y; topMaterialData.rotation = wall.point1To2Data.topBaseboard.materialData.rotation; topMaterialData.offsetX = wall.point1To2Data.topBaseboard.materialData.offsetX; topMaterialData.offsetY = wall.point1To2Data.topBaseboard.materialData.offsetY; newTopBaseboard.materialData = topMaterialData; } newSide1.topBaseboard = newTopBaseboard; newWall.point1To2Data = newSide1; WallSideData newSide2 = new WallSideData(); newSide2.guid = wall.point2To1Data.guid; newSide2.forward = wall.point2To1Data.forward; MaterialData materialData2 = new MaterialData(); materialData2.textureURI = wall.point2To1Data.materialData.textureURI; materialData2.id = wall.point2To1Data.materialData.id; materialData2.guid = wall.point2To1Data.materialData.guid; materialData2.seekId = wall.point2To1Data.materialData.seekId; materialData2.color = wall.point2To1Data.materialData.color; materialData2.tileSize_x = wall.point2To1Data.materialData.tileSize_x; materialData2.tileSize_y = wall.point2To1Data.materialData.tileSize_y; materialData2.rotation = wall.point2To1Data.materialData.rotation; materialData2.offsetX = wall.point2To1Data.materialData.offsetX; materialData2.offsetY = wall.point2To1Data.materialData.offsetY; newSide2.materialData = materialData2; //newSide2.texture = wall.point2To1Data.texture; //newSide2.mesh = wall.point2To1Data.mesh; newSide2.targetWall = newWall; TBaseboard newTBaseboard2 = new TBaseboard(true); newTBaseboard2.guid = wall.point2To1Data.tBaseboard.guid; newTBaseboard2.id = wall.point2To1Data.tBaseboard.id; newTBaseboard2.hide = wall.point2To1Data.tBaseboard.hide; newTBaseboard2.isT = wall.point2To1Data.tBaseboard.isT; newTBaseboard2.type = wall.point2To1Data.tBaseboard.type; newTBaseboard2.width = wall.point2To1Data.tBaseboard.width; newTBaseboard2.height = wall.point2To1Data.tBaseboard.height; newTBaseboard2.disRoot = wall.point2To1Data.tBaseboard.disRoot; if (wall.point2To1Data.tBaseboard.materialData != null) { MaterialData tMaterialData2 = new MaterialData(); tMaterialData2.textureURI = wall.point2To1Data.tBaseboard.materialData.textureURI; tMaterialData2.id = wall.point2To1Data.tBaseboard.materialData.id; tMaterialData2.guid = wall.point2To1Data.tBaseboard.materialData.guid; tMaterialData2.seekId = wall.point2To1Data.tBaseboard.materialData.seekId; tMaterialData2.color = wall.point2To1Data.tBaseboard.materialData.color; tMaterialData2.tileSize_x = wall.point2To1Data.tBaseboard.materialData.tileSize_x; tMaterialData2.tileSize_y = wall.point2To1Data.tBaseboard.materialData.tileSize_y; tMaterialData2.rotation = wall.point2To1Data.tBaseboard.materialData.rotation; tMaterialData2.offsetX = wall.point2To1Data.tBaseboard.materialData.offsetX; tMaterialData2.offsetY = wall.point2To1Data.tBaseboard.materialData.offsetY; newTBaseboard2.materialData = tMaterialData2;//wall.point2To1Data.tBaseboard.materialData; } newSide2.tBaseboard = newTBaseboard2; TBaseboard newTopBaseboard2 = new TBaseboard(true); newTopBaseboard2.guid = wall.point2To1Data.topBaseboard.guid; newTopBaseboard2.id = wall.point2To1Data.topBaseboard.id; newTopBaseboard2.hide = wall.point2To1Data.topBaseboard.hide; newTopBaseboard2.isT = wall.point2To1Data.topBaseboard.isT; newTopBaseboard2.type = wall.point2To1Data.topBaseboard.type; newTopBaseboard2.width = wall.point2To1Data.topBaseboard.width; newTopBaseboard2.height = wall.point2To1Data.topBaseboard.height; newTopBaseboard2.disRoot = wall.point2To1Data.topBaseboard.disRoot; if (wall.point2To1Data.topBaseboard.materialData != null) { MaterialData topMaterialData2 = new MaterialData(); topMaterialData2.textureURI = wall.point2To1Data.topBaseboard.materialData.textureURI; topMaterialData2.id = wall.point2To1Data.topBaseboard.materialData.id; topMaterialData2.guid = wall.point2To1Data.topBaseboard.materialData.guid; topMaterialData2.seekId = wall.point2To1Data.topBaseboard.materialData.seekId; topMaterialData2.color = wall.point2To1Data.topBaseboard.materialData.color; topMaterialData2.tileSize_x = wall.point2To1Data.topBaseboard.materialData.tileSize_x; topMaterialData2.tileSize_y = wall.point2To1Data.topBaseboard.materialData.tileSize_y; topMaterialData2.rotation = wall.point2To1Data.topBaseboard.materialData.rotation; topMaterialData2.offsetX = wall.point2To1Data.topBaseboard.materialData.offsetX; topMaterialData2.offsetY = wall.point2To1Data.topBaseboard.materialData.offsetY; newTopBaseboard2.materialData = topMaterialData2; } newSide2.topBaseboard = newTopBaseboard2; newWall.point2To1Data = newSide2; inputdata.data.AddWall(newWall, true); } for (int i = 0; i < currentData.data.roomList.Count; i++) { RoomData room = currentData.data.roomList[i]; RoomData newroom = new RoomData(); newroom.pointList = new List <Point>(); newroom.guid = room.guid; newroom.name = room.name; newroom.type = room.type; newroom.ceilingHeight = room.ceilingHeight; //newroom.floor = room.floor; //newroom.ceiling = room.ceiling; MaterialData materialData = new MaterialData(); materialData.textureURI = room.floor.textureURI; materialData.id = room.floor.id; materialData.guid = room.floor.guid; materialData.seekId = room.floor.seekId; materialData.color = room.floor.color; materialData.tileSize_x = room.floor.tileSize_x; materialData.tileSize_y = room.floor.tileSize_y; materialData.rotation = room.floor.rotation; materialData.offsetX = room.floor.offsetX; materialData.offsetY = room.floor.offsetY; newroom.floor = materialData; MaterialData materialData2 = new MaterialData(); materialData2.textureURI = room.ceiling.textureURI; materialData2.id = room.ceiling.id; materialData2.guid = room.ceiling.guid; materialData2.seekId = room.ceiling.seekId; materialData2.color = room.ceiling.color; materialData2.tileSize_x = room.ceiling.tileSize_x; materialData2.tileSize_y = room.ceiling.tileSize_y; materialData2.rotation = room.ceiling.rotation; materialData2.offsetX = room.ceiling.offsetX; materialData2.offsetY = room.ceiling.offsetY; newroom.ceiling = materialData2; for (int k = 0; k < room.sideList.Count; k++) { WallSideData side = room.sideList[k]; WallSideData aimside = getSideById(side.guid, inputdata.data); if (aimside != null) { newroom.sideList.Add(aimside); } else { Debug.LogWarning("aimside == null"); } } for (int k = 0; k < room.pointList.Count; k++) { Point point = room.pointList[k]; Point aimpoint = getPointById(point.guid, inputdata.data); newroom.pointList.Add(aimpoint); } inputdata.data.roomList.Add(newroom); } for (int i = 0; i < currentData.data.productDataList.Count; i++) { ProductData product = currentData.data.productDataList[i]; ProductData newproduct = new ProductData(product.id, product.position, product.rotate, product.seekId, product.height, product.type); newproduct.guid = product.guid; newproduct.hide = product.hide; newproduct.scale = product.scale; if (product.targetWall != null) { newproduct.targetWall = inputdata.data.GetWall(product.targetWall.guid); } else { newproduct.targetWall = null; } inputdata.data.productDataList.Add(newproduct); } for (int i = 0; i < currentData.data.maxAngleRooms.Count; i++) { RoomData room = currentData.data.maxAngleRooms[i]; RoomData newroom = new RoomData(); newroom.pointList = new List <Point>(); newroom.guid = room.guid; newroom.name = room.name; newroom.type = room.type; newroom.ceilingHeight = room.ceilingHeight; //newroom.floor = room.floor; //newroom.ceiling = room.ceiling; MaterialData materialData = new MaterialData(); materialData.textureURI = room.floor.textureURI; materialData.id = room.floor.id; materialData.guid = room.floor.guid; materialData.seekId = room.floor.seekId; materialData.color = room.floor.color; materialData.tileSize_x = room.floor.tileSize_x; materialData.tileSize_y = room.floor.tileSize_y; materialData.rotation = room.floor.rotation; materialData.offsetX = room.floor.offsetX; materialData.offsetY = room.floor.offsetY; newroom.floor = materialData; MaterialData materialData2 = new MaterialData(); materialData2.textureURI = room.ceiling.textureURI; materialData2.id = room.ceiling.id; materialData2.guid = room.ceiling.guid; materialData2.seekId = room.ceiling.seekId; materialData2.color = room.ceiling.color; materialData2.tileSize_x = room.ceiling.tileSize_x; materialData2.tileSize_y = room.ceiling.tileSize_y; materialData2.rotation = room.ceiling.rotation; materialData2.offsetX = room.ceiling.offsetX; materialData2.offsetY = room.ceiling.offsetY; newroom.ceiling = materialData2; for (int k = 0; k < room.sideList.Count; k++) { WallSideData side = room.sideList[k]; WallSideData aimside = getSideById(side.guid, inputdata.data); if (aimside != null) { newroom.sideList.Add(aimside); } else { Debug.LogWarning("aimside == null"); } } for (int k = 0; k < room.pointList.Count; k++) { Point point = room.pointList[k]; Point aimpoint = getPointById(point.guid, inputdata.data); newroom.pointList.Add(aimpoint); } inputdata.data.maxAngleRooms.Add(newroom); } for (int i = 0; i < currentData.data.preScanDatas.Count; i++) { PreScanData scanData = currentData.data.preScanDatas[i] as PreScanData; PreScanData newScanData = new PreScanData(); newScanData.id = scanData.id; newScanData.position = scanData.position; newScanData.rotate = scanData.rotate; newScanData.imagemeta = scanData.imagemeta; inputdata.data.preScanDatas.Add(newScanData); } inputdata.data.defaultsettings = currentData.data.defaultsettings; undoDatas.Add(inputdata); redoDatas.Clear(); //jsonCacheManager.SaveSchemeToLocal(); Resources.UnloadUnusedAssets(); }
public override void SetData(ObjData data) { base.SetData(data); this.data = data as WallSideData; }