public void ShowScreenTip(string tips, UIScreenTipPosEnum posType, UnityEngine.Vector3 posVec) { if (lblTips != null) { lblTips.text = tips; } if (posType == UIScreenTipPosEnum.AlignNone) { transform.position = posVec; } else { transform.position = GetWorldPosition(posType); } BloodAnimationScript bas = this.GetComponent <BloodAnimationScript>(); if (bas != null) { bas.PlayAnimation(); } //NGUITools.SetActive(this.gameObject, true); }
public UnityEngine.GameObject NewObject(string objType, float timeRecycle = 0.0f) { UnityEngine.GameObject ret = null; List <UnityEngine.GameObject> tempList = null; switch (objType) { case "AttackEffect": tempList = m_AttackEffectList; break; case "CriticalDamage": tempList = m_CriticalDamageList; break; case "DamageForAddHero": tempList = m_DamageForAddHeroList; break; case "DamageForCutHero": tempList = m_DamageForCutHeroList; break; case "EnergyAdd": tempList = m_EnergyAddList; break; case "EnergyCut": tempList = m_EnergyCutList; break; case "ScreenTip": tempList = m_ScreenTipList; break; case "GainMoney": tempList = m_GainMoneyList; break; default: break; } if (tempList != null) { if (tempList.Count > 0) { int newidx = PlusIdx(objType, tempList); if (tempList[newidx] != null) { ret = tempList[newidx]; BloodAnimationScript bas = ret.GetComponent <BloodAnimationScript>(); if (bas != null) { bas.SetTimeRecycle(timeRecycle); if (bas.IsActive()) { UnityEngine.Transform tf = ret.transform; tf.localScale = UnityEngine.Vector3.one; bas.StopAnimation(); } } } } } return(ret); }
public void NewObject(string objType, int number, UnityEngine.GameObject parent) { List <UnityEngine.GameObject> tempList = null; switch (objType) { case "AttackEffect": tempList = m_AttackEffectList; break; case "CriticalDamage": tempList = m_CriticalDamageList; break; case "DamageForAddHero": tempList = m_DamageForAddHeroList; break; case "DamageForCutHero": tempList = m_DamageForCutHeroList; break; case "EnergyAdd": tempList = m_EnergyAddList; break; case "EnergyCut": tempList = m_EnergyCutList; break; case "ScreenTip": tempList = m_ScreenTipList; break; case "GainMoney": tempList = m_GainMoneyList; break; default: break; } if (number > 0 && tempList != null) { UnityEngine.Object prefab = CrossObjectHelper.TryCastObject <UnityEngine.GameObject>(ArkCrossEngine.ResourceSystem.GetSharedResource(UIManager.Instance.GetPathByName(objType))); if (prefab != null) { UnityEngine.GameObject go = null; UnityEngine.Transform tf = null; BloodAnimationScript bas = null; for (int i = 0; i < number; i++) { go = UnityEngine.GameObject.Instantiate(prefab) as UnityEngine.GameObject; if (go != null) { tf = go.transform; if (parent != null) { tf.parent = parent.transform; } else { tf.parent = null; } tf.localScale = UnityEngine.Vector3.one; bas = go.GetComponent <BloodAnimationScript>(); if (bas != null) { //bas.InitState(); //StopAnimation()里面已经调用该接口 bas.StopAnimation(); } tempList.Add(go); } } } } }