Read in previous values
This commit is contained in:
Родитель
f17d61302b
Коммит
06eaa1a823
|
@ -0,0 +1,31 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using UnityEngine;
|
||||
|
||||
public class ClosingScript : MonoBehaviour
|
||||
{
|
||||
private void OnApplicationQuit()
|
||||
{
|
||||
List<string> settings = new List<string>
|
||||
{
|
||||
"Screenmanager Resolution Width",
|
||||
"Screenmanager Resolution Height",
|
||||
"Screenmanager Fullscreen mode",
|
||||
"Screenmanager Stereo 3D",
|
||||
"UnityGraphicsQuality",
|
||||
"UnitySelectMonitor"
|
||||
};
|
||||
|
||||
using (StreamWriter file = new StreamWriter("ScreenSelectorPrefs.txt"))
|
||||
{
|
||||
foreach(string key in settings)
|
||||
{
|
||||
file.WriteLine(PlayerPrefs.GetInt(key, 0).ToString());
|
||||
}
|
||||
|
||||
file.Flush();
|
||||
file.Close();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 93a8018bd49bbf1458edf2998ccb8717
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -50,12 +50,11 @@ LightmapSettings:
|
|||
m_BounceScale: 1
|
||||
m_IndirectOutputScale: 1
|
||||
m_AlbedoBoost: 1
|
||||
m_TemporalCoherenceThreshold: 1
|
||||
m_EnvironmentLightingMode: 0
|
||||
m_EnableBakedLightmaps: 1
|
||||
m_EnableRealtimeLightmaps: 0
|
||||
m_LightmapEditorSettings:
|
||||
serializedVersion: 10
|
||||
serializedVersion: 12
|
||||
m_Resolution: 2
|
||||
m_BakeResolution: 40
|
||||
m_AtlasSize: 1024
|
||||
|
@ -63,6 +62,7 @@ LightmapSettings:
|
|||
m_AOMaxDistance: 1
|
||||
m_CompAOExponent: 1
|
||||
m_CompAOExponentDirect: 0
|
||||
m_ExtractAmbientOcclusion: 0
|
||||
m_Padding: 2
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_LightmapsBakeMode: 1
|
||||
|
@ -77,10 +77,16 @@ LightmapSettings:
|
|||
m_PVRDirectSampleCount: 32
|
||||
m_PVRSampleCount: 500
|
||||
m_PVRBounces: 2
|
||||
m_PVREnvironmentSampleCount: 500
|
||||
m_PVREnvironmentReferencePointCount: 2048
|
||||
m_PVRFilteringMode: 2
|
||||
m_PVRDenoiserTypeDirect: 0
|
||||
m_PVRDenoiserTypeIndirect: 0
|
||||
m_PVRDenoiserTypeAO: 0
|
||||
m_PVRFilterTypeDirect: 0
|
||||
m_PVRFilterTypeIndirect: 0
|
||||
m_PVRFilterTypeAO: 0
|
||||
m_PVRFilteringMode: 1
|
||||
m_PVREnvironmentMIS: 0
|
||||
m_PVRCulling: 1
|
||||
m_PVRFilteringGaussRadiusDirect: 1
|
||||
m_PVRFilteringGaussRadiusIndirect: 5
|
||||
|
@ -88,7 +94,9 @@ LightmapSettings:
|
|||
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
|
||||
m_PVRFilteringAtrousPositionSigmaIndirect: 2
|
||||
m_PVRFilteringAtrousPositionSigmaAO: 1
|
||||
m_ShowResolutionOverlay: 1
|
||||
m_ExportTrainingData: 0
|
||||
m_TrainingDataDestination: TrainingData
|
||||
m_LightProbeSampleCountMultiplier: 4
|
||||
m_LightingDataAsset: {fileID: 0}
|
||||
m_UseShadowmask: 1
|
||||
--- !u!196 &4
|
||||
|
@ -113,11 +121,55 @@ NavMeshSettings:
|
|||
debug:
|
||||
m_Flags: 0
|
||||
m_NavMeshData: {fileID: 0}
|
||||
--- !u!1 &514779246
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 514779247}
|
||||
- component: {fileID: 514779248}
|
||||
m_Layer: 0
|
||||
m_Name: GameObject
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &514779247
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 514779246}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 2
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &514779248
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 514779246}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 93a8018bd49bbf1458edf2998ccb8717, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1 &705507993
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 705507995}
|
||||
|
@ -133,15 +185,18 @@ GameObject:
|
|||
Light:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 705507993}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 8
|
||||
serializedVersion: 10
|
||||
m_Type: 1
|
||||
m_Shape: 0
|
||||
m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1}
|
||||
m_Intensity: 1
|
||||
m_Range: 10
|
||||
m_SpotAngle: 30
|
||||
m_InnerSpotAngle: 21.80208
|
||||
m_CookieSize: 10
|
||||
m_Shadows:
|
||||
m_Type: 2
|
||||
|
@ -151,6 +206,24 @@ Light:
|
|||
m_Bias: 0.05
|
||||
m_NormalBias: 0.4
|
||||
m_NearPlane: 0.2
|
||||
m_CullingMatrixOverride:
|
||||
e00: 1
|
||||
e01: 0
|
||||
e02: 0
|
||||
e03: 0
|
||||
e10: 0
|
||||
e11: 1
|
||||
e12: 0
|
||||
e13: 0
|
||||
e20: 0
|
||||
e21: 0
|
||||
e22: 1
|
||||
e23: 0
|
||||
e30: 0
|
||||
e31: 0
|
||||
e32: 0
|
||||
e33: 1
|
||||
m_UseCullingMatrixOverride: 0
|
||||
m_Cookie: {fileID: 0}
|
||||
m_DrawHalo: 0
|
||||
m_Flare: {fileID: 0}
|
||||
|
@ -158,19 +231,23 @@ Light:
|
|||
m_CullingMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
m_RenderingLayerMask: 1
|
||||
m_Lightmapping: 1
|
||||
m_LightShadowCasterMode: 0
|
||||
m_AreaSize: {x: 1, y: 1}
|
||||
m_BounceIntensity: 1
|
||||
m_ColorTemperature: 6570
|
||||
m_UseColorTemperature: 0
|
||||
m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_UseBoundingSphereOverride: 0
|
||||
m_ShadowRadius: 0
|
||||
m_ShadowAngle: 0
|
||||
--- !u!4 &705507995
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 705507993}
|
||||
m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261}
|
||||
m_LocalPosition: {x: 0, y: 3, z: 0}
|
||||
|
@ -183,7 +260,8 @@ Transform:
|
|||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 963194228}
|
||||
|
@ -200,23 +278,26 @@ GameObject:
|
|||
AudioListener:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 963194225}
|
||||
m_Enabled: 1
|
||||
--- !u!20 &963194227
|
||||
Camera:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 963194225}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 2
|
||||
m_ClearFlags: 1
|
||||
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
|
||||
m_projectionMatrixMode: 1
|
||||
m_GateFitMode: 2
|
||||
m_FOVAxisMode: 0
|
||||
m_SensorSize: {x: 36, y: 24}
|
||||
m_LensShift: {x: 0, y: 0}
|
||||
m_GateFitMode: 2
|
||||
m_FocalLength: 50
|
||||
m_NormalizedViewPortRect:
|
||||
serializedVersion: 2
|
||||
|
@ -248,7 +329,8 @@ Camera:
|
|||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 963194225}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 1, z: -10}
|
||||
|
|
Двоичный файл не отображается.
Двоичный файл не отображается.
|
@ -2,10 +2,10 @@
|
|||
"dependencies": {
|
||||
"com.unity.collab-proxy": "1.2.16",
|
||||
"com.unity.ide.rider": "1.1.4",
|
||||
"com.unity.ide.vscode": "1.1.3",
|
||||
"com.unity.ide.vscode": "1.1.4",
|
||||
"com.unity.test-framework": "1.1.9",
|
||||
"com.unity.textmeshpro": "2.0.1",
|
||||
"com.unity.timeline": "1.2.9",
|
||||
"com.unity.timeline": "1.2.10",
|
||||
"com.unity.ugui": "1.0.0",
|
||||
"com.unity.modules.ai": "1.0.0",
|
||||
"com.unity.modules.androidjni": "1.0.0",
|
||||
|
|
|
@ -13,7 +13,7 @@ PlayerSettings:
|
|||
useOnDemandResources: 0
|
||||
accelerometerFrequency: 60
|
||||
companyName: DefaultCompany
|
||||
productName: ScreenSelectorExampleProj
|
||||
productName: ScreenSelectorExampleProject
|
||||
defaultCursor: {fileID: 0}
|
||||
cursorHotspot: {x: 0, y: 0}
|
||||
m_SplashScreenBackgroundColor: {r: 0.13725491, g: 0.12156863, b: 0.1254902, a: 1}
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
m_EditorVersion: 2019.3.0f5
|
||||
m_EditorVersionWithRevision: 2019.3.0f5 (44796c9d3c2c)
|
||||
m_EditorVersion: 2019.3.0f6
|
||||
m_EditorVersionWithRevision: 2019.3.0f6 (27ab2135bccf)
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include <codecvt>
|
||||
#include <dxgi.h>
|
||||
#include <dxgi1_2.h>
|
||||
#include <fstream>
|
||||
#include <math.h>
|
||||
#include <set>
|
||||
#include <sstream>
|
||||
|
@ -25,12 +26,12 @@ static Preferences s_preferences;
|
|||
static std::vector<ComPtr<IDXGIOutput>> s_outputs;
|
||||
static const wchar_t* kDefaultQualityLevelNames[] =
|
||||
{
|
||||
L"Fastest",
|
||||
L"Fast",
|
||||
L"Simple",
|
||||
L"Good",
|
||||
L"Beautiful",
|
||||
L"Fantastic"
|
||||
L"Very Low",
|
||||
L"Low",
|
||||
L"Medium",
|
||||
L"High",
|
||||
L"Very High",
|
||||
L"Ultra"
|
||||
};
|
||||
static bool s_stereo3d = true;
|
||||
static std::vector<Resolution> s_resolutions;
|
||||
|
@ -430,7 +431,7 @@ std::wstring ConstructCommandLine()
|
|||
command.append(L" -screen-height ");
|
||||
command.append(std::to_wstring(s_preferences.GetHeight()));
|
||||
command.append(L" -screen-quality ");
|
||||
command.append(kDefaultQualityLevelNames[s_preferences.GetGraphicsQualityIndex()]);
|
||||
command.append(std::to_wstring(s_preferences.GetGraphicsQualityIndex()));
|
||||
command.append(L" -screen-fullscreen ");
|
||||
if (s_preferences.GetFullscreen())
|
||||
command.append(std::to_wstring(1));
|
||||
|
@ -445,8 +446,43 @@ std::wstring ConstructCommandLine()
|
|||
return command;
|
||||
}
|
||||
|
||||
void ReadPreferences()
|
||||
{
|
||||
// Open, read, and close file
|
||||
std::ifstream file("ScreenSelectorPrefs.txt");
|
||||
const int numPrefs = 6;
|
||||
int values[numPrefs] = { 0 };
|
||||
|
||||
if (!file.is_open())
|
||||
return;
|
||||
|
||||
std::string line;
|
||||
std::getline(file, line);
|
||||
|
||||
int i = 0;
|
||||
while (file.good() && i < numPrefs)
|
||||
{
|
||||
values[i] = std::stoi(line);
|
||||
std::getline(file, line);
|
||||
i++;
|
||||
}
|
||||
|
||||
file.close();
|
||||
|
||||
// Set values from file
|
||||
const int windowed = 3; // Windowed in Unity
|
||||
s_preferences.SetWidth(values[0]);
|
||||
s_preferences.SetHeight(values[1]);
|
||||
s_preferences.SetFullscreen(values[2] != windowed);
|
||||
s_preferences.SetStereo3d(values[3] != 0);
|
||||
s_preferences.SetGraphicsQualityIndex(values[4]);
|
||||
s_preferences.SetMonitorSelection(values[5]);
|
||||
}
|
||||
|
||||
bool DisplayScreenSelector(std::wstring& commandline)
|
||||
{
|
||||
ReadPreferences();
|
||||
|
||||
bool cont = (IDCANCEL != DialogBox(NULL, MAKEINTRESOURCE(IDD_SCEENSEL), NULL, screenSelDialogProc));
|
||||
|
||||
commandline = ConstructCommandLine();
|
||||
|
|
Загрузка…
Ссылка в новой задаче