您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
110 行
2.0 KiB
110 行
2.0 KiB
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.Localization;
|
|
using UnityEngine.Serialization;
|
|
[System.Serializable]
|
|
public enum SettingTabType
|
|
{
|
|
Language,
|
|
Audio,
|
|
Graphics
|
|
|
|
}
|
|
[System.Serializable]
|
|
public enum SettingFieldType
|
|
{
|
|
Language,
|
|
Volume_SFx,
|
|
Volume_Music,
|
|
Resolution,
|
|
FullScreen,
|
|
GraphicQuality,
|
|
AntiAliasing,
|
|
Shadow,
|
|
|
|
}
|
|
[System.Serializable]
|
|
public class settingTab
|
|
{
|
|
public SettingTabType settingTabsType;
|
|
public LocalizedString title;
|
|
}
|
|
|
|
[System.Serializable]
|
|
public class SettingField
|
|
{
|
|
public SettingTabType settingTabsType;
|
|
public SettingFieldType settingFieldType;
|
|
public LocalizedString title;
|
|
}
|
|
|
|
public class UISettingManager : MonoBehaviour
|
|
{
|
|
public List<settingTab> settingTabsList = new List<settingTab>();
|
|
[SerializeField]
|
|
private UISettingTabsFiller _settingTabFiller = default;
|
|
[SerializeField]
|
|
private List<SettingField> _settingFieldsList = default;
|
|
[SerializeField]
|
|
private UISettingFieldsFiller _settingFieldsFiller = default;
|
|
private void Start()
|
|
{
|
|
|
|
if (settingTabsList.Count > 0)
|
|
{
|
|
SetTabs();
|
|
SettingTabType defaultTabType = settingTabsList[0].settingTabsType;
|
|
SelectTab(defaultTabType);
|
|
}
|
|
|
|
}
|
|
public void SetTabs()
|
|
{
|
|
_settingTabFiller.FillTabs(settingTabsList);
|
|
}
|
|
|
|
public void SelectTab(SettingTabType selectedTab)
|
|
{
|
|
_settingTabFiller.SelectTab(selectedTab);
|
|
SetFields(selectedTab);
|
|
}
|
|
|
|
public void SetFields(SettingTabType selectedTab)
|
|
{
|
|
List<SettingField> fields= _settingFieldsList.FindAll(o => o.settingTabsType == selectedTab);
|
|
_settingFieldsFiller.FillFields(fields);
|
|
|
|
|
|
}
|
|
public void SelectField()
|
|
{
|
|
|
|
|
|
}
|
|
public void UnselectField()
|
|
{
|
|
|
|
|
|
}
|
|
public void NextOption()
|
|
{
|
|
|
|
|
|
}
|
|
public void PreviousOption()
|
|
{
|
|
|
|
|
|
}
|
|
public void OpenValidateChoicesPrompt()
|
|
{
|
|
|
|
}
|
|
public void ValidateChoices()
|
|
{
|
|
|
|
}
|
|
|
|
|
|
}
|