Esempio n. 1
0
        public void EndCharaData(UguiNovelTextGenerator generator)
        {
            //幅と、最大フォントサイズなどを設定
            maxFontSize = 0;
            float left = 0;

            for (int i = 0; i < characters.Count; ++i)
            {
                UguiNovelTextCharacter character = characters[i];
                maxFontSize = Mathf.Max(maxFontSize, character.DefaultFontSize);
                if (i == 0)
                {
                    left = character.PositionX - character.RubySpaceSize;
                }
            }

            float right = 0;

            for (int i = characters.Count - 1; i >= 0; --i)
            {
                UguiNovelTextCharacter character = characters[i];
                if (!character.IsBr)
                {
                    right = character.PositionX + character.Width + character.RubySpaceSize;
                    break;
                }
            }

            width = Mathf.Abs(right - left);
            //uGUIは行間の基本値1=1.2の模様
            totalHeight = generator.NovelText.GetTotalLineHeight(MaxFontSize);
        }
Esempio n. 2
0
        //当たり判定の情報を作成
        void MakeHitGroups(List <UguiNovelTextCharacter> characterDataList)
        {
            this.HitGroupLists = new List <UguiNovelTextHitArea>();
            int index = 0;

            //一行ぶん(改行までの)の処理をループ内で処理
            while (index < characterDataList.Count)
            {
                UguiNovelTextCharacter currentData = characterDataList[index];
                if (currentData.charData.CustomInfo.IsHitEventTop)
                {
                    CharData.HitEventType type = currentData.CustomInfo.HitEventType;
                    string arg = currentData.CustomInfo.HitEventArg;
                    List <UguiNovelTextCharacter> characterList = new List <UguiNovelTextCharacter>();
                    characterList.Add(currentData);
                    ++index;
                    while (index < characterDataList.Count)
                    {
                        UguiNovelTextCharacter c = characterDataList[index];
                        if (!c.CustomInfo.IsHitEvent || c.CustomInfo.IsHitEventTop)
                        {
                            break;
                        }
                        characterList.Add(c);
                        ++index;
                    }
                    HitGroupLists.Add(new UguiNovelTextHitArea(NovelText, type, arg, characterList));
                }
                else
                {
                    ++index;
                }
            }
        }
        //最後の座標を計算
        internal void RefleshEndPosition()
        {
            int max = CurrentLengthOfView;

            if (LineDataList == null || (max <= 0 && LineDataList.Count <= 0))
            {
                return;
            }

            int count = 0;
            UguiNovelTextCharacter lastCaracter = null;

            foreach (UguiNovelTextLine line in LineDataList)
            {
                if (line.IsOver)
                {
                    break;
                }

                for (int i = 0; i < line.Characters.Count; ++i)
                {
                    UguiNovelTextCharacter character = line.Characters[i];
                    character.IsVisible = (count < max);
                    ++count;
                    if (character.IsVisible)
                    {
                        lastCaracter = character;
                        endPosition  = new Vector3(lastCaracter.EndPositionX, line.Y0, 0);
                    }
                }
            }
        }
