Esempio n. 1
0
 private static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromPath)
 {
     if (!GridPaintingState.savingPalette)
     {
         GridPaletteBrushes.FlushCache();
     }
 }
Esempio n. 2
0
        public void OnEnable()
        {
            instances.Add(this);
            if (clipboardView == null)
            {
                clipboardView           = CreateInstance <GridPaintPaletteClipboard>();
                clipboardView.owner     = this;
                clipboardView.hideFlags = HideFlags.HideAndDontSave;
                clipboardView.unlocked  = false;
            }

            if (m_PaintableSceneViewGrid == null)
            {
                m_PaintableSceneViewGrid           = CreateInstance <PaintableSceneViewGrid>();
                m_PaintableSceneViewGrid.hideFlags = HideFlags.HideAndDontSave;
            }

            GridPaletteBrushes.FlushCache();
            EditMode.editModeStarted           += OnEditModeStart;
            EditMode.editModeEnded             += OnEditModeEnd;
            GridSelection.gridSelectionChanged += OnGridSelectionChanged;
            GridPaintingState.RegisterPainterInterest(this);
            GridPaintingState.scenePaintTargetChanged += OnScenePaintTargetChanged;
            GridPaintingState.brushChanged            += OnBrushChanged;
            SceneView.onSceneGUIDelegate        += OnSceneViewGUI;
            PrefabUtility.prefabInstanceUpdated += PrefabInstanceUpdated;

            AssetPreview.SetPreviewTextureCacheSize(256, GetInstanceID());
            wantsMouseMove             = true;
            wantsMouseEnterLeaveWindow = true;

            if (m_PreviewResizer == null)
            {
                m_PreviewResizer = new PreviewResizer();
                m_PreviewResizer.Init("TilemapBrushInspector");
            }

            minSize = new Vector2(240f, 200f);

            if (palette == null && TilemapEditorUserSettings.lastUsedPalette != null && GridPalettes.palettes.Contains(TilemapEditorUserSettings.lastUsedPalette))
            {
                palette = TilemapEditorUserSettings.lastUsedPalette;
            }

            Tools.onToolChanged += ToolChanged;

            ShortcutIntegration.instance.contextManager.RegisterToolContext(m_ShortcutContext);
        }
Esempio n. 3
0
 public void OnEnable()
 {
     GridPaintPaletteWindow.instances.Add(this);
     if (this.clipboardView == null)
     {
         this.clipboardView           = ScriptableObject.CreateInstance <GridPaintPaletteClipboard>();
         this.clipboardView.owner     = this;
         this.clipboardView.hideFlags = HideFlags.HideAndDontSave;
         this.clipboardView.unlocked  = false;
     }
     if (this.m_PaintableSceneViewGrid == null)
     {
         this.m_PaintableSceneViewGrid           = ScriptableObject.CreateInstance <PaintableSceneViewGrid>();
         this.m_PaintableSceneViewGrid.hideFlags = HideFlags.HideAndDontSave;
     }
     GridPaletteBrushes.FlushCache();
     EditorApplication.globalEventHandler = (EditorApplication.CallbackFunction)Delegate.Combine(EditorApplication.globalEventHandler, new EditorApplication.CallbackFunction(this.HotkeyHandler));
     EditMode.editModeStarted            += new Action <IToolModeOwner, EditMode.SceneViewEditMode>(this.OnEditModeStart);
     EditMode.editModeEnded             += new Action <IToolModeOwner>(this.OnEditModeEnd);
     GridSelection.gridSelectionChanged += new Action(this.OnGridSelectionChanged);
     GridPaintingState.RegisterPainterInterest(this);
     GridPaintingState.scenePaintTargetChanged += new Action <GameObject>(this.OnScenePaintTargetChanged);
     GridPaintingState.brushChanged            += new Action <GridBrushBase>(this.OnBrushChanged);
     SceneView.onSceneGUIDelegate        = (SceneView.OnSceneFunc)Delegate.Combine(SceneView.onSceneGUIDelegate, new SceneView.OnSceneFunc(this.OnSceneViewGUI));
     PrefabUtility.prefabInstanceUpdated = (PrefabUtility.PrefabInstanceUpdated)Delegate.Combine(PrefabUtility.prefabInstanceUpdated, new PrefabUtility.PrefabInstanceUpdated(this.PrefabInstanceUpdated));
     AssetPreview.SetPreviewTextureCacheSize(256, base.GetInstanceID());
     base.wantsMouseMove             = true;
     base.wantsMouseEnterLeaveWindow = true;
     if (this.m_PreviewResizer == null)
     {
         this.m_PreviewResizer = new PreviewResizer();
         this.m_PreviewResizer.Init("TilemapBrushInspector");
     }
     base.minSize = new Vector2(240f, 200f);
     if (this.palette == null && TilemapEditorUserSettings.lastUsedPalette != null && GridPalettes.palettes.Contains(TilemapEditorUserSettings.lastUsedPalette))
     {
         this.palette = TilemapEditorUserSettings.lastUsedPalette;
     }
     Tools.onToolChanged = (Tools.OnToolChangedFunc)Delegate.Combine(Tools.onToolChanged, new Tools.OnToolChangedFunc(this.ToolChanged));
 }