fixed line breaker and translated com_nightmare 1-12
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using Qoo.Def;
|
||||
using Qoo.Game;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection.Emit;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using UnityEngine;
|
||||
@@ -179,28 +180,40 @@ public class CMessageText
|
||||
int testWidth = 0;
|
||||
if (!UnityApp.PlatformApp.isJapanese)
|
||||
{
|
||||
CMessageText.m_isHyphenation = true;
|
||||
for (int i = 0; i < szMsg.Length; i++)
|
||||
{
|
||||
//Force diacritics to closest letter with no accent mark
|
||||
if (Regex.IsMatch(szMsg[i].ToString(), "[À-ž]"))
|
||||
{
|
||||
szMsg = szMsg.Remove(i, 1).Insert(i, szMsg[i].ToString().Normalize(NormalizationForm.FormC).Normalize(NormalizationForm.FormD));
|
||||
}
|
||||
//Auto line breaker based on character widths
|
||||
}
|
||||
|
||||
|
||||
//Improved line breaker
|
||||
//Work around existing code since there was not line breaker that didn't split in the middle of words
|
||||
BMGlyph glyph = this.font.Font.GetGlyph((int)szMsg[i], true);
|
||||
if (glyph != null)
|
||||
{
|
||||
testWidth += glyph.width;
|
||||
}
|
||||
else
|
||||
if (glyph == null)
|
||||
{
|
||||
break;
|
||||
}
|
||||
int nSize = FontDef.GetFontInfo(nFontType).nSize;
|
||||
float num = (float)glyph.advance / (float)this.font.Font.charSize;
|
||||
int num2 = (int)((float)nSize * num);
|
||||
int num3 = (int)((float)nSize * ((float)glyph.height / (float)this.font.Font.charSize));
|
||||
num2 = (int)((float)num2 * FontDef.GetFontInfo(nFontType).fStretch);
|
||||
num3 = (int)((float)num3 * FontDef.GetFontInfo(nFontType).fStretch);
|
||||
|
||||
//Increase line width with each character added
|
||||
testWidth += num2;
|
||||
|
||||
//If there is a line break reset count
|
||||
if (szMsg[i] == '\n')
|
||||
{
|
||||
testWidth = 0;
|
||||
}
|
||||
if (testWidth > 960)
|
||||
|
||||
if (testWidth > this.m_Clip.nCx)
|
||||
{
|
||||
for (int j = i; j >= 0; j--)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user