Esempio n. 4
0
        public static void SetCharacterInfoToVertex(UIVertex[] verts, UguiNovelTextCharacter character, Font font)
        {
            float num5 = 0.1f * character.FontSize;
            float num  = character.charInfo.get_minX();
            float num2 = character.charInfo.get_maxX();
            float num3 = character.charInfo.get_minY();
            float num4 = character.charInfo.get_maxY();

            if (!font.get_dynamic())
            {
                num  *= character.BmpFontScale;
                num3 *= character.BmpFontScale;
                num2 *= character.BmpFontScale;
                num4 *= character.BmpFontScale;
            }
            Vector2 vector  = character.charInfo.get_uvBottomLeft();
            Vector2 vector2 = character.charInfo.get_uvBottomRight();
            Vector2 vector3 = character.charInfo.get_uvTopRight();
            Vector2 vector4 = character.charInfo.get_uvTopLeft();

            verts[0].position.x = verts[3].position.x = num + character.PositionX;
            verts[1].position.x = verts[2].position.x = num2 + character.PositionX;
            verts[0].position.y = verts[1].position.y = (num3 + character.PositionY) + num5;
            verts[2].position.y = verts[3].position.y = (num4 + character.PositionY) + num5;
            verts[0].uv0        = vector;
            verts[1].uv0        = vector2;
            verts[2].uv0        = vector3;
            verts[3].uv0        = vector4;
        }
		//禁則のチェック
		internal bool CheckWordWrap( UguiNovelTextGenerator generator, UguiNovelTextCharacter current, UguiNovelTextCharacter prev)
		{
			//文字間無視文字は改行できない
			if (IsIgonreLetterSpace(prev, current))
			{
				return true;
			}

			//英文文字のWordWrap
			if ((generator.WordWrapType & UguiNovelTextGenerator.WordWrap.Default) == UguiNovelTextGenerator.WordWrap.Default)
			{
				if (CheckWordWrapDefaultEnd(prev) && CheckWordWrapDefaultTop(current))
				{
					return true;
				}
			}

			//日本語のWordWrap
			if ((generator.WordWrapType & UguiNovelTextGenerator.WordWrap.JapaneseKinsoku) == UguiNovelTextGenerator.WordWrap.JapaneseKinsoku)
			{
				if ((CheckKinsokuEnd(prev) || CheckKinsokuTop(current)))
				{
					return true;
				}
			}

			return false;
		}
Esempio n. 6
0
        //禁則のチェック
        internal bool CheckWordWrap(UguiNovelTextGenerator generator, UguiNovelTextCharacter current, UguiNovelTextCharacter prev)
        {
            //文字間無視文字は改行できない
            if (IsIgonreLetterSpace(prev, current))
            {
                return(true);
            }

            //英文文字のWordWrap
            if ((generator.WordWrapType & UguiNovelTextGenerator.WordWrap.Default) == UguiNovelTextGenerator.WordWrap.Default)
            {
                if (CheckWordWrapDefaultEnd(prev) && CheckWordWrapDefaultTop(current))
                {
                    return(true);
                }
            }

            //日本語のWordWrap
            if ((generator.WordWrapType & UguiNovelTextGenerator.WordWrap.JapaneseKinsoku) == UguiNovelTextGenerator.WordWrap.JapaneseKinsoku)
            {
                if ((CheckKinsokuEnd(prev) || CheckKinsokuTop(current)))
                {
                    return(true);
                }
            }

            return(false);
        }
 internal bool CheckWordWrap(UguiNovelTextGenerator generator, UguiNovelTextCharacter current, UguiNovelTextCharacter prev)
 {
     if (!this.IsIgonreLetterSpace(prev, current))
     {
         bool flag  = (generator.WordWrapType & UguiNovelTextGenerator.WordWrap.Default) == UguiNovelTextGenerator.WordWrap.Default;
         bool flag2 = !this.forceIgonreJapaneseKinsoku && ((generator.WordWrapType & UguiNovelTextGenerator.WordWrap.JapaneseKinsoku) == UguiNovelTextGenerator.WordWrap.JapaneseKinsoku);
         if (flag)
         {
             if (flag2)
             {
                 if (this.CheckWordWrapDefaultEnd(prev) && this.CheckWordWrapDefaultTop(current))
                 {
                     return(true);
                 }
             }
             else if (!char.IsSeparator(prev.Char) && !char.IsSeparator(current.Char))
             {
                 return(true);
             }
         }
         if (!flag2 || (!this.CheckKinsokuEnd(prev) && !this.CheckKinsokuTop(current)))
         {
             return(false);
         }
     }
     return(true);
 }
