GitHub
6 年前
当前提交
d18becd3
共有 9 个文件被更改,包括 205 次插入 和 65 次删除
-
17Runtime/foundation/basic_types.cs
-
80Runtime/ui/txt/layout.cs
-
57Runtime/ui/txt/layout_utils.cs
-
16Runtime/ui/txt/linebreaker.cs
-
10Runtime/ui/txt/paragraph.cs
-
8Runtime/ui/txt/word_separate.cs
-
48Runtime/ui/txt/wordbreaker.cs
-
4Samples/UIWidgetSample/txt/TextStyleSample.cs
-
30Runtime/ui/txt/text_buff.cs
|
|||
using System; |
|||
using Unity.UIWidgets.foundation; |
|||
|
|||
namespace Unity.UIWidgets.ui { |
|||
class TextBuff { |
|||
public readonly string text; |
|||
public readonly int offset; |
|||
public readonly int size; |
|||
|
|||
public TextBuff(string text, int? offset = null, int? size = null) { |
|||
this.text = text; |
|||
this.offset = offset ?? 0; |
|||
this.size = size ?? text.Length - this.offset; |
|||
} |
|||
|
|||
public char charAt(int index) { |
|||
return this.text[this.offset + index]; |
|||
} |
|||
|
|||
public TextBuff subBuff(int shift, int size) { |
|||
D.assert(shift >= 0 && shift <= this.size); |
|||
D.assert(shift + size <= this.size); |
|||
return new TextBuff(this.text, this.offset + shift, size); |
|||
} |
|||
|
|||
public String getString() { |
|||
return this.text.Substring(this.offset, this.size); |
|||
} |
|||
} |
|||
} |
撰写
预览
正在加载...
取消
保存
Reference in new issue