internal void InitPosition(UguiNovelTextGenerator generator) { Vector2 vector; foreach (UguiNovelTextLine line in generator.LineDataList) { if (line.Characters.IndexOf(this.TopCharacter) >= 0) { this.textLine = line; } } float letterSpaceSize = generator.LetterSpaceSize; float num2 = 0f; if (this.IsWideType) { vector.x = -this.TopCharacter.RubySpaceSize; } else { num2 = (this.StringWidth - this.RubyWidth) / ((float)this.rubyList.Count); vector.x = (-letterSpaceSize / 2f) + (num2 / 2f); } vector.y = this.textLine.MaxFontSize; float num3 = vector.x + this.TopCharacter.PositionX; float num4 = vector.y + this.TopCharacter.PositionY; foreach (UguiNovelTextCharacter character in this.rubyList) { character.PositionX = num3; character.PositionY = num4; num3 += character.Width + num2; } }
void InitTextLine(UguiNovelTextGenerator generator) { foreach (UguiNovelTextLine line in generator.LineDataList) { if (line.Characters.IndexOf(TopCharaceter) >= 0) { this.textLine = line; } } }
//行データを作成する List <UguiNovelTextLine> CreateLineList(List <UguiNovelTextCharacter> characterDataList, float maxHeight) { //行データの作成&Y位置の調整 List <UguiNovelTextLine> lineList = new List <UguiNovelTextLine>(); //行データを作成 UguiNovelTextLine currentLine = new UguiNovelTextLine(); foreach (UguiNovelTextCharacter character in characterDataList) { currentLine.AddCharaData(character); //改行処理 if (character.IsBrOrAutoBr) { currentLine.EndCharaData(Generator); lineList.Add(currentLine); //次の行を追加 currentLine = new UguiNovelTextLine(); } } if (currentLine.Characters.Count > 0) { currentLine.EndCharaData(Generator); lineList.Add(currentLine); } if (lineList.Count <= 0) { return(lineList); } float y = 0; //行間 for (int i = 0; i < lineList.Count; ++i) { UguiNovelTextLine line = lineList[i]; float y0 = y; y -= line.MaxFontSize; //縦幅のチェック line.IsOver = IsOverMaxHeight(-y, maxHeight); //表示する幅を取得 if (!line.IsOver) { this.Height = -y; } this.PreferredHeight = -y; //Y座標を設定 line.SetLineY(y, Generator); //行間を更新 y = y0 - line.TotalHeight; } return(lineList); }
//位置情報の初期化 internal void InitPosition(UguiNovelTextGenerator generator) { foreach (UguiNovelTextLine line in generator.LineDataList) { if (line.Characters.IndexOf(TopCharacter) >= 0) { this.textLine = line; } } float currentSpace = generator.LetterSpaceSize; //ルビをつける最初の文字からの表示位置のオフセット Vector2 offset; //ルビ同士の文字間 float rubySpace = 0; //ルビの幅が本文の幅よりも長いなら //ルビの幅にあわせて本文をスペースをあけて表示する if (IsWideType) { offset.x = -TopCharacter.RubySpaceSize; } else { rubySpace = (StringWidth - RubyWidth) / rubyList.Count; offset.x = -currentSpace / 2 + rubySpace / 2; } //高さを合わせる offset.y = this.textLine.MaxFontSize; float x = offset.x + TopCharacter.PositionX; float y = offset.y + TopCharacter.PositionY; foreach (UguiNovelTextCharacter ruby in rubyList) { ruby.PositionX = x; ruby.PositionY = y; x += ruby.Width + rubySpace; } }
//行データを作成する List<UguiNovelTextLine> CreateLineList(List<UguiNovelTextCharacter> characterDataList) { //行データの作成&Y位置の調整 List<UguiNovelTextLine> lineList = new List<UguiNovelTextLine>(); //行データを作成 UguiNovelTextLine currentLine = new UguiNovelTextLine(); foreach (UguiNovelTextCharacter character in characterDataList) { currentLine.AddCharaData(character); //改行処理 if (character.IsBrOrAutoBr) { currentLine.EndCharaData(this); lineList.Add(currentLine); //次の行を追加 currentLine = new UguiNovelTextLine(); } } if (currentLine.Characters.Count > 0) { currentLine.EndCharaData(this); lineList.Add(currentLine); } if (lineList.Count <= 0) return lineList; float y = 0; //行間 for(int i = 0; i < lineList.Count; ++i) { UguiNovelTextLine line = lineList[i]; float y0 = y; y -= line.MaxFontSize; //縦幅のチェック line.IsOver = IsOverMaxHeight(-y); //表示する幅を取得 if (!line.IsOver) { this.height = -y; } //Y座標を設定 line.SetLineY(y, this); //行間を更新 y = y0 - line.TotalHeight; } return lineList; }
//位置情報の初期化 internal void InitPosition(UguiNovelTextGenerator generator) { foreach( UguiNovelTextLine line in generator.LineDataList ) { if( line.Characters.IndexOf(TopCharaceter) >= 0 ) { this.textLine = line; } } float currentSpace = generator.LetterSpaceSize; //ルビをつける最初の文字からの表示位置のオフセット Vector2 offset; //ルビ同士の文字間 float rubySpace = 0; //ルビの幅が本文の幅よりも長いなら //ルビの幅にあわせて本文をスペースをあけて表示する if (IsWideType) { offset.x = -TopCharaceter.RubySpaceSize; } else { rubySpace = (StringWidth - RubyWidth) / rubyList.Count; offset.x = -currentSpace / 2 + rubySpace / 2; } //高さを合わせる offset.y = this.textLine.MaxFontSize; float x = offset.x + TopCharaceter.PositionX; float y = offset.y + TopCharaceter.PositionY; foreach (UguiNovelTextCharacter ruby in rubyList) { ruby.PositionX = x; ruby.PositionY = y; x += ruby.Width + rubySpace; } }