创建开始菜单面板和设置面板

- 添加 MenuForm 与 SettingForm
- 为带左右按钮的水平选择界面添加HorizonSelectGroup预制件。
- 添加游戏核心可配置项
This commit is contained in:
SepComet
2026-02-10 15:10:31 +08:00
parent 7ac832f74b
commit 13583354f9
111 changed files with 11247 additions and 755 deletions
@@ -1,9 +1,9 @@
using CustomUtility;
using DataTable;
using Definition;
using Definition.Enum;
using GameFramework.DataTable;
using GameFramework.Event;
using Scene;
using StarForce;
using UnityGameFramework.Runtime;
using ProcedureOwner = GameFramework.Fsm.IFsm<GameFramework.Procedure.IProcedureManager>;
@@ -5,6 +5,7 @@
// Feedback: mailto:ellan@gameframework.cn
//------------------------------------------------------------
using Definition.DataStruct;
using GameFramework;
using GameFramework.Event;
using GameFramework.Resource;
@@ -5,6 +5,7 @@ using System.Collections.Generic;
using CustomUtility;
using DataTable;
using Definition;
using Definition.Enum;
using TMPro;
using UI;
using UnityEngine;
@@ -71,7 +72,7 @@ namespace Procedure
}
}
procedureOwner.SetData<VarInt32>("NextSceneId", GameEntry.Config.GetInt("Scene.GameplayA"));
procedureOwner.SetData<VarInt32>("NextSceneId", (int)SceneId.Main);
ChangeState<ProcedureChangeScene>(procedureOwner);
}
@@ -118,35 +119,37 @@ namespace Procedure
private void LoadFont(string fontName)
{
_loadedFlag.Add(Utility.Text.Format("Font.{0}", fontName), false);
GameEntry.Resource.LoadAsset(AssetUtility.GetFontAsset(fontName), Constant.AssetPriority.FontAsset, new LoadAssetCallbacks(
(assetName, asset, duration, userData) =>
{
_loadedFlag[Utility.Text.Format("Font.{0}", fontName)] = true;
UGuiForm.SetMainFont((Font)asset);
Log.Info("Load font '{0}' OK.", fontName);
},
(assetName, status, errorMessage, userData) =>
{
Log.Error("Can not load font '{0}' from '{1}' with error message '{2}'.", fontName, assetName, errorMessage);
}));
GameEntry.Resource.LoadAsset(AssetUtility.GetFontAsset(fontName), Constant.AssetPriority.FontAsset,
new LoadAssetCallbacks(
(assetName, asset, duration, userData) =>
{
_loadedFlag[Utility.Text.Format("Font.{0}", fontName)] = true;
UGuiForm.SetMainFont((Font)asset);
Log.Info("Load font '{0}' OK.", fontName);
},
(assetName, status, errorMessage, userData) =>
{
Log.Error("Can not load font '{0}' from '{1}' with error message '{2}'.", fontName, assetName,
errorMessage);
}));
}
private void LoadTMPFont(string fontName)
{
_loadedFlag.Add(Utility.Text.Format("Font.{0}", fontName), false);
GameEntry.Resource.LoadAsset(AssetUtility.GetTMPFontAsset(fontName), Constant.AssetPriority.FontAsset, new LoadAssetCallbacks(
(assetName, asset, duration, userData) =>
{
_loadedFlag[Utility.Text.Format("Font.{0}", fontName)] = true;
UGuiForm.SetMainTMPFont((TMP_FontAsset)asset);
Log.Info("Load font '{0}' OK.", fontName);
},
(assetName, status, errorMessage, userData) =>
{
Log.Error("Can not load font '{0}' from '{1}' with error message '{2}'.", fontName, assetName, errorMessage);
}));
GameEntry.Resource.LoadAsset(AssetUtility.GetTMPFontAsset(fontName), Constant.AssetPriority.FontAsset,
new LoadAssetCallbacks(
(assetName, asset, duration, userData) =>
{
_loadedFlag[Utility.Text.Format("Font.{0}", fontName)] = true;
UGuiForm.SetMainTMPFont((TMP_FontAsset)asset);
Log.Info("Load font '{0}' OK.", fontName);
},
(assetName, status, errorMessage, userData) =>
{
Log.Error("Can not load font '{0}' from '{1}' with error message '{2}'.", fontName, assetName,
errorMessage);
}));
}
private void OnLoadConfigSuccess(object sender, GameEventArgs e)
@@ -169,7 +172,8 @@ namespace Procedure
return;
}
Log.Error("Can not load config '{0}' from '{1}' with error message '{2}'.", ne.ConfigAssetName, ne.ConfigAssetName, ne.ErrorMessage);
Log.Error("Can not load config '{0}' from '{1}' with error message '{2}'.", ne.ConfigAssetName,
ne.ConfigAssetName, ne.ErrorMessage);
}
private void OnLoadDataTableSuccess(object sender, GameEventArgs e)
@@ -192,7 +196,8 @@ namespace Procedure
return;
}
Log.Error("Can not load data table '{0}' from '{1}' with error message '{2}'.", ne.DataTableAssetName, ne.DataTableAssetName, ne.ErrorMessage);
Log.Error("Can not load data table '{0}' from '{1}' with error message '{2}'.", ne.DataTableAssetName,
ne.DataTableAssetName, ne.ErrorMessage);
}
private void OnLoadDictionarySuccess(object sender, GameEventArgs e)
@@ -215,7 +220,8 @@ namespace Procedure
return;
}
Log.Error("Can not load dictionary '{0}' from '{1}' with error message '{2}'.", ne.DictionaryAssetName, ne.DictionaryAssetName, ne.ErrorMessage);
Log.Error("Can not load dictionary '{0}' from '{1}' with error message '{2}'.", ne.DictionaryAssetName,
ne.DictionaryAssetName, ne.ErrorMessage);
}
}
}
}
@@ -1,7 +1,6 @@
using Scene;
using Definition.Enum;
using System.Collections.Generic;
using CustomComponent;
using Definition.Enum;
using Event;
using GameFramework.Event;
using UI;
@@ -0,0 +1,18 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ProcedureMain : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b86c72387528b8e4993ed9c395825d0a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,37 @@
using GameFramework.Fsm;
using GameFramework.Procedure;
using UI;
namespace Procedure
{
public class ProcedureMenu : ProcedureBase
{
public override bool UseNativeDialog => false;
private MenuFormController _menuFormController;
#region FSM
protected override void OnEnter(IFsm<IProcedureManager> procedureOwner)
{
base.OnEnter(procedureOwner);
_menuFormController = new MenuFormController();
_menuFormController.OpenUI(new MenuFormContext());
}
protected override void OnLeave(IFsm<IProcedureManager> procedureOwner, bool isShutdown)
{
base.OnLeave(procedureOwner, isShutdown);
}
protected override void OnUpdate(IFsm<IProcedureManager> procedureOwner, float elapseSeconds,
float realElapseSeconds)
{
base.OnUpdate(procedureOwner, elapseSeconds, realElapseSeconds);
}
#endregion
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a8c39c93ba7eab0478a50fc0b1370458
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: