public void Turn() { // Facade.Instance<MusicManager>().Play();//Play2DSound(10); _ro.ResetToBeginning(); _ro.from = new Vector3(0, 0, 0); _ro.to = new Vector3(0, -90, 0); _ro.AddOnFinished(ChangeFEvent); _ro.PlayForward(); }
public void TurnCard() { if (Id == 0) { return; } GetComponent <SpringPosition>().onFinished = () => { }; TweenRotation rightTweenR = TweenRotation.Begin(gameObject, 0.2f, new Quaternion(0, -90, 0, 0)); //TweenRotation rightTweenR = GetComponent<TweenRotation>(); //rightTweenR.from = new Vector3(0, 0, 0); //rightTweenR.to = new Vector3(0, -90, 0); //rightTweenR.duration = 0.2f; if (_changeFEvent == null) { _changeFEvent = new EventDelegate(Onfinish); } rightTweenR.AddOnFinished(_changeFEvent); //rightTweenR.ResetToBeginning(); //rightTweenR.PlayForward(); //rightTweenR.AddOnFinished(new EventDelegate(() => {transform.GetComponentInParent<UIGrid>().Reposition(); })); }
public void MoveToPage(int page) { if (page > TotalPage || page < 1 || islock) { return; } islock = true; CurPage = page; Quaternion tem_qua; float sita = 2 * Mathf.Atan2(0.5f * Width, Radis); float degree = 180f * sita / Mathf.PI; tem_qua = Quaternion.Euler(0, -(DegreePerPage / 2 + (CurPage - 1) * DegreeClipPerPage), 0); FadeInPage(CurPage, true); TweenRotation tr = TweenRotation.Begin(gameObject, 0.6f, tem_qua); tr.AddOnFinished(() => { islock = false; FadeInPage(CurPage - 1, false); FadeInPage(CurPage + 1, false); }); tr.PlayForward(); }
public void TurnCard() { transform.localScale = new Vector3(0.9f, 0.9f, 1f); TweenRotation rightTweenR = GetComponent <TweenRotation>(); rightTweenR.from = new Vector3(0, 0, 0); rightTweenR.to = new Vector3(0, -90, 0); rightTweenR.AddOnFinished(_changeFEvent); rightTweenR.ResetToBeginning(); rightTweenR.PlayForward(); }
void InitBtns() { m_lstBtns = new List <MainBtn>(); //特效TipsUI m_sprite_TipsUI.gameObject.SetActive(false); RegisterBtnEvent(true); // m_trans_roleInfoRoot.gameObject.SetActive(true); m_trans_target.gameObject.SetActive(false); m_trans_MainRoleBUffContainer.gameObject.SetActive(false); // m_trans_btn_Left_Root.gameObject.SetActive(false); //if (Application.isEditor) { if (m_trans_AnchorTopRight != null) { Transform gmTrans = m_trans_AnchorTopRight.Find("GM"); if (gmTrans != null) { gmTrans.gameObject.SetActive(true); } } } TweenRotation tween = m_btn_leftbtn.GetComponent <TweenRotation>(); if (tween != null) { m_btnTween = tween; tween.AddOnFinished(new EventDelegate(() => { bool show = IsShowRightBtn(); Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.MAINRIGHTBTN_TOGGLE, show); UISprite leftBtnSp = m_btnTween.GetComponent <UISprite>(); if (show) { ResetLeftBtnsPos(false); leftBtnSp.spriteName = "anniu_yuan_shouqi"; m_btn_leftbtn.normalSprite = "anniu_yuan_shouqi"; } else { leftBtnSp.spriteName = "anniu_yuan_zhankai"; m_btn_leftbtn.normalSprite = "anniu_yuan_zhankai"; } //发送UI,功能按钮状态变化事件 SendGameObjMoveStatusEvent((show) ? UIDefine.GameObjMoveStatus.Visible : UIDefine.GameObjMoveStatus.Invisible, m_lst_FuncBtnsRight); })); } }
public void TurnCard() { TweenRotation rightTweenR = GetComponent <TweenRotation>(); rightTweenR.from = new Vector3(0, 0, 0); rightTweenR.to = new Vector3(0, -90, 0); if (_changeFEvent == null) { _changeFEvent = new EventDelegate(Onfinish); } rightTweenR.AddOnFinished(_changeFEvent); rightTweenR.ResetToBeginning(); rightTweenR.PlayForward(); }
private void Onfinish() { TweenRotation rightTweenR = GetComponent <TweenRotation>(); SetCardFront(); rightTweenR.RemoveOnFinished(_changeFEvent); rightTweenR.from = new Vector3(0, -90, 0); rightTweenR.to = new Vector3(0, 0, 0); rightTweenR.AddOnFinished(_changeOEvent); rightTweenR.ResetToBeginning(); rightTweenR.PlayForward(); }
/// <summary> /// 播放翻牌动画 /// </summary> private void TurnCard() { TweenRotation rightTweenR = GetComponent <TweenRotation>(); if (rightTweenR == null) { return; } rightTweenR.from = new Vector3(0, 0, 0); rightTweenR.to = new Vector3(0, -90, 0); rightTweenR.AddOnFinished(_changeFEvent); rightTweenR.ResetToBeginning(); rightTweenR.PlayForward(); }
public void TurnCard() { if (Id == 0) { return; } TweenRotation rightTweenR = GetComponent <TweenRotation>(); rightTweenR.from = new Vector3(0, 0, 0); rightTweenR.to = new Vector3(0, -90, 0); rightTweenR.AddOnFinished(_changeFEvent); rightTweenR.ResetToBeginning(); rightTweenR.PlayForward(); }
/// <summary> /// 功能界面按钮点击后的操作 /// </summary> void OnFuncToggleBtnClick() { closeSubMenuForm(); Vector3 rot = Vector3.zero; if (!isOpening) { rot = new Vector3(0.0f, 0.0f, 90.0f); } TweenRotation tween = TweenRotation.Begin(mFuncToggleBtn.gameObject, 0.5f, Quaternion.Euler(rot)); tween.AddOnFinished(OnRotFinished); tween.method = UITweener.Method.EaseInOut; ShowOrHideFuncBtn(); }
public override void OnBegin(Clip clip) { base.OnBegin(clip); if (Tweener == null) { m_Status = Status.Error; return; } if (TweenEndCallback == null) { TweenEndCallback = new EventDelegate() { methodName = "OnTweenEnd" }; } Tweener.AddOnFinished(TweenEndCallback); Tweener.ResetToBeginning(); Tweener.Toggle(); }
public void AddListener() { EventDelegate.Add(mBtn.onClick, OnClicked); mAwardTweener.AddOnFinished(OnTweenerFinished); }
void PlayExitAnimation() { if (playingQueue.Count > 0) { readyPlaying.Enqueue(PlayExitAnimation); return; } if (ExitPosAnimation != null && ExitPosAnimation.Length > 0) { for (int i = 0; i < ExitPosAnimation.Length; ++i) { if (ExitPosAnimation[i] != null) { TweenPosition tween = TweenPosition.Begin(ExitPosAnimation[i].gameObject, exitPosDuration[i], exitPosTo[i]); tween.from = exitPosFrom[i]; tween.animationCurve = exitPosCurve[i]; tween.onFinished.Clear(); tween.AddOnFinished(FinishExitAnimation); playingQueue.Enqueue(tween); } } } if (ExitScaleAnimation != null && ExitScaleAnimation.Length > 0) { for (int i = 0; i < ExitScaleAnimation.Length; ++i) { if (ExitScaleAnimation[i] != null) { TweenScale tween = TweenScale.Begin(ExitScaleAnimation[i].gameObject, exitScaleDuration[i], exitScaleTo[i]); tween.from = exitScaleFrom[i]; tween.animationCurve = exitScaleCurve[i]; tween.onFinished.Clear(); tween.AddOnFinished(FinishExitAnimation); playingQueue.Enqueue(tween); } } } if (ExitAlphaAnimation != null && ExitAlphaAnimation.Length > 0) { for (int i = 0; i < ExitAlphaAnimation.Length; ++i) { if (ExitAlphaAnimation[i] != null) { TweenAlpha tween = TweenAlpha.Begin(ExitAlphaAnimation[i].gameObject, exitAlphaDuration[i], exitAlphaTo[i]); tween.from = exitAlphaFrom[i]; tween.animationCurve = exitAlphaCurve[i]; tween.onFinished.Clear(); tween.AddOnFinished(FinishExitAnimation); playingQueue.Enqueue(tween); } } } if (ExitRotAnimation != null && ExitRotAnimation.Length > 0 && exitRotDuration != null && exitRotDuration.Length >= ExitRotAnimation.Length && exitRotTo != null && exitRotTo.Length >= ExitRotAnimation.Length) { for (int i = 0; i < ExitRotAnimation.Length; ++i) { if (ExitRotAnimation[i] != null) { TweenRotation tween = TweenRotation.Begin(ExitRotAnimation[i].gameObject, exitRotDuration[i], Quaternion.Euler(exitRotTo[i])); tween.from = exitRotFrom[i]; tween.animationCurve = exitRotCurve[i]; tween.onFinished.Clear(); tween.AddOnFinished(FinishEnterAnimation); playingQueue.Enqueue(tween); } } } if (playingQueue.Count <= 0) { FinishExitAnimation(); } }
void PlayEnterAnimation() { if (playingQueue.Count > 0) { readyPlaying.Enqueue(PlayEnterAnimation); return; } playingQueue.Clear(); if (EnterPosAnimation != null && EnterPosAnimation.Length > 0 && enterPosDuration != null && enterPosDuration.Length >= EnterPosAnimation.Length && enterPosTo != null && enterPosTo.Length >= EnterPosAnimation.Length) { for (int i = 0; i < EnterPosAnimation.Length; ++i) { if (EnterPosAnimation[i] != null) { TweenPosition tween = TweenPosition.Begin(EnterPosAnimation[i].gameObject, enterPosDuration[i], enterPosTo[i]); tween.from = enterPosFrom[i]; tween.animationCurve = enterPosCurve[i]; tween.onFinished.Clear(); tween.AddOnFinished(FinishEnterAnimation); playingQueue.Enqueue(tween); } } } if (EnterScaleAnimation != null && EnterScaleAnimation.Length > 0 && enterScaleDuration != null && enterScaleDuration.Length >= EnterScaleAnimation.Length && enterScaleTo != null && enterScaleTo.Length >= EnterScaleAnimation.Length) { for (int i = 0; i < EnterScaleAnimation.Length; ++i) { if (EnterScaleAnimation[i] != null) { TweenScale tween = TweenScale.Begin(EnterScaleAnimation[i].gameObject, enterScaleDuration[i], enterScaleTo[i]); tween.from = enterScaleFrom[i]; tween.animationCurve = enterScaleCurve[i]; tween.onFinished.Clear(); tween.AddOnFinished(FinishEnterAnimation); playingQueue.Enqueue(tween); } } } if (EnterAlphaAnimation != null && EnterAlphaAnimation.Length > 0 && enterAlphaDuration != null && enterAlphaDuration.Length >= EnterAlphaAnimation.Length && enterAlphaTo != null && enterAlphaTo.Length >= EnterAlphaAnimation.Length) { for (int i = 0; i < EnterAlphaAnimation.Length; ++i) { if (EnterAlphaAnimation[i] != null) { TweenAlpha tween = TweenAlpha.Begin(EnterAlphaAnimation[i].gameObject, enterAlphaDuration[i], enterAlphaTo[i]); tween.from = enterAlphaFrom[i]; tween.animationCurve = enterAlphaCurve[i]; tween.onFinished.Clear(); tween.AddOnFinished(FinishEnterAnimation); playingQueue.Enqueue(tween); } } } if (EnterRotAnimation != null && EnterRotAnimation.Length > 0 && enterRotDuration != null && enterRotDuration.Length >= EnterRotAnimation.Length && enterRotTo != null && enterRotTo.Length >= EnterRotAnimation.Length) { for (int i = 0; i < EnterRotAnimation.Length; ++i) { if (EnterRotAnimation[i] != null) { TweenRotation tween = TweenRotation.Begin(EnterRotAnimation[i].gameObject, enterRotDuration[i], Quaternion.Euler(enterRotTo[i])); tween.from = enterRotFrom[i]; tween.animationCurve = enterRotCurve[i]; tween.onFinished.Clear(); tween.AddOnFinished(FinishEnterAnimation); playingQueue.Enqueue(tween); } } } //当PlayingQueue为0时,表示没有Tween动画,需要直接退出,以保证之前的 UICamera.ProhibitUI = true 造成的UI锁屏 if (playingQueue.Count <= 0) { FinishEnterAnimation(); } }
/// <summary> /// 翻牌 /// </summary> /// <param name="time">时间,翻牌一次所用时间</param> /// <param name="forword">翻牌方向 true是从背翻到值 false是从值翻到牌背</param> /// <param name="num">次数</param> public virtual void TurnCard(float time, bool forword, int num = 1) { if (forword)//牌背到牌面的翻牌 { mCardBg.gameObject.SetActive(true); mShowCard.gameObject.SetActive(false); mCardBg.transform.localEulerAngles = new Vector3(0, 0, 0); mShowCard.transform.localEulerAngles = new Vector3(0, 0, 0); TweenRotation n2z = mShowCard.GetComponent <TweenRotation>(); if (n2z != null) { Destroy(n2z); } n2z = mShowCard.AddComponent <TweenRotation>(); n2z.ResetToBeginning(); TweenRotation z2n = mCardBg.GetComponent <TweenRotation>(); if (z2n != null) { Destroy(z2n); } z2n = mCardBg.AddComponent <TweenRotation>(); z2n.ResetToBeginning(); z2n.duration = time / 1.0f; n2z.duration = time / 1.0f; n2z.from = new Vector3(0, 90, 0); n2z.to = new Vector3(0, 0, 0); z2n.from = new Vector3(0, 0, 0); z2n.to = new Vector3(0, 90, 0); n2z.AddOnFinished(() => { num--; if (n2z != null) { Destroy(n2z); } if (num > 0) { TurnCard(time, !forword, num); } }); z2n.AddOnFinished(() => { mCardBg.gameObject.SetActive(false); mShowCard.gameObject.SetActive(true); n2z.PlayForward(); if (z2n != null) { Destroy(z2n); } }); z2n.PlayForward(); } else//是从值翻到牌背 { mCardBg.gameObject.SetActive(false); mShowCard.gameObject.SetActive(true); mCardBg.transform.localEulerAngles = new Vector3(0, 0, 0); mShowCard.transform.localEulerAngles = new Vector3(0, 0, 0); TweenRotation z2n = mShowCard.GetComponent <TweenRotation>(); if (z2n != null) { Destroy(z2n); } z2n = mShowCard.AddComponent <TweenRotation>(); z2n.ResetToBeginning(); TweenRotation n2z = mCardBg.GetComponent <TweenRotation>(); if (n2z != null) { Destroy(n2z); } n2z = mCardBg.AddComponent <TweenRotation>(); n2z.ResetToBeginning(); z2n.duration = time / 1.0f; n2z.duration = time / 1.0f; n2z.from = new Vector3(0, 90, 0); n2z.to = new Vector3(0, 0, 0); z2n.from = new Vector3(0, 0, 0); z2n.to = new Vector3(0, 90, 0); n2z.AddOnFinished(() => { if (n2z != null) { Destroy(n2z); } num--; if (num > 0) { TurnCard(time, !forword, num); } }); z2n.AddOnFinished(() => { mCardBg.gameObject.SetActive(true); mShowCard.gameObject.SetActive(false); n2z.PlayForward(); if (z2n != null) { Destroy(z2n); } }); z2n.PlayForward(); } }
protected override void OnAwake() { base.OnAwake(); Transform tempTrans = null; m_toggle = CacheTransform.Find("Content/OpenContent/Toggle").GetComponent <UIToggle>(); selectMask = CacheTransform.Find("Content/OpenContent/SelectMask"); if (null != m_toggle) { m_toggle.onChange.Add(new EventDelegate(() => { if (IsSelect && !callEvent) { callEvent = true; } InvokeCallBack(); if (null != selectMask && selectMask.gameObject.activeSelf != IsSelect) { selectMask.gameObject.SetActive(IsSelect); } })); } m_tsOpen = CacheTransform.Find("Content/OpenContent"); m_tsClose = CacheTransform.Find("Content/CloseContent"); if (null != m_tsClose) { m_openAnim = m_tsClose.GetComponent <TweenRotation>(); if (null != m_openAnim) { m_openAnim.AddOnFinished(() => { OnAnimFinish(); }); } } m_tsFreeGet = CacheTransform.Find("Content/CloseContent/FreeGet"); m_tsCostRoot = CacheTransform.Find("Content/CloseContent/CostRoot"); m_tsCostMoney = CacheTransform.Find("Content/CloseContent/CostRoot/Money"); tempTrans = CacheTransform.Find("Content/CloseContent/CostRoot/Money/Icon"); if (null != tempTrans) { m_moneyIcon = tempTrans.GetComponent <UISprite>(); } m_tsCostProp = CacheTransform.Find("Content/CloseContent/CostRoot/Prop"); tempTrans = CacheTransform.Find("Content/CloseContent/CostRoot/Prop/Icon"); if (null != tempTrans) { m_propIcon = tempTrans.GetComponent <UITexture>(); } tempTrans = CacheTransform.Find("Content/CloseContent/CostRoot/Prop/Broder"); if (null != tempTrans) { m_propBorder = tempTrans.GetComponent <UISprite>(); } tempTrans = CacheTransform.Find("Content/CloseContent/CostRoot/Num"); if (null != tempTrans) { m_costNum = tempTrans.GetComponent <UILabel>(); } tempTrans = CacheTransform.Find("Content/OpenContent/AttrRoot"); if (null != tempTrans) { int size = 5; m_TransDatas = new AttrTransData[size]; Transform tempTs = null; StringBuilder builder = new StringBuilder(); AttrTransData tempData = null; for (int i = 0; i < size; i++) { tempData = new AttrTransData(); builder.Remove(0, builder.Length); builder.Append(i + 1); tempData.Root = tempTrans.Find(builder.ToString()); builder.Remove(0, builder.Length); builder.Append(i + 1); builder.Append("/Content/Grade/Grade"); tempTs = tempTrans.Find(builder.ToString()); if (null != tempTs) { tempData.Grade = tempTs.GetComponent <UILabel>(); } builder.Remove(0, builder.Length); builder.Append(i + 1); builder.Append("/Content/Des"); tempTs = tempTrans.Find(builder.ToString()); if (null != tempTs) { tempData.Des = tempTs.GetComponent <UILabel>(); } m_TransDatas[i] = tempData; } } InitItemInfoGrid(CacheTransform.Find("Content/OpenContent/InfoGridRoot/InfoGrid"), false); }