推动Config新增
This commit is contained in:
@@ -36,6 +36,7 @@ namespace Demo.Game
|
||||
{
|
||||
public class ScriptLoadableConfig
|
||||
{
|
||||
public int UID = -1;
|
||||
public Vector3 EnterGameLocalPosition, EnterGameEulerAngles, EnterGameLocalScaling;
|
||||
public bool IsSetObjectDisable;
|
||||
public int UpdatePerFrame;
|
||||
@@ -51,6 +52,7 @@ namespace Demo.Game
|
||||
|
||||
public virtual void Deserialize(BinaryReader reader)
|
||||
{
|
||||
UID = BinarySerializeUtility.ReadInt(reader);
|
||||
EnterGameLocalPosition = BinarySerializeUtility.ReadVec3(reader);
|
||||
EnterGameEulerAngles = BinarySerializeUtility.ReadVec3(reader);
|
||||
EnterGameLocalScaling = BinarySerializeUtility.ReadVec3(reader);
|
||||
@@ -69,6 +71,7 @@ namespace Demo.Game
|
||||
}
|
||||
public virtual void Serialize(BinaryWriter writer)
|
||||
{
|
||||
BinarySerializeUtility.WriteInt(writer, UID);
|
||||
BinarySerializeUtility.WriteVec3(writer, EnterGameLocalPosition);
|
||||
BinarySerializeUtility.WriteVec3(writer, EnterGameEulerAngles);
|
||||
BinarySerializeUtility.WriteVec3(writer, EnterGameLocalScaling);
|
||||
@@ -223,6 +226,7 @@ namespace Demo.Game
|
||||
public ScriptableObject Parent;
|
||||
public readonly List<ScriptableObject> Childs = new();
|
||||
|
||||
private RootObject rootObjectCache = null;
|
||||
/// <summary>
|
||||
/// 获取根脚本对象
|
||||
/// </summary>
|
||||
@@ -230,12 +234,16 @@ namespace Demo.Game
|
||||
[Convention.RScript.Variable.Attr.Method]
|
||||
public RootObject GetRoot()
|
||||
{
|
||||
if (Parent == null)
|
||||
return this as RootObject;
|
||||
if (Parent is RootObject result)
|
||||
return result;
|
||||
else
|
||||
return Parent.GetRoot();
|
||||
if (rootObjectCache == null)
|
||||
{
|
||||
if (Parent == null)
|
||||
rootObjectCache = this as RootObject;
|
||||
if (Parent is RootObject result)
|
||||
rootObjectCache = result;
|
||||
else
|
||||
rootObjectCache = Parent.GetRoot();
|
||||
}
|
||||
return rootObjectCache;
|
||||
}
|
||||
|
||||
|
||||
@@ -334,6 +342,7 @@ namespace Demo.Game
|
||||
|
||||
isEnableScript = true;
|
||||
// 只有RootObject的parent会是空的
|
||||
GetRoot().PushLoadedScriptObject(this);
|
||||
if (parent != null)
|
||||
{
|
||||
MyHierarchyItem = parent.MyHierarchyItem.GetHierarchyItem().CreateSubPropertyItem(1)[0];
|
||||
@@ -819,19 +828,12 @@ namespace Demo.Game
|
||||
}
|
||||
}
|
||||
|
||||
private float UIResizeOnTimelineCount = 0;
|
||||
protected override void UpdateTicks(float currentTime, float deltaTime, TickType tickType)
|
||||
{
|
||||
base.UpdateTicks(currentTime, deltaTime, tickType);
|
||||
// 存在严重的性能开销, 在解决之前将不会允许其快速自动更新
|
||||
if (MyTimelineEntry != null)
|
||||
{
|
||||
if (UIResizeOnTimelineCount > 0.1 || tickType != TickType.Update)
|
||||
{
|
||||
UIResizeOnTimelineCount = 0;
|
||||
MyTimelineItem.ResizeOnTimeline();
|
||||
}
|
||||
UIResizeOnTimelineCount += deltaTime;
|
||||
MyTimelineItem.ResizeOnTimeline();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user