Introduce TargetString to eliminate text GC.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Cryville.Common.Pdt;
|
||||
using Cryville.Common.Buffers;
|
||||
using Cryville.Common.Pdt;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
@@ -7,7 +8,7 @@ namespace Cryville.Crtr.Components {
|
||||
public class SpriteText : SpriteBase {
|
||||
public SpriteText() {
|
||||
SubmitProperty("frames", new op_set_frames(this));
|
||||
SubmitProperty("value", new PropOp.String(v => Value = v));
|
||||
SubmitProperty("value", new PropOp.TargetString(() => Value));
|
||||
SubmitProperty("size", new PropOp.Float(v => Size = v));
|
||||
SubmitProperty("spacing", new PropOp.Float(v => Spacing = v));
|
||||
SubmitProperty("opacity", new PropOp.Float(v => Opacity = v));
|
||||
@@ -48,14 +49,8 @@ namespace Cryville.Crtr.Components {
|
||||
set { m_frames = value; UpdateFrames(); UpdateScale(); }
|
||||
}
|
||||
|
||||
public string m_value;
|
||||
public string Value {
|
||||
get { return m_value; }
|
||||
set {
|
||||
if (m_value == value) return;
|
||||
m_value = value; UpdateScale();
|
||||
}
|
||||
}
|
||||
readonly TargetString m_value = new TargetString();
|
||||
public TargetString Value { get { return m_value; } }
|
||||
|
||||
public float m_size;
|
||||
public float Size {
|
||||
@@ -175,6 +170,7 @@ namespace Cryville.Crtr.Components {
|
||||
UpdateFrames();
|
||||
mesh.Mesh.Clear();
|
||||
UpdateScale();
|
||||
Value.OnUpdate += UpdateScale;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user