Example #1
0
 private void PlayBigCharacterQuote(Notification quote, string text, string soundName, float durationSeconds)
 {
     if (this.m_quote != null)
     {
         UnityEngine.Object.Destroy(this.m_quote.gameObject);
     }
     this.m_quote = quote;
     this.m_quote.ChangeText(text);
     TransformUtil.AttachAndPreserveLocalTransform(this.m_quote.transform, Board.Get().FindBone("OffScreenSpeaker1"));
     this.m_quote.transform.localPosition    = Vector3.zero;
     this.m_quote.transform.localScale       = (Vector3)(Vector3.one * 0.01f);
     this.m_quote.transform.localEulerAngles = Vector3.zero;
     if (!string.IsNullOrEmpty(soundName))
     {
         QuoteSoundCallbackData callbackData = new QuoteSoundCallbackData {
             m_quote           = this.m_quote,
             m_durationSeconds = durationSeconds
         };
         AssetLoader.Get().LoadSound(soundName, new AssetLoader.GameObjectCallback(this.OnBigQuoteSoundLoaded), callbackData, false, SoundManager.Get().GetPlaceholderSound());
     }
     else
     {
         this.m_quote.PlayBirthWithForcedScale(Vector3.one);
         if (durationSeconds > 0f)
         {
             this.DestroyNotification(this.m_quote, durationSeconds);
         }
     }
 }
Example #2
0
    private void OnQuoteSoundLoaded(string name, GameObject go, object userData)
    {
        QuoteSoundCallbackData data = (QuoteSoundCallbackData)userData;

        if (data.m_quote == null)
        {
            UnityEngine.Object.Destroy(go);
        }
        else if (go == null)
        {
            UnityEngine.Debug.LogWarning("Quote Sound failed to load!");
            this.PlayQuoteWithoutSound((data.m_durationSeconds <= 0f) ? 8f : data.m_durationSeconds);
        }
        else
        {
            AudioSource component = go.GetComponent <AudioSource>();
            this.m_quote.AssignAudio(component);
            SoundManager.Get().PlayPreloaded(component);
            this.m_quote.PlayBirthWithForcedScale((UniversalInputManager.UsePhoneUI == null) ? this.NOTIFICATION_SCALE : this.NOTIFICATION_SCALE_PHONE);
            float delaySeconds = Mathf.Max(data.m_durationSeconds, component.clip.length);
            this.DestroyNotification(this.m_quote, delaySeconds);
            if (this.m_quote.clickOff != null)
            {
                this.m_quote.clickOff.SetData(this.m_quote);
                this.m_quote.clickOff.AddEventListener(UIEventType.PRESS, new UIEvent.Handler(this.ClickNotification));
            }
        }
    }
Example #3
0
 private void PlayCharacterQuote(Notification quote, Vector3 position, string text, string soundName, float durationSeconds, CanvasAnchor anchorPoint = 1)
 {
     if (this.m_quote != null)
     {
         UnityEngine.Object.Destroy(this.m_quote.gameObject);
     }
     this.m_quote = quote;
     this.m_quote.ChangeText(text);
     this.m_quote.transform.position   = position;
     this.m_quote.transform.localScale = new Vector3(0.01f, 0.01f, 0.01f);
     OverlayUI.Get().AddGameObject(this.m_quote.gameObject, anchorPoint, false, CanvasScaleMode.HEIGHT);
     if (!string.IsNullOrEmpty(soundName))
     {
         QuoteSoundCallbackData callbackData = new QuoteSoundCallbackData {
             m_quote           = this.m_quote,
             m_durationSeconds = durationSeconds
         };
         AssetLoader.Get().LoadSound(soundName, new AssetLoader.GameObjectCallback(this.OnQuoteSoundLoaded), callbackData, false, SoundManager.Get().GetPlaceholderSound());
     }
     else
     {
         this.PlayQuoteWithoutSound(durationSeconds);
     }
 }