IEnumerator Popup(CartridgeDataHolder _cartridge) { CartridgeData uiCartridgeToFill; transform.DOMove(new Vector3(Screen.width / 2, Screen.height / 2, 0), 1f, false); textContainer.DOFade(.3f, 1f); textUI.DOFade(1f, 0f); yield return(new WaitForSeconds(1f)); char[] temp = dialog.ToCharArray(); for (int i = 0; i < dialog.Length; ++i) { textUI.text = textUI.text + temp[i]; yield return(new WaitForSeconds(.05f)); } cassetteUI.transform.DOMove(new Vector3(Screen.width / 2, Screen.height / 2 + 75, 0), 1f, false); cassetteUI.DOColor(cassetteColor, 1f); yield return(new WaitForSeconds(1f)); if (cassette != null) { uiCartridgeToFill = cassetteRotor.ReturnNextUnknownCassette(); uiCartridgeToFill.SetKnown(cassette); } readyUI.SetActive(true); SetState(POPUP_STATE.IDLE); }
public void SetCurPlayer(int curPlayerId) { _lotteryBtn.transform.GetText("Text").text = string.Format(I18NManager.Get("ActivityTemplate_ActivityTemplateLotteryPlayerBtn"), GlobalData.FavorabilityMainModel.GetPlayerName((PlayerPB)curPlayerId)); if (_sequence != null) { _sequence.Kill(); } Tween alphaAnim1 = _activityBgImg.DOColor(new Color(1, 1, 1, 0), 0.3f); alphaAnim1.onComplete = () => { _activityBgImg.texture = ResourceManager.Load <Texture>("ActivityTemplate/Activity_Template_Bg_" + curPlayerId); }; Tween alphaAnim2 = _activityBgImg.DOColor(new Color(1, 1, 1, 1), 0.3f); _sequence = DOTween.Sequence() .Append(alphaAnim1) .Append(alphaAnim2); foreach (Transform t in _tabs) { if (t.gameObject.name == curPlayerId.ToString()) { t.Find("Red").gameObject.Show(); } else { t.Find("Red").gameObject.Hide(); } } }
private void PauseGame() { blur.gameObject.SetActive(true); blur.DOColor(AnimationsInfo.FadedColor, AnimationsInfo.UIAnimationDuration).onComplete += () => { Game.GameState = GameState.Paused; }; }
public void Open() { gameObject.SetActive(true); _window.localScale = Vector3.zero; _tintedGlass.color = new UnityEngine.Color(0.5f, 0.5f, 0.5f, 0); _tintedGlass.DOColor(new UnityEngine.Color(0.5f, 0.5f, 0.5f, 0.5f), Duration); _window.DOScale(1, Duration); }
public void FadeOffUI() { if (videoPlayer.clip != null) { targetColor = whiteAlpha0; rawImage.DOColor(targetColor, fadeOffDuration).OnComplete(() => fadeOffComplete = true); instructionText.DOColor(targetColor, fadeOffDuration); } }
public void Play(Color colr, string track) { Color alphaColor = new Color(colr.r, colr.g, colr.b, .25f); cassette.playGeneric(); ui.DOColor(alphaColor, .5f); StartCoroutine(resetText(track)); }
public void loadMenu(string MenuName) { Color c = fundido.color; c.a = 1; if (!fundido.gameObject.activeInHierarchy) { fundido.gameObject.SetActive(true); } fundido.DOColor(c, 2f).OnComplete(() => { activeMenu(MenuName); VueltaNegro(); }).Play(); }
public void FadeOut() { var aniTime = 0.5f; Dialog.DOFade(0f, 0.2f); Text.DOFade(0f, 0.2f); Draw.DOColor(new Color(0.4f, 0.4f, 0.4f, 1f), aniTime); var pos = IsLeft ? new Vector2(-50, -30) : new Vector2(50, -30); Draw.rectTransform.DOAnchorPos(pos, aniTime); }
public void ShowBanner(string text, float delay = 0) { Overlay.DOColor(new Color(0, 0, 0, 0.5f), 0.25f) .SetDelay(delay) .OnComplete(() => { Banner.gameObject.transform.DOPunchPosition(new Vector3(2f, 2f, 2f), 1f); BannerText.text = text; BannerTextShadow.text = text; Banner.gameObject.SetActive(true); }); }
public void Open() { InitBtnData(); if (btn == null) { return; } btn.transform.localScale = 0.6f * Vector3.one; Sequence seq = DOTween.Sequence(); if (rawImage != null) { rawImage.color = new Vector4(1, 1, 1, 0.6f); seq.Append(btn.transform.DOScale(1.05f * Vector3.one, 0.17f)); seq.Insert(0, rawImage.DOColor(colorNormal, 0.17f)); seq.Append(btn.transform.DOScale(0.96f * Vector3.one, 0.17f)); seq.Append(btn.transform.DOScale(Vector3.one, 0.16f).OnComplete ( delegate { if (ac != null) { ac(); } }) );//关闭 } else { if (image == null) { Debug.LogError("UI关闭Error,检查UI关闭参数【参数是否是Image?】"); } image.color = new Vector4(1, 1, 1, 0.6f); seq.Append(btn.transform.DOScale(1.05f * Vector3.one, 0.17f)); seq.Insert(0, image.DOColor(colorNormal, 0.17f)); seq.Append(btn.transform.DOScale(0.96f * Vector3.one, 0.17f)); seq.Append(btn.transform.DOScale(Vector3.one, 0.16f).OnComplete ( delegate { if (ac != null) { ac(); } }) );//关闭 } }
public void Click() { InitBtnData(); Sequence seq = DOTween.Sequence(); if (rawImage != null) { rawImage.color = colorNormal; btn.transform.localScale = Vector3.one; seq.Append(btn.transform.DOScale(0.8f * Vector3.one, 0.17f)); seq.Insert(0, rawImage.DOColor(colorNormal, 0.17f)); seq.Insert(0.17f, rawImage.DOColor(colorNormal, 0.12f)); seq.Append(btn.transform.DOScale(Vector3.one, 0.12f).OnComplete ( delegate { if (ac != null) { ac(); } }) );//关闭 } else { if (image == null) { Debug.LogError("UI关闭Error,检查UI关闭参数【参数是否是Image?】"); } image.color = colorNormal; btn.transform.localScale = Vector3.one; seq.Append(btn.transform.DOScale(0.8f * Vector3.one, 0.17f)); seq.Insert(0, image.DOColor(colorNormal, 0.17f)); seq.Insert(0.17f, image.DOColor(colorNormal, 0.12f)); seq.Append(btn.transform.DOScale(Vector3.one, 0.12f).OnComplete ( delegate { if (ac != null) { ac(); } }) );//关闭 } } }
public void FlashWhite() { flashImage.color = Color.clear; Sequence mySequence = DOTween.Sequence(); mySequence.Append(flashImage.DOColor(Color.white, animationDuration).SetEase(easing)).Append(flashImage.DOColor(Color.clear, animationDuration).SetEase(easing)); }
public static Tweener DOColor(RawImage target, Color endValue, float duration, float delay = 0, System.Action doComplete = null) { Tweener tweener = target.DOColor(endValue, duration); SetTweenerComplete(tweener, delay, doComplete); return(tweener); }
public void MaskAni(float tweenSpeed1, float tweenSpeed2, Action aniOnComplete) { var blackAni1 = _maskBlack.DOColor(new Color(_maskBlack.color.r, _maskBlack.color.g, _maskBlack.color.b, 0), tweenSpeed1).SetEase(Ease.Unset); var whiteAni1 = _maskWhite.DOColor(new Color(_maskWhite.color.r, _maskWhite.color.g, _maskWhite.color.b, 1), tweenSpeed2).SetEase(Ease.Unset); var whiteAni2 = _maskWhite.DOColor(new Color(_maskWhite.color.r, _maskWhite.color.g, _maskWhite.color.b, 0), tweenSpeed2).SetEase(Ease.Unset); Sequence sequences = DOTween.Sequence() .Append(blackAni1) .Append(whiteAni1) .Append(whiteAni2); sequences.onComplete = () => { aniOnComplete(); }; }
// Update is called once per frame void LateUpdate() { if (!open && !target.isOpen && targetMenu.blocksRaycasts) { open = true; image.DOColor(targetColor, duration) .SetEase(ease) .OnComplete(() => { image.raycastTarget = true; }); } else if (open && target.isOpen) { open = false; image.raycastTarget = false; image.DOColor(initialColor, duration).SetEase(ease); } }
private void ChangeState(HealthState p_state) { if (_state == p_state) { return; } _state = p_state; if (_image == null) { _image = GetComponent <RawImage>(); } switch (_state) { case HealthState.CLEAN: _image.DOColor(Color.white, .5f); //_image.color = Color.white; break; case HealthState.CURED: _image.DOColor(Color.green, .5f); //_image.color = Color.green; break; case HealthState.INFECTED: _image.DOColor(Color.red, .5f); //_image.color = Color.red; break; case HealthState.DEAD: stationary = true; body.bodyType = RigidbodyType2D.Static; _image.DOColor(Color.blue, .5f); //_image.color = new Color(158,255,255); break; case HealthState.QUARANTINED: stationary = true; body.bodyType = RigidbodyType2D.Static; _image.DOColor(Color.magenta, .5f); break; } }
public void Flash() { if (light != null) { light.DOIntensity(1.3f, .4f).SetLoops(-1, LoopType.Yoyo).SetEase(Ease.Linear); } else { text.DOColor(new Color(255, 255, 255, 0), .4f).SetLoops(-1, LoopType.Yoyo).SetEase(Ease.Linear); } }
private void OnChangeRealities() { if (currentReality == CurrentReality.Reality1) { Reality1.DOColor(new Color(Reality1.color.r, Reality1.color.g, Reality1.color.b, 0), 0.01f); Reality2.DOColor(new Color(Reality2.color.r, Reality2.color.g, Reality2.color.b, 255), 0.01f); Debug.Log("1"); currentReality = CurrentReality.Reality2; return; } else { Reality1.DOColor(new Color(Reality1.color.r, Reality1.color.g, Reality1.color.b, 255), 0.01f); Reality2.DOColor(new Color(Reality2.color.r, Reality2.color.g, Reality2.color.b, 0), 0.01f); Debug.Log("2"); currentReality = CurrentReality.Reality1; return; } }
/// <summary> /// /// </summary> /// <param name="fadeOut"></param> /// <param name="time"></param> /// <param name="scene"></param> /// <returns></returns> private IEnumerator coFade(bool fadeOut, float time, string scene) { if (fadeOut) { // ブラックアウト var endColor = image.color; endColor.a = 1; var beginColor = image.color; beginColor.a = 0; image.color = beginColor; image.DOColor(endColor, time); image.enabled = true; yield return(new WaitForSeconds(time)); if (scene.Length != 0) { SceneManager.LoadScene(scene); } } else { // ブラックイン var endColor = image.color; endColor.a = 0; var beginColor = image.color; beginColor.a = 1; image.enabled = true; image.color = beginColor; image.DOColor(endColor, time); yield return(new WaitForSeconds(time)); image.enabled = false; } isFade = false; yield break; }
public void StartGame() { if (_gameRunning) { return; } _gameRunning = true; EffectAudioSource.PlayOneShot(EffectAudioSource.clip); _introTweens[0] = _menuTransform.DOScale(new Vector3(100.5f, 100.5f, 1), ZoomPeriod).SetEase(Ease.InCubic).OnStart(() => { _introTweens[1] = _bgTransform.DOScale(new Vector3(4f, 4f, 1), ZoomPeriod + 10f).SetEase(Ease.InCubic); _introTweens[2] = _fgTransform.DOScale(new Vector3(4f, 4f, 1), ZoomPeriod + 10f).SetEase(Ease.InCubic); _introTweens[3] = _logoImage.DOColor(Color.clear, (float)ZoomPeriod / 2).SetDelay((float)ZoomPeriod / 2) .OnComplete(() => { SkipIntroButton.SetActive(true); MainMenu.GetComponent <CanvasGroup>().interactable = false; MainMenu.GetComponent <CanvasGroup>().blocksRaycasts = false; _introTweens[4] = IntroText1.DOFade(1, TextFadeTime).OnComplete(() => { _introTweens[5] = IntroText1.DOFade(0, TextFadeTime).SetDelay(TextTime) .OnComplete(() => { _introTweens[6] = IntroText2.DOFade(1, TextFadeTime).OnComplete(() => { _introTweens[7] = IntroText2.DOFade(0, TextFadeTime).SetDelay(TextTime) .OnComplete(() => { _introTweens[8] = IntroText3.DOFade(1, TextFadeTime + ExtraDelay).OnComplete(() => { _introTweens[9] = IntroText3.DOFade(0, TextFadeTime + ExtraDelay).SetDelay(TextTime) .OnComplete(() => { SkipIntroButton.SetActive(false); MainMenu.SetActive(false); LightBeam.SetActive(true); StartCoroutine(DelayChange()); }); }); }); }); }); }); }); }); }
public void StarAni() { var color = _contentImg.color; Tween contentImgAlpha = _contentImg.DOColor(new Color(color.r, color.g, color.b, 1), 0.3f); contentImgAlpha.onComplete = () => { new AssetLoader().LoadAudio(AssetLoader.GetBackgrounMusicById("coaxsleepanibg"), (clip, loader) => { _audioClip = clip; }); _isStar = true; AudioManager.Instance.PlayBackgroundMusic(_audioClip); _slider.gameObject.Show(); _skipBtn.gameObject.Show(); SetCardAni(); }; }
public void DoNext() { if (_step == 3) { //显示大屏幕粉丝的动画 _tvImage.gameObject.Show(); _tvImage.color = new Color(1, 1, 1, 0.3f); _tvImage.DOColor(Color.white, 0.8f).SetLoops(-1, LoopType.Yoyo); ClientTimer.Instance.DelayCall(() => { SendMessage(new Message(MessageConst.CMD_VISITBATTLE_FANS_CALL_ANIMATION_FINISH)); }, 3); _step++; } }
private void ShowNext() { int index = Random.Range(0, 4); if (_image1.gameObject.activeSelf == false) { _image1.texture = ResourceManager.Load <Texture>("Card/Image/MiddleCard/" + Ids[index], ModuleName); _image1.gameObject.Show(); _image2.gameObject.Hide(); _image1.color = new Color(1, 1, 1, 0.5f); _image1.DOColor(Color.white, 0.5f); } else { _image2.texture = ResourceManager.Load <Texture>("Card/Image/MiddleCard/" + Ids[index], ModuleName); _image1.gameObject.Hide(); _image2.gameObject.Show(); _image2.color = new Color(1, 1, 1, 0.5f); _image2.DOColor(Color.white, 0.5f); } _delayCallCoroutine = ClientTimer.Instance.DelayCall(ShowNext, 4); }
//具体播放的效果 void TweenPlay(Config config) { Transform t = config.target == null ? transform : config.target; AudioSource audioSource = t.GetComponent <AudioSource>(); if (audioSource == null) { audioSource = t.gameObject.AddComponent <AudioSource>(); } audioSource.volume = 0.3f; audioSource.playOnAwake = false; if (config.source != null) { audioSource.clip = config.source; audioSource.Play(); } switch (config.type) { case Type.Position: if (tweener == null) { t.position = config.vector3FromValue; } else { if (!tweener.IsPlaying()) { t.position = config.vector3FromValue; } } tweener = t.DOMove(config.vector3ToValue, config.duration); break; case Type.LocalPosition: if (tweener == null) { t.localPosition = config.vector3FromValue; } else { if (!tweener.IsPlaying()) { t.localPosition = config.vector3FromValue; } } tweener = t.DOLocalMove(config.vector3ToValue, config.duration); break; #region ex meichao 2017_3_1 case Type.LocalPositionX: if (tweener == null) { // t.localPosition = config.vector3FromValue; } else { if (!tweener.IsPlaying()) { t.localPosition = new Vector3(config.floatFromValue, t.localPosition.y, t.localPosition.z); } } tweener = t.DOLocalMoveX(config.floatToValue, config.duration); break; case Type.LocalPositionY: if (tweener == null) { // t.localPosition = config.vector3FromValue; } else { if (!tweener.IsPlaying()) { t.localPosition = new Vector3(t.localPosition.x, config.floatFromValue, t.localPosition.z); } } tweener = t.DOLocalMoveY(config.floatToValue, config.duration); break; case Type.LocalPositionZ: if (tweener == null) { // t.localPosition = config.vector3FromValue; } else { if (!tweener.IsPlaying()) { t.localPosition = new Vector3(t.localPosition.x, t.localPosition.y, config.floatFromValue); } } tweener = t.DOLocalMoveZ(config.floatToValue, config.duration); break; #endregion case Type.EulerAngle: if (tweener == null) { t.eulerAngles = config.vector3FromValue; } else { if (!tweener.IsPlaying()) { t.eulerAngles = config.vector3FromValue; } } tweener = t.DORotate(config.vector3ToValue, config.duration); break; case Type.LocalEulerAngle: if (tweener == null) { t.localEulerAngles = config.vector3FromValue; } else { if (!tweener.IsPlaying()) { t.localEulerAngles = config.vector3FromValue; } } tweener = t.DOLocalRotate(config.vector3ToValue, config.duration); break; case Type.Scale: if (tweener == null) { t.localScale = config.vector3FromValue; } else { if (!tweener.IsPlaying()) { t.localScale = config.vector3FromValue; } } tweener = t.DOScale(config.vector3ToValue, config.duration); break; case Type.Color: Image image = t.GetComponent <Image>(); if (image != null) { if (tweener == null) { image.color = config.colorFromValue; } else { if (!tweener.IsPlaying()) { image.color = config.colorFromValue; } } tweener = image.DOColor(config.colorToValue, config.duration); } RawImage rawImage = t.GetComponent <RawImage>(); if (rawImage != null) { if (tweener == null) { rawImage.color = config.colorFromValue; } else { if (!tweener.IsPlaying()) { rawImage.color = config.colorFromValue; } } tweener = rawImage.DOColor(config.colorToValue, config.duration); } Text text = t.GetComponent <Text>(); if (text != null) { if (tweener == null) { text.color = config.colorFromValue; } else { if (!tweener.IsPlaying()) { text.color = config.colorFromValue; } } tweener = text.DOColor(config.colorToValue, config.duration); } break; case Type.Alpha: CanvasGroup canvasGroup = t.GetComponent <CanvasGroup>(); if (canvasGroup != null) { if (tweener == null) { canvasGroup.alpha = config.floatFromValue; } else { if (!tweener.IsPlaying()) { canvasGroup.alpha = config.floatFromValue; } } tweener = canvasGroup.DOFade(config.floatToValue, config.duration); } break; } if (tweener != null) { tweener.SetDelay(config.delay); if (config.ease == Ease.INTERNAL_Custom) { tweener.SetEase(config.curve); } else { tweener.SetEase(config.ease); } } tweener.SetUpdate(true); tweener.Play(); }
/// <summary> /// 隐藏截屏 /// </summary> public void HidenScreenBg() { screenBg.DOColor(new Color(1, 1, 1, 0), 0.5f).OnComplete(ScreenHidenComplete); }
void Hide() { ui.DOColor(unknownColor, .25f); textLabel.DOFade(.75f, .25f); }
public void TransitionIn() { movementAnchor.DOAnchorPosX(startingPosition.x, transitionTime); fadeScreen.DOColor(startingColor, transitionTime); }
private void ToggleColor(bool value) { backgroundImage.DOColor(value ? onColor : offColor, tweenTime); }