//scale animation public void DoScaleAnimation(GameObject gameObject, Vector3 desScale) { AnimateScale.Do ( gameObject, EZAnimation.ANIM_MODE.To, desScale, EZAnimation.backIn, 0.1f, 0, null, // no starting delegate null // no ending delegate ); }
//scale animation public void DoAnimateScale() { AnimateScale.Do ( roleBG.gameObject, EZAnimation.ANIM_MODE.FromTo, Vector3.zero, Vector3.one, EZAnimation.spring, 0.5f, 0, null, // no starting delegate null // no ending delegate ); }
IEnumerator DoCoroutineAffector() { _mGameObjectList[0].SetActiveRecursively(true); yield return(new WaitForSeconds(0.3f)); _mGameObjectList[1].SetActiveRecursively(true); yield return(new WaitForSeconds(0.3f)); _mGameObjectList[2].SetActiveRecursively(true); _mGameObjectList[3].SetActiveRecursively(true); yield return(new WaitForSeconds(0.3f)); foreach (GameObject go in _mGameObjectList) { AnimatePosition.Do(go, EZAnimation.ANIM_MODE.To, _mDestPosition, EZAnimation.GetInterpolator(EZAnimation.EASING_TYPE.Linear), 1.0f, 0, EZAnimationStart, EZAnimationEnd); AnimateScale.Do(go, EZAnimation.ANIM_MODE.To, _mScale, EZAnimation.GetInterpolator(EZAnimation.EASING_TYPE.Linear), 1.0f, 0, EZAnimationStart, EZAnimationEnd); } }
//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); } }
public override void OnInput(ref POINTER_INFO ptr) { if (this.deleted) { return; } if (!this.m_controlIsEnabled || base.IsHidden()) { base.OnInput(ref ptr); return; } if (this.inputDelegate != null) { this.inputDelegate(ref ptr); } if (!this.m_controlIsEnabled || base.IsHidden()) { base.OnInput(ref ptr); return; } switch (ptr.evt) { case POINTER_INFO.INPUT_EVENT.PRESS: case POINTER_INFO.INPUT_EVENT.DRAG: if (!this.IsListButton) { this.SetControlState(UIButton.CONTROL_STATE.ACTIVE); } if (this.AvtiveColorText != string.Empty && this.BaseString != string.Empty && this.AvtiveColorText != base.ColorText) { base.ColorText = this.AvtiveColorText; this.Text = this.BaseString; } if (ptr.evt == POINTER_INFO.INPUT_EVENT.PRESS) { if (this.mouseDownDelegate != null) { this.mouseDownDelegate(this); } if (this.bEffectAni && !this.bStartAni) { Vector3 one = Vector3.one; if (0f > base.transform.localScale.x) { one.x *= -1f; } if (0f > base.transform.localScale.y) { one.y *= -1f; } if (0f > base.transform.localScale.z) { one.z *= -1f; } AnimateScale.Do(base.gameObject, EZAnimation.ANIM_MODE.FromTo, this.width, this.height, base.transform.localScale, new Vector3(0.85f * one.x, 0.85f * one.y, 0.85f * one.z), EZAnimation.GetInterpolator(EZAnimation.EASING_TYPE.BackOut), 0.2f, 0f, new EZAnimation.CompletionDelegate(base.EffectAniStartDelegate), new EZAnimation.CompletionDelegate(base.EffectAniCompletionDelegate)); } } break; case POINTER_INFO.INPUT_EVENT.DOUBLE_PRESS: if (!this.IsListButton) { this.SetControlState(UIButton.CONTROL_STATE.ACTIVE); } if (this.doubleClickDelegate != null) { this.doubleClickDelegate(this); } break; case POINTER_INFO.INPUT_EVENT.RIGHT_PRESS: if (!this.IsListButton) { this.SetControlState(UIButton.CONTROL_STATE.ACTIVE); } if (this.rightMouseDelegate != null) { this.rightMouseDelegate(this); } break; case POINTER_INFO.INPUT_EVENT.RELEASE: case POINTER_INFO.INPUT_EVENT.TAP: case POINTER_INFO.INPUT_EVENT.LONG_TAP: if (!this.IsListButton) { this.SetControlState(UIButton.CONTROL_STATE.NORMAL); } break; case POINTER_INFO.INPUT_EVENT.RIGHT_RELEASE: case POINTER_INFO.INPUT_EVENT.RIGHT_TAP: if (ptr.type != POINTER_INFO.POINTER_TYPE.TOUCHPAD && ptr.hitInfo.collider == base.collider) { if (!this.IsListButton) { this.SetControlState(UIButton.CONTROL_STATE.OVER); } } else if (!this.IsListButton) { this.SetControlState(UIButton.CONTROL_STATE.NORMAL); } break; case POINTER_INFO.INPUT_EVENT.MOVE: if (this.m_ctrlState != UIButton.CONTROL_STATE.OVER) { if (!this.IsListButton) { this.SetControlState(UIButton.CONTROL_STATE.OVER); } if (this.OverColorText != string.Empty && this.OverColorText != base.ColorText) { this.NormalColorText = base.ColorText; base.ColorText = this.OverColorText; this.Text = this.BaseString; } if (this.soundOnOver != null) { this.soundOnOver.PlayOneShot(this.soundOnOver.clip); } if (this.mouseOverDelegate != null) { this.mouseOverDelegate(this); } } break; case POINTER_INFO.INPUT_EVENT.MOVE_OFF: case POINTER_INFO.INPUT_EVENT.RELEASE_OFF: if (this.m_ctrlState != UIButton.CONTROL_STATE.NORMAL && this.mouseOutDelegate != null) { this.mouseOutDelegate(this); } if (!this.IsListButton) { this.SetControlState(UIButton.CONTROL_STATE.NORMAL); } if (this.NormalColorText != string.Empty && this.BaseString != string.Empty && this.NormalColorText != base.ColorText) { base.ColorText = this.NormalColorText; this.Text = this.BaseString; } break; } base.OnInput(ref ptr); if (this.repeat) { if (this.m_ctrlState == UIButton.CONTROL_STATE.ACTIVE) { goto IL_4A2; } } else if (ptr.evt == this.whenToInvoke) { goto IL_4A2; } return; IL_4A2: if (ptr.evt == this.whenToInvoke && this.soundOnClick != null) { this.soundOnClick.PlayOneShot(this.soundOnClick.clip); } if (this.scriptWithMethodToInvoke != null) { this.scriptWithMethodToInvoke.Invoke(this.methodToInvoke, this.delay); } if (this.changeDelegate != null) { this.changeDelegate(this); if (this.bUseDefaultSound) { MsgHandler.Handle("ButtonSound", new object[0]); } } }