summaryrefslogtreecommitdiff
path: root/WorldlineKeepers/Assets/ThirdParty/StringUtil/DoubleVString.cs
diff options
context:
space:
mode:
authorchai <215380520@qq.com>2023-05-30 14:27:59 +0800
committerchai <215380520@qq.com>2023-05-30 14:27:59 +0800
commit2fcb4625389b1594bbefdbaf2e038b2cfffa8ead (patch)
tree87f57dbfdaf3d11ebf33869b76f12cc475c9a033 /WorldlineKeepers/Assets/ThirdParty/StringUtil/DoubleVString.cs
parent38e177b0fdf130d6a361ab51c80b5b56ee83f28e (diff)
+ json extends
Diffstat (limited to 'WorldlineKeepers/Assets/ThirdParty/StringUtil/DoubleVString.cs')
-rw-r--r--WorldlineKeepers/Assets/ThirdParty/StringUtil/DoubleVString.cs37
1 files changed, 37 insertions, 0 deletions
diff --git a/WorldlineKeepers/Assets/ThirdParty/StringUtil/DoubleVString.cs b/WorldlineKeepers/Assets/ThirdParty/StringUtil/DoubleVString.cs
new file mode 100644
index 0000000..5d9c6e8
--- /dev/null
+++ b/WorldlineKeepers/Assets/ThirdParty/StringUtil/DoubleVString.cs
@@ -0,0 +1,37 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+
+/// <summary>
+/// 给UI.Text使用的double buffer string
+/// </summary>
+public class DoubleVString
+{
+ private int index;
+ private VString stringA;
+ private VString stringB;
+
+ public DoubleVString(int maxCount)
+ {
+ stringA = new VString(maxCount);
+ stringB = new VString(maxCount);
+ }
+
+ public VString GetCurrentVString()
+ {
+ return (index % 2) == 0 ? stringA : stringB;
+ }
+
+ public VString GetNextVString()
+ {
+ return (index % 2) == 0 ? stringB : stringA;
+ }
+
+
+ //交换current 和Next string对象
+ public void SwapVString()
+ {
+ index = (index + 1) % 2;
+ }
+} \ No newline at end of file