Esempio n. 8
0
        public static void SetCharacterInfoToVertex(UIVertex[] verts, UguiNovelTextCharacter character, Font font)
        {
            float   minX, maxX, minY, maxY;
            Vector2 uvBottomLeft, uvBottomRight, uvTopRight, uvTopLeft;
            float   offsetY;

#if UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6
            //Y座標はフォントアセットのサイズと、文字のサイズを使ってこんな式で計算できる。
            //理屈はわからん!
            offsetY = font.fontSize + 0.1f * (character.FontSize - font.fontSize);

            //positionの設定
            minX = character.charInfo.vert.xMin;
            maxX = character.charInfo.vert.xMax;

            minY = character.charInfo.vert.yMin;
            maxY = character.charInfo.vert.yMax;

            Rect uv = character.charInfo.uv;
            //Flipp処理
            if (character.charInfo.flipped)
            {
                uvBottomLeft  = new Vector2(uv.xMax, uv.yMin);
                uvBottomRight = new Vector2(uv.xMax, uv.yMax);
                uvTopLeft     = new Vector2(uv.xMin, uv.yMin);
                uvTopRight    = new Vector2(uv.xMin, uv.yMax);
            }
            else
            {
                uvBottomLeft  = new Vector2(uv.xMin, uv.yMax);
                uvBottomRight = new Vector2(uv.xMax, uv.yMax);
                uvTopLeft     = new Vector2(uv.xMin, uv.yMin);
                uvTopRight    = new Vector2(uv.xMax, uv.yMin);
            }
#else
            offsetY = 0.1f * (character.FontSize);

            //座標の設定
            minX = character.charInfo.minX;
            maxX = character.charInfo.maxX;
            minY = character.charInfo.minY;
            maxY = character.charInfo.maxY;

            uvBottomLeft  = character.charInfo.uvBottomLeft;
            uvBottomRight = character.charInfo.uvBottomRight;
            uvTopRight    = character.charInfo.uvTopRight;
            uvTopLeft     = character.charInfo.uvTopLeft;
#endif
            //座標の設定
            verts[0].position.x = verts[3].position.x = minX + character.PositionX;
            verts[1].position.x = verts[2].position.x = maxX + character.PositionX;
            verts[0].position.y = verts[1].position.y = minY + character.PositionY + offsetY;
            verts[2].position.y = verts[3].position.y = maxY + character.PositionY + offsetY;

            verts[0].uv0 = uvBottomLeft;
            verts[1].uv0 = uvBottomRight;
            verts[2].uv0 = uvTopRight;
            verts[3].uv0 = uvTopLeft;
        }
		public static void SetCharacterInfoToVertex(UIVertex[] verts, UguiNovelTextCharacter character, Font font )
		{

			float minX,maxX,minY,maxY;
			Vector2 uvBottomLeft,uvBottomRight,uvTopRight,uvTopLeft;
			float offsetY;
#if UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6
			//Y座標はフォントアセットのサイズと、文字のサイズを使ってこんな式で計算できる。
			//理屈はわからん!
			offsetY = font.fontSize + 0.1f*(character.FontSize-font.fontSize);

			//positionの設定
			minX = character.charInfo.vert.xMin;
			maxX = character.charInfo.vert.xMax;

			minY = character.charInfo.vert.yMin;
			maxY = character.charInfo.vert.yMax;

			Rect uv = character.charInfo.uv;
			//Flipp処理
			if (character.charInfo.flipped)
			{
				uvBottomLeft = new Vector2(uv.xMax, uv.yMin);
				uvBottomRight = new Vector2(uv.xMax, uv.yMax);
				uvTopLeft = new Vector2(uv.xMin, uv.yMin);
				uvTopRight = new Vector2(uv.xMin, uv.yMax);
			}
			else
			{
				uvBottomLeft = new Vector2(uv.xMin, uv.yMax);
				uvBottomRight = new Vector2(uv.xMax, uv.yMax);
				uvTopLeft = new Vector2(uv.xMin, uv.yMin);
				uvTopRight = new Vector2(uv.xMax, uv.yMin);
			}
#else
			offsetY = 0.1f * (character.FontSize);

			//座標の設定
			minX = character.charInfo.minX;
			maxX = character.charInfo.maxX;
			minY = character.charInfo.minY;
			maxY = character.charInfo.maxY;

			uvBottomLeft = character.charInfo.uvBottomLeft;
			uvBottomRight = character.charInfo.uvBottomRight;
			uvTopRight = character.charInfo.uvTopRight;
			uvTopLeft = character.charInfo.uvTopLeft;
#endif
			//座標の設定
			verts[0].position.x = verts[3].position.x = minX + character.PositionX;
			verts[1].position.x = verts[2].position.x = maxX + character.PositionX;
			verts[0].position.y = verts[1].position.y = minY + character.PositionY + offsetY;
			verts[2].position.y = verts[3].position.y = maxY + character.PositionY + offsetY;

			verts[0].uv0 = uvBottomLeft;
			verts[1].uv0 = uvBottomRight;
			verts[2].uv0 = uvTopRight;
			verts[3].uv0 = uvTopLeft;
		}
