Exemplo n.º 1
0
 private void ProcessInput()
 {
     if (Event.current != null)
     {
         Event e = Event.current;
         if (e.type == EventType.KeyDown)
         {
             KeyCode k = e.keyCode;
             if (k == KeyCode.LeftControl || k == KeyCode.RightControl)
             {
                 ctrlHeld = true;
             }
         }
         else if (e.type == EventType.KeyUp)
         {
             KeyCode k = e.keyCode;
             if (k == KeyCode.S)
             {
                 if (ctrlHeld)
                 {
                     editorInterface.SaveCanvas();
                 }
             }
             else if (k == KeyCode.LeftControl || k == KeyCode.RightControl)
             {
                 ctrlHeld = false;
             }
         }
     }
 }
Exemplo n.º 2
0
        private void OnDestroy()
        {
            if (editorInterface.ExistingFile())
            {
                editorInterface.SaveCanvas();
            }
            else
            {
                editorInterface.SaveCanvasAs();
            }

            // Unsubscribe from events
            NodeEditor.ClientRepaints               -= Repaint;
            EditorLoadingControl.justLeftPlayMode   -= NormalReInit;
            EditorLoadingControl.justOpenedNewScene -= NormalReInit;
                #if UNITY_2019_1_OR_NEWER
            SceneView.duringSceneGui -= OnSceneGUI;
                #else
            SceneView.onSceneGUIDelegate -= OnSceneGUI;
                #endif
            Undo.undoRedoPerformed -= NodeEditor.RepaintClients;
            Undo.undoRedoPerformed -= UndoRedoRecalculate;

            // Clear Cache
            canvasCache.ClearCacheEvents();
        }