Ejemplo n.º 1
0
 public override void PreStart()
 {
     if (!Object.op_Equality((Object)this.mBubble, (Object)null))
     {
         return;
     }
     this.mBubble = EventTelopBubble.Find(this.ActorID);
     if (Object.op_Equality((Object)this.mBubble, (Object)null) && this.mBubbleResource != null)
     {
         this.mBubble = Object.Instantiate(this.mBubbleResource.asset) as EventTelopBubble;
         ((Component)this.mBubble).get_transform().SetParent(((Component)this.ActiveCanvas).get_transform(), false);
         this.mBubble.BubbleID = this.ActorID;
         ((Component)this.mBubble).get_transform().SetAsLastSibling();
         ((Component)this.mBubble).get_gameObject().SetActive(false);
     }
     this.mBubble.AdjustWidth(this.mTextData);
 }
Ejemplo n.º 2
0
        private void FlushText()
        {
            string mTextQueue = this.mTextQueue;

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

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

            EventTelopBubble.Ctx ctx = new EventTelopBubble.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());
            if (this.TextColor)
            {
                ctx.Color = Color32.op_Implicit(Color.get_white());
            }
            if (this.TextPosition == Event2dAction_Telop.TextPositionTypes.Center)
            {
                this.BodyText.set_alignment((TextAnchor)4);
            }
            else if (this.TextPosition == Event2dAction_Telop.TextPositionTypes.Right)
            {
                this.BodyText.set_alignment((TextAnchor)5);
            }
            else
            {
                this.BodyText.set_alignment((TextAnchor)3);
            }
            this.mNumCharacters = 0;
            this.Parse(EventTelopBubble.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;
        }
Ejemplo n.º 3
0
        public void AdjustWidth(string bodyText)
        {
            if (UnityEngine.Object.op_Equality((UnityEngine.Object) this.BodyText, (UnityEngine.Object)null) || !this.AutoExpandWidth)
            {
                return;
            }
            EventTelopBubble.Element[] elementArray = EventTelopBubble.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);
        }