/// <summary> /// action for changing automap grid mode /// </summary> private void ActionChangeAutomapGridMode() { int numberOfViewModes = Enum.GetNames(typeof(AutomapViewMode)).Length; automapViewMode++; if ((int)automapViewMode > numberOfViewModes - 1) // first mode is mode 0 -> so use numberOfViewModes-1 for comparison automapViewMode = 0; switch (automapViewMode) { case AutomapViewMode.View2D: // update grid graphics nativeTexture.SetPixels(78, nativeTexture.height - 171 - 19, 27, 19, pixelsGrid2D); nativeTexture.Apply(false); saveCameraTransformView3D(); restoreOldCameraTransformViewFromTop(); cameraAutomap.fieldOfView = fieldOfViewCameraMode2D; daggerfallAutomap.RotationPivotAxisPosition = rotationPivotAxisPositionViewFromTop; updateAutomapView(); break; case AutomapViewMode.View3D: // update grid graphics nativeTexture.SetPixels(78, nativeTexture.height - 171 - 19, 27, 19, pixelsGrid3D); nativeTexture.Apply(false); saveCameraTransformViewFromTop(); restoreOldCameraTransformView3D(); cameraAutomap.fieldOfView = fieldOfViewCameraMode3D; daggerfallAutomap.RotationPivotAxisPosition = rotationPivotAxisPositionView3D; updateAutomapView(); break; default: break; } }
/// <summary> /// called when automap window is pushed - resets automap settings to default settings and signals DaggerfallAutomap class /// </summary> public override void OnPush() { initGlobalResources(); // initialize gameobjectAutomap, daggerfallAutomap and layerAutomap if (!isSetup) // if Setup() has not run, run it now Setup(); daggerfallAutomap.IsOpenAutomap = true; // signal DaggerfallAutomap script that automap is open and it should do its stuff in its Update() function daggerfallAutomap.updateAutomapStateOnWindowPush(); // signal DaggerfallAutomap script that automap window was closed and that it should update its state (updates player marker arrow) // get automap camera cameraAutomap = daggerfallAutomap.CameraAutomap; // create automap render texture and Texture2D used in conjuction with automap camera to render automap level geometry and display it in panel Rect positionPanelRenderAutomap = dummyPanelAutomap.Rectangle; createAutomapTextures((int)positionPanelRenderAutomap.width, (int)positionPanelRenderAutomap.height); switch (automapViewMode) { case AutomapViewMode.View2D: default: cameraAutomap.fieldOfView = fieldOfViewCameraMode2D; break; case AutomapViewMode.View3D: cameraAutomap.fieldOfView = fieldOfViewCameraMode3D; break; } if (compass != null) { compass.CompassCamera = cameraAutomap; } // reset values to default whenever automap window is opened resetRotationPivotAxisPosition(); // reset rotation pivot axis daggerfallAutomap.SlicingBiasY = defaultSlicingBiasY; // reset slicing y-bias if (daggerfallAutomap.ResetAutomapSettingsSignalForExternalScript == true) // signaled to reset automap settings { // get initial values for camera transform for view from top resetCameraTransformViewFromTop(); saveCameraTransformViewFromTop(); // get initial values for camera transform for 3D view resetCameraTransformView3D(); saveCameraTransformView3D(); // reset values to default whenever player enters building or dungeon resetCameraPosition(); fieldOfViewCameraMode3D = defaultFieldOfViewCameraMode3D; daggerfallAutomap.ResetAutomapSettingsSignalForExternalScript = false; // indicate the settings were reset } else { // backup view mode AutomapViewMode backupValueAutomapViewMode = automapViewMode; // focus player in 2D view mode - but keep old camera orientation of 2D view mode camera transform automapViewMode = AutomapViewMode.View2D; // need to change view mode so that SwitchFocusToGameObject() does the correct thing restoreOldCameraTransformViewFromTop(); SwitchFocusToGameObject(gameObjectPlayerAdvanced); saveCameraTransformViewFromTop(); // focus player in 3D view mode - but keep old camera orientation of 3D view mode camera transform automapViewMode = AutomapViewMode.View3D; // need to change view mode so that SwitchFocusToGameObject() does the correct thing restoreOldCameraTransformView3D(); SwitchFocusToGameObject(gameObjectPlayerAdvanced); saveCameraTransformView3D(); // restore view mode automapViewMode = backupValueAutomapViewMode; switch (automapViewMode) { case AutomapViewMode.View2D: default: restoreOldCameraTransformViewFromTop(); break; case AutomapViewMode.View3D: restoreOldCameraTransformView3D(); break; } } // and update the automap view updateAutomapView(); }