protected override void RegisterUndo() { if (GridPaintingState.activeBrushEditor != null) { GridPaintingState.activeBrushEditor.RegisterUndo(this.brushTarget, PaintableGrid.EditModeToBrushTool(EditMode.editMode)); } }
public void OnEditModeStart(IToolModeOwner owner, EditMode.SceneViewEditMode editMode) { if (GridPaintingState.gridBrush != null && PaintableGrid.InGridEditMode() && GridPaintingState.activeBrushEditor != null) { GridBrushBase.Tool tool = PaintableGrid.EditModeToBrushTool(editMode); GridPaintingState.activeBrushEditor.OnToolActivated(tool); this.m_PreviousToolActivatedEditor = GridPaintingState.activeBrushEditor; this.m_PreviousToolActivated = tool; for (int i = 0; i < GridPaintPaletteWindow.Styles.sceneViewEditModes.Length; i++) { if (GridPaintPaletteWindow.Styles.sceneViewEditModes[i] == editMode) { Cursor.SetCursor(GridPaintPaletteWindow.Styles.mouseCursorTextures[i], (!(GridPaintPaletteWindow.Styles.mouseCursorTextures[i] != null)) ? Vector2.zero : GridPaintPaletteWindow.Styles.mouseCursorOSHotspot[(int)SystemInfo.operatingSystemFamily], CursorMode.Auto); break; } } } base.Repaint(); }
public void OnEditModeStart(IToolModeOwner owner, EditMode.SceneViewEditMode editMode) { if (GridPaintingState.gridBrush != null && PaintableGrid.InGridEditMode() && GridPaintingState.activeBrushEditor != null) { GridBrushBase.Tool tool = PaintableGrid.EditModeToBrushTool(editMode); GridPaintingState.activeBrushEditor.OnToolActivated(tool); m_PreviousToolActivatedEditor = GridPaintingState.activeBrushEditor; m_PreviousToolActivated = tool; for (int i = 0; i < k_SceneViewEditModes.Length; ++i) { if (k_SceneViewEditModes[i] == editMode) { Cursor.SetCursor(MouseStyles.mouseCursorTextures[i], MouseStyles.mouseCursorTextures[i] != null ? MouseStyles.mouseCursorOSHotspot[(int)SystemInfo.operatingSystemFamily] : Vector2.zero, CursorMode.Auto); break; } } } Repaint(); }
private void CallOnPaintSceneGUI() { bool flag = GridSelection.active && GridSelection.target == this.brushTarget; if (flag || !(GridPaintingState.activeGrid != this)) { RectInt marqueeRect = new RectInt(base.mouseGridPosition, new Vector2Int(1, 1)); if (this.m_MarqueeStart.HasValue) { marqueeRect = GridEditorUtility.GetMarqueeRect(base.mouseGridPosition, this.m_MarqueeStart.Value); } else if (flag) { marqueeRect = new RectInt(GridSelection.position.xMin, GridSelection.position.yMin, GridSelection.position.size.x, GridSelection.position.size.y); } GridLayout gridLayout = (!(this.tilemap != null)) ? this.grid : this.tilemap; if (GridPaintingState.activeBrushEditor != null) { GridPaintingState.activeBrushEditor.OnPaintSceneGUI(gridLayout, this.brushTarget, new BoundsInt(new Vector3Int(marqueeRect.x, marqueeRect.y, 0), new Vector3Int(marqueeRect.width, marqueeRect.height, 1)), PaintableGrid.EditModeToBrushTool(EditMode.editMode), this.m_MarqueeStart.HasValue || base.executing); } else { GridBrushEditorBase.OnPaintSceneGUIInternal(gridLayout, this.brushTarget, new BoundsInt(new Vector3Int(marqueeRect.x, marqueeRect.y, 0), new Vector3Int(marqueeRect.width, marqueeRect.height, 1)), PaintableGrid.EditModeToBrushTool(EditMode.editMode), this.m_MarqueeStart.HasValue || base.executing); } } }