summaryrefslogtreecommitdiff
path: root/WorldlineKeepers/Assets/ThirdParty/StringUtil/DoubleVString.cs
diff options
context:
space:
mode:
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