NGUIText.cs 48 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964
  1. using System;
  2. using System.Diagnostics;
  3. using System.Text;
  4. using UnityEngine;
  5. public static class NGUIText
  6. {
  7. public static void Update()
  8. {
  9. NGUIText.Update(true);
  10. }
  11. public static void Update(bool request)
  12. {
  13. NGUIText.finalSize = Mathf.RoundToInt((float)NGUIText.fontSize / NGUIText.pixelDensity);
  14. NGUIText.finalSpacingX = NGUIText.spacingX * NGUIText.fontScale;
  15. NGUIText.finalLineHeight = ((float)NGUIText.fontSize + NGUIText.spacingY) * NGUIText.fontScale;
  16. NGUIText.useSymbols = (NGUIText.bitmapFont != null && NGUIText.bitmapFont.hasSymbols && NGUIText.encoding && NGUIText.symbolStyle != NGUIText.SymbolStyle.None);
  17. if (NGUIText.dynamicFont != null && request)
  18. {
  19. NGUIText.dynamicFont.RequestCharactersInTexture(")_-", NGUIText.finalSize, NGUIText.fontStyle);
  20. if (!NGUIText.dynamicFont.GetCharacterInfo(')', out NGUIText.mTempChar, NGUIText.finalSize, NGUIText.fontStyle) || NGUIText.mTempChar.vert.height == 0f)
  21. {
  22. NGUIText.dynamicFont.RequestCharactersInTexture("A", NGUIText.finalSize, NGUIText.fontStyle);
  23. if (!NGUIText.dynamicFont.GetCharacterInfo('A', out NGUIText.mTempChar, NGUIText.finalSize, NGUIText.fontStyle))
  24. {
  25. NGUIText.baseline = 0f;
  26. return;
  27. }
  28. }
  29. float yMax = NGUIText.mTempChar.vert.yMax;
  30. float yMin = NGUIText.mTempChar.vert.yMin;
  31. NGUIText.baseline = Mathf.Round(yMax + ((float)NGUIText.finalSize - yMax + yMin) * 0.5f);
  32. }
  33. }
  34. public static void Prepare(string text)
  35. {
  36. if (NGUIText.dynamicFont != null)
  37. {
  38. NGUIText.dynamicFont.RequestCharactersInTexture(text, NGUIText.finalSize, NGUIText.fontStyle);
  39. }
  40. }
  41. public static BMSymbol GetSymbol(string text, int index, int textLength)
  42. {
  43. return (!(NGUIText.bitmapFont != null)) ? null : NGUIText.bitmapFont.MatchSymbol(text, index, textLength);
  44. }
  45. public static float GetGlyphWidth(int ch, int prev)
  46. {
  47. if (NGUIText.bitmapFont != null)
  48. {
  49. bool flag = false;
  50. if (ch == 8201)
  51. {
  52. flag = true;
  53. ch = 32;
  54. }
  55. BMGlyph bmglyph = NGUIText.bitmapFont.bmFont.GetGlyph(ch);
  56. if (bmglyph != null)
  57. {
  58. int num = bmglyph.advance;
  59. if (flag)
  60. {
  61. num >>= 1;
  62. }
  63. return NGUIText.fontScale * (float)((prev == 0) ? bmglyph.advance : (num + bmglyph.GetKerning(prev)));
  64. }
  65. }
  66. else if (NGUIText.dynamicFont != null && NGUIText.dynamicFont.GetCharacterInfo((char)ch, out NGUIText.mTempChar, NGUIText.finalSize, NGUIText.fontStyle))
  67. {
  68. return NGUIText.mTempChar.width * NGUIText.fontScale * NGUIText.pixelDensity;
  69. }
  70. return 0f;
  71. }
  72. public static NGUIText.GlyphInfo GetGlyph(int ch, int prev)
  73. {
  74. if (NGUIText.bitmapFont != null)
  75. {
  76. bool flag = false;
  77. if (ch == 8201)
  78. {
  79. flag = true;
  80. ch = 32;
  81. }
  82. BMGlyph bmglyph = NGUIText.bitmapFont.bmFont.GetGlyph(ch);
  83. if (bmglyph != null)
  84. {
  85. int num = (prev == 0) ? 0 : bmglyph.GetKerning(prev);
  86. NGUIText.glyph.v0.x = (float)((prev == 0) ? bmglyph.offsetX : (bmglyph.offsetX + num));
  87. NGUIText.glyph.v1.y = (float)(-(float)bmglyph.offsetY);
  88. NGUIText.glyph.v1.x = NGUIText.glyph.v0.x + (float)bmglyph.width;
  89. NGUIText.glyph.v0.y = NGUIText.glyph.v1.y - (float)bmglyph.height;
  90. NGUIText.glyph.u0.x = (float)bmglyph.x;
  91. NGUIText.glyph.u0.y = (float)(bmglyph.y + bmglyph.height);
  92. NGUIText.glyph.u2.x = (float)(bmglyph.x + bmglyph.width);
  93. NGUIText.glyph.u2.y = (float)bmglyph.y;
  94. NGUIText.glyph.u1.x = NGUIText.glyph.u0.x;
  95. NGUIText.glyph.u1.y = NGUIText.glyph.u2.y;
  96. NGUIText.glyph.u3.x = NGUIText.glyph.u2.x;
  97. NGUIText.glyph.u3.y = NGUIText.glyph.u0.y;
  98. int num2 = bmglyph.advance;
  99. if (flag)
  100. {
  101. num2 >>= 1;
  102. }
  103. NGUIText.glyph.advance = (float)(num2 + num);
  104. NGUIText.glyph.channel = bmglyph.channel;
  105. if (NGUIText.fontScale != 1f)
  106. {
  107. NGUIText.glyph.v0 *= NGUIText.fontScale;
  108. NGUIText.glyph.v1 *= NGUIText.fontScale;
  109. NGUIText.glyph.advance *= NGUIText.fontScale;
  110. }
  111. return NGUIText.glyph;
  112. }
  113. }
  114. else if (NGUIText.dynamicFont != null && NGUIText.dynamicFont.GetCharacterInfo((char)ch, out NGUIText.mTempChar, NGUIText.finalSize, NGUIText.fontStyle))
  115. {
  116. NGUIText.glyph.v0.x = NGUIText.mTempChar.vert.xMin;
  117. NGUIText.glyph.v1.x = NGUIText.glyph.v0.x + NGUIText.mTempChar.vert.width;
  118. NGUIText.glyph.v0.y = NGUIText.mTempChar.vert.yMax - NGUIText.baseline;
  119. NGUIText.glyph.v1.y = NGUIText.glyph.v0.y - NGUIText.mTempChar.vert.height;
  120. NGUIText.glyph.u0.x = NGUIText.mTempChar.uv.xMin;
  121. NGUIText.glyph.u0.y = NGUIText.mTempChar.uv.yMin;
  122. NGUIText.glyph.u2.x = NGUIText.mTempChar.uv.xMax;
  123. NGUIText.glyph.u2.y = NGUIText.mTempChar.uv.yMax;
  124. if (NGUIText.mTempChar.flipped)
  125. {
  126. NGUIText.glyph.u1 = new Vector2(NGUIText.glyph.u2.x, NGUIText.glyph.u0.y);
  127. NGUIText.glyph.u3 = new Vector2(NGUIText.glyph.u0.x, NGUIText.glyph.u2.y);
  128. }
  129. else
  130. {
  131. NGUIText.glyph.u1 = new Vector2(NGUIText.glyph.u0.x, NGUIText.glyph.u2.y);
  132. NGUIText.glyph.u3 = new Vector2(NGUIText.glyph.u2.x, NGUIText.glyph.u0.y);
  133. }
  134. NGUIText.glyph.advance = NGUIText.mTempChar.width;
  135. NGUIText.glyph.channel = 0;
  136. NGUIText.glyph.v0.x = Mathf.Round(NGUIText.glyph.v0.x);
  137. NGUIText.glyph.v0.y = Mathf.Round(NGUIText.glyph.v0.y);
  138. NGUIText.glyph.v1.x = Mathf.Round(NGUIText.glyph.v1.x);
  139. NGUIText.glyph.v1.y = Mathf.Round(NGUIText.glyph.v1.y);
  140. float num3 = NGUIText.fontScale * NGUIText.pixelDensity;
  141. if (num3 != 1f)
  142. {
  143. NGUIText.glyph.v0 *= num3;
  144. NGUIText.glyph.v1 *= num3;
  145. NGUIText.glyph.advance *= num3;
  146. }
  147. return NGUIText.glyph;
  148. }
  149. return null;
  150. }
  151. [DebuggerHidden]
  152. [DebuggerStepThrough]
  153. public static float ParseAlpha(string text, int index)
  154. {
  155. int num = NGUIMath.HexToDecimal(text[index + 1]) << 4 | NGUIMath.HexToDecimal(text[index + 2]);
  156. return Mathf.Clamp01((float)num / 255f);
  157. }
  158. [DebuggerHidden]
  159. [DebuggerStepThrough]
  160. public static Color ParseColor(string text, int offset)
  161. {
  162. return NGUIText.ParseColor24(text, offset);
  163. }
  164. [DebuggerHidden]
  165. [DebuggerStepThrough]
  166. public static Color ParseColor24(string text, int offset)
  167. {
  168. int num = NGUIMath.HexToDecimal(text[offset]) << 4 | NGUIMath.HexToDecimal(text[offset + 1]);
  169. int num2 = NGUIMath.HexToDecimal(text[offset + 2]) << 4 | NGUIMath.HexToDecimal(text[offset + 3]);
  170. int num3 = NGUIMath.HexToDecimal(text[offset + 4]) << 4 | NGUIMath.HexToDecimal(text[offset + 5]);
  171. float num4 = 0.003921569f;
  172. return new Color(num4 * (float)num, num4 * (float)num2, num4 * (float)num3);
  173. }
  174. [DebuggerHidden]
  175. [DebuggerStepThrough]
  176. public static Color ParseColor32(string text, int offset)
  177. {
  178. int num = NGUIMath.HexToDecimal(text[offset]) << 4 | NGUIMath.HexToDecimal(text[offset + 1]);
  179. int num2 = NGUIMath.HexToDecimal(text[offset + 2]) << 4 | NGUIMath.HexToDecimal(text[offset + 3]);
  180. int num3 = NGUIMath.HexToDecimal(text[offset + 4]) << 4 | NGUIMath.HexToDecimal(text[offset + 5]);
  181. int num4 = NGUIMath.HexToDecimal(text[offset + 6]) << 4 | NGUIMath.HexToDecimal(text[offset + 7]);
  182. float num5 = 0.003921569f;
  183. return new Color(num5 * (float)num, num5 * (float)num2, num5 * (float)num3, num5 * (float)num4);
  184. }
  185. [DebuggerHidden]
  186. [DebuggerStepThrough]
  187. public static string EncodeColor(Color c)
  188. {
  189. return NGUIText.EncodeColor24(c);
  190. }
  191. [DebuggerHidden]
  192. [DebuggerStepThrough]
  193. public static string EncodeAlpha(float a)
  194. {
  195. int num = Mathf.Clamp(Mathf.RoundToInt(a * 255f), 0, 255);
  196. return NGUIMath.DecimalToHex8(num);
  197. }
  198. [DebuggerHidden]
  199. [DebuggerStepThrough]
  200. public static string EncodeColor24(Color c)
  201. {
  202. int num = 16777215 & NGUIMath.ColorToInt(c) >> 8;
  203. return NGUIMath.DecimalToHex24(num);
  204. }
  205. [DebuggerHidden]
  206. [DebuggerStepThrough]
  207. public static string EncodeColor32(Color c)
  208. {
  209. int num = NGUIMath.ColorToInt(c);
  210. return NGUIMath.DecimalToHex32(num);
  211. }
  212. public static bool ParseSymbol(string text, ref int index)
  213. {
  214. int num = 1;
  215. bool flag = false;
  216. bool flag2 = false;
  217. bool flag3 = false;
  218. bool flag4 = false;
  219. bool flag5 = false;
  220. return NGUIText.ParseSymbol(text, ref index, null, false, ref num, ref flag, ref flag2, ref flag3, ref flag4, ref flag5);
  221. }
  222. [DebuggerHidden]
  223. [DebuggerStepThrough]
  224. public static bool IsHex(char ch)
  225. {
  226. return (ch >= '0' && ch <= '9') || (ch >= 'a' && ch <= 'f') || (ch >= 'A' && ch <= 'F');
  227. }
  228. public static bool ParseSymbol(string text, ref int index, BetterList<Color> colors, bool premultiply, ref int sub, ref bool bold, ref bool italic, ref bool underline, ref bool strike, ref bool ignoreColor)
  229. {
  230. int length = text.Length;
  231. if (index + 3 > length || text[index] != '[')
  232. {
  233. return false;
  234. }
  235. if (text[index + 2] == ']')
  236. {
  237. if (text[index + 1] == '-')
  238. {
  239. if (colors != null && colors.size > 1)
  240. {
  241. colors.RemoveAt(colors.size - 1);
  242. }
  243. index += 3;
  244. return true;
  245. }
  246. string text2 = text.Substring(index, 3);
  247. if (text2 != null)
  248. {
  249. if (text2 == "[b]")
  250. {
  251. bold = true;
  252. index += 3;
  253. return true;
  254. }
  255. if (text2 == "[i]")
  256. {
  257. italic = true;
  258. index += 3;
  259. return true;
  260. }
  261. if (text2 == "[u]")
  262. {
  263. underline = true;
  264. index += 3;
  265. return true;
  266. }
  267. if (text2 == "[s]")
  268. {
  269. strike = true;
  270. index += 3;
  271. return true;
  272. }
  273. if (text2 == "[c]")
  274. {
  275. ignoreColor = true;
  276. index += 3;
  277. return true;
  278. }
  279. }
  280. }
  281. if (index + 4 > length)
  282. {
  283. return false;
  284. }
  285. if (text[index + 3] == ']')
  286. {
  287. string text3 = text.Substring(index, 4);
  288. if (text3 != null)
  289. {
  290. if (text3 == "[/b]")
  291. {
  292. bold = false;
  293. index += 4;
  294. return true;
  295. }
  296. if (text3 == "[/i]")
  297. {
  298. italic = false;
  299. index += 4;
  300. return true;
  301. }
  302. if (text3 == "[/u]")
  303. {
  304. underline = false;
  305. index += 4;
  306. return true;
  307. }
  308. if (text3 == "[/s]")
  309. {
  310. strike = false;
  311. index += 4;
  312. return true;
  313. }
  314. if (text3 == "[/c]")
  315. {
  316. ignoreColor = false;
  317. index += 4;
  318. return true;
  319. }
  320. }
  321. char ch = text[index + 1];
  322. char ch2 = text[index + 2];
  323. if (NGUIText.IsHex(ch) && NGUIText.IsHex(ch2))
  324. {
  325. int num = NGUIMath.HexToDecimal(ch) << 4 | NGUIMath.HexToDecimal(ch2);
  326. NGUIText.mAlpha = (float)num / 255f;
  327. index += 4;
  328. return true;
  329. }
  330. }
  331. if (index + 5 > length)
  332. {
  333. return false;
  334. }
  335. if (text[index + 4] == ']')
  336. {
  337. string text4 = text.Substring(index, 5);
  338. if (text4 != null)
  339. {
  340. if (text4 == "[sub]")
  341. {
  342. sub = 1;
  343. index += 5;
  344. return true;
  345. }
  346. if (text4 == "[sup]")
  347. {
  348. sub = 2;
  349. index += 5;
  350. return true;
  351. }
  352. }
  353. }
  354. if (index + 6 > length)
  355. {
  356. return false;
  357. }
  358. if (text[index + 5] == ']')
  359. {
  360. string text5 = text.Substring(index, 6);
  361. if (text5 != null)
  362. {
  363. if (text5 == "[/sub]")
  364. {
  365. sub = 0;
  366. index += 6;
  367. return true;
  368. }
  369. if (text5 == "[/sup]")
  370. {
  371. sub = 0;
  372. index += 6;
  373. return true;
  374. }
  375. if (text5 == "[/url]")
  376. {
  377. index += 6;
  378. return true;
  379. }
  380. }
  381. }
  382. if (text[index + 1] == 'u' && text[index + 2] == 'r' && text[index + 3] == 'l' && text[index + 4] == '=')
  383. {
  384. int num2 = text.IndexOf(']', index + 4);
  385. if (num2 != -1)
  386. {
  387. index = num2 + 1;
  388. return true;
  389. }
  390. index = text.Length;
  391. return true;
  392. }
  393. else
  394. {
  395. if (index + 8 > length)
  396. {
  397. return false;
  398. }
  399. if (text[index + 7] == ']')
  400. {
  401. Color color = NGUIText.ParseColor24(text, index + 1);
  402. if (NGUIText.EncodeColor24(color) != text.Substring(index + 1, 6).ToUpper())
  403. {
  404. return false;
  405. }
  406. if (colors != null)
  407. {
  408. color.a = colors[colors.size - 1].a;
  409. if (premultiply && color.a != 1f)
  410. {
  411. color = Color.Lerp(NGUIText.mInvisible, color, color.a);
  412. }
  413. colors.Add(color);
  414. }
  415. index += 8;
  416. return true;
  417. }
  418. else
  419. {
  420. if (index + 10 > length)
  421. {
  422. return false;
  423. }
  424. if (text[index + 9] != ']')
  425. {
  426. return false;
  427. }
  428. Color color2 = NGUIText.ParseColor32(text, index + 1);
  429. if (NGUIText.EncodeColor32(color2) != text.Substring(index + 1, 8).ToUpper())
  430. {
  431. return false;
  432. }
  433. if (colors != null)
  434. {
  435. if (premultiply && color2.a != 1f)
  436. {
  437. color2 = Color.Lerp(NGUIText.mInvisible, color2, color2.a);
  438. }
  439. colors.Add(color2);
  440. }
  441. index += 10;
  442. return true;
  443. }
  444. }
  445. }
  446. public static string StripSymbols(string text)
  447. {
  448. if (text != null)
  449. {
  450. int i = 0;
  451. int length = text.Length;
  452. while (i < length)
  453. {
  454. char c = text[i];
  455. if (c == '[')
  456. {
  457. int num = 0;
  458. bool flag = false;
  459. bool flag2 = false;
  460. bool flag3 = false;
  461. bool flag4 = false;
  462. bool flag5 = false;
  463. int num2 = i;
  464. if (NGUIText.ParseSymbol(text, ref num2, null, false, ref num, ref flag, ref flag2, ref flag3, ref flag4, ref flag5))
  465. {
  466. text = text.Remove(i, num2 - i);
  467. length = text.Length;
  468. continue;
  469. }
  470. }
  471. i++;
  472. }
  473. }
  474. return text;
  475. }
  476. public static void Align(BetterList<Vector3> verts, int indexOffset, float printedWidth)
  477. {
  478. NGUIText.Alignment alignment = NGUIText.alignment;
  479. if (alignment != NGUIText.Alignment.Right)
  480. {
  481. if (alignment != NGUIText.Alignment.Center)
  482. {
  483. if (alignment == NGUIText.Alignment.Justified)
  484. {
  485. if (printedWidth < (float)NGUIText.rectWidth * 0.65f)
  486. {
  487. return;
  488. }
  489. float num = ((float)NGUIText.rectWidth - printedWidth) * 0.5f;
  490. if (num < 1f)
  491. {
  492. return;
  493. }
  494. int num2 = (verts.size - indexOffset) / 4;
  495. if (num2 < 1)
  496. {
  497. return;
  498. }
  499. float num3 = 1f / (float)(num2 - 1);
  500. float num4 = (float)NGUIText.rectWidth / printedWidth;
  501. int i = indexOffset + 4;
  502. int num5 = 1;
  503. while (i < verts.size)
  504. {
  505. float num6 = verts.buffer[i].x;
  506. float num7 = verts.buffer[i + 2].x;
  507. float num8 = num7 - num6;
  508. float num9 = num6 * num4;
  509. float a = num9 + num8;
  510. float num10 = num7 * num4;
  511. float b = num10 - num8;
  512. float t = (float)num5 * num3;
  513. num6 = Mathf.Lerp(num9, b, t);
  514. num7 = Mathf.Lerp(a, num10, t);
  515. num6 = Mathf.Round(num6);
  516. num7 = Mathf.Round(num7);
  517. verts.buffer[i++].x = num6;
  518. verts.buffer[i++].x = num6;
  519. verts.buffer[i++].x = num7;
  520. verts.buffer[i++].x = num7;
  521. num5++;
  522. }
  523. }
  524. }
  525. else
  526. {
  527. float num11 = ((float)NGUIText.rectWidth - printedWidth) * 0.5f;
  528. if (num11 < 0f)
  529. {
  530. return;
  531. }
  532. int num12 = Mathf.RoundToInt((float)NGUIText.rectWidth - printedWidth);
  533. int num13 = Mathf.RoundToInt((float)NGUIText.rectWidth);
  534. bool flag = (num12 & 1) == 1;
  535. bool flag2 = (num13 & 1) == 1;
  536. if ((flag && !flag2) || (!flag && flag2))
  537. {
  538. num11 += 0.5f * NGUIText.fontScale;
  539. }
  540. for (int j = indexOffset; j < verts.size; j++)
  541. {
  542. Vector3[] buffer = verts.buffer;
  543. int num14 = j;
  544. buffer[num14].x = buffer[num14].x + num11;
  545. }
  546. }
  547. }
  548. else
  549. {
  550. float num15 = (float)NGUIText.rectWidth - printedWidth;
  551. if (num15 < 0f)
  552. {
  553. return;
  554. }
  555. for (int k = indexOffset; k < verts.size; k++)
  556. {
  557. Vector3[] buffer2 = verts.buffer;
  558. int num16 = k;
  559. buffer2[num16].x = buffer2[num16].x + num15;
  560. }
  561. }
  562. }
  563. public static int GetExactCharacterIndex(BetterList<Vector3> verts, BetterList<int> indices, Vector2 pos)
  564. {
  565. for (int i = 0; i < indices.size; i++)
  566. {
  567. int num = i << 1;
  568. int i2 = num + 1;
  569. float x = verts[num].x;
  570. if (pos.x >= x)
  571. {
  572. float x2 = verts[i2].x;
  573. if (pos.x <= x2)
  574. {
  575. float y = verts[num].y;
  576. if (pos.y >= y)
  577. {
  578. float y2 = verts[i2].y;
  579. if (pos.y <= y2)
  580. {
  581. return indices[i];
  582. }
  583. }
  584. }
  585. }
  586. }
  587. return 0;
  588. }
  589. public static int GetApproximateCharacterIndex(BetterList<Vector3> verts, BetterList<int> indices, Vector2 pos)
  590. {
  591. float num = float.MaxValue;
  592. float num2 = float.MaxValue;
  593. int i = 0;
  594. for (int j = 0; j < verts.size; j++)
  595. {
  596. float num3 = Mathf.Abs(pos.y - verts[j].y);
  597. if (num3 <= num2)
  598. {
  599. float num4 = Mathf.Abs(pos.x - verts[j].x);
  600. if (num3 < num2)
  601. {
  602. num2 = num3;
  603. num = num4;
  604. i = j;
  605. }
  606. else if (num4 < num)
  607. {
  608. num = num4;
  609. i = j;
  610. }
  611. }
  612. }
  613. return indices[i];
  614. }
  615. [DebuggerHidden]
  616. [DebuggerStepThrough]
  617. private static bool IsSpace(int ch)
  618. {
  619. return ch == 32 || ch == 8202 || ch == 8203 || ch == 8201;
  620. }
  621. [DebuggerHidden]
  622. [DebuggerStepThrough]
  623. public static void EndLine(ref StringBuilder s)
  624. {
  625. int num = s.Length - 1;
  626. if (num > 0 && NGUIText.IsSpace((int)s[num]))
  627. {
  628. s[num] = '\n';
  629. }
  630. else
  631. {
  632. s.Append('\n');
  633. }
  634. }
  635. [DebuggerHidden]
  636. [DebuggerStepThrough]
  637. private static void ReplaceSpaceWithNewline(ref StringBuilder s)
  638. {
  639. int num = s.Length - 1;
  640. if (num > 0 && NGUIText.IsSpace((int)s[num]))
  641. {
  642. s[num] = '\n';
  643. }
  644. }
  645. public static Vector2 CalculatePrintedSize(string text)
  646. {
  647. Vector2 zero = Vector2.zero;
  648. if (!string.IsNullOrEmpty(text))
  649. {
  650. if (NGUIText.encoding)
  651. {
  652. text = NGUIText.StripSymbols(text);
  653. }
  654. NGUIText.Prepare(text);
  655. float num = 0f;
  656. float num2 = 0f;
  657. float num3 = 0f;
  658. int length = text.Length;
  659. int prev = 0;
  660. for (int i = 0; i < length; i++)
  661. {
  662. int num4 = (int)text[i];
  663. if (num4 == 10)
  664. {
  665. if (num > num3)
  666. {
  667. num3 = num;
  668. }
  669. num = 0f;
  670. num2 += NGUIText.finalLineHeight;
  671. }
  672. else if (num4 >= 32)
  673. {
  674. BMSymbol bmsymbol = (!NGUIText.useSymbols) ? null : NGUIText.GetSymbol(text, i, length);
  675. if (bmsymbol == null)
  676. {
  677. float num5 = NGUIText.GetGlyphWidth(num4, prev);
  678. if (num5 != 0f)
  679. {
  680. num5 += NGUIText.finalSpacingX;
  681. if (Mathf.RoundToInt(num + num5) > NGUIText.regionWidth)
  682. {
  683. if (num > num3)
  684. {
  685. num3 = num - NGUIText.finalSpacingX;
  686. }
  687. num = num5;
  688. num2 += NGUIText.finalLineHeight;
  689. }
  690. else
  691. {
  692. num += num5;
  693. }
  694. prev = num4;
  695. }
  696. }
  697. else
  698. {
  699. float num6 = NGUIText.finalSpacingX + (float)bmsymbol.advance * NGUIText.fontScale;
  700. if (Mathf.RoundToInt(num + num6) > NGUIText.regionWidth)
  701. {
  702. if (num > num3)
  703. {
  704. num3 = num - NGUIText.finalSpacingX;
  705. }
  706. num = num6;
  707. num2 += NGUIText.finalLineHeight;
  708. }
  709. else
  710. {
  711. num += num6;
  712. }
  713. i += bmsymbol.sequence.Length - 1;
  714. prev = 0;
  715. }
  716. }
  717. }
  718. zero.x = ((num <= num3) ? num3 : (num - NGUIText.finalSpacingX));
  719. zero.y = num2 + NGUIText.finalLineHeight;
  720. }
  721. return zero;
  722. }
  723. public static int CalculateOffsetToFit(string text)
  724. {
  725. if (string.IsNullOrEmpty(text) || NGUIText.regionWidth < 1)
  726. {
  727. return 0;
  728. }
  729. NGUIText.Prepare(text);
  730. int length = text.Length;
  731. int prev = 0;
  732. int i = 0;
  733. int length2 = text.Length;
  734. while (i < length2)
  735. {
  736. BMSymbol bmsymbol = (!NGUIText.useSymbols) ? null : NGUIText.GetSymbol(text, i, length);
  737. if (bmsymbol == null)
  738. {
  739. int num = (int)text[i];
  740. float glyphWidth = NGUIText.GetGlyphWidth(num, prev);
  741. if (glyphWidth != 0f)
  742. {
  743. NGUIText.mSizes.Add(NGUIText.finalSpacingX + glyphWidth);
  744. }
  745. prev = num;
  746. }
  747. else
  748. {
  749. NGUIText.mSizes.Add(NGUIText.finalSpacingX + (float)bmsymbol.advance * NGUIText.fontScale);
  750. int j = 0;
  751. int num2 = bmsymbol.sequence.Length - 1;
  752. while (j < num2)
  753. {
  754. NGUIText.mSizes.Add(0f);
  755. j++;
  756. }
  757. i += bmsymbol.sequence.Length - 1;
  758. prev = 0;
  759. }
  760. i++;
  761. }
  762. float num3 = (float)NGUIText.regionWidth;
  763. int num4 = NGUIText.mSizes.size;
  764. while (num4 > 0 && num3 > 0f)
  765. {
  766. num3 -= NGUIText.mSizes[--num4];
  767. }
  768. NGUIText.mSizes.Clear();
  769. if (num3 < 0f)
  770. {
  771. num4++;
  772. }
  773. return num4;
  774. }
  775. public static string GetEndOfLineThatFits(string text)
  776. {
  777. int length = text.Length;
  778. int num = NGUIText.CalculateOffsetToFit(text);
  779. return text.Substring(num, length - num);
  780. }
  781. public static bool WrapText(string text, out string finalText)
  782. {
  783. return NGUIText.WrapText(text, out finalText, false);
  784. }
  785. public static bool WrapText(string text, out string finalText, bool keepCharCount)
  786. {
  787. if (NGUIText.regionWidth < 1 || NGUIText.regionHeight < 1 || NGUIText.finalLineHeight < 1f)
  788. {
  789. finalText = string.Empty;
  790. return false;
  791. }
  792. float num = (NGUIText.maxLines <= 0) ? ((float)NGUIText.regionHeight) : Mathf.Min((float)NGUIText.regionHeight, NGUIText.finalLineHeight * (float)NGUIText.maxLines);
  793. int num2 = (NGUIText.maxLines <= 0) ? 1000000 : NGUIText.maxLines;
  794. num2 = Mathf.FloorToInt(Mathf.Min((float)num2, num / NGUIText.finalLineHeight) + 0.01f);
  795. if (num2 == 0)
  796. {
  797. finalText = string.Empty;
  798. return false;
  799. }
  800. if (string.IsNullOrEmpty(text))
  801. {
  802. text = " ";
  803. }
  804. NGUIText.Prepare(text);
  805. StringBuilder stringBuilder = new StringBuilder();
  806. int length = text.Length;
  807. float num3 = (float)NGUIText.regionWidth;
  808. int num4 = 0;
  809. int i = 0;
  810. int num5 = 1;
  811. int prev = 0;
  812. bool flag = true;
  813. bool flag2 = true;
  814. bool flag3 = false;
  815. while (i < length)
  816. {
  817. char c = text[i];
  818. if (c > '⿿')
  819. {
  820. flag3 = true;
  821. }
  822. if (c == '\n')
  823. {
  824. if (num5 == num2)
  825. {
  826. break;
  827. }
  828. num3 = (float)NGUIText.regionWidth;
  829. if (num4 < i)
  830. {
  831. stringBuilder.Append(text.Substring(num4, i - num4 + 1));
  832. }
  833. else
  834. {
  835. stringBuilder.Append(c);
  836. }
  837. flag = true;
  838. num5++;
  839. num4 = i + 1;
  840. prev = 0;
  841. }
  842. else if (NGUIText.encoding && NGUIText.ParseSymbol(text, ref i))
  843. {
  844. i--;
  845. }
  846. else
  847. {
  848. BMSymbol bmsymbol = (!NGUIText.useSymbols) ? null : NGUIText.GetSymbol(text, i, length);
  849. float num6;
  850. if (bmsymbol == null)
  851. {
  852. float glyphWidth = NGUIText.GetGlyphWidth((int)c, prev);
  853. if (glyphWidth == 0f)
  854. {
  855. goto IL_38A;
  856. }
  857. num6 = NGUIText.finalSpacingX + glyphWidth;
  858. }
  859. else
  860. {
  861. num6 = NGUIText.finalSpacingX + (float)bmsymbol.advance * NGUIText.fontScale;
  862. }
  863. num3 -= num6;
  864. if (NGUIText.IsSpace((int)c) && !flag3 && num4 < i)
  865. {
  866. int num7 = i - num4 + 1;
  867. if (num5 == num2 && num3 <= 0f && i < length)
  868. {
  869. char c2 = text[i];
  870. if (c2 < ' ' || NGUIText.IsSpace((int)c2))
  871. {
  872. num7--;
  873. }
  874. }
  875. stringBuilder.Append(text.Substring(num4, num7));
  876. flag = false;
  877. num4 = i + 1;
  878. }
  879. if (Mathf.RoundToInt(num3) < 0)
  880. {
  881. if (flag || num5 == num2)
  882. {
  883. stringBuilder.Append(text.Substring(num4, Mathf.Max(0, i - num4)));
  884. bool flag4 = NGUIText.IsSpace((int)c);
  885. if (!flag4 && !flag3)
  886. {
  887. flag2 = false;
  888. }
  889. if (num5++ == num2)
  890. {
  891. num4 = i;
  892. break;
  893. }
  894. if (keepCharCount)
  895. {
  896. NGUIText.ReplaceSpaceWithNewline(ref stringBuilder);
  897. }
  898. else
  899. {
  900. NGUIText.EndLine(ref stringBuilder);
  901. }
  902. flag = true;
  903. if (flag4)
  904. {
  905. num4 = i + 1;
  906. num3 = (float)NGUIText.regionWidth;
  907. }
  908. else
  909. {
  910. num4 = i;
  911. num3 = (float)NGUIText.regionWidth - num6;
  912. }
  913. prev = 0;
  914. }
  915. else
  916. {
  917. flag = true;
  918. num3 = (float)NGUIText.regionWidth;
  919. i = num4 - 1;
  920. prev = 0;
  921. if (num5++ == num2)
  922. {
  923. break;
  924. }
  925. if (keepCharCount)
  926. {
  927. NGUIText.ReplaceSpaceWithNewline(ref stringBuilder);
  928. }
  929. else
  930. {
  931. NGUIText.EndLine(ref stringBuilder);
  932. }
  933. goto IL_38A;
  934. }
  935. }
  936. else
  937. {
  938. prev = (int)c;
  939. }
  940. if (bmsymbol != null)
  941. {
  942. i += bmsymbol.length - 1;
  943. prev = 0;
  944. }
  945. }
  946. IL_38A:
  947. i++;
  948. }
  949. if (num4 < i)
  950. {
  951. stringBuilder.Append(text.Substring(num4, i - num4));
  952. }
  953. finalText = stringBuilder.ToString();
  954. return flag2 && (i == length || num5 <= Mathf.Min(NGUIText.maxLines, num2));
  955. }
  956. public static void Print(string text, BetterList<Vector3> verts, BetterList<Vector2> uvs, BetterList<Color32> cols)
  957. {
  958. if (string.IsNullOrEmpty(text))
  959. {
  960. return;
  961. }
  962. int size = verts.size;
  963. NGUIText.Prepare(text);
  964. NGUIText.mColors.Add(Color.white);
  965. NGUIText.mAlpha = 1f;
  966. int prev = 0;
  967. float num = 0f;
  968. float num2 = 0f;
  969. float num3 = 0f;
  970. float num4 = (float)NGUIText.finalSize;
  971. Color a = NGUIText.tint * NGUIText.gradientBottom;
  972. Color b = NGUIText.tint * NGUIText.gradientTop;
  973. Color32 color = NGUIText.tint;
  974. int length = text.Length;
  975. Rect rect = default(Rect);
  976. float num5 = 0f;
  977. float num6 = 0f;
  978. float num7 = num4 * NGUIText.pixelDensity;
  979. bool flag = false;
  980. int num8 = 0;
  981. bool flag2 = false;
  982. bool flag3 = false;
  983. bool flag4 = false;
  984. bool flag5 = false;
  985. bool flag6 = false;
  986. if (NGUIText.bitmapFont != null)
  987. {
  988. rect = NGUIText.bitmapFont.uvRect;
  989. num5 = rect.width / (float)NGUIText.bitmapFont.texWidth;
  990. num6 = rect.height / (float)NGUIText.bitmapFont.texHeight;
  991. }
  992. for (int i = 0; i < length; i++)
  993. {
  994. int num9 = (int)text[i];
  995. float num10 = num;
  996. if (num9 == 10)
  997. {
  998. if (num > num3)
  999. {
  1000. num3 = num;
  1001. }
  1002. if (NGUIText.alignment != NGUIText.Alignment.Left)
  1003. {
  1004. NGUIText.Align(verts, size, num - NGUIText.finalSpacingX);
  1005. size = verts.size;
  1006. }
  1007. num = 0f;
  1008. num2 += NGUIText.finalLineHeight;
  1009. prev = 0;
  1010. }
  1011. else if (num9 < 32)
  1012. {
  1013. prev = num9;
  1014. }
  1015. else if (NGUIText.encoding && NGUIText.ParseSymbol(text, ref i, NGUIText.mColors, NGUIText.premultiply, ref num8, ref flag2, ref flag3, ref flag4, ref flag5, ref flag6))
  1016. {
  1017. Color color2;
  1018. if (flag6)
  1019. {
  1020. color2 = NGUIText.mColors[NGUIText.mColors.size - 1];
  1021. color2.a *= NGUIText.mAlpha * NGUIText.tint.a;
  1022. }
  1023. else
  1024. {
  1025. color2 = NGUIText.tint * NGUIText.mColors[NGUIText.mColors.size - 1];
  1026. color2.a *= NGUIText.mAlpha;
  1027. }
  1028. color = color2;
  1029. int j = 0;
  1030. int num11 = NGUIText.mColors.size - 2;
  1031. while (j < num11)
  1032. {
  1033. color2.a *= NGUIText.mColors[j].a;
  1034. j++;
  1035. }
  1036. if (NGUIText.gradient)
  1037. {
  1038. a = NGUIText.gradientBottom * color2;
  1039. b = NGUIText.gradientTop * color2;
  1040. }
  1041. i--;
  1042. }
  1043. else
  1044. {
  1045. BMSymbol bmsymbol = (!NGUIText.useSymbols) ? null : NGUIText.GetSymbol(text, i, length);
  1046. if (bmsymbol != null)
  1047. {
  1048. float num12 = num + (float)bmsymbol.offsetX * NGUIText.fontScale;
  1049. float num13 = num12 + (float)bmsymbol.width * NGUIText.fontScale;
  1050. float num14 = -(num2 + (float)bmsymbol.offsetY * NGUIText.fontScale);
  1051. float num15 = num14 - (float)bmsymbol.height * NGUIText.fontScale;
  1052. if (Mathf.RoundToInt(num + (float)bmsymbol.advance * NGUIText.fontScale) > NGUIText.regionWidth)
  1053. {
  1054. if (num == 0f)
  1055. {
  1056. return;
  1057. }
  1058. if (NGUIText.alignment != NGUIText.Alignment.Left && size < verts.size)
  1059. {
  1060. NGUIText.Align(verts, size, num - NGUIText.finalSpacingX);
  1061. size = verts.size;
  1062. }
  1063. num12 -= num;
  1064. num13 -= num;
  1065. num15 -= NGUIText.finalLineHeight;
  1066. num14 -= NGUIText.finalLineHeight;
  1067. num = 0f;
  1068. num2 += NGUIText.finalLineHeight;
  1069. }
  1070. verts.Add(new Vector3(num12, num15));
  1071. verts.Add(new Vector3(num12, num14));
  1072. verts.Add(new Vector3(num13, num14));
  1073. verts.Add(new Vector3(num13, num15));
  1074. num += NGUIText.finalSpacingX + (float)bmsymbol.advance * NGUIText.fontScale;
  1075. i += bmsymbol.length - 1;
  1076. prev = 0;
  1077. if (uvs != null)
  1078. {
  1079. Rect uvRect = bmsymbol.uvRect;
  1080. float xMin = uvRect.xMin;
  1081. float yMin = uvRect.yMin;
  1082. float xMax = uvRect.xMax;
  1083. float yMax = uvRect.yMax;
  1084. uvs.Add(new Vector2(xMin, yMin));
  1085. uvs.Add(new Vector2(xMin, yMax));
  1086. uvs.Add(new Vector2(xMax, yMax));
  1087. uvs.Add(new Vector2(xMax, yMin));
  1088. }
  1089. if (cols != null)
  1090. {
  1091. if (NGUIText.symbolStyle == NGUIText.SymbolStyle.Colored)
  1092. {
  1093. for (int k = 0; k < 4; k++)
  1094. {
  1095. cols.Add(color);
  1096. }
  1097. }
  1098. else
  1099. {
  1100. Color32 item = Color.white;
  1101. item.a = color.a;
  1102. for (int l = 0; l < 4; l++)
  1103. {
  1104. cols.Add(item);
  1105. }
  1106. }
  1107. }
  1108. }
  1109. else
  1110. {
  1111. NGUIText.GlyphInfo glyphInfo = NGUIText.GetGlyph(num9, prev);
  1112. if (glyphInfo != null)
  1113. {
  1114. prev = num9;
  1115. if (num8 != 0)
  1116. {
  1117. NGUIText.GlyphInfo glyphInfo2 = glyphInfo;
  1118. glyphInfo2.v0.x = glyphInfo2.v0.x * 0.75f;
  1119. NGUIText.GlyphInfo glyphInfo3 = glyphInfo;
  1120. glyphInfo3.v0.y = glyphInfo3.v0.y * 0.75f;
  1121. NGUIText.GlyphInfo glyphInfo4 = glyphInfo;
  1122. glyphInfo4.v1.x = glyphInfo4.v1.x * 0.75f;
  1123. NGUIText.GlyphInfo glyphInfo5 = glyphInfo;
  1124. glyphInfo5.v1.y = glyphInfo5.v1.y * 0.75f;
  1125. if (num8 == 1)
  1126. {
  1127. NGUIText.GlyphInfo glyphInfo6 = glyphInfo;
  1128. glyphInfo6.v0.y = glyphInfo6.v0.y - NGUIText.fontScale * (float)NGUIText.fontSize * 0.4f;
  1129. NGUIText.GlyphInfo glyphInfo7 = glyphInfo;
  1130. glyphInfo7.v1.y = glyphInfo7.v1.y - NGUIText.fontScale * (float)NGUIText.fontSize * 0.4f;
  1131. }
  1132. else
  1133. {
  1134. NGUIText.GlyphInfo glyphInfo8 = glyphInfo;
  1135. glyphInfo8.v0.y = glyphInfo8.v0.y + NGUIText.fontScale * (float)NGUIText.fontSize * 0.05f;
  1136. NGUIText.GlyphInfo glyphInfo9 = glyphInfo;
  1137. glyphInfo9.v1.y = glyphInfo9.v1.y + NGUIText.fontScale * (float)NGUIText.fontSize * 0.05f;
  1138. }
  1139. }
  1140. float num12 = glyphInfo.v0.x + num;
  1141. float num15 = glyphInfo.v0.y - num2;
  1142. float num13 = glyphInfo.v1.x + num;
  1143. float num14 = glyphInfo.v1.y - num2;
  1144. float num16 = glyphInfo.advance;
  1145. if (NGUIText.finalSpacingX < 0f)
  1146. {
  1147. num16 += NGUIText.finalSpacingX;
  1148. }
  1149. if (Mathf.RoundToInt(num + num16) > NGUIText.regionWidth)
  1150. {
  1151. if (num == 0f)
  1152. {
  1153. return;
  1154. }
  1155. if (NGUIText.alignment != NGUIText.Alignment.Left && size < verts.size)
  1156. {
  1157. NGUIText.Align(verts, size, num - NGUIText.finalSpacingX);
  1158. size = verts.size;
  1159. }
  1160. num12 -= num;
  1161. num13 -= num;
  1162. num15 -= NGUIText.finalLineHeight;
  1163. num14 -= NGUIText.finalLineHeight;
  1164. num = 0f;
  1165. num2 += NGUIText.finalLineHeight;
  1166. num10 = 0f;
  1167. }
  1168. if (NGUIText.IsSpace(num9))
  1169. {
  1170. if (flag4)
  1171. {
  1172. num9 = 95;
  1173. }
  1174. else if (flag5)
  1175. {
  1176. num9 = 45;
  1177. }
  1178. }
  1179. num += ((num8 != 0) ? ((NGUIText.finalSpacingX + glyphInfo.advance) * 0.75f) : (NGUIText.finalSpacingX + glyphInfo.advance));
  1180. if (!NGUIText.IsSpace(num9))
  1181. {
  1182. if (uvs != null)
  1183. {
  1184. if (NGUIText.bitmapFont != null)
  1185. {
  1186. glyphInfo.u0.x = rect.xMin + num5 * glyphInfo.u0.x;
  1187. glyphInfo.u2.x = rect.xMin + num5 * glyphInfo.u2.x;
  1188. glyphInfo.u0.y = rect.yMax - num6 * glyphInfo.u0.y;
  1189. glyphInfo.u2.y = rect.yMax - num6 * glyphInfo.u2.y;
  1190. glyphInfo.u1.x = glyphInfo.u0.x;
  1191. glyphInfo.u1.y = glyphInfo.u2.y;
  1192. glyphInfo.u3.x = glyphInfo.u2.x;
  1193. glyphInfo.u3.y = glyphInfo.u0.y;
  1194. }
  1195. int m = 0;
  1196. int num17 = (!flag2) ? 1 : 4;
  1197. while (m < num17)
  1198. {
  1199. uvs.Add(glyphInfo.u0);
  1200. uvs.Add(glyphInfo.u1);
  1201. uvs.Add(glyphInfo.u2);
  1202. uvs.Add(glyphInfo.u3);
  1203. m++;
  1204. }
  1205. }
  1206. if (cols != null)
  1207. {
  1208. if (glyphInfo.channel == 0 || glyphInfo.channel == 15)
  1209. {
  1210. if (NGUIText.gradient)
  1211. {
  1212. float num18 = num7 + glyphInfo.v0.y / NGUIText.fontScale;
  1213. float num19 = num7 + glyphInfo.v1.y / NGUIText.fontScale;
  1214. num18 /= num7;
  1215. num19 /= num7;
  1216. NGUIText.s_c0 = Color.Lerp(a, b, num18);
  1217. NGUIText.s_c1 = Color.Lerp(a, b, num19);
  1218. int n = 0;
  1219. int num20 = (!flag2) ? 1 : 4;
  1220. while (n < num20)
  1221. {
  1222. cols.Add(NGUIText.s_c0);
  1223. cols.Add(NGUIText.s_c1);
  1224. cols.Add(NGUIText.s_c1);
  1225. cols.Add(NGUIText.s_c0);
  1226. n++;
  1227. }
  1228. }
  1229. else
  1230. {
  1231. int num21 = 0;
  1232. int num22 = (!flag2) ? 4 : 16;
  1233. while (num21 < num22)
  1234. {
  1235. cols.Add(color);
  1236. num21++;
  1237. }
  1238. }
  1239. }
  1240. else
  1241. {
  1242. Color color3 = color;
  1243. color3 *= 0.49f;
  1244. switch (glyphInfo.channel)
  1245. {
  1246. case 1:
  1247. color3.b += 0.51f;
  1248. break;
  1249. case 2:
  1250. color3.g += 0.51f;
  1251. break;
  1252. case 4:
  1253. color3.r += 0.51f;
  1254. break;
  1255. case 8:
  1256. color3.a += 0.51f;
  1257. break;
  1258. }
  1259. Color32 item2 = color3;
  1260. int num23 = 0;
  1261. int num24 = (!flag2) ? 4 : 16;
  1262. while (num23 < num24)
  1263. {
  1264. cols.Add(item2);
  1265. num23++;
  1266. }
  1267. }
  1268. }
  1269. if (!flag2)
  1270. {
  1271. if (!flag3)
  1272. {
  1273. verts.Add(new Vector3(num12, num15));
  1274. verts.Add(new Vector3(num12, num14));
  1275. verts.Add(new Vector3(num13, num14));
  1276. verts.Add(new Vector3(num13, num15));
  1277. }
  1278. else
  1279. {
  1280. float num25 = (float)NGUIText.fontSize * 0.1f * ((num14 - num15) / (float)NGUIText.fontSize);
  1281. verts.Add(new Vector3(num12 - num25, num15));
  1282. verts.Add(new Vector3(num12 + num25, num14));
  1283. verts.Add(new Vector3(num13 + num25, num14));
  1284. verts.Add(new Vector3(num13 - num25, num15));
  1285. }
  1286. }
  1287. else
  1288. {
  1289. for (int num26 = 0; num26 < 4; num26++)
  1290. {
  1291. float num27 = NGUIText.mBoldOffset[num26 * 2];
  1292. float num28 = NGUIText.mBoldOffset[num26 * 2 + 1];
  1293. float num29 = (!flag3) ? 0f : ((float)NGUIText.fontSize * 0.1f * ((num14 - num15) / (float)NGUIText.fontSize));
  1294. verts.Add(new Vector3(num12 + num27 - num29, num15 + num28));
  1295. verts.Add(new Vector3(num12 + num27 + num29, num14 + num28));
  1296. verts.Add(new Vector3(num13 + num27 + num29, num14 + num28));
  1297. verts.Add(new Vector3(num13 + num27 - num29, num15 + num28));
  1298. }
  1299. }
  1300. if (flag4 || flag5)
  1301. {
  1302. NGUIText.GlyphInfo glyphInfo10 = NGUIText.GetGlyph((!flag5) ? 95 : 45, prev);
  1303. if (glyphInfo10 != null)
  1304. {
  1305. if (uvs != null)
  1306. {
  1307. if (NGUIText.bitmapFont != null)
  1308. {
  1309. glyphInfo10.u0.x = rect.xMin + num5 * glyphInfo10.u0.x;
  1310. glyphInfo10.u2.x = rect.xMin + num5 * glyphInfo10.u2.x;
  1311. glyphInfo10.u0.y = rect.yMax - num6 * glyphInfo10.u0.y;
  1312. glyphInfo10.u2.y = rect.yMax - num6 * glyphInfo10.u2.y;
  1313. }
  1314. float x = (glyphInfo10.u0.x + glyphInfo10.u2.x) * 0.5f;
  1315. int num30 = 0;
  1316. int num31 = (!flag2) ? 1 : 4;
  1317. while (num30 < num31)
  1318. {
  1319. uvs.Add(new Vector2(x, glyphInfo10.u0.y));
  1320. uvs.Add(new Vector2(x, glyphInfo10.u2.y));
  1321. uvs.Add(new Vector2(x, glyphInfo10.u2.y));
  1322. uvs.Add(new Vector2(x, glyphInfo10.u0.y));
  1323. num30++;
  1324. }
  1325. }
  1326. if (flag && flag5)
  1327. {
  1328. num15 = (-num2 + glyphInfo10.v0.y) * 0.75f;
  1329. num14 = (-num2 + glyphInfo10.v1.y) * 0.75f;
  1330. }
  1331. else
  1332. {
  1333. num15 = -num2 + glyphInfo10.v0.y;
  1334. num14 = -num2 + glyphInfo10.v1.y;
  1335. }
  1336. if (flag2)
  1337. {
  1338. for (int num32 = 0; num32 < 4; num32++)
  1339. {
  1340. float num33 = NGUIText.mBoldOffset[num32 * 2];
  1341. float num34 = NGUIText.mBoldOffset[num32 * 2 + 1];
  1342. verts.Add(new Vector3(num10 + num33, num15 + num34));
  1343. verts.Add(new Vector3(num10 + num33, num14 + num34));
  1344. verts.Add(new Vector3(num + num33, num14 + num34));
  1345. verts.Add(new Vector3(num + num33, num15 + num34));
  1346. }
  1347. }
  1348. else
  1349. {
  1350. verts.Add(new Vector3(num10, num15));
  1351. verts.Add(new Vector3(num10, num14));
  1352. verts.Add(new Vector3(num, num14));
  1353. verts.Add(new Vector3(num, num15));
  1354. }
  1355. if (NGUIText.gradient)
  1356. {
  1357. float num35 = num7 + glyphInfo10.v0.y / NGUIText.fontScale;
  1358. float num36 = num7 + glyphInfo10.v1.y / NGUIText.fontScale;
  1359. num35 /= num7;
  1360. num36 /= num7;
  1361. NGUIText.s_c0 = Color.Lerp(a, b, num35);
  1362. NGUIText.s_c1 = Color.Lerp(a, b, num36);
  1363. int num37 = 0;
  1364. int num38 = (!flag2) ? 1 : 4;
  1365. while (num37 < num38)
  1366. {
  1367. cols.Add(NGUIText.s_c0);
  1368. cols.Add(NGUIText.s_c1);
  1369. cols.Add(NGUIText.s_c1);
  1370. cols.Add(NGUIText.s_c0);
  1371. num37++;
  1372. }
  1373. }
  1374. else
  1375. {
  1376. int num39 = 0;
  1377. int num40 = (!flag2) ? 4 : 16;
  1378. while (num39 < num40)
  1379. {
  1380. cols.Add(color);
  1381. num39++;
  1382. }
  1383. }
  1384. }
  1385. }
  1386. }
  1387. }
  1388. }
  1389. }
  1390. }
  1391. if (NGUIText.alignment != NGUIText.Alignment.Left && size < verts.size)
  1392. {
  1393. NGUIText.Align(verts, size, num - NGUIText.finalSpacingX);
  1394. size = verts.size;
  1395. }
  1396. NGUIText.mColors.Clear();
  1397. }
  1398. public static void PrintApproximateCharacterPositions(string text, BetterList<Vector3> verts, BetterList<int> indices)
  1399. {
  1400. if (string.IsNullOrEmpty(text))
  1401. {
  1402. text = " ";
  1403. }
  1404. NGUIText.Prepare(text);
  1405. float num = 0f;
  1406. float num2 = 0f;
  1407. float num3 = 0f;
  1408. float num4 = (float)NGUIText.fontSize * NGUIText.fontScale * 0.5f;
  1409. int length = text.Length;
  1410. int size = verts.size;
  1411. int prev = 0;
  1412. for (int i = 0; i < length; i++)
  1413. {
  1414. int num5 = (int)text[i];
  1415. verts.Add(new Vector3(num, -num2 - num4));
  1416. indices.Add(i);
  1417. if (num5 == 10)
  1418. {
  1419. if (num > num3)
  1420. {
  1421. num3 = num;
  1422. }
  1423. if (NGUIText.alignment != NGUIText.Alignment.Left)
  1424. {
  1425. NGUIText.Align(verts, size, num - NGUIText.finalSpacingX);
  1426. size = verts.size;
  1427. }
  1428. num = 0f;
  1429. num2 += NGUIText.finalLineHeight;
  1430. prev = 0;
  1431. }
  1432. else if (num5 < 32)
  1433. {
  1434. prev = 0;
  1435. }
  1436. else if (NGUIText.encoding && NGUIText.ParseSymbol(text, ref i))
  1437. {
  1438. i--;
  1439. }
  1440. else
  1441. {
  1442. BMSymbol bmsymbol = (!NGUIText.useSymbols) ? null : NGUIText.GetSymbol(text, i, length);
  1443. if (bmsymbol == null)
  1444. {
  1445. float num6 = NGUIText.GetGlyphWidth(num5, prev);
  1446. if (num6 != 0f)
  1447. {
  1448. num6 += NGUIText.finalSpacingX;
  1449. if (Mathf.RoundToInt(num + num6) > NGUIText.regionWidth)
  1450. {
  1451. if (num == 0f)
  1452. {
  1453. return;
  1454. }
  1455. if (NGUIText.alignment != NGUIText.Alignment.Left && size < verts.size)
  1456. {
  1457. NGUIText.Align(verts, size, num - NGUIText.finalSpacingX);
  1458. size = verts.size;
  1459. }
  1460. num = num6;
  1461. num2 += NGUIText.finalLineHeight;
  1462. }
  1463. else
  1464. {
  1465. num += num6;
  1466. }
  1467. verts.Add(new Vector3(num, -num2 - num4));
  1468. indices.Add(i + 1);
  1469. prev = num5;
  1470. }
  1471. }
  1472. else
  1473. {
  1474. float num7 = (float)bmsymbol.advance * NGUIText.fontScale + NGUIText.finalSpacingX;
  1475. if (Mathf.RoundToInt(num + num7) > NGUIText.regionWidth)
  1476. {
  1477. if (num == 0f)
  1478. {
  1479. return;
  1480. }
  1481. if (NGUIText.alignment != NGUIText.Alignment.Left && size < verts.size)
  1482. {
  1483. NGUIText.Align(verts, size, num - NGUIText.finalSpacingX);
  1484. size = verts.size;
  1485. }
  1486. num = num7;
  1487. num2 += NGUIText.finalLineHeight;
  1488. }
  1489. else
  1490. {
  1491. num += num7;
  1492. }
  1493. verts.Add(new Vector3(num, -num2 - num4));
  1494. indices.Add(i + 1);
  1495. i += bmsymbol.sequence.Length - 1;
  1496. prev = 0;
  1497. }
  1498. }
  1499. }
  1500. if (NGUIText.alignment != NGUIText.Alignment.Left && size < verts.size)
  1501. {
  1502. NGUIText.Align(verts, size, num - NGUIText.finalSpacingX);
  1503. }
  1504. }
  1505. public static void PrintExactCharacterPositions(string text, BetterList<Vector3> verts, BetterList<int> indices)
  1506. {
  1507. if (string.IsNullOrEmpty(text))
  1508. {
  1509. text = " ";
  1510. }
  1511. NGUIText.Prepare(text);
  1512. float num = (float)NGUIText.fontSize * NGUIText.fontScale;
  1513. float num2 = 0f;
  1514. float num3 = 0f;
  1515. float num4 = 0f;
  1516. int length = text.Length;
  1517. int size = verts.size;
  1518. int prev = 0;
  1519. for (int i = 0; i < length; i++)
  1520. {
  1521. int num5 = (int)text[i];
  1522. if (num5 == 10)
  1523. {
  1524. if (num2 > num4)
  1525. {
  1526. num4 = num2;
  1527. }
  1528. if (NGUIText.alignment != NGUIText.Alignment.Left)
  1529. {
  1530. NGUIText.Align(verts, size, num2 - NGUIText.finalSpacingX);
  1531. size = verts.size;
  1532. }
  1533. num2 = 0f;
  1534. num3 += NGUIText.finalLineHeight;
  1535. prev = 0;
  1536. }
  1537. else if (num5 < 32)
  1538. {
  1539. prev = 0;
  1540. }
  1541. else if (NGUIText.encoding && NGUIText.ParseSymbol(text, ref i))
  1542. {
  1543. i--;
  1544. }
  1545. else
  1546. {
  1547. BMSymbol bmsymbol = (!NGUIText.useSymbols) ? null : NGUIText.GetSymbol(text, i, length);
  1548. if (bmsymbol == null)
  1549. {
  1550. float glyphWidth = NGUIText.GetGlyphWidth(num5, prev);
  1551. if (glyphWidth != 0f)
  1552. {
  1553. float num6 = glyphWidth + NGUIText.finalSpacingX;
  1554. if (Mathf.RoundToInt(num2 + num6) > NGUIText.regionWidth)
  1555. {
  1556. if (num2 == 0f)
  1557. {
  1558. return;
  1559. }
  1560. if (NGUIText.alignment != NGUIText.Alignment.Left && size < verts.size)
  1561. {
  1562. NGUIText.Align(verts, size, num2 - NGUIText.finalSpacingX);
  1563. size = verts.size;
  1564. }
  1565. num2 = 0f;
  1566. num3 += NGUIText.finalLineHeight;
  1567. prev = 0;
  1568. i--;
  1569. }
  1570. else
  1571. {
  1572. indices.Add(i);
  1573. verts.Add(new Vector3(num2, -num3 - num));
  1574. verts.Add(new Vector3(num2 + num6, -num3));
  1575. prev = num5;
  1576. num2 += num6;
  1577. }
  1578. }
  1579. }
  1580. else
  1581. {
  1582. float num7 = (float)bmsymbol.advance * NGUIText.fontScale + NGUIText.finalSpacingX;
  1583. if (Mathf.RoundToInt(num2 + num7) > NGUIText.regionWidth)
  1584. {
  1585. if (num2 == 0f)
  1586. {
  1587. return;
  1588. }
  1589. if (NGUIText.alignment != NGUIText.Alignment.Left && size < verts.size)
  1590. {
  1591. NGUIText.Align(verts, size, num2 - NGUIText.finalSpacingX);
  1592. size = verts.size;
  1593. }
  1594. num2 = 0f;
  1595. num3 += NGUIText.finalLineHeight;
  1596. prev = 0;
  1597. i--;
  1598. }
  1599. else
  1600. {
  1601. indices.Add(i);
  1602. verts.Add(new Vector3(num2, -num3 - num));
  1603. verts.Add(new Vector3(num2 + num7, -num3));
  1604. i += bmsymbol.sequence.Length - 1;
  1605. num2 += num7;
  1606. prev = 0;
  1607. }
  1608. }
  1609. }
  1610. }
  1611. if (NGUIText.alignment != NGUIText.Alignment.Left && size < verts.size)
  1612. {
  1613. NGUIText.Align(verts, size, num2 - NGUIText.finalSpacingX);
  1614. }
  1615. }
  1616. public static void PrintCaretAndSelection(string text, int start, int end, BetterList<Vector3> caret, BetterList<Vector3> highlight)
  1617. {
  1618. if (string.IsNullOrEmpty(text))
  1619. {
  1620. text = " ";
  1621. }
  1622. NGUIText.Prepare(text);
  1623. int num = end;
  1624. if (start > end)
  1625. {
  1626. end = start;
  1627. start = num;
  1628. }
  1629. float num2 = 0f;
  1630. float num3 = 0f;
  1631. float num4 = 0f;
  1632. float num5 = (float)NGUIText.fontSize * NGUIText.fontScale;
  1633. int indexOffset = (caret == null) ? 0 : caret.size;
  1634. int num6 = (highlight == null) ? 0 : highlight.size;
  1635. int length = text.Length;
  1636. int i = 0;
  1637. int prev = 0;
  1638. bool flag = false;
  1639. bool flag2 = false;
  1640. Vector2 zero = Vector2.zero;
  1641. Vector2 zero2 = Vector2.zero;
  1642. while (i < length)
  1643. {
  1644. if (caret != null && !flag2 && num <= i)
  1645. {
  1646. flag2 = true;
  1647. caret.Add(new Vector3(num2 - 1f, -num3 - num5));
  1648. caret.Add(new Vector3(num2 - 1f, -num3));
  1649. caret.Add(new Vector3(num2 + 1f, -num3));
  1650. caret.Add(new Vector3(num2 + 1f, -num3 - num5));
  1651. }
  1652. int num7 = (int)text[i];
  1653. if (num7 == 10)
  1654. {
  1655. if (num2 > num4)
  1656. {
  1657. num4 = num2;
  1658. }
  1659. if (caret != null && flag2)
  1660. {
  1661. if (NGUIText.alignment != NGUIText.Alignment.Left)
  1662. {
  1663. NGUIText.Align(caret, indexOffset, num2 - NGUIText.finalSpacingX);
  1664. }
  1665. caret = null;
  1666. }
  1667. if (highlight != null)
  1668. {
  1669. if (flag)
  1670. {
  1671. flag = false;
  1672. highlight.Add(zero2);
  1673. highlight.Add(zero);
  1674. }
  1675. else if (start <= i && end > i)
  1676. {
  1677. highlight.Add(new Vector3(num2, -num3 - num5));
  1678. highlight.Add(new Vector3(num2, -num3));
  1679. highlight.Add(new Vector3(num2 + 2f, -num3));
  1680. highlight.Add(new Vector3(num2 + 2f, -num3 - num5));
  1681. }
  1682. if (NGUIText.alignment != NGUIText.Alignment.Left && num6 < highlight.size)
  1683. {
  1684. NGUIText.Align(highlight, num6, num2 - NGUIText.finalSpacingX);
  1685. num6 = highlight.size;
  1686. }
  1687. }
  1688. num2 = 0f;
  1689. num3 += NGUIText.finalLineHeight;
  1690. prev = 0;
  1691. }
  1692. else if (num7 < 32)
  1693. {
  1694. prev = 0;
  1695. }
  1696. else if (NGUIText.encoding && NGUIText.ParseSymbol(text, ref i))
  1697. {
  1698. i--;
  1699. }
  1700. else
  1701. {
  1702. BMSymbol bmsymbol = (!NGUIText.useSymbols) ? null : NGUIText.GetSymbol(text, i, length);
  1703. float num8 = (bmsymbol == null) ? NGUIText.GetGlyphWidth(num7, prev) : ((float)bmsymbol.advance * NGUIText.fontScale);
  1704. if (num8 != 0f)
  1705. {
  1706. float num9 = num2;
  1707. float num10 = num2 + num8;
  1708. float num11 = -num3 - num5;
  1709. float num12 = -num3;
  1710. if (Mathf.RoundToInt(num10 + NGUIText.finalSpacingX) > NGUIText.regionWidth)
  1711. {
  1712. if (num2 == 0f)
  1713. {
  1714. return;
  1715. }
  1716. if (num2 > num4)
  1717. {
  1718. num4 = num2;
  1719. }
  1720. if (caret != null && flag2)
  1721. {
  1722. if (NGUIText.alignment != NGUIText.Alignment.Left)
  1723. {
  1724. NGUIText.Align(caret, indexOffset, num2 - NGUIText.finalSpacingX);
  1725. }
  1726. caret = null;
  1727. }
  1728. if (highlight != null)
  1729. {
  1730. if (flag)
  1731. {
  1732. flag = false;
  1733. highlight.Add(zero2);
  1734. highlight.Add(zero);
  1735. }
  1736. else if (start <= i && end > i)
  1737. {
  1738. highlight.Add(new Vector3(num2, -num3 - num5));
  1739. highlight.Add(new Vector3(num2, -num3));
  1740. highlight.Add(new Vector3(num2 + 2f, -num3));
  1741. highlight.Add(new Vector3(num2 + 2f, -num3 - num5));
  1742. }
  1743. if (NGUIText.alignment != NGUIText.Alignment.Left && num6 < highlight.size)
  1744. {
  1745. NGUIText.Align(highlight, num6, num2 - NGUIText.finalSpacingX);
  1746. num6 = highlight.size;
  1747. }
  1748. }
  1749. num9 -= num2;
  1750. num10 -= num2;
  1751. num11 -= NGUIText.finalLineHeight;
  1752. num12 -= NGUIText.finalLineHeight;
  1753. num2 = 0f;
  1754. num3 += NGUIText.finalLineHeight;
  1755. }
  1756. num2 += num8 + NGUIText.finalSpacingX;
  1757. if (highlight != null)
  1758. {
  1759. if (start > i || end <= i)
  1760. {
  1761. if (flag)
  1762. {
  1763. flag = false;
  1764. highlight.Add(zero2);
  1765. highlight.Add(zero);
  1766. }
  1767. }
  1768. else if (!flag)
  1769. {
  1770. flag = true;
  1771. highlight.Add(new Vector3(num9, num11));
  1772. highlight.Add(new Vector3(num9, num12));
  1773. }
  1774. }
  1775. zero = new Vector2(num10, num11);
  1776. zero2 = new Vector2(num10, num12);
  1777. prev = num7;
  1778. }
  1779. }
  1780. i++;
  1781. }
  1782. if (caret != null)
  1783. {
  1784. if (!flag2)
  1785. {
  1786. caret.Add(new Vector3(num2 - 1f, -num3 - num5));
  1787. caret.Add(new Vector3(num2 - 1f, -num3));
  1788. caret.Add(new Vector3(num2 + 1f, -num3));
  1789. caret.Add(new Vector3(num2 + 1f, -num3 - num5));
  1790. }
  1791. if (NGUIText.alignment != NGUIText.Alignment.Left)
  1792. {
  1793. NGUIText.Align(caret, indexOffset, num2 - NGUIText.finalSpacingX);
  1794. }
  1795. }
  1796. if (highlight != null)
  1797. {
  1798. if (flag)
  1799. {
  1800. highlight.Add(zero2);
  1801. highlight.Add(zero);
  1802. }
  1803. else if (start < i && end == i)
  1804. {
  1805. highlight.Add(new Vector3(num2, -num3 - num5));
  1806. highlight.Add(new Vector3(num2, -num3));
  1807. highlight.Add(new Vector3(num2 + 2f, -num3));
  1808. highlight.Add(new Vector3(num2 + 2f, -num3 - num5));
  1809. }
  1810. if (NGUIText.alignment != NGUIText.Alignment.Left && num6 < highlight.size)
  1811. {
  1812. NGUIText.Align(highlight, num6, num2 - NGUIText.finalSpacingX);
  1813. }
  1814. }
  1815. }
  1816. public static UIFont bitmapFont;
  1817. public static Font dynamicFont;
  1818. public static NGUIText.GlyphInfo glyph = new NGUIText.GlyphInfo();
  1819. public static int fontSize = 16;
  1820. public static float fontScale = 1f;
  1821. public static float pixelDensity = 1f;
  1822. public static FontStyle fontStyle = FontStyle.Normal;
  1823. public static NGUIText.Alignment alignment = NGUIText.Alignment.Left;
  1824. public static Color tint = Color.white;
  1825. public static int rectWidth = 1000000;
  1826. public static int rectHeight = 1000000;
  1827. public static int regionWidth = 1000000;
  1828. public static int regionHeight = 1000000;
  1829. public static int maxLines = 0;
  1830. public static bool gradient = false;
  1831. public static Color gradientBottom = Color.white;
  1832. public static Color gradientTop = Color.white;
  1833. public static bool encoding = false;
  1834. public static float spacingX = 0f;
  1835. public static float spacingY = 0f;
  1836. public static bool premultiply = false;
  1837. public static NGUIText.SymbolStyle symbolStyle;
  1838. public static int finalSize = 0;
  1839. public static float finalSpacingX = 0f;
  1840. public static float finalLineHeight = 0f;
  1841. public static float baseline = 0f;
  1842. public static bool useSymbols = false;
  1843. private static Color mInvisible = new Color(0f, 0f, 0f, 0f);
  1844. private static BetterList<Color> mColors = new BetterList<Color>();
  1845. private static float mAlpha = 1f;
  1846. private static CharacterInfo mTempChar;
  1847. private static BetterList<float> mSizes = new BetterList<float>();
  1848. private static Color32 s_c0;
  1849. private static Color32 s_c1;
  1850. private static float[] mBoldOffset = new float[]
  1851. {
  1852. -0.25f,
  1853. 0f,
  1854. 0.25f,
  1855. 0f,
  1856. 0f,
  1857. -0.25f,
  1858. 0f,
  1859. 0.25f
  1860. };
  1861. public enum Alignment
  1862. {
  1863. Automatic,
  1864. Left,
  1865. Center,
  1866. Right,
  1867. Justified
  1868. }
  1869. public enum SymbolStyle
  1870. {
  1871. None,
  1872. Normal,
  1873. Colored
  1874. }
  1875. public class GlyphInfo
  1876. {
  1877. public Vector2 v0;
  1878. public Vector2 v1;
  1879. public Vector2 u0;
  1880. public Vector2 u1;
  1881. public Vector2 u2;
  1882. public Vector2 u3;
  1883. public float advance;
  1884. public int channel;
  1885. }
  1886. }