private void Update() { if (!EditorObjects.isBuilding) { return; } if (GUIUtility.hotControl == 0) { if (EditorInteract.isFlying) { EditorObjects.handleType = EDragType.NONE; if (EditorObjects.isDragging) { EditorObjects._dragStart = Vector2.zero; EditorObjects._dragEnd = Vector2.zero; EditorObjects._isDragging = false; if (EditorObjects.onDragStopped != null) { EditorObjects.onDragStopped(); } EditorObjects.clearSelection(); } return; } if (EditorObjects.handleType != EDragType.NONE) { if (!Input.GetKey(ControlsSettings.primary)) { if (EditorObjects.dragMode == EDragMode.SCALE) { for (int i = 0; i < EditorObjects.selection.Count; i++) { EditorObjects.selection[i].transform.parent = EditorObjects.selection[i].parent; } EditorObjects.group.localScale = Vector3.one; for (int j = 0; j < EditorObjects.selection.Count; j++) { EditorObjects.selection[j].transform.parent = EditorObjects.group; } } EditorObjects.applySelection(); EditorObjects.handleType = EDragType.NONE; } else { if (EditorObjects.handleType == EDragType.TRANSFORM_X) { EditorObjects.transformGroup(EditorObjects.handle.right, EditorObjects.handle.up); } else if (EditorObjects.handleType == EDragType.TRANSFORM_Y) { EditorObjects.transformGroup(EditorObjects.handle.up, EditorObjects.handle.right); } else if (EditorObjects.handleType == EDragType.TRANSFORM_Z) { EditorObjects.transformGroup(EditorObjects.handle.forward, EditorObjects.handle.up); } else if (EditorObjects.handleType == EDragType.PLANE_X) { EditorObjects.planeGroup(EditorObjects.handle.right); } else if (EditorObjects.handleType == EDragType.PLANE_Y) { EditorObjects.planeGroup(EditorObjects.handle.up); } else if (EditorObjects.handleType == EDragType.PLANE_Z) { EditorObjects.planeGroup(EditorObjects.handle.forward); } if (EditorObjects.handleType == EDragType.ROTATION_X) { EditorObjects.rotateGroup(EditorObjects.handle.right, Vector3.right); } else if (EditorObjects.handleType == EDragType.ROTATION_Y) { EditorObjects.rotateGroup(EditorObjects.handle.up, Vector3.up); } else if (EditorObjects.handleType == EDragType.ROTATION_Z) { EditorObjects.rotateGroup(EditorObjects.handle.forward, Vector3.forward); } else if (EditorObjects.handleType == EDragType.SCALE_X) { EditorObjects.scaleGroup(EditorObjects.handle.right, Vector3.right, EditorObjects.handle.localScale.x * EditorObjects.scaleHandle.localScale.x); } else if (EditorObjects.handleType == EDragType.SCALE_Y) { EditorObjects.scaleGroup(EditorObjects.handle.up, Vector3.up, EditorObjects.handle.localScale.x * EditorObjects.scaleHandle.localScale.y); } else if (EditorObjects.handleType == EDragType.SCALE_Z) { EditorObjects.scaleGroup(EditorObjects.handle.forward, Vector3.forward, EditorObjects.handle.localScale.x * EditorObjects.scaleHandle.localScale.z); } else if (EditorObjects.handleType == EDragType.SIZE) { EditorObjects.sizeGroup(EditorObjects.handle.localScale.x); } } } if (Input.GetKeyDown(ControlsSettings.tool_0)) { EditorObjects.dragMode = EDragMode.TRANSFORM; } if (Input.GetKeyDown(ControlsSettings.tool_1)) { EditorObjects.dragMode = EDragMode.ROTATE; } if (Input.GetKeyDown(ControlsSettings.tool_3)) { EditorObjects.dragMode = EDragMode.SCALE; } if ((Input.GetKeyDown(127) || Input.GetKeyDown(8)) && EditorObjects.selection.Count > 0) { LevelObjects.step++; for (int k = 0; k < EditorObjects.selection.Count; k++) { EditorObjects.selection[k].transform.parent = EditorObjects.selection[k].parent; LevelObjects.registerRemoveObject(EditorObjects.selection[k].transform); } EditorObjects.selection.Clear(); EditorObjects.calculateHandleOffsets(); } if (Input.GetKeyDown(122) && Input.GetKey(306)) { EditorObjects.clearSelection(); LevelObjects.undo(); } if (Input.GetKeyDown(120) && Input.GetKey(306)) { EditorObjects.clearSelection(); LevelObjects.redo(); } if (Input.GetKeyDown(98) && EditorObjects.selection.Count > 0 && Input.GetKey(306)) { EditorObjects.copyPosition = EditorObjects.handle.position; EditorObjects.copyRotation = EditorObjects.handle.rotation; if (EditorObjects.selection.Count == 1) { EditorObjects.copyScale = EditorObjects.selection[0].transform.localScale; EditorObjects.copyScale.x = EditorObjects.copyScale.x * EditorObjects.group.localScale.x; EditorObjects.copyScale.y = EditorObjects.copyScale.y * EditorObjects.group.localScale.y; EditorObjects.copyScale.z = EditorObjects.copyScale.z * EditorObjects.group.localScale.z; } else { EditorObjects.copyScale = Vector3.one; } } if (Input.GetKeyDown(110) && EditorObjects.selection.Count > 0 && EditorObjects.copyPosition != Vector3.zero && Input.GetKey(306)) { EditorObjects.pointSelection(); EditorObjects.handle.position = EditorObjects.copyPosition; EditorObjects.handle.rotation = EditorObjects.copyRotation; if (EditorObjects.selection.Count == 1) { EditorObjects.group.localScale = EditorObjects.copyScale; } EditorObjects.updateGroup(); EditorObjects.applySelection(); } if (Input.GetKeyDown(99) && EditorObjects.selection.Count > 0 && Input.GetKey(306)) { EditorObjects.copies.Clear(); for (int l = 0; l < EditorObjects.selection.Count; l++) { ObjectAsset objectAsset; ItemAsset itemAsset; LevelObjects.getAssetEditor(EditorObjects.selection[l].transform, out objectAsset, out itemAsset); if (objectAsset != null || itemAsset != null) { EditorObjects.copies.Add(new EditorCopy(EditorObjects.selection[l].transform.position, EditorObjects.selection[l].transform.rotation, EditorObjects.selection[l].transform.localScale, objectAsset, itemAsset)); } } } if (Input.GetKeyDown(118) && EditorObjects.copies.Count > 0 && Input.GetKey(306)) { EditorObjects.clearSelection(); LevelObjects.step++; for (int m = 0; m < EditorObjects.copies.Count; m++) { Transform transform = LevelObjects.registerAddObject(EditorObjects.copies[m].position, EditorObjects.copies[m].rotation, EditorObjects.copies[m].scale, EditorObjects.copies[m].objectAsset, EditorObjects.copies[m].itemAsset); if (transform != null) { EditorObjects.addSelection(transform); } } } if (EditorObjects.handleType == EDragType.NONE) { if (Input.GetKeyDown(ControlsSettings.primary)) { if (EditorInteract.logicHit.transform != null && (EditorInteract.logicHit.transform.name == "Arrow_X" || EditorInteract.logicHit.transform.name == "Arrow_Y" || EditorInteract.logicHit.transform.name == "Arrow_Z" || EditorInteract.logicHit.transform.name == "Plane_X" || EditorInteract.logicHit.transform.name == "Plane_Y" || EditorInteract.logicHit.transform.name == "Plane_Z" || EditorInteract.logicHit.transform.name == "Circle_X" || EditorInteract.logicHit.transform.name == "Circle_Y" || EditorInteract.logicHit.transform.name == "Circle_Z" || EditorInteract.logicHit.transform.name == "Scale_X" || EditorInteract.logicHit.transform.name == "Scale_Y" || EditorInteract.logicHit.transform.name == "Scale_Z" || EditorInteract.logicHit.transform.name == "Size")) { EditorObjects.mouseOrigin = Input.mousePosition; EditorObjects.transformOrigin = EditorObjects.handle.position; EditorObjects.rotateOrigin = EditorObjects.handle.rotation; EditorObjects.scaleOrigin = EditorObjects.group.localScale; EditorObjects.handleOffset = EditorInteract.logicHit.point - EditorObjects.handle.position; EditorObjects.pointSelection(); if (EditorInteract.logicHit.transform.name == "Arrow_X") { EditorObjects.handleType = EDragType.TRANSFORM_X; } else if (EditorInteract.logicHit.transform.name == "Arrow_Y") { EditorObjects.handleType = EDragType.TRANSFORM_Y; } else if (EditorInteract.logicHit.transform.name == "Arrow_Z") { EditorObjects.handleType = EDragType.TRANSFORM_Z; } else if (EditorInteract.logicHit.transform.name == "Plane_X") { EditorObjects.handleType = EDragType.PLANE_X; } else if (EditorInteract.logicHit.transform.name == "Plane_Y") { EditorObjects.handleType = EDragType.PLANE_Y; } else if (EditorInteract.logicHit.transform.name == "Plane_Z") { EditorObjects.handleType = EDragType.PLANE_Z; } else if (EditorInteract.logicHit.transform.name == "Circle_X") { EditorObjects.rotateInverted = (Vector3.Dot(EditorInteract.logicHit.point - EditorObjects.handle.position, MainCamera.instance.transform.up) < 0f); EditorObjects.handleType = EDragType.ROTATION_X; } else if (EditorInteract.logicHit.transform.name == "Circle_Y") { EditorObjects.rotateInverted = (Vector3.Dot(EditorInteract.logicHit.point - EditorObjects.handle.position, MainCamera.instance.transform.up) < 0f); EditorObjects.handleType = EDragType.ROTATION_Y; } else if (EditorInteract.logicHit.transform.name == "Circle_Z") { EditorObjects.rotateInverted = (Vector3.Dot(EditorInteract.logicHit.point - EditorObjects.handle.position, MainCamera.instance.transform.up) < 0f); EditorObjects.handleType = EDragType.ROTATION_Z; } else if (EditorInteract.logicHit.transform.name == "Scale_X") { EditorObjects.handleType = EDragType.SCALE_X; } else if (EditorInteract.logicHit.transform.name == "Scale_Y") { EditorObjects.handleType = EDragType.SCALE_Y; } else if (EditorInteract.logicHit.transform.name == "Scale_Z") { EditorObjects.handleType = EDragType.SCALE_Z; } else if (EditorInteract.logicHit.transform.name == "Size") { EditorObjects.handleType = EDragType.SIZE; } } else if (EditorInteract.objectHit.transform != null) { if (Input.GetKey(ControlsSettings.modify)) { if (EditorObjects.containsSelection(EditorInteract.objectHit.transform)) { EditorObjects.removeSelection(EditorInteract.objectHit.transform); } else { EditorObjects.addSelection(EditorInteract.objectHit.transform); } } else if (EditorObjects.containsSelection(EditorInteract.objectHit.transform)) { EditorObjects.clearSelection(); } else { EditorObjects.clearSelection(); EditorObjects.addSelection(EditorInteract.objectHit.transform); } } else { if (!EditorObjects.isDragging) { EditorObjects._dragStart.x = EditorUI.window.mouse_x; EditorObjects._dragStart.y = EditorUI.window.mouse_y; } if (!Input.GetKey(ControlsSettings.modify)) { EditorObjects.clearSelection(); } } } else if (Input.GetKey(ControlsSettings.primary) && EditorObjects.dragStart.x != 0f) { EditorObjects._dragEnd.x = EditorUI.window.mouse_x; EditorObjects._dragEnd.y = EditorUI.window.mouse_y; if (EditorObjects.isDragging || Mathf.Abs(EditorObjects.dragEnd.x - EditorObjects.dragStart.x) > 50f || Mathf.Abs(EditorObjects.dragEnd.x - EditorObjects.dragStart.x) > 50f) { int num = (int)EditorObjects.dragStart.x; int num2 = (int)EditorObjects.dragStart.y; if (EditorObjects.dragEnd.x < EditorObjects.dragStart.x) { num = (int)EditorObjects.dragEnd.x; } if (EditorObjects.dragEnd.y < EditorObjects.dragStart.y) { num2 = (int)EditorObjects.dragEnd.y; } int num3 = (int)EditorObjects.dragEnd.x; int num4 = (int)EditorObjects.dragEnd.y; if (EditorObjects.dragStart.x > EditorObjects.dragEnd.x) { num3 = (int)EditorObjects.dragStart.x; } if (EditorObjects.dragStart.y > EditorObjects.dragEnd.y) { num4 = (int)EditorObjects.dragStart.y; } if (EditorObjects.onDragStarted != null) { EditorObjects.onDragStarted(num, num2, num3, num4); } if (!EditorObjects.isDragging) { EditorObjects._isDragging = true; EditorObjects.dragable.Clear(); byte region_x = Editor.editor.area.region_x; byte region_y = Editor.editor.area.region_y; if (Regions.checkSafe((int)region_x, (int)region_y)) { for (int n = (int)(region_x - 1); n <= (int)(region_x + 1); n++) { for (int num5 = (int)(region_y - 1); num5 <= (int)(region_y + 1); num5++) { if (Regions.checkSafe((int)((byte)n), (int)((byte)num5)) && LevelObjects.regions[n, num5]) { for (int num6 = 0; num6 < LevelObjects.objects[n, num5].Count; num6++) { LevelObject levelObject = LevelObjects.objects[n, num5][num6]; if (!(levelObject.transform == null)) { Vector3 newScreen = MainCamera.instance.WorldToScreenPoint(levelObject.transform.position); if (newScreen.z >= 0f) { newScreen.y = (float)Screen.height - newScreen.y; EditorObjects.dragable.Add(new EditorDrag(levelObject.transform, newScreen)); } } } for (int num7 = 0; num7 < LevelObjects.buildables[n, num5].Count; num7++) { LevelBuildableObject levelBuildableObject = LevelObjects.buildables[n, num5][num7]; if (!(levelBuildableObject.transform == null)) { Vector3 newScreen2 = MainCamera.instance.WorldToScreenPoint(levelBuildableObject.transform.position); if (newScreen2.z >= 0f) { newScreen2.y = (float)Screen.height - newScreen2.y; EditorObjects.dragable.Add(new EditorDrag(levelBuildableObject.transform, newScreen2)); } } } } } } } } if (!Input.GetKey(ControlsSettings.modify)) { for (int num8 = 0; num8 < EditorObjects.selection.Count; num8++) { Vector3 vector = MainCamera.instance.WorldToScreenPoint(EditorObjects.selection[num8].transform.position); if (vector.z < 0f) { EditorObjects.removeSelection(EditorObjects.selection[num8].transform); } else { vector.y = (float)Screen.height - vector.y; if (vector.x < (float)num || vector.y < (float)num2 || vector.x > (float)num3 || vector.y > (float)num4) { EditorObjects.removeSelection(EditorObjects.selection[num8].transform); } } } } for (int num9 = 0; num9 < EditorObjects.dragable.Count; num9++) { EditorDrag editorDrag = EditorObjects.dragable[num9]; if (!(editorDrag.transform == null)) { if (!(editorDrag.transform.parent == EditorObjects.group)) { if (editorDrag.screen.x >= (float)num && editorDrag.screen.y >= (float)num2 && editorDrag.screen.x <= (float)num3 && editorDrag.screen.y <= (float)num4) { EditorObjects.addSelection(editorDrag.transform); } } } } } } if (EditorObjects.selection.Count > 0) { if (Input.GetKeyDown(ControlsSettings.tool_2) && EditorInteract.worldHit.transform != null) { EditorObjects.pointSelection(); EditorObjects.handle.position = EditorInteract.worldHit.point; if (Input.GetKey(ControlsSettings.snap)) { EditorObjects.handle.position += EditorInteract.worldHit.normal * EditorObjects.snapTransform; } EditorObjects.updateGroup(); EditorObjects.applySelection(); } if (Input.GetKeyDown(ControlsSettings.focus)) { MainCamera.instance.transform.parent.position = EditorObjects.handle.position - 15f * MainCamera.instance.transform.forward; } } else if (EditorInteract.worldHit.transform != null) { if (EditorInteract.worldHit.transform.CompareTag("Large") || EditorInteract.worldHit.transform.CompareTag("Medium") || EditorInteract.worldHit.transform.CompareTag("Small") || EditorInteract.worldHit.transform.CompareTag("Barricade") || EditorInteract.worldHit.transform.CompareTag("Structure")) { ObjectAsset objectAsset2; ItemAsset itemAsset2; LevelObjects.getAssetEditor(EditorInteract.worldHit.transform, out objectAsset2, out itemAsset2); if (objectAsset2 != null) { EditorUI.hint(EEditorMessage.FOCUS, objectAsset2.objectName); } else if (itemAsset2 != null) { EditorUI.hint(EEditorMessage.FOCUS, itemAsset2.itemName); } } if (Input.GetKeyDown(ControlsSettings.tool_2)) { EditorObjects.handle.position = EditorInteract.worldHit.point; if (Input.GetKey(ControlsSettings.snap)) { EditorObjects.handle.position += EditorInteract.worldHit.normal * EditorObjects.snapTransform; } EditorObjects.handle.rotation = Quaternion.Euler(-90f, 0f, 0f); if (EditorObjects.selectedObjectAsset != null || EditorObjects.selectedItemAsset != null) { LevelObjects.step++; Transform transform2 = LevelObjects.registerAddObject(EditorObjects.handle.position, EditorObjects.handle.rotation, Vector3.one, EditorObjects.selectedObjectAsset, EditorObjects.selectedItemAsset); if (transform2 != null) { EditorObjects.addSelection(transform2); } } } } } } if (Input.GetKeyUp(ControlsSettings.primary) && EditorObjects.dragStart.x != 0f) { EditorObjects._dragStart = Vector2.zero; if (EditorObjects.isDragging) { EditorObjects._dragEnd = Vector2.zero; EditorObjects._isDragging = false; if (EditorObjects.onDragStopped != null) { EditorObjects.onDragStopped(); } } } }
// Token: 0x06002EB3 RID: 11955 RVA: 0x001309B4 File Offset: 0x0012EDB4 private void Update() { if (!this.isBuilding) { return; } this.ray = MainCamera.instance.ScreenPointToRay(Input.mousePosition); Physics.Raycast(this.ray, out this.worldHit, 256f, RayMasks.EDITOR_WORLD); Physics.Raycast(this.ray, out this.buildableHit, 256f, RayMasks.EDITOR_BUILDABLE); Physics.Raycast(this.ray, out this.logicHit, 256f, RayMasks.VIEWMODEL); if (GUIUtility.hotControl == 0) { if (Input.GetKey(ControlsSettings.secondary)) { this.handleType = EDragType.NONE; if (this.isDragging) { this._dragStart = Vector2.zero; this._dragEnd = Vector2.zero; this._isDragging = false; if (this.onDragStopped != null) { this.onDragStopped(); } this.clearSelection(); } return; } if (this.handleType != EDragType.NONE) { if (!Input.GetKey(ControlsSettings.primary)) { this.applySelection(); this.handleType = EDragType.NONE; } else { if (this.handleType == EDragType.TRANSFORM_X) { this.transformGroup(this.handle.right, this.handle.up); } else if (this.handleType == EDragType.TRANSFORM_Y) { this.transformGroup(this.handle.up, this.handle.right); } else if (this.handleType == EDragType.TRANSFORM_Z) { this.transformGroup(this.handle.forward, this.handle.up); } else if (this.handleType == EDragType.PLANE_X) { this.planeGroup(this.handle.right); } else if (this.handleType == EDragType.PLANE_Y) { this.planeGroup(this.handle.up); } else if (this.handleType == EDragType.PLANE_Z) { this.planeGroup(this.handle.forward); } if (this.handleType == EDragType.ROTATION_X) { this.rotateGroup(this.handle.right, Vector3.right); } else if (this.handleType == EDragType.ROTATION_Y) { this.rotateGroup(this.handle.up, Vector3.up); } else if (this.handleType == EDragType.ROTATION_Z) { this.rotateGroup(this.handle.forward, Vector3.forward); } } } if (Input.GetKeyDown(ControlsSettings.tool_0)) { this.dragMode = EDragMode.TRANSFORM; } if (Input.GetKeyDown(ControlsSettings.tool_1)) { this.dragMode = EDragMode.ROTATE; } if (Input.GetKeyDown(KeyCode.B) && this.selection.Count > 0 && Input.GetKey(KeyCode.LeftControl)) { this.copyPosition = this.handle.position; this.copyRotation = this.handle.rotation; } if (Input.GetKeyDown(KeyCode.N) && this.selection.Count > 0 && this.copyPosition != Vector3.zero && Input.GetKey(KeyCode.LeftControl)) { this.pointSelection(); this.handle.position = this.copyPosition; this.handle.rotation = this.copyRotation; this.updateGroup(); this.applySelection(); } if (this.handleType == EDragType.NONE) { if (Input.GetKeyDown(ControlsSettings.primary)) { if (this.logicHit.transform != null && (this.logicHit.transform.name == "Arrow_X" || this.logicHit.transform.name == "Arrow_Y" || this.logicHit.transform.name == "Arrow_Z" || this.logicHit.transform.name == "Plane_X" || this.logicHit.transform.name == "Plane_Y" || this.logicHit.transform.name == "Plane_Z" || this.logicHit.transform.name == "Circle_X" || this.logicHit.transform.name == "Circle_Y" || this.logicHit.transform.name == "Circle_Z")) { this.mouseOrigin = Input.mousePosition; this.transformOrigin = this.handle.position; this.rotateOrigin = this.handle.rotation; this.handleOffset = this.logicHit.point - this.handle.position; this.pointSelection(); if (this.logicHit.transform.name == "Arrow_X") { this.handleType = EDragType.TRANSFORM_X; } else if (this.logicHit.transform.name == "Arrow_Y") { this.handleType = EDragType.TRANSFORM_Y; } else if (this.logicHit.transform.name == "Arrow_Z") { this.handleType = EDragType.TRANSFORM_Z; } else if (this.logicHit.transform.name == "Plane_X") { this.handleType = EDragType.PLANE_X; } else if (this.logicHit.transform.name == "Plane_Y") { this.handleType = EDragType.PLANE_Y; } else if (this.logicHit.transform.name == "Plane_Z") { this.handleType = EDragType.PLANE_Z; } else if (this.logicHit.transform.name == "Circle_X") { this.rotateInverted = (Vector3.Dot(this.logicHit.point - this.handle.position, MainCamera.instance.transform.up) < 0f); this.handleType = EDragType.ROTATION_X; } else if (this.logicHit.transform.name == "Circle_Y") { this.rotateInverted = (Vector3.Dot(this.logicHit.point - this.handle.position, MainCamera.instance.transform.up) < 0f); this.handleType = EDragType.ROTATION_Y; } else if (this.logicHit.transform.name == "Circle_Z") { this.rotateInverted = (Vector3.Dot(this.logicHit.point - this.handle.position, MainCamera.instance.transform.up) < 0f); this.handleType = EDragType.ROTATION_Z; } } else { Transform transform = this.buildableHit.transform; if (transform != null && (transform.CompareTag("Barricade") || transform.CompareTag("Structure"))) { InteractableDoorHinge component = transform.GetComponent <InteractableDoorHinge>(); if (component != null) { transform = component.transform.parent.parent; } if (Input.GetKey(ControlsSettings.modify)) { if (this.containsSelection(transform)) { this.removeSelection(transform); } else { this.addSelection(transform); } } else if (this.containsSelection(transform)) { this.clearSelection(); } else { this.clearSelection(); this.addSelection(transform); } } else { if (!this.isDragging) { this._dragStart.x = PlayerUI.window.mouse_x; this._dragStart.y = PlayerUI.window.mouse_y; } if (!Input.GetKey(ControlsSettings.modify)) { this.clearSelection(); } } } } else if (Input.GetKey(ControlsSettings.primary) && this.dragStart.x != 0f) { this._dragEnd.x = PlayerUI.window.mouse_x; this._dragEnd.y = PlayerUI.window.mouse_y; if (this.isDragging || Mathf.Abs(this.dragEnd.x - this.dragStart.x) > 50f || Mathf.Abs(this.dragEnd.x - this.dragStart.x) > 50f) { int num = (int)this.dragStart.x; int num2 = (int)this.dragStart.y; if (this.dragEnd.x < this.dragStart.x) { num = (int)this.dragEnd.x; } if (this.dragEnd.y < this.dragStart.y) { num2 = (int)this.dragEnd.y; } int num3 = (int)this.dragEnd.x; int num4 = (int)this.dragEnd.y; if (this.dragStart.x > this.dragEnd.x) { num3 = (int)this.dragStart.x; } if (this.dragStart.y > this.dragEnd.y) { num4 = (int)this.dragStart.y; } if (this.onDragStarted != null) { this.onDragStarted(num, num2, num3, num4); } if (!this.isDragging) { this._isDragging = true; this.dragable.Clear(); byte region_x = Player.player.movement.region_x; byte region_y = Player.player.movement.region_y; if (Regions.checkSafe((int)region_x, (int)region_y)) { for (int i = 0; i < BarricadeManager.plants.Count; i++) { BarricadeRegion barricadeRegion = BarricadeManager.plants[i]; for (int j = 0; j < barricadeRegion.drops.Count; j++) { BarricadeDrop barricadeDrop = barricadeRegion.drops[j]; if (!(barricadeDrop.model == null)) { Vector3 newScreen = MainCamera.instance.WorldToScreenPoint(barricadeDrop.model.position); if (newScreen.z >= 0f) { newScreen.y = (float)Screen.height - newScreen.y; this.dragable.Add(new EditorDrag(barricadeDrop.model, newScreen)); } } } } for (int k = (int)(region_x - 1); k <= (int)(region_x + 1); k++) { for (int l = (int)(region_y - 1); l <= (int)(region_y + 1); l++) { if (Regions.checkSafe((int)((byte)k), (int)((byte)l))) { for (int m = 0; m < BarricadeManager.regions[k, l].drops.Count; m++) { BarricadeDrop barricadeDrop2 = BarricadeManager.regions[k, l].drops[m]; if (!(barricadeDrop2.model == null)) { Vector3 newScreen2 = MainCamera.instance.WorldToScreenPoint(barricadeDrop2.model.position); if (newScreen2.z >= 0f) { newScreen2.y = (float)Screen.height - newScreen2.y; this.dragable.Add(new EditorDrag(barricadeDrop2.model, newScreen2)); } } } for (int n = 0; n < StructureManager.regions[k, l].drops.Count; n++) { StructureDrop structureDrop = StructureManager.regions[k, l].drops[n]; if (structureDrop != null) { Vector3 newScreen3 = MainCamera.instance.WorldToScreenPoint(structureDrop.model.position); if (newScreen3.z >= 0f) { newScreen3.y = (float)Screen.height - newScreen3.y; this.dragable.Add(new EditorDrag(structureDrop.model, newScreen3)); } } } } } } } } if (!Input.GetKey(ControlsSettings.modify)) { for (int num5 = 0; num5 < this.selection.Count; num5++) { if (!(this.selection[num5].transform == null)) { Vector3 vector = MainCamera.instance.WorldToScreenPoint(this.selection[num5].transform.position); if (vector.z < 0f) { this.removeSelection(this.selection[num5].transform); } else { vector.y = (float)Screen.height - vector.y; if (vector.x < (float)num || vector.y < (float)num2 || vector.x > (float)num3 || vector.y > (float)num4) { this.removeSelection(this.selection[num5].transform); } } } } } for (int num6 = 0; num6 < this.dragable.Count; num6++) { EditorDrag editorDrag = this.dragable[num6]; if (!(editorDrag.transform == null)) { if (!(editorDrag.transform.parent == this.group)) { if (editorDrag.screen.x >= (float)num && editorDrag.screen.y >= (float)num2 && editorDrag.screen.x <= (float)num3 && editorDrag.screen.y <= (float)num4) { this.addSelection(editorDrag.transform); } } } } } } if (this.selection.Count > 0 && Input.GetKeyDown(ControlsSettings.tool_2) && this.worldHit.transform != null) { this.pointSelection(); this.handle.position = this.worldHit.point; if (Input.GetKey(ControlsSettings.snap)) { this.handle.position += this.worldHit.normal * this.snapTransform; } this.updateGroup(); this.applySelection(); } } } if (Input.GetKeyUp(ControlsSettings.primary) && this.dragStart.x != 0f) { this._dragStart = Vector2.zero; if (this.isDragging) { this._dragEnd = Vector2.zero; this._isDragging = false; if (this.onDragStopped != null) { this.onDragStopped(); } } } }