修改设置界面

This commit is contained in:
bob
2025-05-29 18:03:24 +08:00
parent cdcb007d6d
commit f421288244
306 changed files with 41744 additions and 612 deletions

View File

@@ -0,0 +1,51 @@
using System;
namespace NBF
{
public abstract class BaseAttribute : Attribute
{
}
[AttributeUsage(AttributeTargets.Field)]
public class InputIconAttribute : BaseAttribute
{
public string KeyBoardIcon;
public string ControllerIcon;
/// <summary>
///
/// </summary>
/// <param name="keyBoardIcon">键盘图标</param>
/// <param name="controllerIcon">控制器图标</param>
public InputIconAttribute(string keyBoardIcon, string controllerIcon)
{
KeyBoardIcon = keyBoardIcon;
ControllerIcon = controllerIcon;
}
}
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Class, AllowMultiple = true)]
public class TitleAttribute : BaseAttribute
{
public string Title;
public TitleAttribute(string title)
{
Title = title;
}
}
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Class, AllowMultiple = true)]
public class DescriptionAttribute : BaseAttribute
{
public string Description;
public DescriptionAttribute(string description)
{
Description = description;
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 647174a4726c4c4c92193aa7dcd3ddad
timeCreated: 1748509835

View File

@@ -1,22 +0,0 @@
using System;
namespace NBF
{
[AttributeUsage(AttributeTargets.Field)]
public class InputIconAttribute : Attribute
{
public string KeyBoardIcon;
public string ControllerIcon;
/// <summary>
///
/// </summary>
/// <param name="keyBoardIcon">键盘图标</param>
/// <param name="controllerIcon">控制器图标</param>
public InputIconAttribute(string keyBoardIcon, string controllerIcon)
{
KeyBoardIcon = keyBoardIcon;
ControllerIcon = controllerIcon;
}
}
}

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 5fb17097160c43ee9840411aded17084
timeCreated: 1748180773

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 011d59a9e9454122bc76461e942de184
timeCreated: 1748489400

View File

@@ -13,10 +13,8 @@ namespace NBF
GamePad = 1
}
public class InputManager : MonoBehaviour
public class InputManager : MonoService<InputManager>
{
public static InputManager Instance { get; private set; }
public static bool IsOp1;
public static bool IsOp2;
@@ -62,9 +60,8 @@ namespace NBF
public static ControllerType ControllerType = ControllerType.KeyboardMouse;
private void Awake()
protected override void OnAwake()
{
Instance = this;
InputCursorExtension.InputInit();
DontDestroyOnLoad(gameObject);
}

View File

@@ -0,0 +1,24 @@
using NBC;
using UnityEngine;
namespace NBF
{
public abstract class MonoService : MonoBehaviour
{
}
public abstract class MonoService<T> : MonoService where T : MonoService
{
public static T Instance { get; private set; }
protected void Awake()
{
Instance = this as T;
OnAwake();
}
protected virtual void OnAwake()
{
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 62c58708f36041db9bb11a7e4d16c62c
timeCreated: 1748491579

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 6111c0ab89e74c9fada884e4e4051549
timeCreated: 1748489421

View File

@@ -0,0 +1,300 @@
using Newtonsoft.Json;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
namespace NBF
{
public class GameSettings : MonoService<GameSettings>
{
public enum QualityEnum
{
Low = 0,
Medium = 1,
High = 2,
Ultra = 3
}
public enum VSyncEnum
{
Off = 0,
On = 1,
}
/// <summary>
/// 抗锯齿等级
/// </summary>
public enum AntiAliasLevelEnum
{
Off = 1,
x2 = 2,
x4 = 4,
x8 = 8
}
/// <summary>
/// 贴图质量
/// </summary>
public enum TextureQualityEnum
{
FullRes = 0,
HalfRes = 1,
QuarterRes = 2,
EighthRes = 3
}
public enum AnisotropicLevelEnum
{
Off = -1,
x2 = 2,
x4 = 4,
x8 = 8,
x16 = 16
}
public enum ShadowmapResolutionEnum
{
Low = 0,
Medium = 1,
High = 2,
}
public const string SaveKey = "PlayerGameSetting";
[System.Serializable]
public class GameSettingsData
{
/// <summary>
/// 质量等级 0 1 2 3
/// </summary>
[Title("Settings_Title_quality")] [Description("Settings_Description_quality")]
public QualityEnum QualityLevel = QualityEnum.High;
/// <summary>
/// 显示分辨率有任意一个为0则为全屏
/// </summary>
[Title("Settings_Title_Resolution")] [Description("Settings_Description_Resolution")]
public Vector2Int Resolution = new Vector2Int(0, 0);
/// <summary>
/// 渲染比例
/// </summary>
[Title("Settings_Title_RenderScale")] [Description("Settings_Description_RenderScale")] [Range(0.1f, 2f)]
public float RenderScale = 1f;
/// <summary>
/// 窗口模式
/// </summary>
[Title("Settings_Title_WindowedMode")] [Description("Settings_Description_WindowedMode")]
public FullScreenMode WindowedMode = FullScreenMode.MaximizedWindow;
/// <summary>
/// 垂直同步个数
/// </summary>
[Title("Settings_Title_VSync")] [Description("Settings_Description_VSync")]
public VSyncEnum VSync = VSyncEnum.Off;
/// <summary>
///抗锯齿等级
/// </summary>
[Title("Settings_Title_AntiAliasLevel")] [Description("Settings_Description_AntiAliasLevel")]
public AntiAliasLevelEnum AntiAliasLevel = AntiAliasLevelEnum.Off;
/// <summary>
/// 纹理质量
/// </summary>
[Title("Settings_Title_TextureQuality")] [Description("Settings_Description_TextureQuality")]
public TextureQualityEnum TextureQuality = TextureQualityEnum.FullRes;
/// <summary>
/// 全局各向异性纹理过滤模式
/// </summary>
[Title("Settings_Title_AnisotropicMode")] [Description("Settings_Description_AnisotropicMode")]
public AnisotropicFiltering AnisotropicMode = AnisotropicFiltering.Enable;
/// <summary>
/// 全局各向异性过滤限制
/// </summary>
[Title("Settings_Description_AnisotropicLevel")] [Description("Settings_Description_AnisotropicLevel")]
public AnisotropicLevelEnum AnisotropicLevel = AnisotropicLevelEnum.x4;
/// <summary>
/// 阴影等级
/// </summary>
[Title("Settings_Description_ShadowmapResolution")]
[Description("Settings_Description_ShadowmapResolution")]
public ShadowmapResolutionEnum ShadowmapResolution = ShadowmapResolutionEnum.High;
}
/// <summary>
/// 默认配置
/// </summary>
private GameSettingsData DefaultSettingsConverted = new GameSettingsData();
/// <summary>
/// 当前正在调整的配置
/// </summary>
private GameSettingsData CurrentSettings = new GameSettingsData();
/// <summary>
/// 当前使用配置
/// </summary>
public readonly GameSettingsData UseSettings = new GameSettingsData();
protected override void OnAwake()
{
LoadSettings();
}
/// <summary>
/// 重置
/// </summary>
public void ResetSettings()
{
CurrentSettings.QualityLevel = DefaultSettingsConverted.QualityLevel;
CurrentSettings.Resolution = DefaultSettingsConverted.Resolution;
CurrentSettings.RenderScale = DefaultSettingsConverted.RenderScale;
CurrentSettings.WindowedMode = DefaultSettingsConverted.WindowedMode;
CurrentSettings.VSync = DefaultSettingsConverted.VSync;
CurrentSettings.AntiAliasLevel = DefaultSettingsConverted.AntiAliasLevel;
CurrentSettings.TextureQuality = DefaultSettingsConverted.TextureQuality;
CurrentSettings.AnisotropicMode = DefaultSettingsConverted.AnisotropicMode;
CurrentSettings.AnisotropicLevel = DefaultSettingsConverted.AnisotropicLevel;
CurrentSettings.ShadowmapResolution = DefaultSettingsConverted.ShadowmapResolution;
}
/// <summary>
/// 开始进入设置模式,将当前使用的配置缓存一份
/// </summary>
public void BeginChangeSettings()
{
UseSettings.QualityLevel = CurrentSettings.QualityLevel;
UseSettings.Resolution = CurrentSettings.Resolution;
UseSettings.RenderScale = CurrentSettings.RenderScale;
UseSettings.WindowedMode = CurrentSettings.WindowedMode;
UseSettings.VSync = CurrentSettings.VSync;
UseSettings.AntiAliasLevel = CurrentSettings.AntiAliasLevel;
UseSettings.TextureQuality = CurrentSettings.TextureQuality;
UseSettings.AnisotropicMode = CurrentSettings.AnisotropicMode;
UseSettings.AnisotropicLevel = CurrentSettings.AnisotropicLevel;
UseSettings.ShadowmapResolution = CurrentSettings.ShadowmapResolution;
}
/// <summary>
/// 保存设置
/// </summary>
public void SaveSettings()
{
CurrentSettings.QualityLevel = UseSettings.QualityLevel;
CurrentSettings.Resolution = UseSettings.Resolution;
CurrentSettings.RenderScale = UseSettings.RenderScale;
CurrentSettings.WindowedMode = UseSettings.WindowedMode;
CurrentSettings.VSync = UseSettings.VSync;
CurrentSettings.AntiAliasLevel = UseSettings.AntiAliasLevel;
CurrentSettings.TextureQuality = UseSettings.TextureQuality;
CurrentSettings.AnisotropicMode = UseSettings.AnisotropicMode;
CurrentSettings.AnisotropicLevel = UseSettings.AnisotropicLevel;
CurrentSettings.ShadowmapResolution = UseSettings.ShadowmapResolution;
var json = JsonConvert.SerializeObject(CurrentSettings);
PlayerPrefs.SetString(SaveKey, json);
}
private void LoadSettings()
{
ResetSettings();
if (PlayerPrefs.HasKey(SaveKey))
{
var json = PlayerPrefs.GetString(SaveKey, string.Empty);
if (!string.IsNullOrEmpty(json))
{
var settings = JsonConvert.DeserializeObject<GameSettingsData>(json);
if (settings != null)
{
CurrentSettings.QualityLevel = settings.QualityLevel;
CurrentSettings.Resolution = settings.Resolution;
CurrentSettings.RenderScale = settings.RenderScale;
CurrentSettings.WindowedMode = settings.WindowedMode;
CurrentSettings.VSync = settings.VSync;
CurrentSettings.AntiAliasLevel = settings.AntiAliasLevel;
CurrentSettings.TextureQuality = settings.TextureQuality;
CurrentSettings.AnisotropicMode = settings.AnisotropicMode;
CurrentSettings.AnisotropicLevel = settings.AnisotropicLevel;
CurrentSettings.ShadowmapResolution = settings.ShadowmapResolution;
}
}
}
if (CurrentSettings.Resolution.x < 1 || CurrentSettings.Resolution.y < 1)
{
CurrentSettings.WindowedMode = FullScreenMode.ExclusiveFullScreen;
CurrentSettings.Resolution = new Vector2Int(Screen.width, Screen.height);
}
ApplySettings();
}
/// <summary>
/// 应用设置
/// </summary>
private void ApplySettings()
{
// // 设置当前质量等级
QualitySettings.SetQualityLevel((int)CurrentSettings.QualityLevel);
switch (CurrentSettings.WindowedMode)
{
case FullScreenMode.ExclusiveFullScreen:
Screen.SetResolution(Screen.width, Screen.width, FullScreenMode.ExclusiveFullScreen);
break;
case FullScreenMode.FullScreenWindow:
Screen.SetResolution(CurrentSettings.Resolution.x, CurrentSettings.Resolution.y,
FullScreenMode.FullScreenWindow);
break;
case FullScreenMode.MaximizedWindow:
Screen.SetResolution(CurrentSettings.Resolution.x, CurrentSettings.Resolution.y,
FullScreenMode.MaximizedWindow);
break;
case FullScreenMode.Windowed:
Screen.SetResolution(CurrentSettings.Resolution.x, CurrentSettings.Resolution.y,
FullScreenMode.Windowed);
break;
default:
Screen.SetResolution(Screen.width, Screen.width, FullScreenMode.ExclusiveFullScreen);
break;
}
// 获取当前URP Asset
UniversalRenderPipelineAsset URPAsset =
QualitySettings.GetRenderPipelineAssetAt(QualitySettings.GetQualityLevel()) as
UniversalRenderPipelineAsset;
if (URPAsset)
{
//渲染比例
URPAsset.renderScale = CurrentSettings.RenderScale;
//抗锯齿等级
URPAsset.msaaSampleCount = (int)CurrentSettings.AntiAliasLevel;
URPAsset.supportsHDR = true;
//纹理质量
QualitySettings.globalTextureMipmapLimit = (int)CurrentSettings.TextureQuality;
QualitySettings.anisotropicFiltering = CurrentSettings.AnisotropicMode;
if (CurrentSettings.AnisotropicMode == AnisotropicFiltering.Disable ||
CurrentSettings.AnisotropicMode == AnisotropicFiltering.Enable)
{
Texture.SetGlobalAnisotropicFilteringLimits(-1, -1);
}
else if (CurrentSettings.AnisotropicMode == AnisotropicFiltering.ForceEnable)
{
Texture.SetGlobalAnisotropicFilteringLimits((int)CurrentSettings.AnisotropicLevel,
(int)CurrentSettings.AnisotropicLevel);
}
//垂直同步
QualitySettings.vSyncCount = (int)CurrentSettings.VSync;
}
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: ae00ae2fd4474db3af9dc52692900f94
timeCreated: 1748489275

View File

@@ -0,0 +1,133 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using UnityEngine;
namespace NBF
{
public static class TypeCache
{
private static readonly Dictionary<Type, List<Type>> _subTypeCache = new Dictionary<Type, List<Type>>();
private static readonly Dictionary<Type, List<Type>> _attributeCache = new Dictionary<Type, List<Type>>();
private static readonly Dictionary<string, Type> _typeNameCache = new Dictionary<string, Type>();
private static Type[] _filteredTypes;
// 目标命名空间
private static readonly string[] TargetNamespaces = { "NBF", "NBC" };
// 初始化缓存
static TypeCache()
{
InitializeCache();
}
// 初始化缓存(仅缓存指定命名空间的类型)
private static void InitializeCache()
{
// 获取Unity默认的主程序集Assembly-CSharp
var mainAssembly = AppDomain.CurrentDomain.GetAssemblies()
.FirstOrDefault(a => a.GetName().Name == "Assembly-CSharp");
if (mainAssembly == null)
{
Debug.LogError("找不到Assembly-CSharp程序集");
_filteredTypes = Array.Empty<Type>();
return;
}
// 过滤出NBF和NBC命名空间的类型
_filteredTypes = mainAssembly.GetTypes()
.Where(t => TargetNamespaces.Any(ns => t.Namespace != null && t.Namespace.StartsWith(ns)))
.ToArray();
// 预缓存类型名
foreach (var type in _filteredTypes)
{
if (type.FullName != null) _typeNameCache[type.FullName] = type;
}
Debug.Log($"TypeCache初始化完成缓存了{_filteredTypes.Length}个类型仅限NBF和NBC命名空间");
}
/// <summary>
/// 获取所有已缓存的类型
/// </summary>
/// <returns></returns>
public static Type[] GetAllTypes()
{
if (_filteredTypes == null)
{
InitializeCache();
}
return _filteredTypes;
}
/// <summary>
/// 通过基类或接口获取所有子类/实现类
/// </summary>
/// <typeparam name="TBase"></typeparam>
/// <returns></returns>
public static List<Type> GetTypesWithBaseType<TBase>() where TBase : class
{
return GetTypesWithBaseType(typeof(TBase));
}
public static List<Type> GetTypesWithBaseType(Type baseType)
{
if (_subTypeCache.TryGetValue(baseType, out var cachedTypes))
{
return cachedTypes;
}
var types = GetAllTypes()
.Where(t => baseType.IsAssignableFrom(t) && t != baseType && !t.IsAbstract && !t.IsInterface)
.ToList();
_subTypeCache[baseType] = types;
return types;
}
/// <summary>
/// 通过特性获取所有类型
/// </summary>
/// <typeparam name="TAttribute"></typeparam>
/// <returns></returns>
public static List<Type> GetTypesWithAttribute<TAttribute>() where TAttribute : Attribute
{
var attributeType = typeof(TAttribute);
if (_attributeCache.TryGetValue(attributeType, out var cachedTypes))
{
return cachedTypes;
}
var types = GetAllTypes()
.Where(t => t.IsDefined(attributeType, false))
.ToList();
_attributeCache[attributeType] = types;
return types;
}
/// <summary>
/// 通过类型名获取类型
/// </summary>
/// <param name="typeName"></param>
/// <returns></returns>
public static Type GetTypeByName(string typeName)
{
return _typeNameCache.GetValueOrDefault(typeName);
}
// 清除缓存
public static void ClearCache()
{
_subTypeCache.Clear();
_attributeCache.Clear();
_typeNameCache.Clear();
_filteredTypes = null;
Debug.Log("TypeCache已清除");
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 12e6673112ac446b8d4658b32d38a5b3
timeCreated: 1748510780

View File

@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using UnityEngine;
using Random = UnityEngine.Random;
namespace NBF
{
@@ -14,9 +15,25 @@ namespace NBF
public List<object> Items = new List<object>();
}
public class TabListData
{
public TabItemData Tab;
}
public class TabListSettingData : TabListData
{
/// <summary>
/// 设置保存对象
/// </summary>
public object SettingsObject;
}
/// <summary>
/// 保护二级子目录的列表
/// </summary>
public class TabListAndSubListData : TabListData
{
public List<TabSubItemData> SubTab = new List<TabSubItemData>();
public void AddTestData(int index)
@@ -31,7 +48,6 @@ namespace NBF
TabSubItemData subTab = new TabSubItemData();
subTab.Name = $"类型-{i}";
subTab.Icon = testIcon[Random.Range(0, testIcon.Length)];
// ListData.Add(new ListClassifyData($"Title-{i}"));
for (int j = 0; j < count2; j++)
{
var item = new ShopGearData();

View File

@@ -1,5 +1,6 @@
using System;
using System.ComponentModel;
using UnityEngine;
using Object = UnityEngine.Object;
namespace NBC
@@ -63,4 +64,19 @@ namespace NBC
Instance = null;
}
}
public class SingletonMono<T> : MonoBehaviour where T : MonoBehaviour
{
public static T Instance { get; private set; }
protected void Awake()
{
Instance = this as T;
OnAwake();
}
protected virtual void OnAwake()
{
}
}
}

View File

@@ -18,6 +18,7 @@ namespace NBF
[SerializeField] private GameObject startCanvas;
[SerializeField] private bool playVideo;
private void CheckOver(VideoPlayer vp)
{
Destroy(startCanvas);
@@ -62,9 +63,13 @@ namespace NBF
private void Init()
{
InitService();
InitUI();
}
#region UI
private void InitUI()
{
GRoot.inst.SetContentScaleFactor(UIDef.DefaultScreen.Width, UIDef.DefaultScreen.Height,
@@ -84,28 +89,45 @@ namespace NBF
UI.Inst.AddPackage("Common/Common");
}
#endregion
#region Service
// private static readonly List<MonoService> Services = new List<MonoService>();
private static readonly Dictionary<Type, MonoService> Services = new Dictionary<Type, MonoService>();
private void AddService<T>() where T : MonoService, new()
{
var service = this.GetComponent<T>();
if (!service)
{
service = gameObject.AddComponent<T>();
}
Services[typeof(T)] = service;
}
private void InitService()
{
AddService<InputManager>();
AddService<GameSettings>();
}
#endregion
public void StartGame()
{
PermanentCommon.Init();
InputDef.LoadIcon();
// UI.Inst.OpenUI<FishingShopPanel>();
UI.Inst.OpenUI<SettingPanel>();
LoadData();
Fishing.Inst.Go(1);
// Fishing.Inst.Go(1);
}
private void LoadData()
{
ConfigAssets.Init();
// var cfgAssets = Resources.Load<CfgAssets>("config/CfgAssets");
// var playerCache = Resources.Load<PlayerCacheData>("config/PlayerCache");
// GameManager.Instance._playerData = playerCache.PlayerData;
var inputManager = this.GetComponent<InputManager>();
if (inputManager == null)
{
inputManager = gameObject.AddComponent<InputManager>();
}
GameModel.Inst.Init();

View File

@@ -11,6 +11,7 @@ namespace NBF
{
public const string URL = "ui://6hgkvlaufcfggr";
public Controller showType;
public GList List;
public GButton BtnUserHead;
public BtnInputControl BtnPrev;
@@ -20,6 +21,7 @@ namespace NBF
{
base.ConstructFromXML(xml);
showType = GetController("showType");
List = (GList)GetChild("List");
BtnUserHead = (GButton)GetChild("BtnUserHead");
BtnPrev = (BtnInputControl)GetChild("BtnPrev");

View File

@@ -39,25 +39,25 @@ namespace NBF
}
}
public void SetTabs(List<TabListData> tabList, int selectIndex = 0)
public void SetTabs<T>(List<T> tabList, int selectIndex = 0) where T : TabListData
{
List.RemoveChildrenToPool();
var width = 0f;
var listWidth = 0f;
for (int i = 0; i < tabList.Count; i++)
{
var tabData = tabList[i];
var tabItem = List.AddItemFromPool().asButton;
tabItem.title = tabData.Tab.Name;
width += tabItem.width;
listWidth += tabItem.width;
if (i > 0)
{
width += List.columnGap;
listWidth += List.columnGap;
}
}
Log.Info($"Set tab index={List.selectedIndex}");
List.selectedIndex = selectIndex;
List.width = width;
List.width = listWidth;
OnClickItem();
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 1f016abb75434032bce35085f1e55639
timeCreated: 1748509254

View File

@@ -0,0 +1,32 @@
/**本脚本为自动生成每次生成会覆盖请勿手动修改生成插件文档及项目地址https://git.whoot.com/whoot-games/whoot.fguieditorplugin**/
using FairyGUI;
using FairyGUI.Utils;
using NBC;
using System.Collections.Generic;
namespace NBF
{
/// <summary> </summary>
public partial class SettingPanel
{
public GObject this[string aKey] => ContentPane.GetChild(aKey);
[AutoFind(Name = "back")]
public GImage back;
[AutoFind(Name = "Menu")]
public CommonMenu Menu;
[AutoFind(Name = "TextTitle")]
public GTextField TextTitle;
[AutoFind(Name = "Introduce")]
public GComponent Introduce;
[AutoFind(Name = "List")]
public GList List;
[AutoFind(Name = "BottomMenu")]
public BottomMenu BottomMenu;
[AutoFind(Name = "BottomLine")]
public GImage BottomLine;
public override string[] GetDependPackages(){ return new string[] {"Common"}; }
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 5bd9a89782b28a342b84154c6ca06d32

View File

@@ -0,0 +1,79 @@
// 本脚本只在不存在时会生成一次。已存在不会再次生成覆盖
using System.Collections.Generic;
using UnityEngine;
using NBC;
namespace NBF
{
public partial class SettingPanel : UIPanel
{
public override string UIPackName => "Main";
public override string UIResName => "SettingPanel";
private List<TabListSettingData> tabList = new List<TabListSettingData>();
protected override void OnInit()
{
base.OnInit();
IsShowCursor = true;
TabListSettingData tabInput = new TabListSettingData();
tabInput.Tab = new TabItemData();
tabInput.Tab.Name = "键盘和鼠标";
tabList.Add(tabInput);
TabListSettingData tabCtrl = new TabListSettingData();
tabCtrl.Tab = new TabItemData();
tabCtrl.Tab.Name = "控制器";
tabList.Add(tabCtrl);
TabListSettingData tabVideo = new TabListSettingData();
tabVideo.Tab = new TabItemData();
tabVideo.Tab.Name = "视频";
tabVideo.SettingsObject = GameSettings.Instance.UseSettings;
tabList.Add(tabVideo);
TabListSettingData tabSound = new TabListSettingData();
tabSound.Tab = new TabItemData();
tabSound.Tab.Name = "音频和语言";
tabList.Add(tabSound);
Menu.OnTabChange += ChangeTab;
}
protected override void OnShow()
{
Menu.SetTabs(tabList);
}
private void ChangeTab(int index)
{
Log.Info($"Change tab index={index}");
// var tabListData = _tabList[index];
// _currentTab = tabListData;
// SubMenu.SetTabs(_currentTab.SubTab);
}
private void Reset()
{
}
private void Save()
{
}
protected override void OnHide()
{
base.OnHide();
}
protected override void OnDestroy()
{
base.OnDestroy();
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 9daadae7a1573774cb1b07ea9dc5b077

View File

@@ -17,8 +17,8 @@ namespace NBF
public override string UIPackName => "Shop";
public override string UIResName => "FishingShopPanel";
private List<TabListData> _tabList = new List<TabListData>();
private TabListData _currentTab;
private List<TabListAndSubListData> _tabList = new List<TabListAndSubListData>();
private TabListAndSubListData _currentTab;
protected override void OnInit()
{
@@ -28,7 +28,7 @@ namespace NBF
for (int i = 0; i < 10; i++)
{
var itemData = new TabListData();
var itemData = new TabListAndSubListData();
itemData.AddTestData(i);
_tabList.Add(itemData);
}