Skip to content

Commit fcddc11

Browse files
committed
Update README.md
1 parent 75fd421 commit fcddc11

1 file changed

Lines changed: 30 additions & 4 deletions

File tree

README.md

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,36 @@
1-
# uGUI-Hypertext [![License](https://img.shields.io/badge/license-MIT-lightgrey.svg?style=flat)](http://mit-license.org)
2-
Hypertext for uGUI
1+
# uGUI-Hypertext ![license](https://img.shields.io/badge/license-MIT-green.svg?style=flat-square)
2+
3+
`UnityEngine.UI.Text` で任意の部分文字列をクリック可能にするコンポーネントです。[English](https://translate.google.com/translate?sl=ja&tl=en&u=https://github.com/setchi/uGUI-Hypertext) (by Google Translate)
34

45
![screencast](screencast.gif)
56

6-
## Environment
7-
Unity 2018.2.12f1
7+
```csharp
8+
text.OnClick(RegexURL, url => Debug.Log(url));
9+
text.OnClick(RegexHashtag, hashtag => Debug.Log(hashtag));
10+
```
11+
12+
## サンプル
13+
[Hypertext/Examples](Assets/Hypertext/Examples/) に正規表現によるパターンマッチで任意の部分文字列をクリック可能にする実装例があるので参考にしてください。
14+
15+
## 使い方
16+
[HypertextBase](Assets/Hypertext/Scripts/HypertextBase.cs) を継承したクラスを作成し、`OnClick` メソッドを使って任意の部分文字列がクリックされた時のコールバックを登録できます。詳細はサンプルの [RegexHypertext](Assets/Hypertext/Examples/RegexHypertext.cs) を参考にしてください。
17+
18+
```csharp
19+
/// <summary>
20+
/// 指定した部分文字列にクリックイベントを登録します
21+
/// </summary>
22+
/// <param name="startIndex">部分文字列の開始文字位置</param>
23+
/// <param name="length">部分文字列の長さ</param>
24+
/// <param name="color">部分文字列につける色</param>
25+
/// <param name="onClick">部分文字列がクリックされたときのコールバック</param>
26+
protected void OnClick(int startIndex, int length, Color color, Action<string> onClick)
27+
```
28+
29+
## 開発環境
30+
Unity 2018.3.6f1
31+
32+
## Author
33+
[setchi](https://github.com/setchi)
834

935
## License
1036
MIT

0 commit comments

Comments
 (0)