mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-07 16:45:10 +00:00
[+] 编辑器拓展资源运行模式
[+] 编辑器拓展资源运行模式
This commit is contained in:
@@ -31,20 +31,22 @@ namespace GameMain
|
||||
|
||||
if (initializationOperation.Status == EOperationStatus.Succeed)
|
||||
{
|
||||
EPlayMode playMode = GameModule.Resource.PlayMode;
|
||||
|
||||
// 编辑器模式。
|
||||
if (GameModule.Resource.playMode == EPlayMode.EditorSimulateMode)
|
||||
if (playMode == EPlayMode.EditorSimulateMode)
|
||||
{
|
||||
Log.Info("Editor resource mode detected.");
|
||||
ChangeState<ProcedurePreload>(procedureOwner);
|
||||
}
|
||||
// 单机模式。
|
||||
else if (GameModule.Resource.playMode == EPlayMode.OfflinePlayMode)
|
||||
else if (playMode == EPlayMode.OfflinePlayMode)
|
||||
{
|
||||
Log.Info("Package resource mode detected.");
|
||||
ChangeState<ProcedureInitResources>(procedureOwner);
|
||||
}
|
||||
// 可更新模式。
|
||||
else if (GameModule.Resource.playMode == EPlayMode.HostPlayMode)
|
||||
else if (playMode == EPlayMode.HostPlayMode)
|
||||
{
|
||||
// 打开启动UI。
|
||||
UILoadMgr.Show(UIDefine.UILoadUpdate);
|
||||
|
@@ -39,7 +39,7 @@ namespace GameMain
|
||||
|
||||
private void InitLanguageSettings()
|
||||
{
|
||||
if (GameModule.Resource.playMode == EPlayMode.EditorSimulateMode && GameModule.Base.EditorLanguage != Language.Unspecified)
|
||||
if (GameModule.Resource.PlayMode == EPlayMode.EditorSimulateMode && GameModule.Base.EditorLanguage != Language.Unspecified)
|
||||
{
|
||||
// 编辑器资源模式直接使用 Inspector 上设置的语言
|
||||
return;
|
||||
|
@@ -19,7 +19,7 @@ namespace GameMain
|
||||
/// <summary>
|
||||
/// 是否需要加载热更新DLL
|
||||
/// </summary>
|
||||
public bool NeedLoadDll => GameModule.Resource.playMode == EPlayMode.HostPlayMode || GameModule.Resource.playMode == EPlayMode.OfflinePlayMode;
|
||||
public bool NeedLoadDll => GameModule.Resource.PlayMode == EPlayMode.HostPlayMode || GameModule.Resource.PlayMode == EPlayMode.OfflinePlayMode;
|
||||
|
||||
private bool m_enableAddressable = true;
|
||||
public override bool UseNativeDialog => true;
|
||||
@@ -60,7 +60,7 @@ namespace GameMain
|
||||
m_LoadMetadataAssemblyComplete = true;
|
||||
}
|
||||
|
||||
if (!NeedLoadDll || GameModule.Resource.playMode == EPlayMode.EditorSimulateMode)
|
||||
if (!NeedLoadDll || GameModule.Resource.PlayMode == EPlayMode.EditorSimulateMode)
|
||||
{
|
||||
m_MainLogicAssembly = GetMainLogicAssembly();
|
||||
}
|
||||
|
@@ -27,7 +27,7 @@ namespace GameMain
|
||||
|
||||
m_LoadedFlag.Clear();
|
||||
|
||||
if (GameModule.Resource.playMode == EPlayMode.EditorSimulateMode)
|
||||
if (GameModule.Resource.PlayMode == EPlayMode.EditorSimulateMode)
|
||||
{
|
||||
m_InitConfigXml = true;
|
||||
}
|
||||
@@ -88,7 +88,7 @@ namespace GameMain
|
||||
|
||||
private void LoadAllConfig()
|
||||
{
|
||||
if (GameModule.Resource.playMode == EPlayMode.EditorSimulateMode)
|
||||
if (GameModule.Resource.PlayMode == EPlayMode.EditorSimulateMode)
|
||||
{
|
||||
m_InitConfigXml = true;
|
||||
return;
|
||||
|
@@ -66,7 +66,7 @@ namespace TEngine.Editor.Inspector
|
||||
{
|
||||
if (EditorApplication.isPlaying && IsPrefabInHierarchy(t.gameObject))
|
||||
{
|
||||
EditorGUILayout.EnumPopup("Resource Mode", t.playMode);
|
||||
EditorGUILayout.EnumPopup("Resource Mode", t.PlayMode);
|
||||
|
||||
EditorGUILayout.EnumPopup("VerifyLevel", t.verifyLevel);
|
||||
|
||||
|
@@ -28,7 +28,7 @@ MonoBehaviour:
|
||||
m_AtlasFolder: Assets/AssetRaw/UIRaw
|
||||
m_ResourceVersionFileName: ResourceVersion.txt
|
||||
HostServerURL: http://127.0.0.1:8081/AssetsRoot/
|
||||
FallbackHostServerURL:
|
||||
FallbackHostServerURL: http://127.0.0.1:8081/AssetsRoot/
|
||||
EnableUpdateData: 1
|
||||
WindowsUpdateDataUrl: http://127.0.0.1:8081/AssetsRoot/UpdateData.json
|
||||
MacOSUpdateDataUrl: http://127.0.0.1
|
||||
|
@@ -101,7 +101,7 @@ namespace TEngine
|
||||
transform.localScale = Vector3.one;
|
||||
|
||||
m_LocalizationManager.SetLocalizationHelper(localizationHelper);
|
||||
m_LocalizationManager.Language = resourceModule.playMode == EPlayMode.EditorSimulateMode && rootModule.EditorLanguage != Language.Unspecified
|
||||
m_LocalizationManager.Language = resourceModule.PlayMode == EPlayMode.EditorSimulateMode && rootModule.EditorLanguage != Language.Unspecified
|
||||
? rootModule.EditorLanguage : m_LocalizationManager.SystemLanguage;
|
||||
}
|
||||
|
||||
|
@@ -146,9 +146,18 @@ namespace TEngine
|
||||
YooAssets.SetDefaultPackage(package);
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
//编辑器模式使用。
|
||||
EPlayMode playMode = (EPlayMode)UnityEditor.EditorPrefs.GetInt("EditorResourceMode");
|
||||
Log.Warning($"编辑器模式使用:{playMode}");
|
||||
#else
|
||||
//运行时使用。
|
||||
EPlayMode playMode = PlayMode;
|
||||
#endif
|
||||
|
||||
// 编辑器下的模拟模式
|
||||
InitializationOperation initializationOperation = null;
|
||||
if (PlayMode == EPlayMode.EditorSimulateMode)
|
||||
if (playMode == EPlayMode.EditorSimulateMode)
|
||||
{
|
||||
var createParameters = new EditorSimulateModeParameters();
|
||||
createParameters.SimulateManifestFilePath = EditorSimulateModeHelper.SimulateBuild(packageName);
|
||||
@@ -156,7 +165,7 @@ namespace TEngine
|
||||
}
|
||||
|
||||
// 单机运行模式
|
||||
if (PlayMode == EPlayMode.OfflinePlayMode)
|
||||
if (playMode == EPlayMode.OfflinePlayMode)
|
||||
{
|
||||
var createParameters = new OfflinePlayModeParameters();
|
||||
createParameters.DecryptionServices = new GameDecryptionServices();
|
||||
@@ -164,7 +173,7 @@ namespace TEngine
|
||||
}
|
||||
|
||||
// 联机运行模式
|
||||
if (PlayMode == EPlayMode.HostPlayMode)
|
||||
if (playMode == EPlayMode.HostPlayMode)
|
||||
{
|
||||
var createParameters = new HostPlayModeParameters();
|
||||
createParameters.DecryptionServices = new GameDecryptionServices();
|
||||
|
@@ -43,7 +43,31 @@ namespace TEngine
|
||||
/// <summary>
|
||||
/// 资源系统运行模式。
|
||||
/// </summary>
|
||||
public EPlayMode playMode = EPlayMode.EditorSimulateMode;
|
||||
[SerializeField] private EPlayMode playMode = EPlayMode.EditorSimulateMode;
|
||||
|
||||
/// <summary>
|
||||
/// 资源系统运行模式。
|
||||
/// <remarks>编辑器内优先使用。</remarks>
|
||||
/// </summary>
|
||||
public EPlayMode PlayMode
|
||||
{
|
||||
get
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
//编辑器模式使用。
|
||||
return (EPlayMode)UnityEditor.EditorPrefs.GetInt("EditorResourceMode");
|
||||
#else
|
||||
//运行时使用。
|
||||
return playMode;
|
||||
#endif
|
||||
}
|
||||
set
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
playMode = value;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 下载文件校验等级。
|
||||
|
@@ -239,12 +239,11 @@ public class FrameworkGlobalSettings
|
||||
get { return m_ConfigFolderName; }
|
||||
}
|
||||
|
||||
[LabelText("代码生成脚本命名空间")]
|
||||
[SerializeField] private string @namespace = "GameLogic";
|
||||
|
||||
public string NameSpace => @namespace;
|
||||
|
||||
[SerializeField] [LabelText("代码生成脚本名映射")]
|
||||
[SerializeField]
|
||||
private List<ScriptGenerateRuler> scriptGenerateRule = new List<ScriptGenerateRuler>()
|
||||
{
|
||||
new("m_go", "GameObject"),
|
||||
|
Reference in New Issue
Block a user