internal UguiNovelTextGeneratorAddtionalRuby( List<UguiNovelTextCharacter> characters, int index, Font rubyFont, float rubySizeScale)
		{
			UguiNovelTextCharacter original = characters[index];
			int rubySize = Mathf.CeilToInt(rubySizeScale * original.FontSize);
			stringData.Add(original);
			for (int i = index + 1; i < characters.Count; ++i)
			{
				UguiNovelTextCharacter c = characters[i];
				if (!c.CustomInfo.IsRuby || c.CustomInfo.IsRubyTop) break;
				stringData.Add(c);
			}
			
			//カラー情報のみコピー
			CharData.CustomCharaInfo rubyInfo = new CharData.CustomCharaInfo();
			rubyInfo.IsColor = original.charData.CustomInfo.IsColor;
			rubyInfo.color = original.charData.CustomInfo.color;
			if (original.charData.CustomInfo.IsEmphasisMark)
			{
				for (int i = 0; i < stringData.Count; ++i)
				{
					CharData data = new CharData(original.charData.CustomInfo.rubyStr[0], rubyInfo);
					rubyList.Add(new UguiNovelTextCharacter(data, rubyFont, rubySize, original.FontStyle ));
				}
			}
			else
			{
				foreach (char c in original.charData.CustomInfo.rubyStr)
				{
					CharData data = new CharData(c, rubyInfo);
					rubyList.Add(new UguiNovelTextCharacter(data, rubyFont, rubySize, original.FontStyle ));
				}
			}
		}
Exemplo n.º 2
0
        //本来二文字ぶんの改行文字を追加
        void AddDoubleLineBreak()
        {
            CharData.CustomCharaInfo custom = customInfo;
            custom.IsDoubleWord = true;
            CharData data = new CharData('\n', custom);

            charList.Add(data);
        }
        private void AddDoubleLineBreak()
        {
            CharData.CustomCharaInfo customInfo = this.customInfo;
            customInfo.IsDoubleWord = true;
            CharData item = new CharData('\n', customInfo);

            this.charList.Add(item);
        }
		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);
		}
Exemplo n.º 5
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);
        }
Exemplo n.º 6
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);
        }
Exemplo n.º 7
0
        //絵文字を追加
        bool TryAddEmoji(string arg)
        {
            if (string.IsNullOrEmpty(arg))
            {
                return(false);
            }

            CharData.CustomCharaInfo custom = customInfo;
            custom.IsEmoji  = true;
            custom.EmojiKey = arg;
            CharData data = new CharData('□', custom);

            charList.Add(data);
            return(true);
        }
        private void AddDash(string arg)
        {
            int num;

            if (!int.TryParse(arg, out num))
            {
                num = 1;
            }
            CharData.CustomCharaInfo customInfo = this.customInfo;
            customInfo.IsDash   = true;
            customInfo.DashSize = num;
            CharData item = new CharData('—', customInfo);

            this.charList.Add(item);
        }
Exemplo n.º 9
0
        //棒線(ダッシュ、ダーシ)を追加
        void AddDash(string arg)
        {
            int size;

            if (!int.TryParse(arg, out size))
            {
                size = 1;
            }
            CharData.CustomCharaInfo custom = customInfo;
            custom.IsDash   = true;
            custom.DashSize = size;
            CharData data = new CharData(CharData.Dash, custom);

            charList.Add(data);
        }
Exemplo n.º 10
0
        //サイズ指定のスペースの追加
        bool TryAddSpace(string arg)
        {
            int size;

            if (!int.TryParse(arg, out size))
            {
                return(false);
            }

            CharData.CustomCharaInfo custom = customInfo;
            custom.IsSpace   = true;
            custom.SpaceSize = size;
            CharData data = new CharData(' ', custom);

            charList.Add(data);
            return(true);
        }
Exemplo n.º 11
0
        internal UguiNovelTextGeneratorAdditionalRuby(List <UguiNovelTextCharacter> characters, int index, UguiNovelTextGenerator generator)
        {
            Font  rubyFont                  = generator.NovelText.font;
            float rubySizeScale             = generator.RubySizeScale;
            UguiNovelTextCharacter original = characters[index];
            int rubySize = Mathf.CeilToInt(rubySizeScale * original.FontSize);

            stringData.Add(original);
            for (int i = index + 1; i < characters.Count; ++i)
            {
                UguiNovelTextCharacter c = characters[i];
                if (!c.CustomInfo.IsRuby || c.CustomInfo.IsRubyTop)
                {
                    break;
                }
                stringData.Add(c);
            }

            //カラー情報のみコピー
            CharData.CustomCharaInfo rubyInfo = new CharData.CustomCharaInfo();
            rubyInfo.IsColor = original.charData.CustomInfo.IsColor;
            rubyInfo.color   = original.charData.CustomInfo.color;
            if (original.charData.CustomInfo.IsEmphasisMark)
            {
                for (int i = 0; i < stringData.Count; ++i)
                {
                    CharData data = new CharData(original.charData.CustomInfo.rubyStr[0], rubyInfo);
                    rubyList.Add(new UguiNovelTextCharacter(data, rubyFont, rubySize, generator.BmpFontSize, original.FontStyle));
                }
            }
            else
            {
                foreach (char c in original.charData.CustomInfo.rubyStr)
                {
                    CharData data = new CharData(c, rubyInfo);
                    rubyList.Add(new UguiNovelTextCharacter(data, rubyFont, rubySize, generator.BmpFontSize, original.FontStyle));
                }
            }
        }
