成功使用RScript作为脚本初步运行
This commit is contained in:
Submodule Assets/Plugins/Flee updated: 47b12f4bc0...5c561fc69c
@@ -183,7 +183,6 @@ MonoBehaviour:
|
|||||||
TotalTimelineBar: {fileID: 8439816364275150554}
|
TotalTimelineBar: {fileID: 8439816364275150554}
|
||||||
CurrentTimeText: {fileID: 2053773207632650149}
|
CurrentTimeText: {fileID: 2053773207632650149}
|
||||||
CurrentFPS: {fileID: 3211738389701231255}
|
CurrentFPS: {fileID: 3211738389701231255}
|
||||||
CurrentProjectDefaultFileStyle: 0
|
|
||||||
IsLowPerformance: 0
|
IsLowPerformance: 0
|
||||||
LastLoadProjectName:
|
LastLoadProjectName:
|
||||||
MainGameController: {fileID: 0}
|
MainGameController: {fileID: 0}
|
||||||
|
|||||||
@@ -376,6 +376,7 @@ namespace Demo.Editor
|
|||||||
|
|
||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
|
GlobalConfig.ConstConfigFile = "config.easysave";
|
||||||
// Generate Framework
|
// Generate Framework
|
||||||
var generaters = DefaultInstantiate.GetScriptableObjectInstantiate();
|
var generaters = DefaultInstantiate.GetScriptableObjectInstantiate();
|
||||||
foreach (var asm in AppDomain.CurrentDomain.GetAssemblies())
|
foreach (var asm in AppDomain.CurrentDomain.GetAssemblies())
|
||||||
|
|||||||
@@ -441,6 +441,42 @@ namespace Demo
|
|||||||
callback?.Invoke(child);
|
callback?.Invoke(child);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IEnumerator DoGenerateSubScriptAsync([In] string type, string name, [Opt] Action<ScriptableObject> callback)
|
||||||
|
{
|
||||||
|
// 判断类型是否合法
|
||||||
|
if (DefaultInstantiate.GetScriptableObjectInstantiate().TryGetValue(type, out var creater) == false)
|
||||||
|
{
|
||||||
|
Debug.LogError($"{type} is not exist or {type}'s Instantiater is not valid", this);
|
||||||
|
callback?.Invoke(null);
|
||||||
|
yield break;
|
||||||
|
}
|
||||||
|
// 生成对象
|
||||||
|
var child = creater();
|
||||||
|
child.ScriptName = name;
|
||||||
|
child.transform.SetParent(this.transform);
|
||||||
|
child.transform.SetLocalPositionAndRotation(Vector3.zero, Quaternion.identity);
|
||||||
|
child.transform.localScale = Vector3.one;
|
||||||
|
child.EnableScript("", "", type, this);
|
||||||
|
|
||||||
|
// Add Child
|
||||||
|
Childs.Add(child);
|
||||||
|
|
||||||
|
// Load Child Script
|
||||||
|
yield return child.LoadScript("");
|
||||||
|
|
||||||
|
LastLoadedScriptableObject = child;
|
||||||
|
callback?.Invoke(child);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 创建子脚本
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="type">指定类型</param>
|
||||||
|
public IEnumerator NewSubScript([In] string type)
|
||||||
|
{
|
||||||
|
return DoGenerateSubScriptAsync(type, $"New {type}", null);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 加载子脚本
|
/// 加载子脚本
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -24,8 +24,8 @@ EditorSettings:
|
|||||||
m_EnableEditorAsyncCPUTextureLoading: 0
|
m_EnableEditorAsyncCPUTextureLoading: 0
|
||||||
m_AsyncShaderCompilation: 1
|
m_AsyncShaderCompilation: 1
|
||||||
m_PrefabModeAllowAutoSave: 1
|
m_PrefabModeAllowAutoSave: 1
|
||||||
m_EnterPlayModeOptionsEnabled: 1
|
m_EnterPlayModeOptionsEnabled: 0
|
||||||
m_EnterPlayModeOptions: 2
|
m_EnterPlayModeOptions: 0
|
||||||
m_GameObjectNamingDigits: 1
|
m_GameObjectNamingDigits: 1
|
||||||
m_GameObjectNamingScheme: 0
|
m_GameObjectNamingScheme: 0
|
||||||
m_AssetNamingUsesSpace: 1
|
m_AssetNamingUsesSpace: 1
|
||||||
|
|||||||
Reference in New Issue
Block a user