private void OnCGTweenGroupFinishendEvent(GameObject gameObj, bool isAutoJump) { TweenGroup tweenGroup = textureBackgroundScene.GetComponent <TweenGroup>(); tweenGroup.TweenFinishedEvents -= OnCGTweenGroupFinishendEvent; mMustPlayEffect = false; SetText(talkList[curIndex]); }
public static void SafeSetActive(this TweenGroup tweenGroup, bool active) { if (tweenGroup == null || tweenGroup.gameObject == null) { return; } tweenGroup.gameObject.SetActive(active); }
/// <summary> /// This function should perform all necessary cleanup. It is expected that the [this.tween] /// reference will be NULL after this function completes. /// </summary> protected void cleanup() { if (group != null) { group.Stop(); group.Release(); group = null; } }
public void Update() { if (mTaskCameraPlaying) { if (mTaskCameraAnimation != null && !mTaskCameraAnimation.IsPlaying(mTaskCameraAnimationName)) { if (talkList[curIndex].effectIDTail > 0) { ///设置 SpriteScenePreground效果的//// TweenGroupConfig tweenGroupConfig = Globals.Instance.MDataTableManager.GetConfig <TweenGroupConfig>(); if (tweenGroupConfig.IsPregroundGroup("SpriteScenePreground", talkList[curIndex].effectIDTail)) { GameObject priorGameObj = Globals.Instance.MSceneManager.mTaskCamera.transform.Find("SpriteScenePreground").gameObject; if (priorGameObj != null) { NGUITools.SetActive(priorGameObj, true); } } TweenGroup tweenGroup = textureBackgroundScene.GetComponent <TweenGroup>(); if (tweenGroup == null) { tweenGroup = textureBackgroundScene.gameObject.AddComponent <TweenGroup>(); } tweenGroup.setTweenGroupID(talkList[curIndex].effectIDTail); tweenGroup.playTweenAnimation(); tweenGroup.TweenFinishedEvents += OnTweenGroupFinishendEvent; } else { PressedButton(null); } mTaskCameraPlaying = false; } } // if (mSpeakering ) // { // // mSpeakerTime -= Time.deltaTime; // if (mSpeakerTime < 0.0f) // { // Animator animator = mCharacterCustomizeCurrent.getCharacterAnimator(); // if (animator.layerCount > 2) // { // animator.SetInteger("index",0); // } // mSpeakering = false; // } // } return; }
private void OnTweenGroupFinishendEvent(GameObject gameObj, bool isAutoJump) { TweenGroup tweenGroup = textureBackgroundScene.GetComponent <TweenGroup>(); tweenGroup.TweenFinishedEvents -= OnTweenGroupFinishendEvent; mMustPlayEffect = false; if (isAutoJump) { PressedButton(null); } }
void DrawTargetButtons(TweenInfo twInfo, TweenGroup twGroup) { if (GUILayout.Button(twGroup == TweenGroup.Running ? "Pause" : "Play", HOGUIStyle.BtTinyStyle, GUILayout.Width(45))) { if (twGroup == TweenGroup.Running) { twInfo.tween.Pause(); } else { twInfo.tween.Play(); } } if (GUILayout.Button("Kill", HOGUIStyle.BtTinyStyle, GUILayout.Width(32))) { twInfo.tween.Kill(); } }
// =================================================================================== // METHODS --------------------------------------------------------------------------- void DrawTarget(TweenInfo twInfo, object twTarget, TweenGroup twGroup, bool isSequenced) { GUILayout.BeginHorizontal(); if (isSequenced) { GUILayout.Space(9); } if (GUILayout.Button(twTarget.ToString(), HOGUIStyle.BtLabelStyle)) { SelectTargetGameObject(twTarget); } if (!isSequenced && twGroup != TweenGroup.Disabled) { DrawTargetButtons(twInfo, twGroup); } GUILayout.EndHorizontal(); if (!isSequenced && twGroup != TweenGroup.Disabled) { DrawInfo(twInfo); } }
protected void configureTween() { if (this.group == null) { this.group = (TweenGroup) new TweenGroup() .OnStarted((x) => { onStarted(); }) .OnStopped((x) => { onStopped(); }) .OnPaused((x) => { onPaused(); }) .OnResumed((x) => { onResumed(); }) .OnLoopCompleted((x) => { onLoopCompleted(); }) .OnCompleted((x) => { onCompleted(); }); } group .ClearTweens() .SetMode(this.groupMode) .SetDelay(this.startDelay) .SetLoopType(this.loopType) .SetLoopCount(this.loopCount); for (int i = 0; i < tweens.Count; i++) { var tween = tweens[i]; if (tween != null) { tween.AutoRun = false; var baseTween = tween.BaseTween; if (baseTween == null) { Debug.LogError("Base tween not set", tween); } else { group.AppendTween(baseTween); } } } }
private void InitCameraTween() { float duration = 0.5f; mMoveCamTweenPos = Tween <Vector3> .Obtain() .SetDuration(duration) .OnExecute(pos => { MoveCamTs.position = pos; }); mMoveCamTweenRot = Tween <Vector3> .Obtain() .SetDuration(duration) .OnExecute(forward => { MoveCamTs.forward = forward; }); mCameraTween = new TweenGroup(); mCameraTween.SetMode(TweenGroupMode.Concurrent); mCameraTween.AppendTween(mMoveCamTweenPos, mMoveCamTweenRot); }
private void OnTweenGroupFinishedEvent(GameObject tweenGameObj, bool isAutoJump) { TweenGroup tweenGroup = tweenGameObj.GetComponent <TweenGroup>(); tweenGroup.TweenFinishedEvents -= OnTweenGroupFinishedEvent; mShowNum--; Debug.Log("OnTweenGroupFinishedEvent mShowNum is :" + mShowNum); if (mShowNum == 0 && mShowBookNum == 0) { Debug.Log("OnTweenGroupFinishedEvent mShowNum == 0 mCurTime is :" + mCurTime); if (DropFinishedEvents != null) { DropFinishedEvents(gameObject); DropFinishedEvents = null; GUISingleDrop guiSingleDrop = Globals.Instance.MGUIManager.GetGUIWindow <GUISingleDrop>(); if (guiSingleDrop != null) { guiSingleDrop.Close(); } } Globals.Instance.MTeachManager.NewGUISingleDropFinishedEvent(); } GameObject.DestroyObject(tweenGameObj); }
// Register a new tween group public void RegisterGroup(TweenGroup tweenGroup) { tweenGroup.Retain(); _groups.Add(tweenGroup); }
private void PressedButton(GameObject obj) { // tzz added // the talk list will be null if used in Teach scene // check TeachFirstEnterGame.cs for detail if (mTypewriterEffect == null) { return; } if (mTypewriterEffect.IsTypewriterIng()) { mTypewriterEffect.FinishTypewriter(); return; } if (mMustPlayEffect) { if (FinishedTipSprite.gameObject.active) { if (talkList[curIndex].effectIDTail > 0) { ///设置 SpriteScenePreground效果的//// TweenGroupConfig tweenGroupConfig = Globals.Instance.MDataTableManager.GetConfig <TweenGroupConfig>(); if (tweenGroupConfig.IsPregroundGroup("SpriteScenePreground", talkList[curIndex].effectIDTail)) { GameObject priorGameObj = Globals.Instance.MSceneManager.mTaskCamera.transform.Find("SpriteScenePreground").gameObject; if (priorGameObj != null) { NGUITools.SetActive(priorGameObj, true); } } TweenGroup tweenGroup = textureBackgroundScene.GetComponent <TweenGroup>(); if (tweenGroup == null) { tweenGroup = textureBackgroundScene.gameObject.AddComponent <TweenGroup>(); } tweenGroup.setTweenGroupID(talkList[curIndex].effectIDTail); tweenGroup.playTweenAnimation(); tweenGroup.TweenFinishedEvents += OnTweenGroupFinishendEvent; NGUITools.SetActive(TaskDialogGameObject, false); } } return; } if (talkList == null || talkList.Count == 0 || curIndex >= talkList.Count || mAniPlayIng /*|| CurTask == null*/) { if (mForTZZDelegate != null) { mForTZZDelegate(); } return; } //对话结束 if (curIndex == talkList.Count - 1) { if (CurTask == null) { // DestroyThisGUI(); if (mTalkCallBackDelegate != null) { mTalkCallBackDelegate(); mTalkCallBackDelegate = null; } return; } int nCurTaskID = CurTask.Task_ID; if (!mClentTask) { if (!ProcessorTaskBefoeFinished(nCurTaskID)) { SendTaskMessage(); } } // DestroyThisGUI(); if (mTalkCallBackDelegate != null) { mTalkCallBackDelegate(); mTalkCallBackDelegate = null; } if (GameStatusManager.Instance.MGameState == GameState.GAME_STATE_COPY) { GameStatusManager.Instance.MCurrentGameStatus.Resume(); } //TalkAniOut(); return; } else { if (talkList[curIndex].talkTpye == (int)TALKTYE.TALK4) { NGUITools.SetActive(TaskDialogGameObject, false); if (talkList[curIndex].effectIDTail > 0) { ///设置 SpriteScenePreground效果的//// TweenGroupConfig tweenGroupConfig = Globals.Instance.MDataTableManager.GetConfig <TweenGroupConfig>(); if (tweenGroupConfig.IsPregroundGroup("SpriteScenePreground", talkList[curIndex].effectIDTail)) { GameObject priorGameObj = Globals.Instance.MSceneManager.mTaskCamera.transform.Find("SpriteScenePreground").gameObject; if (priorGameObj != null) { NGUITools.SetActive(priorGameObj, true); } } TweenGroup tweenGroup = textureBackgroundScene.GetComponent <TweenGroup>(); if (tweenGroup == null) { tweenGroup = textureBackgroundScene.gameObject.AddComponent <TweenGroup>(); } tweenGroup.setTweenGroupID(talkList[curIndex].effectIDTail); tweenGroup.playTweenAnimation(); tweenGroup.TweenFinishedEvents += OnCGTweenGroupFinishendEvent; mMustPlayEffect = true; curIndex++; return; } } curIndex++; } SetText(talkList[curIndex]); }
public void OnEnable() { if( spriteTemplate == null ) return; var radius = Camera.main.orthographicSize * 0.95f; var duration = 0.5f; TweenEasingCallback easingFunc = TweenEasingFunctions.EaseOutSine; for( int i = 0; i < SPRITE_COUNT; i++ ) { var angle = Random.Range( 0.0f, Mathf.PI * 2f ); var endPosition = new Vector3 ( Mathf.Cos( angle ) * radius, Mathf.Sin( angle ) * radius ); var sprite = (GameObject)GameObject.Instantiate( spriteTemplate ); sprite.hideFlags = HideFlags.HideInHierarchy; var animateOpacity = sprite.renderer .TweenAlpha() .SetDuration( duration ) .SetEasing( easingFunc ) .SetStartValue( 0f ) .SetEndValue( 0.8f ); var animateScale = sprite.transform .TweenScale() .SetDuration( duration ) .SetEasing( easingFunc ) .SetStartValue( Vector3.one * 0.25f ) .SetEndValue( Vector3.one ); var animatePosition = sprite.transform .TweenPosition() .SetDuration( duration ) .SetEasing( easingFunc ) .SetStartValue( Vector3.zero ) .SetEndValue( endPosition ); var concurrentGroup = new TweenGroup() .SetMode( TweenGroupMode.Concurrent ) .AppendTween( animateOpacity, animateScale, animatePosition ); var sequentialGroup = new TweenGroup() .SetMode( TweenGroupMode.Sequential ) .AppendDelay( 255f / i ) .AppendTween( concurrentGroup ) .SetLoopType( TweenLoopType.Loop ); tweens.Add( sequentialGroup ); sequentialGroup.Play(); } // There are three animations per sprite plus two tween groups DebugMessages.Add( (SPRITE_COUNT * 5) + " tweens created..." ); if( pivot != null ) { var animatePivot = pivot.transform .TweenRotation() .SetDuration( 10 ) .SetStartValue( new Vector3( 0, -45, 0 ) ) .SetEndValue( new Vector3( 0, 45, 0 ) ) .SetLoopType( TweenLoopType.Pingpong ); tweens.Add( animatePivot ); animatePivot.Play(); } }
private void playDropAnimationOne() { if (dropItemList.Count <= 0) { return; } DropItem dropItem = dropItemList[0]; dropItemList.RemoveAt(0); if (dropItem.type == GUISingleDrop.ItemType.ITEM_ICON) { GameObject bodyPartObj = GameObject.Instantiate(DropItemIconPrefab) as GameObject; bodyPartObj.name = "DropItemPrefab"; UILabel dropText = bodyPartObj.transform.Find("UILableGot").GetComponent <UILabel>(); UILabel dropNumText = bodyPartObj.transform.Find("UILableGotNum").GetComponent <UILabel>(); UITexture dropTexture = bodyPartObj.transform.Find("Texture").GetComponent <UITexture>(); UITexture backgrond = bodyPartObj.transform.Find("SpriteBG").GetComponent <UITexture>(); int dorpItem = (int)dropItem.obj; bool IsHas = mItemConfig.GetItemElement(dorpItem, out mElement); if (!IsHas) { return; } dropText.text = GetPrName(TextItemName.ITEM) + " " + Globals.Instance.MDataTableManager.GetWordText(mElement.NameID); dropNumText.text = GUIFontColor.DarkBlue + " + " + dropItem.num.ToString(); string texturePath = "Icon/ItemIcon/" + mElement.Icon; dropTexture.mainTexture = Resources.Load(texturePath, typeof(Texture2D)) as Texture2D; bodyPartObj.transform.parent = gameObject.transform; bodyPartObj.transform.localPosition = new Vector3(0, -600f, -3f); bodyPartObj.transform.localScale = Vector3.one; TweenGroup tweenGroup = bodyPartObj.GetComponent <TweenGroup>(); tweenGroup.playTweenAnimation(); tweenGroup.TweenFinishedEvents += OnTweenGroupFinishedEvent; backgrond.material.color = StrParser.ParseColor(dropItem.BGSpriteColor); } else if (dropItem.type == GUISingleDrop.ItemType.MONEY_ICON) { GameObject bodyPartObj = GameObject.Instantiate(DropItemCommonIconPrefab) as GameObject; bodyPartObj.name = "DropItemPrefab"; UILabel dropText = bodyPartObj.transform.Find("UILableContent").GetComponent <UILabel>(); UILabel dropCountText = bodyPartObj.transform.Find("UILableCount").GetComponent <UILabel>(); UISprite dropTexture = bodyPartObj.transform.Find("Texture").GetComponent <UISprite>(); UITexture backgrond = bodyPartObj.transform.Find("SpriteBG").GetComponent <UITexture>(); dropText.text = (string)dropItem.obj; if (-1 != dropItem.CharacterSize) { dropText.transform.localScale = new Vector3(dropItem.CharacterSize, dropItem.CharacterSize, dropText.transform.localScale.z); } if (-1 != dropItem.MaxLeft) { dropText.transform.localPosition = new Vector3(dropText.transform.localPosition.x + dropItem.MaxLeft, dropText.transform.localPosition.y, dropText.transform.localPosition.z); } dropTexture.spriteName = dropItem.spritename; dropCountText.text = GUIFontColor.DarkBlue + " + " + dropItem.num.ToString(); bodyPartObj.transform.parent = gameObject.transform; bodyPartObj.transform.localPosition = new Vector3(0, -600f, -3f); bodyPartObj.transform.localScale = Vector3.one; TweenGroup tweenGroup = bodyPartObj.GetComponent <TweenGroup>(); tweenGroup.playTweenAnimation(); tweenGroup.TweenFinishedEvents += OnTweenGroupFinishedEvent; backgrond.material.color = StrParser.ParseColor(dropItem.BGSpriteColor); } else if (dropItem.type == GUISingleDrop.ItemType.SELF_TEXTURE) { GameObject bodyPartObj = GameObject.Instantiate(DropItemIconPrefab) as GameObject; bodyPartObj.name = "DropItemPrefab"; UILabel dropText = bodyPartObj.transform.Find("UILableGot").GetComponent <UILabel>(); UILabel dropNumText = bodyPartObj.transform.Find("UILableGotNum").GetComponent <UILabel>(); UITexture dropTexture = bodyPartObj.transform.Find("Texture").GetComponent <UITexture>(); UITexture backgrond = bodyPartObj.transform.Find("SpriteBG").GetComponent <UITexture>(); dropText.text = (string)dropItem.obj; dropNumText.text = GUIFontColor.DarkBlue + " + " + dropItem.num.ToString(); dropTexture.mainTexture = Resources.Load(dropItem.spritename, typeof(Texture2D)) as Texture2D; bodyPartObj.transform.parent = gameObject.transform; bodyPartObj.transform.localPosition = new Vector3(0, -600f, -3f); bodyPartObj.transform.localScale = Vector3.one; TweenGroup tweenGroup = bodyPartObj.GetComponent <TweenGroup>(); tweenGroup.playTweenAnimation(); tweenGroup.TweenFinishedEvents += OnTweenGroupFinishedEvent; backgrond.material.color = StrParser.ParseColor(dropItem.BGSpriteColor); } else { GameObject bodyPartObj = GameObject.Instantiate(DropItemPrefab) as GameObject; bodyPartObj.name = "DropItemPrefab"; UILabel dropText = bodyPartObj.transform.Find("UILable").GetComponent <UILabel>(); UITexture backgrond = bodyPartObj.transform.Find("SpriteBG").GetComponent <UITexture>(); dropText.text = (string)dropItem.obj; bodyPartObj.transform.parent = gameObject.transform; bodyPartObj.transform.localPosition = new Vector3(0, -600f, -3f); bodyPartObj.transform.localScale = Vector3.one; TweenGroup tweenGroup = bodyPartObj.GetComponent <TweenGroup>(); tweenGroup.playTweenAnimation(); tweenGroup.TweenFinishedEvents += OnTweenGroupFinishedEvent; backgrond.material.color = StrParser.ParseColor(dropItem.BGSpriteColor); } }
// =================================================================================== // METHODS --------------------------------------------------------------------------- void DrawTarget(TweenInfo twInfo, object twTarget, TweenGroup twGroup, bool isSequenced) { GUILayout.BeginHorizontal(); if (isSequenced) GUILayout.Space(9); if (GUILayout.Button(twTarget.ToString(), HOGUIStyle.BtLabelStyle)) { SelectTargetGameObject(twTarget); } if (!isSequenced && twGroup != TweenGroup.Disabled) { DrawTargetButtons(twInfo, twGroup); } GUILayout.EndHorizontal(); if (!isSequenced && twGroup != TweenGroup.Disabled) { DrawInfo(twInfo); } }