Exemplo n.º 12
0
        internal UguiNovelTextGeneratorAdditionalRuby(List <UguiNovelTextCharacter> characters, int index, UguiNovelTextGenerator generator)
        {
            Font  font                  = generator.NovelText.get_font();
            float rubySizeScale         = generator.RubySizeScale;
            UguiNovelTextCharacter item = characters[index];
            int fontSize                = Mathf.CeilToInt(rubySizeScale * item.FontSize);

            this.stringData.Add(item);
            for (int i = index + 1; i < characters.Count; i++)
            {
                UguiNovelTextCharacter character2 = characters[i];
                if (!character2.CustomInfo.IsRuby || character2.CustomInfo.IsRubyTop)
                {
                    break;
                }
                this.stringData.Add(character2);
            }
            CharData.CustomCharaInfo customInfo = new CharData.CustomCharaInfo {
                IsColor = item.charData.CustomInfo.IsColor,
                color   = item.charData.CustomInfo.color
            };
            if (item.charData.CustomInfo.IsEmphasisMark)
            {
                for (int j = 0; j < this.stringData.Count; j++)
                {
                    CharData charData = new CharData(item.charData.CustomInfo.rubyStr[0], customInfo);
                    this.rubyList.Add(new UguiNovelTextCharacter(charData, font, fontSize, generator.BmpFontSize, item.FontStyle));
                }
            }
            else
            {
                foreach (char ch in item.charData.CustomInfo.rubyStr)
                {
                    CharData data2 = new CharData(ch, customInfo);
                    this.rubyList.Add(new UguiNovelTextCharacter(data2, font, fontSize, generator.BmpFontSize, item.FontStyle));
                }
            }
        }
Exemplo n.º 13
0
		//絵文字を追加
		bool TryAddEmoji(string arg)
		{
			if(string.IsNullOrEmpty(arg))
			{
				return false;
			}

			CharData.CustomCharaInfo custom = new CharData.CustomCharaInfo();
			custom.IsEmoji = true;
			custom.EmojiKey = arg;
			CharData data = new CharData('□', custom);
			charList.Add(data);
			return true;
		}
Exemplo n.º 14
0
        /// Unityのリッチテキストフォーマットのテキストを初期化する
        public void InitUnityRitchText()
        {
            //作成ずみならなにもしない
            if (!string.IsNullOrEmpty(unityRitchText))
            {
                return;
            }

            unityRitchText = "";
            CharData.CustomCharaInfo curentCustomInfo = new CharData.CustomCharaInfo();

            //タグの前後関係を正しくするためにStackを使う
            Stack <string> endTagStack = new Stack <string>();

            for (int i = 0; i < CharList.Count; ++i)
            {
                CharData c = CharList[i];
                if (c.CustomInfo.IsEndBold(ref curentCustomInfo))
                {
                    unityRitchText += endTagStack.Pop();
                }
                if (c.CustomInfo.IsEndItalic(ref curentCustomInfo))
                {
                    unityRitchText += endTagStack.Pop();
                }
                if (c.CustomInfo.IsEndSize(ref curentCustomInfo))
                {
                    unityRitchText += endTagStack.Pop();
                }
                if (c.CustomInfo.IsEndColor(ref curentCustomInfo))
                {
                    unityRitchText += endTagStack.Pop();
                }

                if (c.CustomInfo.IsBeginColor(ref curentCustomInfo))
                {
//					unityRitchText += "<color=#" + ColorUtil.ToColorString(c.CustomInfo.color) + ">";
                    unityRitchText += "<color=" + c.CustomInfo.colorStr + ">";
                    endTagStack.Push(ColorEndTag);
                }
                if (c.CustomInfo.IsBeginSize(ref curentCustomInfo))
                {
                    unityRitchText += "<size=" + c.CustomInfo.size + ">";
                    endTagStack.Push(SizeEndTag);
                }
                if (c.CustomInfo.IsBeginItalic(ref curentCustomInfo))
                {
                    unityRitchText += "<i>";
                    endTagStack.Push(ItalicEndTag);
                }
                if (c.CustomInfo.IsBeginBold(ref curentCustomInfo))
                {
                    unityRitchText += "<b>";
                    endTagStack.Push(BoldEndTag);
                }

                c.UnityRitchTextIndex = unityRitchText.Length;
                unityRitchText       += c.Char;
                if (c.CustomInfo.IsDoubleWord)
                {
                    unityRitchText += " ";
                }
                curentCustomInfo = c.CustomInfo;
            }
            if (curentCustomInfo.IsBold)
            {
                unityRitchText += endTagStack.Pop();
            }
            if (curentCustomInfo.IsItalic)
            {
                unityRitchText += endTagStack.Pop();
            }
            if (curentCustomInfo.IsSize)
            {
                unityRitchText += endTagStack.Pop();
            }
            if (curentCustomInfo.IsColor)
            {
                unityRitchText += endTagStack.Pop();
            }
        }
