public AdvCommandText(StringGridRow row, AdvSettingDataManager dataManager)
			: base(row)
		{
			//ページコントローラー
			this.pageCtrlType = AdvParser.ParseCellOptional<AdvPageController.Type>(row, AdvColumnName.PageCtrl, AdvPageController.Type.None );
			dataManager.PageContoroller.Update(this.pageCtrlType);

			//メッセージウィンドウのタイプ
			this.windowType = AdvParser.ParseCellOptional<string>(row, AdvColumnName.WindowType, "");
			
			this.text = AdvParser.ParseCell<string>(row, AdvColumnName.Text);
			if (AdvCommand.IsEditorErrorCheck)
			{
				TextData textData = new TextData(text);
				if (!string.IsNullOrEmpty(textData.ErrorMsg))
				{
					Debug.LogError(row.ToErrorString(textData.ErrorMsg));
				}
			}
			
			//ページの末端かチェック
			//ページコントローラーでテキストを表示しつづける場合は、ページ末端じゃない
			this.isPageEnd = (text.Length > 0) && !dataManager.PageContoroller.IsKeepText;
		}
        //各文字の描画データを作成
        List <CharacterRenderInfo> CreateRenderInfo(TextData textData)
        {
            List <CharacterRenderInfo> infoList = new List <CharacterRenderInfo>();

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

            float y            = -Size;
            bool  isOverHeight = false;

            while (infoList.Count < textData.Length && !isOverHeight)
            {
                float x = 0;
                while (infoList.Count < textData.Length)
                {
                    CharData       c               = textData.CharList[infoList.Count];
                    FontRenderInfo renderInfo      = null;
                    float          w               = 0;
                    bool           isAutoLineBreak = false;
                    if (c.IsBr)
                    {
                    }
                    else if (char.IsWhiteSpace(c.Char))
                    {
                        w = Space;
                    }
                    else
                    {
                        renderInfo = Font.GetRenderInfoCreateIfMissing(c.Char, pixcelsToUnits);
                        if (renderInfo != null)
                        {
                            w = GetCharacterRenderWidth(renderInfo);
                            //横幅を越えるなら自動改行
                            isAutoLineBreak = IsOverMaxWidth(x, w);
                        }
                    }
                    //文字の追加
                    CharacterRenderInfo charInfo = new CharacterRenderInfo(c, renderInfo, x, y, w, isAutoLineBreak);
                    infoList.Add(charInfo);
                    x += w + LetterSpace;
                    //改行処理
                    if (charInfo.IsBr)
                    {
                        if (isAutoLineBreak)
                        {
                            //自動改行
                            AutoLineBreak(infoList);
                        }
                        float offsetY = -(LineSpace + Size);
                        //縦幅のチェック
                        if (IsOverMaxHeight(y + offsetY))
                        {
                            isOverHeight = true;
                        }
                        else
                        {
                            y += offsetY;
                        }
                        break;
                    }
                }
            }

            MoveLayout(y, infoList);
            return(infoList);
        }
        //テキスト表示を更新
        void RefreshText()
        {
            DestroyRootObject();
            if (!this.gameObject.activeInHierarchy)
            {
                return;
            }
            if (Font == null)
            {
                return;
            }

            //テキストデータを取得
            if (!isTextDataChanged)
            {
                textData = new TextData(text);
            }
            string str = (textData == null) ? "" : textData.NoneMetaString;

            if (isTextDataChanged)
            {
                currentText = str;
            }
            isTextDataChanged = false;

            //フォントのアトラス作成
            egnoreRebuild = true;
            Font.MakeFontAtlas(str);
            egnoreRebuild = false;

            //描画データ作成
            renderInfoList.Clear();
            renderInfoList = CreateRenderInfo(textData);

            //描画オブジェクトを更新

            //不可視のオブジェクトとして作成(子オブジェクトにもしない。プレハブ化できなくなるから)
            CreateRootObject();

            Color mulColorEffect = ColorEffect * this.Color;
            int   effectOrder    = 0;
            int   defaultOrder   = (type == ViewType.Default) ? 0 : 1;

            foreach (CharacterRenderInfo renderInfo in renderInfoList)
            {
                if (renderInfo.fontInfo == null)
                {
                    continue;
                }

                switch (type)
                {
                case ViewType.Shadow:
                    AddCharObject(childRoot, renderInfo, mulColorEffect, effectOrder, 1, -1);
                    break;

                case ViewType.Outline:
                    AddCharObject(childRoot, renderInfo, mulColorEffect, effectOrder, -1, -1);
                    AddCharObject(childRoot, renderInfo, mulColorEffect, effectOrder, 1, -1);
                    AddCharObject(childRoot, renderInfo, mulColorEffect, effectOrder, 1, 1);
                    AddCharObject(childRoot, renderInfo, mulColorEffect, effectOrder, -1, 1);
                    break;

                default:
                    break;
                }
                Color mulColor = (renderInfo.charInfo.CustomInfo.IsColor) ? renderInfo.charInfo.CustomInfo.color * this.Color : this.Color;
                AddCharObject(childRoot, renderInfo, mulColor, defaultOrder);
            }
            RefreshLengthOfView();
        }
		//頂点情報を作成
		void Refresh()
		{
			if (isRequestingCharactersInTexture)
			{
				if (isDebugLog) Debug.LogError("RequestingCharactersInTexture on Reflesh");
				return;
			}

			//TextData作成
			textData = new TextData(NovelText.text);
			if (isDebugLog) Debug.Log(textData.ParsedText.OriginalText);

			//描画範囲のサイズを設定しておく
			Rect rect = CachedRectTransform.rect;
			maxWidth = Mathf.Abs(rect.width);
			maxHeight = Mathf.Abs(rect.height);

			//文字データを作成
			List<UguiNovelTextCharacter> characterDataList = CreateCharacterDataList();
			//拡張的な情報を作成
			addtional = new UguiNovelTextGeneratorAddtional(characterDataList, this);
			//フォントの文字画像を準備・設定
			InitFontCharactes(NovelText.font, characterDataList);
			//拡張的な情報の初期化
			Addtional.InitAfterCharacterInfo(this);
			//独自の改行処理を入れる
			AutoLineBreak(characterDataList);
			//行ごとの文字データを作成
			lineDataList = CreateLineList(characterDataList);
			//テキストのアンカーを適用する
			ApplyTextAnchor(lineDataList, NovelText.alignment);
			//Offsetを適用する
			ApplyOffset(lineDataList);
			//拡張的な情報の表示位置を初期化
			Addtional.InitPosition(this);
			//各頂点データを構築
			MakeVerts(lineDataList);

			isInitGraphicObjectList = false;
			HasChangedLitte = false;
			HasChanged = false;
			IsRebuidFont = false;
		}
