mirror of
http://47.107.252.169:3000/Roguelite-Game-Developing-Team/Gen_Hack-and-Slash-Roguelite.git
synced 2025-11-20 12:47:12 +08:00
(client) feat:健康给予,路径优化,结算界面,商店界面 (#60)
Co-authored-by: m0_75251201 <m0_75251201@noreply.gitcode.com> Reviewed-on: http://47.107.252.169:3000/Roguelite-Game-Developing-Team/Gen_Hack-and-Slash-Roguelite/pulls/60
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
using Base;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using Base;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
@@ -17,12 +19,12 @@ namespace UI
|
||||
[SerializeField] private TMP_InputField progressStepDuration;
|
||||
[SerializeField] private TMP_InputField exitAnimationDuration;
|
||||
|
||||
Base.Setting.GameSettings currentSettings;
|
||||
private Setting.GameSettings currentSettings;
|
||||
|
||||
public override void Show()
|
||||
{
|
||||
base.Show();
|
||||
currentSettings = Base.Setting.Instance.CurrentSettings;
|
||||
currentSettings = Setting.Instance.CurrentSettings;
|
||||
globalVolume.value = currentSettings.globalVolume;
|
||||
developerMode.isOn = currentSettings.developerMode;
|
||||
friendlyFire.isOn = currentSettings.friendlyFire;
|
||||
@@ -32,45 +34,49 @@ namespace UI
|
||||
exitAnimationDuration.text = currentSettings.exitAnimationDuration.ToString(CultureInfo.InvariantCulture);
|
||||
|
||||
windowResolution.ClearOptions();
|
||||
var options = new System.Collections.Generic.List<TMP_Dropdown.OptionData>();
|
||||
foreach (var resolution in Base.Setting.CommonResolutions)
|
||||
{
|
||||
var options = new List<TMP_Dropdown.OptionData>();
|
||||
foreach (var resolution in Setting.CommonResolutions)
|
||||
options.Add(new TMP_Dropdown.OptionData(resolution.ToString()));
|
||||
}
|
||||
windowResolution.AddOptions(options);
|
||||
if (currentSettings.windowResolution != null)
|
||||
{
|
||||
var resolutionIndex = System.Array.FindIndex(Base.Setting.CommonResolutions, r => r == currentSettings.windowResolution);
|
||||
var resolutionIndex =
|
||||
Array.FindIndex(Setting.CommonResolutions, r => r == currentSettings.windowResolution);
|
||||
windowResolution.value = resolutionIndex >= 0 ? resolutionIndex : 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
windowResolution.value = 0;
|
||||
}
|
||||
|
||||
windowMode.value = (int)currentSettings.currentWindowMode;
|
||||
}
|
||||
|
||||
public void CancelSettings()
|
||||
{
|
||||
UIInputControl.Instance.Hide(this);
|
||||
}
|
||||
|
||||
public void ApplySettings()
|
||||
{
|
||||
currentSettings.globalVolume = globalVolume.value;
|
||||
currentSettings.developerMode = developerMode.isOn;
|
||||
currentSettings.friendlyFire = friendlyFire.isOn;
|
||||
currentSettings.currentWindowMode = (Base.Setting.WindowMode)windowMode.value;
|
||||
currentSettings.windowResolution = Base.Setting.CommonResolutions[windowResolution.value];
|
||||
currentSettings.currentWindowMode = (Setting.WindowMode)windowMode.value;
|
||||
currentSettings.windowResolution = Setting.CommonResolutions[windowResolution.value];
|
||||
currentSettings.progressStepDuration = float.Parse(progressStepDuration.text, CultureInfo.InvariantCulture);
|
||||
currentSettings.exitAnimationDuration = float.Parse(exitAnimationDuration.text, CultureInfo.InvariantCulture);
|
||||
currentSettings.exitAnimationDuration =
|
||||
float.Parse(exitAnimationDuration.text, CultureInfo.InvariantCulture);
|
||||
currentSettings.showMiniMap = showMiniMap.isOn;
|
||||
Base.Setting.Instance.CurrentSettings = currentSettings;
|
||||
Base.Setting.Instance.Apply();
|
||||
Setting.Instance.CurrentSettings = currentSettings;
|
||||
Setting.Instance.Apply();
|
||||
}
|
||||
|
||||
public void EnterSetting()
|
||||
{
|
||||
ApplySettings();
|
||||
UIInputControl.Instance.Hide(this);
|
||||
Base.Setting.Instance.SaveSettings();
|
||||
Setting.Instance.SaveSettings();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user