Exemplo n.º 15
0
		//サイズ指定のスペースの追加
		bool TryAddSpace(string arg)
		{
			int size;
			if (!int.TryParse(arg, out size))
			{
				return false;
			}

			CharData.CustomCharaInfo custom = new CharData.CustomCharaInfo();
			custom.IsSpace = true;
			custom.SpaceSize = size;
			CharData data = new CharData(' ', custom);
			charList.Add(data);
			return true;
		}
Exemplo n.º 16
0
		//棒線(ダッシュ、ダーシ)を追加
		void AddDash(string arg)
		{
			int size;
			if (!int.TryParse(arg, out size))
			{
				size = 1;
			}
			CharData.CustomCharaInfo custom = new CharData.CustomCharaInfo();
			custom.IsDash = true;
			custom.DashSize = size;
			CharData data = new CharData(CharData.Dash, custom);
			charList.Add(data);
		}
Exemplo n.º 17
0
		//本来二文字ぶんの改行文字を追加
		void AddDoubleLineBreak()
		{
			CharData.CustomCharaInfo custom = new CharData.CustomCharaInfo();
			custom.IsDobleWord = true;
			CharData data = new CharData('\n', custom);
			charList.Add(data);
		}
Exemplo n.º 18
0
		/// Unityのリッチテキストフォーマットのテキストを初期化する
		public void InitUnityRitchText()
		{
			//作成ずみならなにもしない
			if (!string.IsNullOrEmpty(unityRitchText)) return;

			unityRitchText = "";
			CharData.CustomCharaInfo curentCustomInfo = new CharData.CustomCharaInfo();

			//タグの前後関係を正しくするためにStackを使う
			Stack<string> endTagStack = new Stack<string>();

			for (int i = 0; i < CharList.Count; ++i)
			{
				CharData c = CharList[i];
				if (c.CustomInfo.IsEndBold(ref curentCustomInfo)) unityRitchText += endTagStack.Pop();
				if (c.CustomInfo.IsEndItalic(ref curentCustomInfo)) unityRitchText += endTagStack.Pop();
				if (c.CustomInfo.IsEndSize(ref curentCustomInfo)) unityRitchText += endTagStack.Pop();
				if (c.CustomInfo.IsEndColor(ref curentCustomInfo)) unityRitchText += endTagStack.Pop();

				if (c.CustomInfo.IsBeginColor(ref curentCustomInfo))
				{
//					unityRitchText += "<color=#" + ColorUtil.ToColorString(c.CustomInfo.color) + ">";
					unityRitchText += "<color=" + c.CustomInfo.colorStr + ">";
					endTagStack.Push(ColorEndTag);
				}
				if (c.CustomInfo.IsBeginSize(ref curentCustomInfo))
				{
					unityRitchText += "<size=" + c.CustomInfo.size + ">";
					endTagStack.Push(SizeEndTag);
				}
				if (c.CustomInfo.IsBeginItalic(ref curentCustomInfo))
				{
					unityRitchText += "<i>";
					endTagStack.Push(ItalicEndTag);
				}
				if (c.CustomInfo.IsBeginBold(ref curentCustomInfo))
				{
					unityRitchText += "<b>";
					endTagStack.Push(BoldEndTag);
				}

				c.UnityRitchTextIndex = unityRitchText.Length;
				unityRitchText += c.Char;
				if (c.CustomInfo.IsDobleWord)
				{
					unityRitchText += " ";
				}
				curentCustomInfo = c.CustomInfo;
			}
			if (curentCustomInfo.IsBold) unityRitchText += endTagStack.Pop();
			if (curentCustomInfo.IsItalic) unityRitchText += endTagStack.Pop();
			if (curentCustomInfo.IsSize) unityRitchText += endTagStack.Pop();
			if (curentCustomInfo.IsColor) unityRitchText += endTagStack.Pop();
		}