ParticleEffect出现无法加载完成的异常
This commit is contained in:
@@ -402,6 +402,8 @@ namespace Demo.Editor
|
|||||||
Convention.RScript.Variable.CStyle.CScriptRScriptVariableGenerater.GetTypename(typeof(SplineComputer.SampleMode))).Register();
|
Convention.RScript.Variable.CStyle.CScriptRScriptVariableGenerater.GetTypename(typeof(SplineComputer.SampleMode))).Register();
|
||||||
new Convention.RScript.Variable.CStyle.CScriptRScriptVariableGenerater(typeof(Spline.Type), null, null,
|
new Convention.RScript.Variable.CStyle.CScriptRScriptVariableGenerater(typeof(Spline.Type), null, null,
|
||||||
Convention.RScript.Variable.CStyle.CScriptRScriptVariableGenerater.GetTypename(typeof(Spline.Type))).Register();
|
Convention.RScript.Variable.CStyle.CScriptRScriptVariableGenerater.GetTypename(typeof(Spline.Type))).Register();
|
||||||
|
new Convention.RScript.Variable.CStyle.CScriptRScriptVariableGenerater(typeof(IEffectHookObject.InteractiveEffectType), null, null,
|
||||||
|
Convention.RScript.Variable.CStyle.CScriptRScriptVariableGenerater.GetTypename(typeof(IEffectHookObject.InteractiveEffectType))).Register();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Start()
|
private void Start()
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
using Convention;
|
|
||||||
using Convention.RScript;
|
|
||||||
using Convention.WindowsUI.Variant;
|
|
||||||
using Demo.Game;
|
|
||||||
using Dreamteck.Splines;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
using Convention;
|
||||||
|
using Convention.RScript;
|
||||||
|
using Convention.WindowsUI.Variant;
|
||||||
|
using Demo.Game;
|
||||||
|
using Dreamteck.Splines;
|
||||||
using Unity.VisualScripting;
|
using Unity.VisualScripting;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
@@ -76,6 +76,15 @@ namespace Demo
|
|||||||
public Spline.Type CatmullRom => Spline.Type.CatmullRom;
|
public Spline.Type CatmullRom => Spline.Type.CatmullRom;
|
||||||
public Spline.Type Bezier => Spline.Type.Bezier;
|
public Spline.Type Bezier => Spline.Type.Bezier;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class IEffectHookObjectInstance
|
||||||
|
{
|
||||||
|
public static IEffectHookObjectInstance instance = new();
|
||||||
|
public IEffectHookObject.InteractiveEffectType VisibleDuration => IEffectHookObject.InteractiveEffectType.VisibleDuration;
|
||||||
|
public IEffectHookObject.InteractiveEffectType InteractiveDuration => IEffectHookObject.InteractiveEffectType.InteractiveDuration;
|
||||||
|
public IEffectHookObject.InteractiveEffectType InteractableScoreInterval => IEffectHookObject.InteractiveEffectType.InteractableScoreInterval;
|
||||||
|
public IEffectHookObject.InteractiveEffectType InteractableIntervalThatCanScoreBest => IEffectHookObject.InteractiveEffectType.InteractableIntervalThatCanScoreBest;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public partial class ScriptableObject : IScriptableObject
|
public partial class ScriptableObject : IScriptableObject
|
||||||
@@ -204,7 +213,7 @@ namespace Demo
|
|||||||
|
|
||||||
public ScriptableObject Parent;
|
public ScriptableObject Parent;
|
||||||
public readonly List<ScriptableObject> Childs = new();
|
public readonly List<ScriptableObject> Childs = new();
|
||||||
public readonly List<ScriptableObject> UpdateChilds = new();
|
[Content, SerializeField] private List<ScriptableObject> UpdateChilds = new();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取根脚本对象
|
/// 获取根脚本对象
|
||||||
@@ -490,6 +499,8 @@ namespace Demo
|
|||||||
new() { data = PrivateType.SplineComputerSampleModeInstance.instance, type = typeof(PrivateType.SplineComputerSampleModeInstance)} },
|
new() { data = PrivateType.SplineComputerSampleModeInstance.instance, type = typeof(PrivateType.SplineComputerSampleModeInstance)} },
|
||||||
{ $"Spline{nameof(Spline.Type)}",
|
{ $"Spline{nameof(Spline.Type)}",
|
||||||
new() { data = PrivateType.SplineTypeInstance.instance, type = typeof(PrivateType.SplineTypeInstance)} },
|
new() { data = PrivateType.SplineTypeInstance.instance, type = typeof(PrivateType.SplineTypeInstance)} },
|
||||||
|
{ nameof(IEffectHookObject.InteractiveEffectType),
|
||||||
|
new() { data = PrivateType.IEffectHookObjectInstance.instance, type = typeof(PrivateType.IEffectHookObjectInstance)} }
|
||||||
};
|
};
|
||||||
|
|
||||||
foreach (var ir in engine.RunAsync(script, importClass, variables).Yield())
|
foreach (var ir in engine.RunAsync(script, importClass, variables).Yield())
|
||||||
@@ -530,7 +541,7 @@ namespace Demo
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// UpdateTicks
|
// UpdateTicks
|
||||||
if (UpdatePerFrame > 0)
|
if (this.IsSelfEnableUpdate && UpdatePerFrame > 0)
|
||||||
{
|
{
|
||||||
if (ScriptUpdateCounter % UpdatePerFrame == 0)
|
if (ScriptUpdateCounter % UpdatePerFrame == 0)
|
||||||
UpdateTicks(currentTime, deltaTime, tickType);
|
UpdateTicks(currentTime, deltaTime, tickType);
|
||||||
@@ -751,7 +762,6 @@ namespace Demo
|
|||||||
|
|
||||||
public static IEnumerator LoadAssetBundle(this IAssetBundleLoader self, string ab, Action<AssetBundle> callback)
|
public static IEnumerator LoadAssetBundle(this IAssetBundleLoader self, string ab, Action<AssetBundle> callback)
|
||||||
{
|
{
|
||||||
Debug.Log($"{self.SharedInterfaceScriptObject.ScriptName}.{nameof(LoadAssetBundle)}({ab})", self.SharedInterfaceScriptObject);
|
|
||||||
yield return LoadAssetBundleAsync(ab, callback);
|
yield return LoadAssetBundleAsync(ab, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -69,41 +69,38 @@ namespace Demo.Game
|
|||||||
|
|
||||||
protected override void UpdateTicks(float currentTime, float deltaTime, TickType tickType)
|
protected override void UpdateTicks(float currentTime, float deltaTime, TickType tickType)
|
||||||
{
|
{
|
||||||
using (Profiler.BeginZone($"Updatement<{typeof(DataType).Name}>.UpdateTicks"))
|
base.UpdateTicks(currentTime, deltaTime, tickType);
|
||||||
|
|
||||||
|
float GetPercentValue()
|
||||||
{
|
{
|
||||||
base.UpdateTicks(currentTime, deltaTime, tickType);
|
return (currentTime - Entries[Content].TimePoint) / (Entries[Content + 1].TimePoint - Entries[Content].TimePoint);
|
||||||
|
}
|
||||||
|
|
||||||
float GetPercentValue()
|
if (Entries.Count <= 1)
|
||||||
{
|
return;
|
||||||
return (currentTime - Entries[Content].TimePoint) / (Entries[Content + 1].TimePoint - Entries[Content].TimePoint);
|
switch (tickType)
|
||||||
}
|
{
|
||||||
|
case TickType.Reset:
|
||||||
if (Entries.Count <= 1)
|
case TickType.Start:
|
||||||
return;
|
{
|
||||||
switch (tickType)
|
Content = 0;
|
||||||
{
|
while (Content + 1 < Entries.Count && Entries[Content + 1].TimePoint < currentTime)
|
||||||
case TickType.Reset:
|
|
||||||
case TickType.Start:
|
|
||||||
{
|
|
||||||
Content = 0;
|
|
||||||
while (Content + 1 < Entries.Count && Entries[Content + 1].TimePoint < currentTime)
|
|
||||||
Content++;
|
|
||||||
UpdateEntry(Content, GetPercentValue());
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
if (Entries[0].TimePoint > currentTime)
|
|
||||||
return;
|
|
||||||
if (Content + 1 >= Entries.Count)
|
|
||||||
return;
|
|
||||||
if (Entries[Content + 1].TimePoint < currentTime)
|
|
||||||
Content++;
|
Content++;
|
||||||
if (Content + 1 >= Entries.Count)
|
UpdateEntry(Content, GetPercentValue());
|
||||||
UpdateEntry(Content, 1);
|
}
|
||||||
else
|
break;
|
||||||
UpdateEntry(Content, GetPercentValue());
|
default:
|
||||||
break;
|
if (Entries[0].TimePoint > currentTime)
|
||||||
}
|
return;
|
||||||
|
if (Content + 1 >= Entries.Count)
|
||||||
|
return;
|
||||||
|
if (Entries[Content + 1].TimePoint < currentTime)
|
||||||
|
Content++;
|
||||||
|
if (Content + 1 >= Entries.Count)
|
||||||
|
UpdateEntry(Content, 1);
|
||||||
|
else
|
||||||
|
UpdateEntry(Content, GetPercentValue());
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using Convention;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace Demo.Game
|
namespace Demo.Game
|
||||||
@@ -11,9 +13,17 @@ namespace Demo.Game
|
|||||||
return new GameObject().AddComponent<ParticleEffect>();
|
return new GameObject().AddComponent<ParticleEffect>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Dictionary<string,bool> AssetBundleLoaders = new();
|
||||||
private readonly List<string> AssetBundles = new();
|
private readonly List<string> AssetBundles = new();
|
||||||
private readonly List<GameObject> Prefabs = new();
|
private readonly List<GameObject> Prefabs = new();
|
||||||
|
|
||||||
|
protected override IEnumerator DoSomethingDuringApplyScript()
|
||||||
|
{
|
||||||
|
yield return base.DoSomethingDuringApplyScript();
|
||||||
|
while (AssetBundleLoaders.Any(x => x.Value == false))
|
||||||
|
yield return null;
|
||||||
|
}
|
||||||
|
|
||||||
public override IEnumerator UnloadScript()
|
public override IEnumerator UnloadScript()
|
||||||
{
|
{
|
||||||
yield return base.UnloadScript();
|
yield return base.UnloadScript();
|
||||||
@@ -29,9 +39,10 @@ namespace Demo.Game
|
|||||||
/// <param name="ab"></param>
|
/// <param name="ab"></param>
|
||||||
/// <param name="prefab"></param>
|
/// <param name="prefab"></param>
|
||||||
[Convention.RScript.Variable.Attr.Method]
|
[Convention.RScript.Variable.Attr.Method]
|
||||||
public IEnumerator Load(string ab, string prefab)
|
public void Load(string ab, string prefab)
|
||||||
{
|
{
|
||||||
yield return this.LoadAssetBundle(ab, x =>
|
AssetBundleLoaders.TryAdd(ab, false);
|
||||||
|
ConventionUtility.StartCoroutine(this.LoadAssetBundle(ab, x =>
|
||||||
{
|
{
|
||||||
GameObject sub = Instantiate(x.LoadAsset<GameObject>(prefab));
|
GameObject sub = Instantiate(x.LoadAsset<GameObject>(prefab));
|
||||||
sub.SetActive(false);
|
sub.SetActive(false);
|
||||||
@@ -39,7 +50,8 @@ namespace Demo.Game
|
|||||||
sub.transform.SetParent(transform);
|
sub.transform.SetParent(transform);
|
||||||
sub.transform.localPosition = Vector3.zero;
|
sub.transform.localPosition = Vector3.zero;
|
||||||
AssetBundles.Add(ab);
|
AssetBundles.Add(ab);
|
||||||
});
|
AssetBundleLoaders[ab] = true;
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnInit()
|
public override void OnInit()
|
||||||
|
|||||||
@@ -116,9 +116,9 @@ namespace Demo.Game
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="path"></param>
|
/// <param name="path"></param>
|
||||||
[Convention.RScript.Variable.Attr.Method]
|
[Convention.RScript.Variable.Attr.Method]
|
||||||
public void Bind(string path)
|
public void Bind(IInteraction target)
|
||||||
{
|
{
|
||||||
MyInteractionModule = FindWithPath(path) as IInteraction;
|
MyInteractionModule = target;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user