Esempio n. 10
0
        public static float GetCharacterEndPointX(UguiNovelTextCharacter character)
        {
#if UNITY_4_6_OR_EARLIER
            return(character.charInfo.flipped ? character.Verts[1].position.x : character.Verts[2].position.x);
#else
            return(character.Verts[1].position.x);
#endif
        }
 internal bool IsIgonreLetterSpace(UguiNovelTextCharacter current, UguiNovelTextCharacter next)
 {
     if ((current == null) || (next == null))
     {
         return(false);
     }
     return((current.Char == next.Char) && (this.IgnoreLetterSpace.IndexOf(current.Char) >= 0));
 }
Esempio n. 12
0
        void InitSub(Type type, UguiNovelTextGenerator generator)
        {
            this.type = type;
            //ダッシュ('—')の文字を作成
            CharData data = new CharData(generator.DashChar);

            data.CustomInfo.IsDash   = true;
            data.CustomInfo.DashSize = 1;
            characteData             = new UguiNovelTextCharacter(data, generator);
        }
Esempio n. 13
0
        private bool IsLineEnd(UguiNovelTextCharacter c)
        {
            Type lineType = this.LineType;

            if (lineType != Type.Strike)
            {
                return((lineType == Type.UnderLine) && (!c.CustomInfo.IsUnderLine || c.CustomInfo.IsUnderLineTop));
            }
            return(!c.CustomInfo.IsStrike || c.CustomInfo.IsStrikeTop);
        }
		void InitSub(Type type, UguiNovelTextGenerator generator)
		{
			this.type = type;
			//ダッシュ('—')の文字を作成
			CharData.CustomCharaInfo custom = new CharData.CustomCharaInfo();
			custom.IsDash = true;
			custom.DashSize = 1;
			CharData data = new CharData(CharData.Dash, custom);
			characteData = new UguiNovelTextCharacter(data, generator);
		}
Esempio n. 15
0
        private void InitSub(Type type, UguiNovelTextGenerator generator)
        {
            this.type = type;
            CharData.CustomCharaInfo customInfo = new CharData.CustomCharaInfo {
                IsDash   = true,
                DashSize = 1
            };
            CharData charData = new CharData(generator.DashChar, customInfo);

            this.characteData = new UguiNovelTextCharacter(charData, generator);
        }
Esempio n. 16
0
 internal float GetTopLetterSpace(UguiNovelTextCharacter lineTopCharacter, UguiNovelTextGenerator generator)
 {
     foreach (UguiNovelTextGeneratorAdditionalRuby ruby in this.RubyList)
     {
         if (!ruby.IsWideType && (ruby.TopCharacter == lineTopCharacter))
         {
             return(generator.LetterSpaceSize / 2f);
         }
     }
     return(0f);
 }
