Added Graphics Settings

This commit is contained in:
Zoe J
2022-02-20 20:15:05 -06:00
parent 70f8c81cdf
commit 0ef0e6388f
11 changed files with 5421 additions and 197 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 8bd1780577b8eaf43ad60554189eb11e
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
File diff suppressed because one or more lines are too long
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 1a720ceb9285174499a73898e09bd868
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
File diff suppressed because one or more lines are too long
@@ -206,6 +206,20 @@ MonoBehaviour:
m_Height: 0
m_Scale: 1
m_AtlasIndex: 0
- m_Index: 31
m_Metrics:
m_Width: 0
m_Height: 0
m_HorizontalBearingX: 0
m_HorizontalBearingY: 0
m_HorizontalAdvance: 27.953125
m_GlyphRect:
m_X: 0
m_Y: 0
m_Width: 0
m_Height: 0
m_Scale: 1
m_AtlasIndex: 0
- m_Index: 38
m_Metrics:
m_Width: 47.1875
@@ -505,6 +519,10 @@ MonoBehaviour:
m_Unicode: 32
m_GlyphIndex: 3
m_Scale: 1
- m_ElementType: 1
m_Unicode: 60
m_GlyphIndex: 31
m_Scale: 1
- m_ElementType: 1
m_Unicode: 67
m_GlyphIndex: 38
@@ -235,7 +235,7 @@ MonoBehaviour:
m_NormalColor: {r: 0.58431375, g: 0.65882355, b: 0.58431375, a: 0.6117647}
m_HighlightedColor: {r: 0.5686275, g: 0.8588236, b: 0.41176474, a: 0.84313726}
m_PressedColor: {r: 0.13725491, g: 0.5647059, b: 0.38823533, a: 0.8784314}
m_SelectedColor: {r: 0.5686275, g: 0.8588236, b: 0.41176474, a: 1}
m_SelectedColor: {r: 0.5686275, g: 0.8588236, b: 0.41176474, a: 0.84313726}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
+100
View File
@@ -0,0 +1,100 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using TMPro;
public class OptionsScreen : MonoBehaviour
{
public Toggle fullscreenTog, vsyncTog;
public List<ResItem> resolutions = new List<ResItem>();
private int selectedResolution;
public TMP_Text resolutionLabel;
// Start is called before the first frame update
void Start()
{
fullscreenTog.isOn = Screen.fullScreen;
if (QualitySettings.vSyncCount == 0)
{
vsyncTog.isOn = false;
} else
{
vsyncTog.isOn = true;
}
bool foundRes = false;
for (int i = 0; i < resolutions.Count; i++)
{
if (Screen.width == resolutions[i].horizontal && Screen.height == resolutions[i].vertical)
{
foundRes = true;
selectedResolution = i;
UpdateResLabel();
}
}
if (!foundRes)
{
ResItem newRes = new ResItem();
newRes.horizontal = Screen.width;
newRes.vertical = Screen.height;
resolutions.Add(newRes);
selectedResolution = resolutions.Count - 1;
UpdateResLabel();
}
}
// Update is called once per frame
void Update()
{
}
public void ResLeft()
{
selectedResolution--;
if (selectedResolution < 0)
{
selectedResolution = resolutions.Count - 1;
}
UpdateResLabel();
}
public void ResRight()
{
selectedResolution++;
if (selectedResolution > resolutions.Count - 1)
{
selectedResolution = 0;
}
UpdateResLabel();
}
public void UpdateResLabel()
{
resolutionLabel.text = resolutions[selectedResolution].horizontal.ToString() + " x " + resolutions[selectedResolution].vertical.ToString();
}
public void ApplyGraphics()
{
//Screen.fullScreen = fullscreenTog.isOn;
if (vsyncTog.isOn)
{
QualitySettings.vSyncCount = 1;
} else
{
QualitySettings.vSyncCount = 0;
}
Screen.SetResolution(resolutions[selectedResolution].horizontal, resolutions[selectedResolution].vertical, fullscreenTog.isOn);
}
}
[System.Serializable]
public class ResItem
{
public int horizontal, vertical;
}
+11
View File
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 447f7ce6530519346b944ce158890ad6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+1885 -1
View File
File diff suppressed because it is too large Load Diff