private IEnumerator OnAddToStack() { _shouldFadeIn = true; yield return(delayTime); if (_shouldFadeIn) { UITweenActivator tweener = new UITweenActivator(gameObject, 1); tweener.PlayForward(); _shouldFadeIn = false; _hasStarted = true; timer = 0; } }
private void ActivateBubbleContainer(bool activate) { if (activate) { bool doTweenOn = false; if (bubbleContainer.activeSelf) { if (closeTween != null && closeTween.IsRunning) // Stop closing tweens that might be running { closeTween.onFinished -= OnCloseTweenFinished; closeTween.ResetToBeginning(); doTweenOn = true; } } else { NGUITools.SetActive(bubbleContainer, true); doTweenOn = true; } if (doTweenOn) { // play open tween if (openTween == null) { openTween = new UITweenActivator(bubbleContainer, 0, false); } openTween.PlayForward(); } } else if (bubbleContainer.activeSelf) { // play end tween if (closeTween == null) { closeTween = new UITweenActivator(bubbleContainer, 1, false); } if (!closeTween.IsRunning) { closeTween.onFinished += OnCloseTweenFinished; closeTween.PlayForward(); } } }
public void StopUsingChatBubble(GameObject chatBubble) { for (int chatBubbleIndex = 0; chatBubbleIndex < _allChatBubbles.Count; ++chatBubbleIndex) { if (_allChatBubbles[chatBubbleIndex].isInUseCurrently && chatBubble == _allChatBubbles[chatBubbleIndex].bubble) { UITweenActivator activator = new UITweenActivator(chatBubble, 1); activator.onFinished += () => { _allChatBubbles[chatBubbleIndex].isInUseCurrently = false; NGUITools.SetActive(_allChatBubbles[chatBubbleIndex].bubble, _allChatBubbles[chatBubbleIndex].isInUseCurrently); }; activator.PlayForward(); return; } } EB.Debug.LogWarning("ChatBubbleContainer.StopUsingChatBubble() chatBubble could not be found"); }
private IEnumerator OnRemoveFromStack() { _shouldFadeIn = false; if (_hasStarted) { UITweenActivator tweener = new UITweenActivator(gameObject, 1); tweener.PlayReverse(); _hasStarted = false; bool isFinished = false; tweener.onFinished += delegate() { isFinished = true; }; while (!isFinished) { yield return(null); } } StopAllCoroutines(); GameObject.Destroy(gameObject); }
private void LateUpdate() { if (null == _chatBubbleLabel) { return; } if ((Time.time - _displayStartTime) > kDisplayTimeSeconds) { Hide(); return; } if (_UICam == null) { _UICam = UICamera.mainCamera; } if (_gameCam == null) { _gameCam = Camera.main; } if (null == _UICam || null == _gameCam) { return; } float horizontalOffset = 0f; switch (bubbleTypeRequired) { case ChatBubbleContainer.ChatBubbleType.left: horizontalOffset = -0.5f; break; case ChatBubbleContainer.ChatBubbleType.right: horizontalOffset = 0.5f; break; default: break; } Vector3 screenPoint = _gameCam.WorldToScreenPoint(transform.position + Vector3.up * _offsetToTopOfCharactersHead); Vector3 bubblePosWorldPoint = _UICam.ScreenToWorldPoint(screenPoint); bubblePosWorldPoint.z = 0f; if (_chatBubble) { _chatBubble.transform.position = bubblePosWorldPoint; _chatBubble.transform.localPosition += new Vector3(_chatBubbleLabel.localSize.x * horizontalOffset, -_chatBubbleSprite.bottomAnchor.absolute, 0f); if (!_chatBubble.activeSelf) { NGUITools.SetActive(_chatBubble, true); UITweenActivator activator = new UITweenActivator(_chatBubble); activator.PlayForward(); //FusionAudio.PostEvent(FusionAudio.eEvent.DLG_common); } } }