Ejemplo n.º 1
0
        public Texture2D GetEmotionImage(PortraitSet.EmotionTypes type)
        {
            switch (type)
            {
            case PortraitSet.EmotionTypes.Smile:
                if (!Object.op_Equality((Object)this.Smile, (Object)null))
                {
                    return(this.Smile);
                }
                break;

            case PortraitSet.EmotionTypes.Sad:
                if (!Object.op_Equality((Object)this.Sad, (Object)null))
                {
                    return(this.Sad);
                }
                break;

            case PortraitSet.EmotionTypes.Angry:
                if (!Object.op_Equality((Object)this.Angry, (Object)null))
                {
                    return(this.Angry);
                }
                break;
            }
            return(this.Normal);
        }
Ejemplo n.º 2
0
        public override void OnActivate()
        {
            if (Object.op_Inequality((Object)this.mBubble, (Object)null) && !((Component)this.mBubble).get_gameObject().get_activeInHierarchy())
            {
                for (int index = 0; index < EventDialogBubble.Instances.Count && Object.op_Inequality((Object)EventDialogBubble.Instances[index], (Object)this.mBubble); ++index)
                {
                    if (EventDialogBubble.Instances[index].BubbleID == this.ActorID)
                    {
                        EventDialogBubble.Instances[index].Close();
                    }
                }
                ((Component)this.mBubble).get_gameObject().SetActive(true);
            }
            if (!Object.op_Inequality((Object)this.mBubble, (Object)null))
            {
                return;
            }
            if (!string.IsNullOrEmpty(this.mVoiceID))
            {
                string[] idPair = EventAction_Dialog.GetIDPair(this.mVoiceID);
                if (idPair != null)
                {
                    this.mBubble.VoiceSheetName = idPair[0];
                    this.mBubble.VoiceCueName   = idPair[1];
                }
            }
            RectTransform transform1 = ((Component)this.mBubble).get_transform() as RectTransform;

            for (int index = 0; index < EventDialogBubble.Instances.Count; ++index)
            {
                RectTransform transform2 = ((Component)EventDialogBubble.Instances[index]).get_transform() as RectTransform;
                if (Object.op_Inequality((Object)transform1, (Object)transform2))
                {
                    Rect rect = transform1.get_rect();
                    // ISSUE: explicit reference operation
                    if (((Rect)@rect).Overlaps(transform2.get_rect()))
                    {
                        EventDialogBubble.Instances[index].Close();
                    }
                }
            }
            this.mBubble.SetName(this.mUnit == null ? "???" : this.mUnit.name);
            this.mBubble.SetBody(this.mTextData);
            if (this.mPortraitResource != null && this.mPortraitResource.isDone)
            {
                if (this.mPortraitResource.asset is PortraitSet)
                {
                    this.mBubble.PortraitSet   = (PortraitSet)this.mPortraitResource.asset;
                    this.mBubble.CustomEmotion = (Texture2D)null;
                }
                else
                {
                    this.mBubble.CustomEmotion = (Texture2D)this.mPortraitResource.asset;
                }
            }
            this.mBubble.Emotion = this.Emotion;
            this.mBubble.Open();
        }
Ejemplo n.º 3
0
 private void UpdatePortrait()
 {
     if (UnityEngine.Object.op_Equality((UnityEngine.Object) this.PortraitFront, (UnityEngine.Object)null) || UnityEngine.Object.op_Equality((UnityEngine.Object) this.PortraitSet, (UnityEngine.Object)null) && UnityEngine.Object.op_Equality((UnityEngine.Object) this.CustomEmotion, (UnityEngine.Object)null))
     {
         return;
     }
     if (this.mPortraitInitialized && this.Emotion == this.mCurrentEmotion && (UnityEngine.Object.op_Equality((UnityEngine.Object) this.CustomEmotion, (UnityEngine.Object)null) || UnityEngine.Object.op_Equality((UnityEngine.Object) this.PortraitFront.get_texture(), (UnityEngine.Object) this.CustomEmotion)))
     {
         this.mPortraitTransition = 0.0f;
     }
     else if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.PortraitBack, (UnityEngine.Object)null) && this.mPortraitInitialized)
     {
         this.mPortraitTransition += Time.get_deltaTime();
         if ((double)this.mPortraitTransition < (double)this.PortraitTransitionTime)
         {
             float num = Mathf.Clamp01(this.mPortraitTransition / this.PortraitTransitionTime);
             ((Graphic)this.PortraitFront).set_color(new Color(1f, 1f, 1f, num));
             this.PortraitBack.set_texture(this.PortraitFront.get_texture());
             if (UnityEngine.Object.op_Equality((UnityEngine.Object) this.CustomEmotion, (UnityEngine.Object)null))
             {
                 this.PortraitFront.set_texture((Texture)this.PortraitSet.GetEmotionImage(this.Emotion));
             }
             else
             {
                 this.PortraitFront.set_texture((Texture)this.CustomEmotion);
             }
             ((Graphic)this.PortraitBack).set_color(new Color(1f, 1f, 1f, 1f - num));
             ((Component)this.PortraitBack).get_gameObject().SetActive(true);
         }
         else
         {
             this.mCurrentEmotion = this.Emotion;
             ((Graphic)this.PortraitFront).set_color(new Color(1f, 1f, 1f, 1f));
             ((Component)this.PortraitBack).get_gameObject().SetActive(false);
         }
     }
     else
     {
         if (UnityEngine.Object.op_Equality((UnityEngine.Object) this.CustomEmotion, (UnityEngine.Object)null))
         {
             this.PortraitFront.set_texture((Texture)this.PortraitSet.GetEmotionImage(this.mCurrentEmotion));
         }
         else
         {
             this.PortraitFront.set_texture((Texture)this.CustomEmotion);
         }
         this.mPortraitInitialized = true;
     }
 }
Ejemplo n.º 4
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;
            }
        }