/// <summary> /// Adds a scene command to the active ones on the scene. /// </summary> /// <param name="command"></param> public static void AddSceneCommand(SceneCommand command) { #if UNITY_2017_1_OR_NEWER EditorApplication.playModeStateChanged -= PlayStateChangeCallBack; EditorApplication.playModeStateChanged += PlayStateChangeCallBack; #else EditorApplication.playmodeStateChanged -= PlayStateChangeCallBack; EditorApplication.playmodeStateChanged += PlayStateChangeCallBack; #endif EditorApplication.update -= MonKeyEditorUpdate; EditorApplication.update += MonKeyEditorUpdate; #if UNITY_2019 SceneView.duringSceneGui -= OnSceneViewGUI; SceneView.duringSceneGui += OnSceneViewGUI; #else SceneView.duringSceneGui -= OnSceneViewGUI; SceneView.duringSceneGui += OnSceneViewGUI; #endif command.OnActionDone += NotifyActionRemoved; int i = 1; while (CurrentSceneCommands.Count(_ => _.SceneCommandName == command.SceneCommandName) > 0) { if (command.SceneCommandName.Contains(i.ToString())) { command.SceneCommandName = command.SceneCommandName.Replace((i - 1).ToString(), i.ToString()); } else { command.SceneCommandName = command.SceneCommandName + " " + i; } i++; } CurrentSceneCommands.Add(command); if (!CurrentSceneView) { CurrentSceneView = SceneView.currentDrawingSceneView; } if (CurrentSceneView) { CurrentSceneView.Focus(); } SelectedSceneCommand = command; if (MonKeyInternalSettings.Instance.UseSceneCommandAsEditorWindow) { SceneCommandsWindow.ShowSceneCommandWindow(); } }
void TransformScene(CurrentSceneView view) { switch (view) { case CurrentSceneView.UniversalView: //Should move to place corresponding to the earth position //Currently just remove the control parameters _leftKey = _rightKey = _upKey = _downKey = _delta = 0; _rotateAngle = _yMove = _zMove = 0; _beginTerrainAnimation = false; _currentView = CurrentSceneView.UniversalView; break; case CurrentSceneView.EarthView: _currentView = CurrentSceneView.EarthView; break; } }