//达到伤害值,中断技能 void OnBreakSkill() { //打断吟唱 m_skillBase.BreakPrepareSkill(); UnRegisterEvent(); if (m_attackBreakDesc.isUsedUI) { CancelInvoke("UpdateShowTime"); EventToUI.SendEvent("EU_DPSBAR_HIDE"); } if (m_attackBreakDesc.behitAction.Length == 0) { m_skillBase.SkillEnd(); return; } //播放被击动作 m_skillBase.m_actor.StopAll(); m_skillBase.m_actor.PlayAction(m_attackBreakDesc.behitAction); //动作完后结束技能 Invoke("SkillEnd", m_skillBase.m_actor.GetActionLength(m_attackBreakDesc.behitAction)); }
// Update is called once per frame //void Update() //{ //} void OnDestroy() { UnRegisterEvent(); if (m_attackBreakDesc.isUsedUI) { CancelInvoke("UpdateShowTime"); EventToUI.SendEvent("EU_DPSBAR_HIDE"); } }
void PlayStayEfxObj() { mFallTran.gameObject.SetActive(false); mStayTran.gameObject.SetActive(true); EventToUI.SetArg(UIEventArg.Arg1, gameObject); EventToUI.SetArg(UIEventArg.Arg2, string.Format("{0}x{1}", itemName, count)); EventToUI.SetArg(UIEventArg.Arg3, (int)quality); EventToUI.SendEvent("EU_ADD_DROPITEMTEXT"); CancelInvoke("PlayStayEfxObj"); }
// Use this for initialization void Start() { CancelInvoke("Start"); //m_skillBase = this.transform.root.gameObject.GetComponent<SkillBase>(); if (m_skillBase == null || m_skillBase.m_actor == null) { return; } m_prepareKeepTime = m_skillBase.prepareKeepTime; if (m_attackBreakDesc == null) { return; } if (m_attackBreakDesc.breakDamageHP <= 0) { return; } m_breakDamageHP = m_attackBreakDesc.breakDamageHP; //开始等待伤害 m_hadDamageValue = 0; //注册事件 RegisterEvent(); if (m_attackBreakDesc.isUsedUI) { EventToUI.SetArg(UIEventArg.Arg1, 1f); EventToUI.SetArg(UIEventArg.Arg2, m_prepareKeepTime); EventToUI.SendEvent("EU_DPSBAR_SHOW"); m_updateCount = 0; InvokeRepeating("UpdateShowTime", 1, 1); } //加载UI //if (m_attackBreakDesc.UIPrefabPath.Length <= 0) //{ // return; //} //m_damageUIObj = Instantiate( // CoreEntry.gResLoader.LoadResource(m_attackBreakDesc.UIPrefabPath)) as GameObject; }
/// <summary> /// 回收拾取 /// </summary> /// <param name="item"></param> private void RecycleDropFlyItem(DropFlyItem item, bool isDone = false) { //item.gameObject.SetActive(false); item.gameObject.transform.SetRenderActive(false); mDropFlyItemList.Remove(item); mCachedFlyItemList.Add(item); if (isDone) { DoBagTween(); EventToUI.SetArg(UIEventArg.Arg1, item.mItemName); EventToUI.SetArg(UIEventArg.Arg2, item.mItemQuality); EventToUI.SendEvent("EU_SHOW_DROPFLYTIP"); } }
void UpdateShowTime() { m_updateCount++; float diffTime = m_prepareKeepTime - m_updateCount; if (diffTime < 0) { diffTime = 0; } diffTime = Mathf.Floor(diffTime); EventToUI.SetArg(UIEventArg.Arg1, diffTime); EventToUI.SendEvent("EU_DPSBAR_SET_TIME_VAULE"); }
void EventFunction(GameEvent ge, EventParameter parameter) { switch (ge) { case GameEvent.GE_DAMAGE_CHANGE: { int entityID = parameter.intParameter; if (entityID != m_skillBase.m_actor.entityid) { return; } int hp = parameter.intParameter1; m_hadDamageValue += hp; //更新UI if (m_attackBreakDesc.isUsedUI) { float ratio = (m_breakDamageHP - m_hadDamageValue) * 1.0f / m_breakDamageHP; //LogMgr.UnityLog("ratio=" + ratio); if (ratio < 0) { ratio = 0; } EventToUI.SetArg(UIEventArg.Arg1, ratio); EventToUI.SendEvent("EU_DPSBAR_SET_PERCENT_VAULE"); } //是否达到目标伤害 if (m_hadDamageValue >= m_breakDamageHP) { UnRegisterEvent(); OnBreakSkill(); } } break; default: break; } }
/// <summary> /// 回收掉落物品 /// </summary> /// <param name="unusedDropItem"></param> private void ReleaseDropItem(DropItemInfo unusedDropItem) { EventToUI.SetArg(UIEventArg.Arg1, unusedDropItem.dropItemObj); EventToUI.SendEvent("EU_REMOVE_DROPITEMTEXT"); GameObjectPool objPool = m_moneyEftObjectPool; if (unusedDropItem.dropType == DROP_TYPE.DROPTYPE_COMMON) { objPool = m_itemEftPoolDict[unusedDropItem.dropEft]; } if (null != unusedDropItem.dropQualityEftObj) { CoreEntry.gGameObjPoolMgr.Destroy(unusedDropItem.dropQualityEftObj); } if (unusedDropItem.dropItemObj != null) { objPool.RecyclePrefabInstance(unusedDropItem.dropItemObj); unusedDropItem.dropItemObj = null; } m_UnusedDropItemList.Add(unusedDropItem); }
/// <summary> /// 拾取特效 /// </summary> /// <param name="dropItem"></param> private void PlayPickEffect(DropItemInfo dropItem) { if (dropItem.dropType == DROP_TYPE.DROPTYPE_GOLD) { EventToUI.SetArg(UIEventArg.Arg1, dropItem.count); EventToUI.SetArg(UIEventArg.Arg2, dropItem.dropPosition); EventToUI.SendEvent("EU_SHOW_DROPGOLDGFLY"); CoreEntry.gAudioMgr.PlayUISound(900014); return; } LuaTable itemCfg = null; LuaTable equipCfg = null; itemCfg = ConfigManager.Instance.BagItem.GetItemConfig(dropItem.cfgID); if (null == itemCfg) { equipCfg = ConfigManager.Instance.BagItem.GetItemConfig(dropItem.cfgID); } if (null == itemCfg && null == equipCfg) { return; } string dmeshid = string.Empty; string itemName = string.Empty; int quality = -1; if (null != itemCfg) { dmeshid = itemCfg.Get <string>("dmeshid"); itemName = itemCfg.Get <string>("name"); quality = itemCfg.Get <int>("quality"); } else { if (equipCfg != null) { dmeshid = equipCfg.Get <string>("dmeshid"); itemName = equipCfg.Get <string>("name"); quality = equipCfg.Get <int>("quality"); } } string[] strs = dmeshid.Split('#'); if (strs == null || strs.Length != 2) { return; } EventToUI.SetArg(UIEventArg.Arg1, strs[0]); EventToUI.SetArg(UIEventArg.Arg2, dropItem.dropPosition); Transform t = PickFlyTarget; if (null != t) { EventToUI.SetArg(UIEventArg.Arg3, t.position); } else { EventToUI.SetArg(UIEventArg.Arg3, Vector3.zero); } EventToUI.SetArg(UIEventArg.Arg4, string.Format("{0} x{1}", itemName, dropItem.count)); EventToUI.SetArg(UIEventArg.Arg5, quality); EventToUI.SendEvent("EU_SHOW_DROPFLY"); //if (m_pickEftObjectPool != null) //{ // GameObject pickFlyObj = m_pickEftObjectPool.ObtainPrefabInstance(); // if (pickFlyObj != null) // { // pickFlyObj.SetActive(true); // DropPickFly pickFly = pickFlyObj.GetComponent<DropPickFly>(); // ActorObj po = CoreEntry.gActorMgr.GetPlayerActorByServerID(MainRole.Instance.serverID); // //pickFly.Init(dropItem.dropPosition, po.gameObject, m_pickEftObjectPool); // pickFly.Init(dropItem.dropPosition, m_BagUIPos, m_pickEftObjectPool); // } //} }