æ¦è¦
using System.Text.RegularExpressions; public static class StringExtensions { private const RegexOptions OPTIONS = RegexOptions.IgnoreCase; public static string RemoveBBCode( this string self ) { self = Regex.Replace( self, @"\[b\](.*)\[\/b\]" , "$1", OPTIONS ); // 太å self = Regex.Replace( self, @"\[i\](.*)\[\/i\]" , "$1", OPTIONS ); // æä½ self = Regex.Replace( self, @"\[u\](.*)\[\/u\]" , "$1", OPTIONS ); // ä¸ç·ä»ã self = Regex.Replace( self, @"\[s\](.*)\[\/s\]" , "$1", OPTIONS ); // æã¡æ¶ãç· self = Regex.Replace( self, @"\[sub\](.*)\[\/sub\]" , "$1", OPTIONS ); // ä¸ä»ãæå self = Regex.Replace( self, @"\[sup\](.*)\[\/sup\]" , "$1", OPTIONS ); // ä¸ä»ãæå self = Regex.Replace( self, @"\[url=.*?\](.*)\[\/url\]" , "$1", OPTIONS ); // URL self = Regex.Replace( self, @"\[[0-9a-f]{6}\](.*)\[\-\]" , "$1", OPTIONS ); // è² return self; } }
var str = "[b][i][u][s][sub][sup][url=https://www.google.co.jp/][FF00aa]ãã«ãã¥ã¦[-][/url][/sup][/sub][/s][/u][/i][/b]"; Debug.Log( str.RemoveBBCode() ); // ãã«ãã¥ã¦
NGUIã®UIInputã§å
¥åæ¬ãä½æããå ´åã«BBCodeä»ãã§æååãå
¥åããã¦ãã¾ãã¨
ãã®æååã使ç¨ãã¦ããå ´æã§å¤ªåãæä½ãé©ç¨ããã¦ãã¾ãä¸å
·åã«ééãããã
ãããé²ãããã«ä½æãã¾ãã
UIInputã§å
¥åãããæååã使ç¨ãã¦ããUILabelãHierarchyãã¥ã¼ã§é¸æãã¦
Inspectorãã¥ã¼ã§BBCodeã®ãã§ãã¯ããªãã«ãããã¨ã§
BBCodeãç¡å¹åãããã¨ãå¯è½ã§ã
NGUIã§ä½¿ç¨ã§ããBBCode
ã¿ã° | 説æ |
---|---|
[b]ãã«ãã¥ã¦[/b] | 太å |
[i]ãã«ãã¥ã¦[/i] | æä½ |
[u]ãã«ãã¥ã¦[/u] | ä¸ç·ä»ã |
[s]ãã«ãã¥ã¦[/s] | æã¡æ¶ãç· |
[sub]ãã«ãã¥ã¦[/sub] | ä¸ä»ãæå |
[sup]ãã«ãã¥ã¦[/sup] | ä¸ä»ãæå |
[url=https://www.google.co.jp/]ãã«ãã¥ã¦[/url] | ãã¤ãã¼ãªã³ã¯ |
[ff0000]ãã«ãã¥ã¦[-] | è² |
[b][u]ãã«ãã¥ã¦[/u][/b] | è¤åæå®(ä¾ï¼å¤ªåã¨ä¸ç·ä»ã) |