Esempio n. 17
0
        void InitSub(Type type, UguiNovelTextGenerator generator)
        {
            this.type = type;
            //ダッシュ('—')の文字を作成
            CharData.CustomCharaInfo custom = new CharData.CustomCharaInfo();
            custom.IsDash   = true;
            custom.DashSize = 1;
            CharData data = new CharData(CharData.Dash, custom);

            characteData = new UguiNovelTextCharacter(data, generator);
        }
Esempio n. 18
0
 public bool TryAddData(UguiNovelTextCharacter data)
 {
     if (size == data.FontSize && style == data.FontStyle)
     {
         characters += data.Char;
         return(true);
     }
     else
     {
         return(false);
     }
 }
		//
		bool IsLineEnd(UguiNovelTextCharacter c)
		{
			switch(LineType)
			{
				case Type.Strike:
					return (!c.CustomInfo.IsStrike || c.CustomInfo.IsStrikeTop);
				case Type.UnderLine:
					return (!c.CustomInfo.IsUnderLine || c.CustomInfo.IsUnderLineTop);
				default:
					return false;
			}
		}
		//		string kinsokuBurasage = "、。";						//ぶら下げ組み文字

		//禁則のチェック
		internal bool IsIgonreLetterSpace(UguiNovelTextCharacter current, UguiNovelTextCharacter next)
		{
			if (current == null || next == null) return false;

			if (current.Char == next.Char)
			{ 
				if( IgnoreLetterSpace.IndexOf(current.Char) >= 0  )
				{
					return true;
				}
			}
			return false;
		}
Esempio n. 21
0
 internal UguiNovelTextGeneratorAddtionalLine(Type type, List <UguiNovelTextCharacter> characters, int index, UguiNovelTextGenerator generator)
 {
     InitSub(type, generator);
     stringData.Add(characters[index]);
     for (int i = index + 1; i < characters.Count; ++i)
     {
         UguiNovelTextCharacter c = characters[i];
         if (IsLineEnd(c))
         {
             break;
         }
         stringData.Add(c);
     }
 }
Esempio n. 22
0
 internal float GetMaxWidth(UguiNovelTextCharacter currentData)
 {
     if (currentData.CustomInfo.IsRubyTop)
     {
         foreach (UguiNovelTextGeneratorAdditionalRuby ruby in this.RubyList)
         {
             if (ruby.TopCharacter == currentData)
             {
                 return(Mathf.Max(ruby.StringWidth, ruby.RubyWidth));
             }
         }
     }
     return(currentData.Width);
 }
        //行の先頭だった場合のスペースサイズを取得
        internal float GetTopLetterSpace(UguiNovelTextCharacter lineTopCharacter, UguiNovelTextGenerator generator)
        {
            float space = 0;

            foreach (UguiNovelTextGeneratorAddtionalRuby ruby in RubyList)
            {
                if (!ruby.IsWideType && ruby.TopCharaceter == lineTopCharacter)
                {
                    space = generator.LetterSpaceSize / 2;
                    break;
                }
            }
            return(space);
        }
Esempio n. 24
0
        //
        bool IsLineEnd(UguiNovelTextCharacter c)
        {
            switch (LineType)
            {
            case Type.Strike:
                return(!c.CustomInfo.IsStrike || c.CustomInfo.IsStrikeTop);

            case Type.UnderLine:
                return(!c.CustomInfo.IsUnderLine || c.CustomInfo.IsUnderLineTop);

            default:
                return(false);
            }
        }
Esempio n. 25
0
 internal UguiNovelTextGeneratorAdditionalLine(Type type, List <UguiNovelTextCharacter> characters, int index, UguiNovelTextGenerator generator)
 {
     this.stringData = new List <UguiNovelTextCharacter>();
     this.InitSub(type, generator);
     this.stringData.Add(characters[index]);
     for (int i = index + 1; i < characters.Count; i++)
     {
         UguiNovelTextCharacter c = characters[i];
         if (this.IsLineEnd(c))
         {
             break;
         }
         this.stringData.Add(c);
     }
 }
