интерфейс
This commit is contained in:
1 parent
ccaf43b3fe
commit
db0eed28af
9 files changed
+3697
-66
No files matched your search
+2998
-1
File diff suppressed because it is too large.
Load diff
@@ -777,6 +777,36 @@ MonoBehaviour:
|
|||||||
m_XAdvance: 0
|
m_XAdvance: 0
|
||||||
m_YAdvance: 0
|
m_YAdvance: 0
|
||||||
m_FeatureLookupFlags: 1
|
m_FeatureLookupFlags: 1
|
||||||
|
- m_FirstAdjustmentRecord:
|
||||||
|
m_GlyphIndex: 74
|
||||||
|
m_GlyphValueRecord:
|
||||||
|
m_XPlacement: 0
|
||||||
|
m_YPlacement: 0
|
||||||
|
m_XAdvance: 0
|
||||||
|
m_YAdvance: 0
|
||||||
|
m_SecondAdjustmentRecord:
|
||||||
|
m_GlyphIndex: 8
|
||||||
|
m_GlyphValueRecord:
|
||||||
|
m_XPlacement: 0
|
||||||
|
m_YPlacement: 0
|
||||||
|
m_XAdvance: 0
|
||||||
|
m_YAdvance: 0
|
||||||
|
m_FeatureLookupFlags: 15
|
||||||
|
- m_FirstAdjustmentRecord:
|
||||||
|
m_GlyphIndex: 74
|
||||||
|
m_GlyphValueRecord:
|
||||||
|
m_XPlacement: 0
|
||||||
|
m_YPlacement: 0
|
||||||
|
m_XAdvance: 0
|
||||||
|
m_YAdvance: 0
|
||||||
|
m_SecondAdjustmentRecord:
|
||||||
|
m_GlyphIndex: 204
|
||||||
|
m_GlyphValueRecord:
|
||||||
|
m_XPlacement: 0
|
||||||
|
m_YPlacement: 0
|
||||||
|
m_XAdvance: 0
|
||||||
|
m_YAdvance: 0
|
||||||
|
m_FeatureLookupFlags: 1634730025
|
||||||
m_MarkToBaseAdjustmentRecords: []
|
m_MarkToBaseAdjustmentRecords: []
|
||||||
m_MarkToMarkAdjustmentRecords: []
|
m_MarkToMarkAdjustmentRecords: []
|
||||||
m_ShouldReimportFontFeatures: 0
|
m_ShouldReimportFontFeatures: 0
|
||||||
|
|||||||
@@ -40,6 +40,8 @@ namespace _Project.Scripts.PlayerUtils
|
|||||||
|
|
||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
|
enableHeadBob = PlayerPrefs.GetInt("EnableHeadBob", 1) == 1;
|
||||||
|
AudioListener.volume = PlayerPrefs.GetFloat("MasterVolume", 0.8f);
|
||||||
controls = Player.Instance.Controls;
|
controls = Player.Instance.Controls;
|
||||||
movement = Player.Instance.Movement;
|
movement = Player.Instance.Movement;
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ namespace _Project.Scripts.PlayerUtils
|
|||||||
|
|
||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
|
|
||||||
movement = Player.Instance.Movement;
|
movement = Player.Instance.Movement;
|
||||||
possession = Player.Instance.Possession;
|
possession = Player.Instance.Possession;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,176 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.SceneManagement;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
|
||||||
|
namespace _Project.Scripts.Utilities
|
||||||
|
{
|
||||||
|
public class MainMenuController : MonoBehaviour
|
||||||
|
{
|
||||||
|
[Header("Сцены")]
|
||||||
|
[Tooltip("Имя игровой сцены (или оставь пустым, чтобы грузить следующую по Build Index)")]
|
||||||
|
[SerializeField] private string gameSceneName = "";
|
||||||
|
|
||||||
|
[Header("Панели UI")]
|
||||||
|
[SerializeField] private GameObject mainPanel;
|
||||||
|
[SerializeField] private GameObject settingsPanel;
|
||||||
|
|
||||||
|
[Header("Элементы настроек (UI)")]
|
||||||
|
[SerializeField] private Slider volumeSlider;
|
||||||
|
[SerializeField] private Slider sensitivitySlider;
|
||||||
|
[SerializeField] private Toggle fullscreenToggle;
|
||||||
|
[SerializeField] private Toggle vsyncToggle;
|
||||||
|
[SerializeField] private Toggle headbobToggle;
|
||||||
|
|
||||||
|
[Header("Значения по умолчанию")]
|
||||||
|
[SerializeField] private float defaultVolume = 0.8f;
|
||||||
|
[SerializeField] private float defaultSensitivity = 0.1f;
|
||||||
|
|
||||||
|
// Ключи для PlayerPrefs (совпадают с PlayerCamera.cs)
|
||||||
|
public const string KeyVolume = "MasterVolume";
|
||||||
|
public const string KeySensitivity = "MouseSensitivity";
|
||||||
|
public const string KeyFullscreen = "Fullscreen";
|
||||||
|
public const string KeyVSync = "VSync";
|
||||||
|
public const string KeyHeadbob = "EnableHeadBob";
|
||||||
|
|
||||||
|
private void Awake()
|
||||||
|
{
|
||||||
|
// На случай возврата из игровой сцены: возвращаем нормальное время и видимый курсор
|
||||||
|
Time.timeScale = 1f;
|
||||||
|
Cursor.lockState = CursorLockMode.None;
|
||||||
|
Cursor.visible = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Start()
|
||||||
|
{
|
||||||
|
ShowMainPanel();
|
||||||
|
LoadAndApplySettings();
|
||||||
|
BindUIEvents();
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------- КНОПКИ ГЛАВНОГО МЕНЮ (для Button -> OnClick) ----------
|
||||||
|
|
||||||
|
public void OnPlayButtonClicked()
|
||||||
|
{
|
||||||
|
PlayerPrefs.Save();
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(gameSceneName))
|
||||||
|
{
|
||||||
|
SceneManager.LoadScene(gameSceneName);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Загружает следующую сцену в Build Settings (например, индекс 1)
|
||||||
|
int nextSceneIndex = SceneManager.GetActiveScene().buildIndex + 1;
|
||||||
|
if (nextSceneIndex < SceneManager.sceneCountInBuildSettings)
|
||||||
|
SceneManager.LoadScene(nextSceneIndex);
|
||||||
|
else
|
||||||
|
Debug.LogError("MainMenuController: Игровая сцена не добавлена в Build Settings!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnSettingsButtonClicked()
|
||||||
|
{
|
||||||
|
if (mainPanel != null) mainPanel.SetActive(false);
|
||||||
|
if (settingsPanel != null) settingsPanel.SetActive(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnCloseSettingsButtonClicked()
|
||||||
|
{
|
||||||
|
PlayerPrefs.Save();
|
||||||
|
ShowMainPanel();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnQuitButtonClicked()
|
||||||
|
{
|
||||||
|
PlayerPrefs.Save();
|
||||||
|
Debug.Log("Выход из игры...");
|
||||||
|
|
||||||
|
#if UNITY_EDITOR
|
||||||
|
UnityEditor.EditorApplication.isPlaying = false;
|
||||||
|
#else
|
||||||
|
Application.Quit();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ShowMainPanel()
|
||||||
|
{
|
||||||
|
if (mainPanel != null) mainPanel.SetActive(true);
|
||||||
|
if (settingsPanel != null) settingsPanel.SetActive(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------- ЗАГРУЗКА И ИЗМЕНЕНИЕ НАСТРОЕК ----------
|
||||||
|
|
||||||
|
private void LoadAndApplySettings()
|
||||||
|
{
|
||||||
|
float volume = PlayerPrefs.GetFloat(KeyVolume, defaultVolume);
|
||||||
|
float sens = PlayerPrefs.GetFloat(KeySensitivity, defaultSensitivity);
|
||||||
|
bool isFullscreen = PlayerPrefs.GetInt(KeyFullscreen, Screen.fullScreen ? 1 : 0) == 1;
|
||||||
|
bool isVSync = PlayerPrefs.GetInt(KeyVSync, QualitySettings.vSyncCount > 0 ? 1 : 0) == 1;
|
||||||
|
bool isHeadbob = PlayerPrefs.GetInt(KeyHeadbob, 1) == 1;
|
||||||
|
|
||||||
|
// Применяем к движку
|
||||||
|
AudioListener.volume = volume;
|
||||||
|
Screen.fullScreen = isFullscreen;
|
||||||
|
QualitySettings.vSyncCount = isVSync ? 1 : 0;
|
||||||
|
|
||||||
|
// Выставляем ползунки и галочки в UI
|
||||||
|
if (volumeSlider != null) volumeSlider.SetValueWithoutNotify(volume);
|
||||||
|
if (sensitivitySlider != null)
|
||||||
|
{
|
||||||
|
// Настраиваем разумные границы для сенсы новой Input System (0.01 .. 0.8)
|
||||||
|
sensitivitySlider.minValue = 0.01f;
|
||||||
|
sensitivitySlider.maxValue = 0.8f;
|
||||||
|
sensitivitySlider.SetValueWithoutNotify(sens);
|
||||||
|
}
|
||||||
|
if (fullscreenToggle != null) fullscreenToggle.SetIsOnWithoutNotify(isFullscreen);
|
||||||
|
if (vsyncToggle != null) vsyncToggle.SetIsOnWithoutNotify(isVSync);
|
||||||
|
if (headbobToggle != null) headbobToggle.SetIsOnWithoutNotify(isHeadbob);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void BindUIEvents()
|
||||||
|
{
|
||||||
|
if (volumeSlider != null)
|
||||||
|
volumeSlider.onValueChanged.AddListener(SetVolume);
|
||||||
|
|
||||||
|
if (sensitivitySlider != null)
|
||||||
|
sensitivitySlider.onValueChanged.AddListener(SetSensitivity);
|
||||||
|
|
||||||
|
if (fullscreenToggle != null)
|
||||||
|
fullscreenToggle.onValueChanged.AddListener(SetFullscreen);
|
||||||
|
|
||||||
|
if (vsyncToggle != null)
|
||||||
|
vsyncToggle.onValueChanged.AddListener(SetVSync);
|
||||||
|
|
||||||
|
if (headbobToggle != null)
|
||||||
|
headbobToggle.onValueChanged.AddListener(SetHeadbob);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetVolume(float value)
|
||||||
|
{
|
||||||
|
AudioListener.volume = value;
|
||||||
|
PlayerPrefs.SetFloat(KeyVolume, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetSensitivity(float value)
|
||||||
|
{
|
||||||
|
PlayerPrefs.SetFloat(KeySensitivity, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetFullscreen(bool isFullscreen)
|
||||||
|
{
|
||||||
|
Screen.fullScreen = isFullscreen;
|
||||||
|
PlayerPrefs.SetInt(KeyFullscreen, isFullscreen ? 1 : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetVSync(bool enabled)
|
||||||
|
{
|
||||||
|
QualitySettings.vSyncCount = enabled ? 1 : 0;
|
||||||
|
PlayerPrefs.SetInt(KeyVSync, enabled ? 1 : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetHeadbob(bool enabled)
|
||||||
|
{
|
||||||
|
PlayerPrefs.SetInt(KeyHeadbob, enabled ? 1 : 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 53fa80094e5e42e98eee0f9272ea3797
|
||||||
|
timeCreated: 1793885337
|
||||||
Binary file not shown.
@@ -0,0 +1,144 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: c8a9f08e06d8365a4aebdeaeb20b66b2
|
||||||
|
TextureImporter:
|
||||||
|
internalIDToNameTable:
|
||||||
|
- first:
|
||||||
|
213: -8390816124192099294
|
||||||
|
second: back_icon_0
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 13
|
||||||
|
mipmaps:
|
||||||
|
mipMapMode: 0
|
||||||
|
enableMipMap: 0
|
||||||
|
sRGBTexture: 1
|
||||||
|
linearTexture: 0
|
||||||
|
fadeOut: 0
|
||||||
|
borderMipMap: 0
|
||||||
|
mipMapsPreserveCoverage: 0
|
||||||
|
alphaTestReferenceValue: 0.5
|
||||||
|
mipMapFadeDistanceStart: 1
|
||||||
|
mipMapFadeDistanceEnd: 3
|
||||||
|
bumpmap:
|
||||||
|
convertToNormalMap: 0
|
||||||
|
externalNormalMap: 0
|
||||||
|
heightScale: 0.25
|
||||||
|
normalMapFilter: 0
|
||||||
|
flipGreenChannel: 0
|
||||||
|
isReadable: 0
|
||||||
|
streamingMipmaps: 0
|
||||||
|
streamingMipmapsPriority: 0
|
||||||
|
vTOnly: 0
|
||||||
|
ignoreMipmapLimit: 0
|
||||||
|
grayScaleToAlpha: 0
|
||||||
|
generateCubemap: 6
|
||||||
|
cubemapConvolution: 0
|
||||||
|
seamlessCubemap: 0
|
||||||
|
textureFormat: 1
|
||||||
|
maxTextureSize: 2048
|
||||||
|
textureSettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
filterMode: 0
|
||||||
|
aniso: 1
|
||||||
|
mipBias: 0
|
||||||
|
wrapU: 0
|
||||||
|
wrapV: 0
|
||||||
|
wrapW: 0
|
||||||
|
nPOTScale: 0
|
||||||
|
lightmap: 0
|
||||||
|
compressionQuality: 50
|
||||||
|
spriteMode: 1
|
||||||
|
spriteExtrude: 1
|
||||||
|
spriteMeshType: 1
|
||||||
|
alignment: 0
|
||||||
|
spritePivot: {x: 0.5, y: 0.5}
|
||||||
|
spritePixelsToUnits: 100
|
||||||
|
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
spriteGenerateFallbackPhysicsShape: 1
|
||||||
|
alphaUsage: 1
|
||||||
|
alphaIsTransparency: 1
|
||||||
|
spriteTessellationMethod: 0
|
||||||
|
spriteTessellationDetail: -1
|
||||||
|
spriteGeometrySubdivision: -1
|
||||||
|
textureType: 8
|
||||||
|
textureShape: 1
|
||||||
|
singleChannelComponent: 0
|
||||||
|
flipbookRows: 1
|
||||||
|
flipbookColumns: 1
|
||||||
|
maxTextureSizeSet: 0
|
||||||
|
compressionQualitySet: 0
|
||||||
|
textureFormatSet: 0
|
||||||
|
ignorePngGamma: 0
|
||||||
|
applyGammaDecoding: 0
|
||||||
|
swizzle: 50462976
|
||||||
|
cookieLightType: 0
|
||||||
|
platformSettings:
|
||||||
|
- serializedVersion: 4
|
||||||
|
buildTarget: DefaultTexturePlatform
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
ignorePlatformSupport: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
- serializedVersion: 4
|
||||||
|
buildTarget: Standalone
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
ignorePlatformSupport: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
spriteSheet:
|
||||||
|
serializedVersion: 2
|
||||||
|
sprites:
|
||||||
|
- serializedVersion: 2
|
||||||
|
name: back_icon_0
|
||||||
|
rect:
|
||||||
|
serializedVersion: 2
|
||||||
|
x: 0
|
||||||
|
y: 0
|
||||||
|
width: 900
|
||||||
|
height: 512
|
||||||
|
alignment: 0
|
||||||
|
pivot: {x: 0, y: 0}
|
||||||
|
border: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
customData:
|
||||||
|
outline: []
|
||||||
|
physicsShape: []
|
||||||
|
tessellationDetail: -1
|
||||||
|
bones: []
|
||||||
|
spriteID: 224f8e50135dd8b80800000000000000
|
||||||
|
internalID: -8390816124192099294
|
||||||
|
vertices: []
|
||||||
|
indices:
|
||||||
|
edges: []
|
||||||
|
weights: []
|
||||||
|
outline: []
|
||||||
|
customData:
|
||||||
|
physicsShape: []
|
||||||
|
bones: []
|
||||||
|
spriteID: 5e97eb03825dee720800000000000000
|
||||||
|
internalID: 0
|
||||||
|
vertices: []
|
||||||
|
indices:
|
||||||
|
edges: []
|
||||||
|
weights: []
|
||||||
|
secondaryTextures: []
|
||||||
|
spriteCustomMetadata:
|
||||||
|
entries: []
|
||||||
|
nameFileIdTable: {}
|
||||||
|
mipmapLimitGroupName:
|
||||||
|
pSDRemoveMatte: 0
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
+340
-65
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user