private void FlushText() { string mTextQueue = this.mTextQueue; this.mTextQueue = (string)null; if (this.mCharacters == null || this.mCharacters.Length < mTextQueue.Length) { this.mCharacters = new EventDialogBubbleCustom.Character[mTextQueue.Length * 2]; } string str = "REPLACE_PLAYER_NAME"; string newValue = string.Empty; if (Object.op_Inequality((Object)MonoSingleton <GameManager> .GetInstanceDirect(), (Object)null)) { newValue = MonoSingleton <GameManager> .GetInstanceDirect().Player.Name; } string s = mTextQueue.Replace("<p_name>", str).Replace("<br>", "\n"); EventAction_Dialog.TextSpeedTypes speed = EventAction_Dialog.TextSpeedTypes.Normal; int n = 0; EventDialogBubbleCustom.Ctx ctx = new EventDialogBubbleCustom.Ctx(); ctx.Interval = speed.ToFloat(); ctx.Color = Color32.op_Implicit(!Object.op_Inequality((Object)this.BodyText, (Object)null) ? Color.get_black() : ((Graphic)this.BodyText).get_color()); this.mNumCharacters = 0; EventDialogBubbleCustom.Element[] c = EventDialogBubbleCustom.SplitTags(s); for (int index = 0; index < c.Length; ++index) { if (c[index] != null) { c[index].Value = c[index].Value.Replace(str, newValue); } } this.Parse(c, ref n, (string)null, ctx); if (Object.op_Inequality((Object)this.BodyText, (Object)null)) { this.BodyText.set_text(string.Empty); } this.mStartTime = Time.get_time() + this.FadeInTime; this.mTextNeedsUpdate = this.mNumCharacters > 0; this.mFadingOut = false; if (string.IsNullOrEmpty(this.VoiceSheetName) || string.IsNullOrEmpty(this.VoiceCueName)) { this.FadeOutVoice(); } else { this.mVoice = new MySound.Voice(this.VoiceSheetName, (string)null, (string)null); this.mVoice.Play(this.VoiceCueName, 0.0f); this.VoiceCueName = (string)null; } }
public void AdjustWidth(string bodyText) { if (Object.op_Equality((Object)this.BodyText, (Object)null) || !this.AutoExpandWidth) { return; } EventDialogBubbleCustom.Element[] elementArray = EventDialogBubbleCustom.SplitTags(bodyText); StringBuilder stringBuilder = new StringBuilder(elementArray.Length); for (int index = 0; index < elementArray.Length; ++index) { if (!string.IsNullOrEmpty(elementArray[index].Value)) { stringBuilder.Append(elementArray[index].Value); } } float num = Mathf.Min(this.BodyText.get_cachedTextGeneratorForLayout().GetPreferredWidth(stringBuilder.ToString(), this.BodyText.GetGenerationSettings(Vector2.get_zero())) / this.BodyText.get_pixelsPerUnit(), this.MaxBodyTextWidth) + this.mBaseWidth; RectTransform transform = ((Component)this).get_transform() as RectTransform; Vector2 sizeDelta = transform.get_sizeDelta(); sizeDelta.x = (__Null)(double)Mathf.Max((float)sizeDelta.x, num); transform.set_sizeDelta(sizeDelta); }