Esempio n. 26
0
        //禁則のチェック
        internal bool IsIgonreLetterSpace(UguiNovelTextCharacter current, UguiNovelTextCharacter next)
        {
            if (current == null || next == null)
            {
                return(false);
            }

            if (current.Char == next.Char)
            {
                if (IgnoreLetterSpace.IndexOf(current.Char) >= 0)
                {
                    return(true);
                }
            }
            return(false);
        }
Esempio n. 27
0
        //文字データを作成
        List <UguiNovelTextCharacter> CreateCharacterDataList()
        {
            List <UguiNovelTextCharacter> characterDataList = new List <UguiNovelTextCharacter>();

            if (textData == null)
            {
                return(characterDataList);
            }

            for (int i = 0; i < textData.Length; i++)
            {
                UguiNovelTextCharacter character = new UguiNovelTextCharacter(textData.CharList[i], this);
                characterDataList.Add(character);
            }
            return(characterDataList);
        }
Esempio n. 28
0
        //フォントの文字画像の作成のための情報を作成
        void AddToRequestCharactersInfoList(UguiNovelTextCharacter characterData, List <RequestCharactersInfo> infoList)
        {
            if (characterData.IsNoFontData)
            {
                return;
            }

            foreach (RequestCharactersInfo info in infoList)
            {
                if (info.TryAddData(characterData))
                {
                    return;
                }
            }
            infoList.Add(new RequestCharactersInfo(characterData));
        }
Esempio n. 29
0
        //文字データを作成
        List <UguiNovelTextCharacter> CreateCharacterDataList(TextData data)
        {
            List <UguiNovelTextCharacter> characterDataList = new List <UguiNovelTextCharacter>();

            if (data == null)
            {
                return(characterDataList);
            }

            for (int i = 0; i < data.Length; i++)
            {
                UguiNovelTextCharacter character = new UguiNovelTextCharacter(data.CharList[i], Generator);
                characterDataList.Add(character);
            }
            return(characterDataList);
        }
Esempio n. 30
0
        //禁則のチェック
        bool CheckWordWrap(UguiNovelTextCharacter current, UguiNovelTextCharacter prev)
        {
            //ルビは開始の文字以外は改行できない
            if (current.IsDisableAutoLineBreak)
            {
                return(true);
            }

            if (Generator.TextSettings != null)
            {
                return(Generator.TextSettings.CheckWordWrap(Generator, current, prev));
            }
            else
            {
                return(false);
            }
        }
Esempio n. 31
0
        //WordWrap処理
        int ParseWordWrap(List <UguiNovelTextCharacter> infoList, int beginIndex, int index)
        {
            if (index <= beginIndex)
            {
                return(beginIndex);
            }

            UguiNovelTextCharacter current = infoList[index];               //改行させる文字
            UguiNovelTextCharacter prev    = infoList[index - 1];           //一つ前の文字

            if (CheckWordWrap(current, prev))
            {               //禁則に引っかかるので、一文字前をチェック
                return(ParseWordWrap(infoList, beginIndex, index - 1));
            }
            else
            {
                return(index - 1);
            }
        }
Esempio n. 32
0
        //1行ぶんのヒットエリアを作成
        Rect MakeHitArea(List <UguiNovelTextCharacter> lineCharacters)
        {
            UguiNovelTextCharacter topCharacter = lineCharacters[0];
            float xMin        = topCharacter.BeginPositionX;
            float xMax        = topCharacter.EndPositionX;
            int   fontSizeMax = 0;

            foreach (UguiNovelTextCharacter c in lineCharacters)
            {
                xMax        = Mathf.Max(xMax, c.EndPositionX);
                fontSizeMax = Mathf.Max(fontSizeMax, c.FontSize);
            }

            //行間含んだ高さ
            int   totalHeight = novelText.GetTotalLineHeight(fontSizeMax);
            float yMin        = topCharacter.PositionY - (totalHeight - fontSizeMax) / 2.0f;

            return(new Rect(xMin, yMin, xMax - xMin, totalHeight));
        }