/*
		/// <summary>
		/// キャラクタのセリフを設定
		/// </summary>
		/// <param name="text">テキスト(セリフ)</param>
		/// <param name="name">キャラクター名</param>
		public void SetCharacterText(string text, string name)
		{
			this.NameText = name;
			this.textData = new TextData(text);
			if (text.Length == 0)
			{
				Debug.LogError("text is empty");
			}
			this.status = ( text.Length > 0 ) ? Status.SendChar : Status.BrPage;
			this.isInputSendMessage = false;
			Engine.OnPageTextChange.Invoke(Engine);
		}

		/// <summary>
		/// テキスト(地の文)を設定
		/// </summary>
		/// <param name="text">テキスト</param>
		public void SetText(string text)
		{
			SetCharacterText(text, "");
		}
*/
		/// <summary>
		/// メッセージウィドウのテキストを変更
		/// </summary>
		public void ChangeMessageWindowText(string nameText, string characterLabel, string text, string windowType )
		{
			this.NameText = nameText;
			this.CharacterLabel = characterLabel;
			this.WindowType = windowType;
			this.textData = new TextData(text);
			if (text.Length == 0)
			{
				Debug.LogError("text is empty");
			}
			this.status = (text.Length > 0) ? Status.SendChar : Status.BrPage;
			this.isInputSendMessage = false;
			if (Engine.Config.TimeSendChar <= 0 || CheckSkip())
			{
				currentTextLen = TextData.Length;
			}
			Engine.OnPageTextChange.Invoke(Engine);
		}
		public AdvCommandCharacter(StringGridRow row, AdvSettingDataManager dataManager)
			: base(row)
		{
			//名前
			string name = AdvParser.ParseCell<string>(row, AdvColumnName.Arg1);
			//パターンラベル
			string patternLabel = AdvParser.ParseCellOptional<string>(row, AdvColumnName.Arg2, "");
			//キャラの表示情報を取得
			this.characterInfo = dataManager.CharacterSetting.GetCharacterInfo(name, patternLabel);
			AddLoadGraphic(characterInfo.Graphic);
			//表示レイヤー
			this.layerName = AdvParser.ParseCellOptional<string>(row, AdvColumnName.Arg3, "");
			if (!string.IsNullOrEmpty(layerName) && !dataManager.LayerSetting.Contains(layerName, AdvLayerSettingData.LayerType.Character))
			{
				//表示レイヤーが見つからない
				Debug.LogError(row.ToErrorString(layerName + " is not contained in layer setting"));
			}

			//グラフィック表示処理を作成
			this.graphicOperaitonArg 
				= new AdvGraphicOperaitonArg( 
					row, 
					characterInfo.Graphic, 
					AdvParser.ParseCellOptional<float>(row, AdvColumnName.Arg6, 0.2f), 
					characterInfo.IsNonePattern );

			//メッセージウィンドウのタイプ
			this.windowType = AdvParser.ParseCellOptional<string>(row, AdvColumnName.WindowType, "");

			//ページコントローラー
			this.pageCtrlType = AdvParser.ParseCellOptional<AdvPageController.Type>(row, AdvColumnName.PageCtrl, AdvPageController.Type.None);
			dataManager.PageContoroller.Update(this.pageCtrlType);

			//テキスト関連
			this.text = AdvParser.ParseCellOptional<string>(row, AdvColumnName.Text, "");
			if (AdvCommand.IsEditorErrorCheck)
			{
				TextData textData = new TextData(text);
				if (!string.IsNullOrEmpty(textData.ErrorMsg))
				{
					Debug.LogError(row.ToErrorString(textData.ErrorMsg));
				}
			}
			//ボイス
			string voice = AdvParser.ParseCellOptional<string>(row, AdvColumnName.Voice, "");
			int voiceVersion = AdvParser.ParseCellOptional<int>(row, AdvColumnName.VoiceVersion, 0);

			//サウンドファイル設定
			if (!string.IsNullOrEmpty(voice))
			{
				if (AdvCommand.IsEditorErrorCheck)
				{
				}
				else
				{
					voiceFile = AddLoadFile(dataManager.SettingData.VoiceDirInfo.FileNameToPath(voice));
					if (voiceFile != null) voiceFile.Version = voiceVersion;
					//ストリーミング再生にバグがある模様。途中で無音が混じると飛ばされる?
					//				voiceFile.LoadFlags = AssetFileLoadFlags.Streaming;
				}
			}

			//ページの末端かチェック
			//ページコントローラーでテキストを表示しつづける場合は、ページ末端じゃない
			this.isPageEnd = (text.Length > 0) && !dataManager.PageContoroller.IsKeepText;
		}
		/// <summary>
		/// ページ終了
		/// </summary>
		/// <param name="scenarioName">シナリオラベル</param>
		/// <param name="pageNo">ページ名</param>
		public void EndPage()
		{
			this.NameText = "";
			this.textData = new TextData("");
			this.currentTextLen = 0;
			this.deltaTimeSendMessage = 0;
			this.status = Status.EndPage;
			this.Contoller.Clear();
		}
		/// <summary>
		/// クリア
		/// </summary>
		public void Clear()
		{
			this.status = Status.BrPage;
			this.ScenarioLabel = "";
			this.PageNo = 0;
			this.NameText = "";
			this.textData = new TextData("");
			this.currentTextLen = 0;
			this.deltaTimeSendMessage = 0;
			this.Contoller.Clear();
		}
        public AdvCommandCharacter(StringGridRow row, AdvSettingDataManager dataManager)
            : base(row)
        {
            //名前
            string name = AdvParser.ParseCell <string>(row, AdvColumnName.Arg1);
            //パターンラベル
            string patternLabel = AdvParser.ParseCellOptional <string>(row, AdvColumnName.Arg2, "");

            //キャラの表示情報を取得
            this.characterInfo = dataManager.CharacterSetting.GetCharacterInfo(name, patternLabel);
            AddLoadGraphic(characterInfo.Graphic);
            //表示レイヤー
            this.layerName = AdvParser.ParseCellOptional <string>(row, AdvColumnName.Arg3, "");
            if (!string.IsNullOrEmpty(layerName) && !dataManager.LayerSetting.Contains(layerName, AdvLayerSettingData.LayerType.Character))
            {
                //表示レイヤーが見つからない
                Debug.LogError(row.ToErrorString(layerName + " is not contained in layer setting"));
            }

            //グラフィック表示処理を作成
            this.graphicOperaitonArg
                = new AdvGraphicOperaitonArg(
                      row,
                      characterInfo.Graphic,
                      AdvParser.ParseCellOptional <float>(row, AdvColumnName.Arg6, 0.2f),
                      characterInfo.IsNonePattern);

            //メッセージウィンドウのタイプ
            this.windowType = AdvParser.ParseCellOptional <string>(row, AdvColumnName.WindowType, "");

            //ページコントローラー
            this.pageCtrlType = AdvParser.ParseCellOptional <AdvPageController.Type>(row, AdvColumnName.PageCtrl, AdvPageController.Type.None);
            dataManager.PageContoroller.Update(this.pageCtrlType);

            //テキスト関連
            this.text = AdvParser.ParseCellOptional <string>(row, AdvColumnName.Text, "");
            if (AdvCommand.IsEditorErrorCheck)
            {
                TextData textData = new TextData(text);
                if (!string.IsNullOrEmpty(textData.ErrorMsg))
                {
                    Debug.LogError(row.ToErrorString(textData.ErrorMsg));
                }
            }
            //ボイス
            string voice        = AdvParser.ParseCellOptional <string>(row, AdvColumnName.Voice, "");
            int    voiceVersion = AdvParser.ParseCellOptional <int>(row, AdvColumnName.VoiceVersion, 0);

            //サウンドファイル設定
            if (!string.IsNullOrEmpty(voice))
            {
                if (AdvCommand.IsEditorErrorCheck)
                {
                }
                else
                {
                    voiceFile = AddLoadFile(dataManager.SettingData.VoiceDirInfo.FileNameToPath(voice));
                    if (voiceFile != null)
                    {
                        voiceFile.Version = voiceVersion;
                    }
                    //ストリーミング再生にバグがある模様。途中で無音が混じると飛ばされる?
                    //				voiceFile.LoadFlags = AssetFileLoadFlags.Streaming;
                }
            }

            //ページの末端かチェック
            //ページコントローラーでテキストを表示しつづける場合は、ページ末端じゃない
            this.isPageEnd = (text.Length > 0) && !dataManager.PageContoroller.IsKeepText;
        }
		//各文字の描画データを作成
		List<CharacterRenderInfo> CreateRenderInfo(TextData textData)
		{

			List<CharacterRenderInfo> infoList = new List<CharacterRenderInfo>();
			if (textData == null) return infoList;

			float y = -Size;
			bool isOverHeight = false;
			while (infoList.Count < textData.Length && !isOverHeight)
			{
				float x = 0;
				while (infoList.Count < textData.Length)
				{
					CharData c = textData.CharList[infoList.Count];
					FontRenderInfo renderInfo = null;
					float w = 0;
					bool isAutoLineBreak = false;
					if (c.IsBr)
					{
					}
					else if (char.IsWhiteSpace(c.Char))
					{
						w = Space;
					}
					else
					{
						renderInfo = Font.GetRenderInfoCreateIfMissing(c.Char,pixcelsToUnits);
						if (renderInfo != null)
						{
							w = GetCharacterRenderWidth(renderInfo);
							//横幅を越えるなら自動改行
							isAutoLineBreak = IsOverMaxWidth(x, w);
						}
					}
					//文字の追加
					CharacterRenderInfo charInfo = new CharacterRenderInfo(c, renderInfo, x, y, w, isAutoLineBreak);
					infoList.Add(charInfo);
					x += w + LetterSpace;
					//改行処理
					if (charInfo.IsBr)
					{
						if (isAutoLineBreak)
						{
							//自動改行
							AutoLineBreak(infoList);
						}
						float offsetY = -(LineSpace + Size);
						//縦幅のチェック
						if (IsOverMaxHeight(y + offsetY))
						{
							isOverHeight = true;
						}
						else
						{
							y += offsetY;
						}
						break;
					}
				}
			}

			MoveLayout(y, infoList);
			return infoList;
		}
		//テキスト表示を更新
		void RefreshText()
		{
			DestroyRootObject();
			if (!this.gameObject.activeInHierarchy) return;
			if (Font == null) return;
			
			//テキストデータを取得
			if (!isTextDataChanged)
			{
				textData = new TextData(text);
			}
			string str = (textData == null) ? "" : textData.NoneMetaString;
			if(isTextDataChanged)
			{
				currentText = str;
			}
			isTextDataChanged = false;

			//フォントのアトラス作成
			egnoreRebuild = true;
			Font.MakeFontAtlas(str);
			egnoreRebuild = false;

			//描画データ作成
			renderInfoList.Clear();
			renderInfoList = CreateRenderInfo(textData);

			//描画オブジェクトを更新

			//不可視のオブジェクトとして作成(子オブジェクトにもしない。プレハブ化できなくなるから)
			CreateRootObject();

			Color mulColorEffect = ColorEffect * this.Color;
			int effectOrder = 0;
			int defaultOrder = ( type == ViewType.Default ) ? 0 : 1;
			foreach (CharacterRenderInfo renderInfo in renderInfoList)
			{
				if (renderInfo.fontInfo == null) continue;

				switch (type)
				{
					case ViewType.Shadow:
						AddCharObject(childRoot, renderInfo, mulColorEffect, effectOrder, 1, -1);
						break;
					case ViewType.Outline:
						AddCharObject(childRoot, renderInfo, mulColorEffect, effectOrder, -1, -1);
						AddCharObject(childRoot, renderInfo, mulColorEffect, effectOrder, 1, -1);
						AddCharObject(childRoot, renderInfo, mulColorEffect, effectOrder, 1, 1);
						AddCharObject(childRoot, renderInfo, mulColorEffect, effectOrder, -1, 1);
						break;
					default:
						break;
				}
				Color mulColor = ( renderInfo.charInfo.CustomInfo.IsColor  ) ? renderInfo.charInfo.CustomInfo.color * this.Color : this.Color;
				AddCharObject(childRoot, renderInfo, mulColor, defaultOrder);
			}
			RefreshLengthOfView();
		}