//! fade out all object private void StartDisappear() { EZAnimation.CompletionDelegate dele = delegate(EZAnimation ani){ if (mPlayDoneEvent != null) { try{ mPlayDoneEvent(); }catch (System.Exception e) { Debug.LogError(e.GetType().Name + " " + e.Message); } } try{ NextEffectFont(); }catch (System.Exception e) { Debug.LogError(e.Message + "\n" + e.StackTrace); } }; if (mCurrType == EffectType.TouXiChengGong) { // TouXiChengGong NewEffectFont must move to battle buffer position // GUIBattle battle = Globals.Instance.MGUIManager.GetGUIWindow <GUIBattle>(); if (battle != null && battle.GetBufferInfoRoot() != null) { UIButton[] btns = battle.GetBufferInfoRoot().GetComponentsInChildren <UIButton>(); foreach (UIButton btn in btns) { if (btn.Data is BuffData) { // get the buffData // BuffData TouXiBuf = (BuffData)btn.Data; if (TouXiBuf.ID == 1429999999) // is right touxiBuffer { iTween.MoveTo(gameObject, btn.transform.position, DisappearTime); EZAnimation.CompletionDelegate backDele = dele; iTween.ScaleTo(gameObject, new Vector3(0, 0, 1), DisappearTime); break; } } } } } SpriteRoot[] tSprite = GetComponentsInChildren <SpriteRoot>(); for (int i = 0; i < tSprite.Length; i++) { FadeSpriteAlpha tSpriteFade = FadeSpriteAlpha.Do(tSprite[i], EZAnimation.ANIM_MODE.To, Color.clear, EZAnimation.linear, DisappearTime, FontShakeTime, null, i == tSprite.Length - 1?dele:null); } }
public void PlayAttackNumber(EffectType type, string animationName, string animationStr, int val) { delay = AttackNumAnimPosDelayTime; duration = AttackNumAnimPosDurationTime; val = Mathf.Abs(val); int length = val.ToString().Length + 1; // Scale 0.5f float scaleFactor = 1.0f; if (type == EffectType.NUMBER_GREEN || type == EffectType.NUMBER_GRAY) { scaleFactor = 0.5f; } float singleWidth = numberPreb.width; singleWidth *= scaleFactor; float width = length * singleWidth; if (!animationName.Equals("GreenPlus")) { PackedSprite number = GameObject.Instantiate(numberPreb) as PackedSprite; number.width *= scaleFactor; number.height *= scaleFactor; number.transform.parent = _gobjCrit.transform; number.transform.localPosition = new Vector3(-width / 2, 0, 0); number.transform.localScale = Vector3.one; number.SetAnchor(SpriteRoot.ANCHOR_METHOD.MIDDLE_LEFT); number.PlayAnim(animationName); FadeSpriteAlpha.Do(number, EZAnimation.ANIM_MODE.To, Color.clear, EZAnimation.linear, AnimAlphaDurationTime, AnimAlphaDelayTime, null, DestroyEffectObj); AnimatePosition.Do(_gobjCrit.gameObject, EZAnimation.ANIM_MODE.To, _gobjCrit.transform.localPosition + new Vector3(0, AttackNumRiseUpHeight, 0), EZAnimation.linear, duration, delay, null, DestroyEffectObj); } for (int i = 0; i < length - 1; i++) { int currNum = val / (int)Mathf.Pow(10, length - 2 - i) % 10; PackedSprite number2 = GameObject.Instantiate(numberPreb) as PackedSprite; number2.width *= scaleFactor; number2.height *= scaleFactor; number2.transform.parent = _gobjCrit.transform; number2.transform.localPosition = new Vector3(-width / 2 + singleWidth * (i + 1), 0, 0); number2.transform.localScale = Vector3.one; number2.SetAnchor(SpriteRoot.ANCHOR_METHOD.MIDDLE_LEFT); number2.PlayAnim(animationStr + currNum); FadeSpriteAlpha.Do(number2, EZAnimation.ANIM_MODE.To, Color.clear, EZAnimation.linear, AnimAlphaDurationTime, AnimAlphaDelayTime, null, null); AnimatePosition.Do(_gobjCrit.gameObject, EZAnimation.ANIM_MODE.To, _gobjCrit.transform.localPosition + new Vector3(0, AttackNumRiseUpHeight, 0), EZAnimation.linear, duration, delay, null, DestroyEffectObj); } }
/// <summary> /// Starts the cutscene. /// </summary> /// <param name='playDoneDelegate'> /// Play done delegate. /// </param> public void StartCutscene(iTween.EventDelegate playDoneDelegate) { if (Globals.Instance.MGUIManager != null) { transform.localPosition = new Vector3(0, 0, GUIManager.GUI_NEAREST_Z + 1); } Top.transform.localPosition = new Vector3(0, Top.height, 0); Bottom.transform.localPosition = new Vector3(0, -Bottom.height, 0); LightMask.Color = new Color(1, 1, 1, 0); FightFlash.Color = new Color(1, 1, 1, 0); FightLeft.Color = new Color(1, 1, 1, 0); FightRight.Color = new Color(1, 1, 1, 0); FightLeft.transform.localScale = Vector3.one; FightRight.transform.localScale = Vector3.one; FightFlash.transform.localScale = Vector3.one; FightLeft.transform.localPosition = new Vector3(-(FightLeft.width + Top.width) / 2, 0, -1); FightRight.transform.localPosition = new Vector3((FightLeft.width + Top.width) / 2, 0, -1); FightFlash.transform.localPosition = new Vector3(0, 0, -2); iTween.MoveTo(Top.gameObject, iTween.Hash("position", new Vector3(0, Top.height / 2, 0), "islocal", true, "time", TopBottomMoveTime, "easetype", iTween.EaseType.easeInQuart), null, delegate() { FadeSpriteAlpha.Do(FightLeft, EZAnimation.ANIM_MODE.To, new Color(1, 1, 1, 0.5f), EZAnimation.quadraticIn, FightScaleTime, 0, null, null); FadeSpriteAlpha.Do(FightRight, EZAnimation.ANIM_MODE.To, new Color(1, 1, 1, 0.5f), EZAnimation.quadraticIn, FightScaleTime, 0, null, null); iTween.MoveTo(FightLeft.gameObject, iTween.Hash("position", new Vector3(0, 0, -1), "islocal", true, "time", FightScaleTime, "easetype", iTween.EaseType.easeInQuart), null, delegate() { iTween.ShakePosition(FightLeft.gameObject, new Vector3(5, 5, 1), LightMaskFlashTime / 2); iTween.ShakePosition(FightRight.gameObject, new Vector3(5, 5, 1), LightMaskFlashTime / 2); FadeSpriteAlpha.Do(FightFlash, EZAnimation.ANIM_MODE.To, new Color(1, 1, 1, 1), EZAnimation.quadraticIn, LightMaskFlashTime / 2, 0, null, null); iTween.ScaleTo(FightFlash.gameObject, new Vector3(FightScale, FightScale, 1), LightMaskFlashTime); iTween.ScaleTo(FightLeft.gameObject, new Vector3(FightScale, FightScale, 1), LightMaskFlashTime); iTween.ScaleTo(FightRight.gameObject, new Vector3(FightScale, FightScale, 1), LightMaskFlashTime); FadeSpriteAlpha.Do(LightMask, EZAnimation.ANIM_MODE.To, Color.white, EZAnimation.quarticIn, LightMaskFlashTime, 0, null, delegate { if (playDoneDelegate != null) { try{ playDoneDelegate(); }catch {} } Top.transform.localPosition = new Vector3(0, 3000, 0); Bottom.transform.localPosition = new Vector3(0, 3000, 0); FightLeft.transform.localPosition = new Vector3(0, 3000, 0); FightRight.transform.localPosition = new Vector3(0, 3000, 0); FightFlash.transform.localPosition = new Vector3(0, 3000, 0); FadeSpriteAlpha.Do(LightMask, EZAnimation.ANIM_MODE.To, Color.clear, EZAnimation.quarticIn, LightMaskFlashTime, 0, null, delegate { transform.localPosition = new Vector3(0, 6000, 0); }); }); }); iTween.MoveTo(FightRight.gameObject, iTween.Hash("position", new Vector3(0, 0, -1), "islocal", true, "time", FightScaleTime, "easetype", iTween.EaseType.easeInQuart), null, null); }); iTween.MoveTo(Bottom.gameObject, iTween.Hash("position", new Vector3(0, -Bottom.height / 2, 0), "islocal", true, "time", TopBottomMoveTime, "easetype", iTween.EaseType.easeInQuart), null, null); }
//crit font private void ReleaseEffect(Transform parent, Vector3 position, EffectType type, int val, string skillName, Vector3 offset) { // Vector3 warshipViewPosition = _mainCamera.WorldToViewportPoint(position); // Vector3 uiOffset = new Vector3((warshipViewPosition.x - 0.5f) * Screen.width,(warshipViewPosition.y - 0.5f) * Screen.height,100); _gobjCrit = new GameObject("BattleCritFont"); _gobjCrit.transform.position = position; _gobjCrit.transform.parent = Globals.Instance.MGUIManager.MGUICamera.transform; _gobjCrit.transform.localScale = new Vector3(Globals.Instance.MGUIManager.widthRatio, Globals.Instance.MGUIManager.heightRatio, 1); // _gobjCrit.transform.localPosition = uiOffset + offset; PackedSprite effectFont = null; SpriteText textSkill = null; PackedSprite number = null; switch (type) { case EffectType.CRIT: // effectFont = GameObject.Instantiate(effectFontPreb) as PackedSprite; // effectFont.transform.parent = _gobjCrit.transform; // effectFont.transform.localPosition = new Vector3 (0, 0, 0); // effectFont.PlayAnim ("RedCrit"); // AnimateScale.Do (_gobjCrit, EZAnimation.ANIM_MODE.To, Vector3.one * 2, EZAnimation.linear, AnimScaleDurationTime, 0f, null, null); // FadeSpriteAlpha.Do (effectFont, EZAnimation.ANIM_MODE.To, Color.clear, EZAnimation.linear, AnimAlphaDurationTime, AnimAlphaDelayTime, null, DestroyEffectObj); break; case EffectType.DODGE: effectFont = GameObject.Instantiate(effectFontPreb) as PackedSprite; effectFont.transform.parent = _gobjCrit.transform; effectFont.transform.localPosition = new Vector3(0, 0, 0); effectFont.transform.localScale = Vector3.one; effectFont.PlayAnim("Shan"); AnimateScale.Do(_gobjCrit, EZAnimation.ANIM_MODE.To, Vector3.one * 2, EZAnimation.linear, AnimScaleDurationTime, 0f, null, null); FadeSpriteAlpha.Do(effectFont, EZAnimation.ANIM_MODE.To, Color.clear, EZAnimation.linear, AnimAlphaDurationTime, AnimAlphaDelayTime, null, DestroyEffectObj); break; case EffectType.SKILL: //delay = 0; //duration = 6; textSkill = GameObject.Instantiate(textSkillPreb) as SpriteText; textSkill.transform.parent = _gobjCrit.transform; textSkill.transform.localPosition = new Vector3(0, 0, 0); textSkill.transform.localScale = Vector3.one; textSkill.Text = skillName; //textSkill.SetColor(new Color32(255,129,54,255)); // textSkill.SetColor(new Color32(255,255,0,255)); textSkill.SeaColor = SeaClientColorType.DarkRed210000005; //textSkill.SetColor(Color.magenta); textSkill.SetCharacterSize(40); FadeText.Do(textSkill, EZAnimation.ANIM_MODE.To, Color.clear, EZAnimation.linear, AnimAlphaDurationTime, AnimAlphaDelayTime, null, DestroyEffectObj); break; case EffectType.CRIT_SKILL: //delay = 0; //duration = 6; // effectFont = GameObject.Instantiate(effectFontPreb) as PackedSprite; // effectFont.transform.parent = _gobjCrit.transform; // effectFont.transform.localPosition = new Vector3 (0, 20, 0); // effectFont.PlayAnim ("RedCrit"); // //DoAnimationFade (effectFont, DestroyEffectObj); // AnimateScale.Do (_gobjCrit, EZAnimation.ANIM_MODE.To, Vector3.one * 1.5f, EZAnimation.linear, AnimScaleDurationTime, 0f, null, null); // FadeSpriteAlpha.Do (effectFont, EZAnimation.ANIM_MODE.To, Color.clear, EZAnimation.linear, AnimAlphaDurationTime, AnimAlphaDelayTime, null, DestroyEffectObj); textSkill = GameObject.Instantiate(textSkillPreb) as SpriteText; textSkill.transform.parent = _gobjCrit.transform; textSkill.transform.localPosition = new Vector3(0, 0, 0); textSkill.transform.localScale = Vector3.one; textSkill.Text = skillName; // textSkill.SetColor(new Color32(255,255,0,255)); textSkill.SeaColor = SeaClientColorType.DarkRed210000005; //textSkill.SetColor(Color.magenta); textSkill.SetCharacterSize(40); FadeText.Do(textSkill, EZAnimation.ANIM_MODE.To, Color.clear, EZAnimation.linear, AnimAlphaDurationTime, AnimAlphaDelayTime, null, DestroyEffectObj); break; case EffectType.NUMBER_GRAY: this.PlayAttackNumber(type, "NumMinus", "NumRed", val); break; case EffectType.NUMBER_RED: this.PlayAttackNumber(type, "NumMinus", "NumRed", val); break; case EffectType.NUMBER_GREEN: this.PlayAttackNumber(type, "GreenPlus", "NumGreen", val); break; } if (type == EffectType.CRIT || type == EffectType.CRIT_SKILL || type == EffectType.NUMBER_RED) { iTween.ShakePosition(_gobjCrit, new Vector3(5, 5, 0), AnimAlphaDurationTime); // _gobjCrit.transform.localScale = new Vector3(2.5f,2.5f,1); } }