Esempio n. 33
0
        //描画用頂点データリストを作成
        List <UIVertex> CreateVertexList(List <UguiNovelTextLine> lineList, int max)
        {
            List <UIVertex> verts = new List <UIVertex>();

            if (lineList == null || (max <= 0 && lineList.Count <= 0))
            {
                return(verts);
            }

            int count = 0;
            UguiNovelTextCharacter lastCaracter = null;

            foreach (UguiNovelTextLine line in lineList)
            {
                if (line.IsOver)
                {
                    break;
                }

                for (int i = 0; i < line.Characters.Count; ++i)
                {
                    UguiNovelTextCharacter character = line.Characters[i];
                    character.IsVisible = (count < max);
                    ++count;
                    if (character.IsBr)
                    {
                        continue;
                    }
                    if (character.IsVisible)
                    {
                        lastCaracter = character;
                        if (!character.IsNoFontData)
                        {
                            verts.AddRange(character.Verts);
                        }
                        endPosition = new Vector3(lastCaracter.EndPositionX, line.Y0, 0);
                    }
                }
            }

            Addtional.AddVerts(verts, endPosition, this);
            return(verts);
        }
Esempio n. 34
0
 internal UguiNovelTextGeneratorAdditional(List <UguiNovelTextCharacter> characters, UguiNovelTextGenerator generataor)
 {
     for (int i = 0; i < characters.Count; i++)
     {
         UguiNovelTextCharacter character = characters[i];
         if (character.CustomInfo.IsStrikeTop)
         {
             this.lineList.Add(new UguiNovelTextGeneratorAdditionalLine(UguiNovelTextGeneratorAdditionalLine.Type.Strike, characters, i, generataor));
         }
         if (character.CustomInfo.IsUnderLineTop)
         {
             this.lineList.Add(new UguiNovelTextGeneratorAdditionalLine(UguiNovelTextGeneratorAdditionalLine.Type.UnderLine, characters, i, generataor));
         }
         if (character.CustomInfo.IsRubyTop)
         {
             this.rubyList.Add(new UguiNovelTextGeneratorAdditionalRuby(characters, i, generataor));
         }
     }
 }
