示例#1
0
        private void FlushText()
        {
            string mTextQueue = this.mTextQueue;

            this.mTextQueue = (string)null;
            if (this.mCharacters == null || this.mCharacters.Length < mTextQueue.Length)
            {
                this.mCharacters = new EventDialogBubble.Character[mTextQueue.Length * 2];
            }
            string s = mTextQueue.Replace("<br>", "\n");

            EventAction_Dialog.TextSpeedTypes speed = EventAction_Dialog.TextSpeedTypes.Normal;
            int n = 0;

            EventDialogBubble.Ctx ctx = new EventDialogBubble.Ctx();
            ctx.Interval        = speed.ToFloat();
            ctx.Color           = Color32.op_Implicit(!UnityEngine.Object.op_Inequality((UnityEngine.Object) this.BodyText, (UnityEngine.Object)null) ? Color.get_black() : ((Graphic)this.BodyText).get_color());
            this.mNumCharacters = 0;
            this.Parse(EventDialogBubble.SplitTags(s), ref n, (string)null, ctx);
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.BodyText, (UnityEngine.Object)null))
            {
                this.BodyText.set_text(string.Empty);
            }
            this.mStartTime       = Time.get_time() + this.FadeInTime;
            this.mTextNeedsUpdate = this.mNumCharacters > 0;
            this.mFadingOut       = false;
            this.mCurrentEmotion  = this.Emotion;
            if (string.IsNullOrEmpty(this.VoiceSheetName) || string.IsNullOrEmpty(this.VoiceCueName))
            {
                this.FadeOutVoice();
            }
            else
            {
                this.mVoice = new MySound.Voice(this.VoiceSheetName, (string)null, (string)null, EventAction.IsUnManagedAssets(this.VoiceSheetName, false));
                this.mVoice.Play(this.VoiceCueName, 0.0f, false);
                this.VoiceCueName = (string)null;
            }
        }
示例#2
0
        public void AdjustWidth(string bodyText)
        {
            if (UnityEngine.Object.op_Equality((UnityEngine.Object) this.BodyText, (UnityEngine.Object)null) || !this.AutoExpandWidth)
            {
                return;
            }
            EventDialogBubble.Element[] elementArray = EventDialogBubble.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);
        }