[+] 编辑器拓展资源运行模式

[+] 编辑器拓展资源运行模式
This commit is contained in:
ALEXTANG
2023-05-12 12:24:19 +08:00
parent 73b3ae6527
commit fdc526cfca
10 changed files with 51 additions and 17 deletions

View File

@@ -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);

View File

@@ -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

View File

@@ -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;
}

View File

@@ -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();

View File

@@ -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>
/// 下载文件校验等级。

View File

@@ -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"),