Esempio n. 35
0
        //禁則のチェック
        internal bool CheckWordWrap(UguiNovelTextGenerator generator, UguiNovelTextCharacter current, UguiNovelTextCharacter prev)
        {
            //文字間無視文字は改行できない
            if (IsIgonreLetterSpace(prev, current))
            {
                return(true);
            }

            bool isWordRapDefault  = (generator.WordWrapType & UguiNovelTextGenerator.WordWrap.Default) == UguiNovelTextGenerator.WordWrap.Default;
            bool isJapaneseKinsoku = !forceIgonreJapaneseKinsoku && (generator.WordWrapType & UguiNovelTextGenerator.WordWrap.JapaneseKinsoku) == UguiNovelTextGenerator.WordWrap.JapaneseKinsoku;

            //英文文字のWordWrap
            if (isWordRapDefault)
            {
                if (isJapaneseKinsoku)
                {
                    //日本語の禁則がある場合は、半角かどうかで改行チェックを
                    if (CheckWordWrapDefaultEnd(prev) && CheckWordWrapDefaultTop(current))
                    {
                        return(true);
                    }
                }
                else
                {
                    //日本語の禁則がない場合は、
                    if (!char.IsSeparator(prev.Char) && !char.IsSeparator(current.Char))
                    {
                        return(true);
                    }
                }
            }

            //日本語のWordWrap
            if (isJapaneseKinsoku)
            {
                if ((CheckKinsokuEnd(prev) || CheckKinsokuTop(current)))
                {
                    return(true);
                }
            }

            return(false);
        }
			public bool TryAddData(UguiNovelTextCharacter data)
			{
				if (size == data.FontSize && style == data.FontStyle)
				{
					characters += data.Char;
					return true;
				}
				else
				{
					return false;
				}
			}
		//行の先頭だった場合のスペースサイズを取得
		internal float GetTopLetterSpace(UguiNovelTextCharacter lineTopCharacter, UguiNovelTextGenerator generator)
		{
			float space = 0;
			foreach (UguiNovelTextGeneratorAddtionalRuby ruby in RubyList)
			{
				if (!ruby.IsWideType && ruby.TopCharaceter == lineTopCharacter)
				{
					space = generator.LetterSpaceSize / 2;
					break;
				}
			}
			return space;
		}
		public void AddCharaData(UguiNovelTextCharacter charaData)
		{
			characters.Add(charaData);
		}
		//文字の最大幅を取得
		internal float GetMaxWidth(UguiNovelTextCharacter currentData)
		{
			if (currentData.CustomInfo.IsRubyTop)
			{
				foreach (UguiNovelTextGeneratorAddtionalRuby ruby in RubyList)
				{
					if (ruby.TopCharaceter == currentData)
					{
						return Mathf.Max(ruby.StringWidth, ruby.RubyWidth);
					}
				}
			}
			return currentData.Width;
		}
		public static float GetCharacterEndPointX(UguiNovelTextCharacter character)
		{
#if UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6
			return character.charInfo.flipped ? character.Verts[1].position.x : character.Verts[2].position.x;
#else
			return character.Verts[1].position.x;
#endif
		}
		//文字データを作成
		List<UguiNovelTextCharacter> CreateCharacterDataList()
		{
			List<UguiNovelTextCharacter> characterDataList = new List<UguiNovelTextCharacter>();
			if (textData == null) return characterDataList;

			for (int i = 0; i < textData.Length; i++)
			{
				UguiNovelTextCharacter character = new UguiNovelTextCharacter(textData.CharList[i], this );
				characterDataList.Add(character);
			}
			return characterDataList;
		}
			public GraphicObject(UguiNovelTextCharacter character, RectTransform graphic)
			{
				this.character = character;
				this.graphic = graphic;
			}
			public RequestCharactersInfo(UguiNovelTextCharacter data)
			{
				characters = "" + data.Char;
				size = data.FontSize;
				style = data.FontStyle;
			}
		//フォントの文字画像の作成のための情報を作成
		void AddToRequestCharactersInfoList(UguiNovelTextCharacter characterData, List<RequestCharactersInfo> infoList)
		{
			if (characterData.IsNoFontData) return;

			foreach (RequestCharactersInfo info in infoList)
			{
				if (info.TryAddData(characterData))
				{
					return;
				}
			}
			infoList.Add(new RequestCharactersInfo(characterData));
		}
		//禁則のチェック
		bool CheckWordWrap(UguiNovelTextCharacter current, UguiNovelTextCharacter prev)
		{
			//ルビは開始の文字以外は改行できない
			if (current.IsDisableAutoLineBreak)
			{
				return true;
			}

			if( TextSettings !=null )
			{
				return TextSettings.CheckWordWrap(this,current, prev);
			}
			else
			{
				return false;
			}
		}
		//行末の禁則文字のチェック
		bool CheckKinsokuEnd(UguiNovelTextCharacter character)
		{
			return (kinsokuEnd.IndexOf(character.Char) >= 0);
		}
		//ぶら下げ文字のチェック
		bool CheckKinsokuBurasage(UguiNovelTextCharacter c)
		{
			return false;
		}
		//英単語のワードラップチェック(行頭)
		bool CheckWordWrapDefaultTop(UguiNovelTextCharacter character)
		{
			char c = character.Char;
			return UtageToolKit.IsHankaku(c) && !char.IsSeparator(c);
		}
		//英単語のワードラップチェック(行末)
		bool CheckWordWrapDefaultEnd(UguiNovelTextCharacter character)
		{
			char c = character.Char;
			return UtageToolKit.IsHankaku(c) && !char.IsSeparator(c) && !(wordWrapSeparator.IndexOf(c) >= 0);
		}