private void OnSwipeRight() { TweenPosition tweenPos = gameObject.AddComponent <TweenPosition>(); tweenPos.animationCurve = ColorManagementSystemController.EasyInOutAnimCurve; Vector3 curerntPos = transform.localPosition; tweenPos.from = curerntPos; tweenPos.to = new Vector3(_notificationModel.MainBackground.width * 1.2f, curerntPos.y, curerntPos.z); tweenPos.duration = AnimationDurationTime; tweenPos.SetOnFinished(() => Destroy(tweenPos)); TweenAlpha tween = gameObject.AddComponent <TweenAlpha>(); tween.to = 0f; tween.duration = AnimationDurationTime; if (null != OnDismissedEvent) { OnDismissedEvent(_baseCard); } tween.SetOnFinished(() => { Destroy(tween); CloseNotification(); }); }
void StartAnimation_TweenPosition() { tweenPosition.from = transform.position; tweenPosition.to = PlayGameInstance.INSTANCE.PSC.PC.transform.position; tweenPosition.ResetToBeginning(); tweenPosition.PlayForward(); tweenPosition.SetOnFinished(EndAnimation); }
private void ShowWatch(bool first = false) { if (first) { for (int i = 0; i < watchPlayers.Length; ++i) { TweenPosition tp = watchPlayers [i]; tp.SetOnFinished(() => { tp.gameObject.SetActive(showWatchPlayer); }); tp.gameObject.SetActive(false); } } else { if (showWatchPlayer) { // 关闭 for (int i = 0; i < watchPlayers.Length; ++i) { TweenPosition tp = watchPlayers [i]; tp.ResetToBeginning(); tp.from = new Vector3(watchPlayerPosInterval * (i + 1), 0, 0); tp.to = Vector3.zero; tp.PlayForward(); tp.gameObject.SetActive(true); } showWatchPlayer = false; } else { // 打开 for (int i = 0; i < watchPlayers.Length; ++i) { TweenPosition tp = watchPlayers [i]; tp.ResetToBeginning(); tp.from = Vector3.zero; tp.to = new Vector3(watchPlayerPosInterval * (i + 1), 0, 0); tp.PlayForward(); tp.gameObject.SetActive(true); } showWatchPlayer = true; } } // 方向小标 if (showWatchPlayer) { watchAmmor.transform.localScale = new Vector3(-1, 1, 1); } else { watchAmmor.transform.localScale = Vector3.one; } }
IEnumerator _ExplodedToEnd() { yield return(new WaitForSeconds(m_effect.m_explodedWaitingTime)); TweenPosition tween = TweenPosition.Begin(m_goScoreEffect, m_effect.m_explodedToEndTime, m_effect.m_endPos); tween.method = UITweener.Method.EaseOut; tween.SetOnFinished(new EventDelegate(_OnArriveEnd)); }
public void Hide() { isShow = false; App.OnlyController = null; CancelTouch.enabled = false; TweenPos.onFinished.Clear(); TweenPos.SetOnFinished(OnHideFinished); TweenPos.PlayReverse(); }
public void Play(Vector3 from, Vector3 to, float dur, bool autoDestroy = true) { mAutoDestroy = autoDestroy; transform.position = from; TweenPosition tp = TweenPosition.Begin(gameObject, dur, to); tp.SetOnFinished(onFinish); tp.PlayForward(); }
public void StartShockEffect() { tp.enabled = true; tp.ResetToBeginning(); tp.PlayForward(); shockSpanTime = 0; shocking = true; tp.SetOnFinished(ShockFinished); startShockPotY = transform.position.y; preShockPot = transform.position; }
private int AniState = 0; //动画的状态,0:初始状态;1:展开状态 void Start() { posAni = GetComponent <TweenPosition>(); if (posAni == null) { return; } posAni.from = From; posAni.to = To; posAni.SetOnFinished(AniPlayOver); }
private void ShowBtn(Action callback = null) { gameObject.SetActive(true); Tween.enabled = true; Tween.onFinished.Clear(); if (null != callback) { Tween.SetOnFinished(new EventDelegate(() => { callback(); })); } Tween.PlayForward(); }
protected void Show() { this.mPanel.alpha = 1f; TweenPosition tweenPosition = UITweener.Begin <TweenPosition>(base.get_transform().get_gameObject(), 0.4f); tweenPosition.from = this.mOutDisplayPosition; tweenPosition.to = this.mStartLocalPosition; tweenPosition.ignoreTimeScale = false; tweenPosition.SetOnFinished(delegate { this.FinishedShowAnimation(); }); }
void _InitToExploded() { Vector3 targetPos = m_goScoreEffect.transform.localPosition; targetPos.x += Random.Range(-100.0f, 100.0f); targetPos.y += Random.Range(-200.0f, 0.0f); targetPos.z = 0.0f; TweenPosition tween = TweenPosition.Begin(m_goScoreEffect, m_effect.m_initToExplodedTime, targetPos); tween.method = UITweener.Method.EaseOut; tween.SetOnFinished(new EventDelegate(_ExplodedToEndFunc)); }
protected void Show(Vector3 to) { mPanel.alpha = 1f; TweenPosition tweenPosition = UITweener.Begin <TweenPosition>(base.transform.gameObject, 0.4f); tweenPosition.from = mOutDisplayPosition; tweenPosition.to = to; tweenPosition.ignoreTimeScale = false; tweenPosition.SetOnFinished(delegate { FinishedShowAnimation(); }); }
/// <summary> /// Shows the direction. /// </summary> /// <param name="uiWindow">User interface window.</param> /// <param name="state">If set to <c>true</c> state.</param> /// <param name="direct">Direct.</param> private void ShowDirection(GameObject uiWindow, bool state, int direct) { Vector3 from = Vector3.zero; Vector3 to = Vector3.zero; switch (direct) { case 1: from = Vector3.left * Screen.width; break; case 2: from = Vector3.right * Screen.width; break; case 3: from = Vector3.up * Screen.height; break; case 4: from = Vector3.down * Screen.height; break; default: Debug.LogError("Your parm is ERROR!Please use 1/2/3/ or 4"); break; } TweenPosition tp = uiWindow.GetOrAddComponent <TweenPosition>(); tp.from = from; tp.to = to; UIWindowControllerBase uiWindowController = uiWindow.GetOrAddComponent <UIWindowControllerBase>(); tp.duration = uiWindowController.duration; tp.animationCurve = uiWindowController.windowUIShowAnimationCurve; if (state) { NGUITools.SetActive(uiWindow, true); } if (!state) { tp.SetOnFinished(() => { DestroyUIWindow(uiWindow); }); tp.Play(false); } }
private void SelectedHexAnimation(Action onFinishedCallBack) { TweenPosition tweenPosition = TweenPosition.Begin(mTransform_AnimationTile.gameObject, 0.3f, mStrategyTopTaskManager.strategyCamera.transform.localPosition + new Vector3(0f, -78f, 196f)); TweenRotation.Begin(mTransform_AnimationTile.gameObject, 0.3f, Quaternion.AngleAxis(90f, Vector3.right)); TweenAlpha.Begin(mTransform_AnimationTile.gameObject, 0.8f, 0f); tweenPosition.SetOnFinished(delegate { if (onFinishedCallBack != null) { onFinishedCallBack(); } }); }
/// <summary> /// 动画移动 /// </summary> /// <param name="index"></param> private void scaleCenter(int index, float xD) { if (Mathf.Abs(xD) < GetComponent <RectTransform>().rect.width / 10) { int i = 0; foreach (Transform child in @group.transform) { var des = childLastPos[i]; TweenPosition tp = TweenPosition.Begin(child.gameObject, 0.5f, des); tp.easeType = EaseType.easeInQuad; i++; } } else { int i = 0; float ot = xD > 0 ? offset : -offset; foreach (Transform child in @group.transform) { var des = childLastPos[i] + new Vector3(ot, 0, 0); TweenPosition tp = TweenPosition.Begin(child.gameObject, 0.3f, des); tp.easeType = EaseType.easeInQuad; tp.SetOnFinished(() => { if (child.localPosition.x > (offset * (@group.transform.childCount / 2))) { child.localPosition = -offset * (@group.transform.childCount / 2) * Vector3.right; } else if (child.localPosition.x < (-offset * (@group.transform.childCount / 2))) { child.localPosition = offset * (@group.transform.childCount / 2) * Vector3.right; } beginDrag = false; }); if (index == i) { TweenScale ts = TweenScale.Begin(child.gameObject, 0.5f, Vector3.one * 1.04f); ts.easeType = EaseType.easeInQuad; } else { TweenScale ts = TweenScale.Begin(child.gameObject, 0.5f, Vector3.one * 0.82f); ts.easeType = EaseType.easeInQuad; } i++; } } }
private void Open() { while (!enableList[index]) { index++; if (index >= TweenList.Count) { if (callback != null) { callback(); callback = null; } PlayOver = true; return; } } TweenPosition curTween = TweenList[index]; curTween.gameObject.SetActive(true); curTween.Play(true); index++; if (index < TweenList.Count) { curTween.SetOnFinished(Open); } else { if (callback != null) { callback(); callback = null; } curTween.SetOnFinished(delegate() { PlayOver = true; }); } }
public void last() { if (node_content.childCount > 1) { return; } next_btn.enabled = false; last_btn.enabled = false; int old_id = content_id; Transform now_img = node_content.GetChild(0); content_id--; if (content_id < 0) { content_id = TextuerName.listTextuerProp[upItem].num - 1; } GameObject last_img = NGUITools.AddChild(node_content.gameObject, item_style.gameObject); last_img.SetActive(true); last_img.name = "last"; TweenPosition now_tp = now_img.GetComponent <TweenPosition>(); now_tp.from = now_p; now_tp.to = next_p; //last_img.GetComponent<UISprite>().spriteName = TextuerName.listTextuerProp[upItem].texture1 + (content_id+1).ToString(); Texture t = Resources.Load <Texture>("content/" + TextuerName.listTextuerProp[upItem].texture1 + (content_id + 1).ToString()); last_img.GetComponent <UITexture>().mainTexture = t; TweenPosition last_tp = last_img.GetComponent <TweenPosition>(); last_tp.from = last_p; last_tp.to = now_p; now_tp.enabled = true; now_tp.ResetToBeginning(); now_tp.PlayForward(); last_tp.enabled = true; last_tp.ResetToBeginning(); last_tp.PlayForward(); EventDelegate.Callback del = delegate { DotChangeColor(); Destroy(now_img.gameObject); last_img.name = "now"; next_btn.enabled = true; last_btn.enabled = true; }; last_tp.SetOnFinished(del); }
public void Exit() { if (isEnter) { isEnter = false; tp.PlayReverse(); tp.SetOnFinished(delegate { if (!isEnter) { Crane.AnimStop(); } }); } }
public void Hide(Action hiddenCallBack) { TweenPosition tweenPosition = UITweener.Begin <TweenPosition>(base.get_gameObject(), 0.3f); tweenPosition.from = base.get_gameObject().get_transform().get_localPosition(); tweenPosition.to = this.mVector3_HidePosition; tweenPosition.ignoreTimeScale = false; tweenPosition.SetOnFinished(delegate { if (hiddenCallBack != null) { hiddenCallBack.Invoke(); } }); }
public void Hide(Action hiddenCallBack) { TweenPosition tweenPosition = UITweener.Begin <TweenPosition>(base.gameObject, 0.3f); tweenPosition.from = base.gameObject.transform.localPosition; tweenPosition.to = mVector3_HidePosition; tweenPosition.ignoreTimeScale = false; tweenPosition.SetOnFinished(delegate { if (hiddenCallBack != null) { hiddenCallBack(); } }); }
private void _set_view_board(int page) { if (this._isAnime) { return; } this._onYet = true; this._isAnime = true; if (page == 1) { if (this._now_page != page) { SoundUtils.PlaySE(SEFIleInfos.MainMenuOnMouse); TweenPosition tweenPosition = TweenPosition.Begin(this._board1, 0.5f, new Vector3(this._board1.get_transform().get_localPosition().x, 0f, this._board1.get_transform().get_localPosition().z)); tweenPosition.animationCurve = UtilCurves.TweenEaseInOutQuad; tweenPosition.SetOnFinished(new EventDelegate.Callback(this.PageAnimeDone)); this._AM.Play("boards_wait"); this._arrow_flag = true; } this._now_page = 1; } else if (page == 2) { if (this._now_page != page) { SoundUtils.PlaySE(SEFIleInfos.MainMenuOnMouse); TweenPosition tweenPosition2 = TweenPosition.Begin(this._board1, 0.5f, new Vector3(this._board1.get_transform().get_localPosition().x, 544f, this._board1.get_transform().get_localPosition().z)); tweenPosition2.animationCurve = UtilCurves.TweenEaseInOutQuad; tweenPosition2.SetOnFinished(new EventDelegate.Callback(this.PageAnimeDone)); this._AM.Play("boards_wait"); this._arrow_flag = true; } this._now_page = 2; } else { if (this._now_page != page) { SoundUtils.PlaySE(SEFIleInfos.MainMenuOnMouse); TweenPosition tweenPosition3 = TweenPosition.Begin(this._board1, 0.5f, new Vector3(this._board1.get_transform().get_localPosition().x, 1088f, this._board1.get_transform().get_localPosition().z)); tweenPosition3.animationCurve = UtilCurves.TweenEaseInOutQuad; tweenPosition3.SetOnFinished(new EventDelegate.Callback(this.PageAnimeDone)); this._AM.Play("boards_wait"); this._arrow_flag = true; } this._now_page = 3; } }
public void Show(Action shownCallBack) { TweenPosition tweenPosition = UITweener.Begin <TweenPosition>(base.gameObject, 0.3f); tweenPosition.from = mVector3_HidePosition; tweenPosition.to = mVector3_ShowPosition; tweenPosition.ignoreTimeScale = false; tweenPosition.SetOnFinished(delegate { if (shownCallBack != null) { shownCallBack(); } }); tweenPosition.PlayForward(); }
private void SmoothShiftContainer() { TweenPosition tweenPos = gameObject.AddComponent <TweenPosition>(); tweenPos.duration = AnimationTime; tweenPos.animationCurve = ColorManagementSystemController.EasyInOutAnimCurve; tweenPos.from = _model.Container.transform.localPosition; float toY = tweenPos.to.y + PositionShiftY; tweenPos.to = new Vector3(tweenPos.from.x, toY, tweenPos.from.z); tweenPos.SetOnFinished(() => Destroy(tweenPos)); }
/// <summary> /// 从不同方向显示效果 /// </summary> /// <param name="uiWin"></param> /// <param name="dirType">0: 从上 1:从下 2: 从左 3:从右</param> /// <param name="isOpen"></param> private void ShowFromDir(int dirType, bool isOpen, Action callBack) { TweenPosition tween = gameObject.GetOrAddComponent <TweenPosition>(); tween.animationCurve = animationCurve; Vector3 from = Vector3.zero; switch (dirType) { case 0: from = new Vector3(0, 1000, 0); break; case 1: from = new Vector3(0, -1000, 0); break; case 2: from = new Vector3(-1400, 0, 0); break; case 3: from = new Vector3(1400, 0, 0); break; } tween.from = from; tween.to = moveToPoint; tween.duration = duration; tween.SetOnFinished(() => { if (!isOpen) { windowTrans.localPosition = OUT_SCREEN_POSITION; } if (callBack != null) { callBack(); } }); windowTrans.localPosition = Vector3.zero; tween.Play(isOpen); }
/// <summary> /// 从各个方向播放动画 /// </summary> /// <param name="window">Window.</param> /// <param name="dirType">1从上 2从下 3从左 4从右</param> /// <param name="isOpen">If set to <c>true</c> is open.</param> private void ShowFromDir(UIWindowBase window, int dirType, bool isOpen) { TweenPosition ts = NGUITools.AddMissingComponent <TweenPosition>(window.gameObject); ts.animationCurve = GlobalInit.Instance.UIAnimationCurve; Vector3 from = Vector3.zero; switch (dirType) { case 1: from = new Vector3(0, 1000, 0); break; case 2: from = new Vector3(0, -1000, 0); break; case 3: from = new Vector3(-1400, 0, 0); break; case 4: from = new Vector3(1400, 0, 0); break; } ts.from = from; ts.to = Vector3.one; ts.duration = window.duration; ts.SetOnFinished(() => { if (!isOpen) { DestroyWindow(window); } }); NGUITools.SetActive(window.gameObject, true); // 关闭窗口,播放缩小动画 if (!isOpen) { ts.Play(isOpen); } }
private void AnimationClose(Action action) { TweenPosition moveTween = UITweener.Begin <TweenPosition>(base.gameObject, 0.4f); Vector3 from = mStartLocalPosition; Vector3 to = mOutDisplayPosition; moveTween.ignoreTimeScale = false; moveTween.from = from; moveTween.to = to; moveTween.SetOnFinished(delegate { if (action != null) { action(); } UnityEngine.Object.Destroy(moveTween); }); }
public void InitData(Model_HeroGroup.ExpChangeResult heroExp) { _Level_Label.text = "LV" + heroExp.level; _exp_Value_Label.text = "" + heroExp.expChanged; if (heroExp.levelChanged > 0) { _label_Tips.gameObject.SetActive(true); _label_Tips.text = "等级提升" + heroExp.levelChanged; tweenPos.PlayForward(); tweenPos.SetOnFinished(FinishCallBack); } else { _label_Tips.gameObject.SetActive(false); } }
public void Exit() { if (isEnter) { isEnter = false; tp.PlayReverse(); tp.SetOnFinished(delegate { TweenRotation[] array = tweenRots; foreach (TweenRotation tweenRotation in array) { tweenRotation.enabled = false; } SingletonMonoBehaviour <UIShortCutMenu> .Instance.isCloseAnimNow = false; SingletonMonoBehaviour <UIShortCutMenu> .Instance.SetActiveChildren(isActive: false); }); } }
/// <summary> /// 从各个方向打开窗口 /// </summary> /// <param name="dir">0 上 1下 2 左 3 右</param> private void ShowWindowWithDirection(UIWindowBase windowBase, bool isOpen, int dir) { //创建或者获取TweenScale TweenPosition tp = windowBase.gameObject.GetOrCreateComponent <TweenPosition>(); tp.animationCurve = GlobalInit.Instance.animationCurve; Vector3 from = Vector3.zero; switch (dir) { case 0: from = new Vector3(0, 1000, 0); break; case 1: from = new Vector3(0, -1000, 0); break; case 2: from = new Vector3(-1400, 0, 0); break; case 3: from = new Vector3(1400, 0, 0); break; } tp.from = from; tp.to = Vector3.one; tp.duration = windowBase.duration; tp.SetOnFinished(() => { if (!isOpen) { DestroyWindow(windowBase); } }); NGUITools.SetActive(windowBase.gameObject, true); //如果是关闭窗口就反方向播放动画(从大到小,当动画播放完毕后会自动销毁窗口) if (!isOpen) { tp.Play(isOpen); } }
private void SwitchSlowAnimation(GameObject mEntranceCamera, CharacterState mCurCs) { mCurCs.pm.Enter(); TweenPosition td = mEntranceCamera.AddComponent <TweenPosition>(); SetTweenPositon(td, mEntranceCamera.transform.localPosition, mEntranceCamera.transform.localPosition + mEntranceCamera.transform.forward * 0.05f / mCurCs.transform.localScale.z, UITweener.Style.Once, UITweener.Method.EaseIn, 3.0f); td.SetOnFinished(() => { td.onFinished.Clear(); if (mBossAI != null) { mBossAI.enabled = true; } GameLibrary.isBossChuChang = false; GameLibrary.Instance().SetCsInvisible(CharacterManager.playerCS, false, skinned); Destroy(mEntranceCamera); }); }
public override void OnLoadedUI(bool close3dTouch, object args) { base.OnLoadedUI(close3dTouch, args); _anchorBottomLeft = transform.Find("Anchor_Bottom_Left"); _anchorBottom = transform.Find("Anchor_Bottom"); _chatDetail = transform.Find("Anchor_Left/chat_back"); _detailTween = _chatDetail.GetComponent<TweenPosition>(); _detailTween.SetOnFinished(() => { if (_detailTween.direction == AnimationOrTween.Direction.Forward) { _anchorBottomLeft.gameObject.SetActive(false); } }); RegistUIBase<ChatUIExpSlider>(_anchorBottom); RegisterEvent(EnumEventDispathcer.ChatViewRefreshPanel,RefreshChatPanel); RegisterEvent(EnumEventDispathcer.ChatViewRefreshHistory, RefreshHistory); _chatUIChatPanel = RegistUIBase<ChatUIChatPanel>(_anchorBottomLeft); _chatDetailView = RegistUIBase<ChatDetailView>(_chatDetail); _chatDetail.gameObject.SetActive(false); playName = "王五"; }