using DG.Tweening; using GameFramework.Event; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityGameFramework.Runtime; public class ExpManager : MonoBehaviour { private GameObject eff = null; private static ExpManager mInst = null; public static void Init() { if (null == mInst) { GameObject obj = new GameObject(typeof(ExpManager).ToString()); mInst = obj.AddComponent(); } } private void OnEnable() { EventComponent eventCmpt = GameEntry.GetComponent(); eventCmpt.Subscribe(HeroLvlUpEvent.EventId, HeroLevelUpProcessor); eventCmpt.Subscribe(GetExpEvent.EventId, HeroAddProcessor); } private void OnDisable() { EventComponent eventCmpt = GameEntry.GetComponent(); if (eventCmpt.Check(HeroLvlUpEvent.EventId, HeroLevelUpProcessor)) { eventCmpt.Unsubscribe(HeroLvlUpEvent.EventId, HeroLevelUpProcessor); } if (eventCmpt.Check(GetExpEvent.EventId, HeroAddProcessor)) { eventCmpt.Unsubscribe(GetExpEvent.EventId, HeroAddProcessor); } } /// /// 唤灵师等级提升事件 /// /// public void HeroLevelUpProcessor(object sender, GameEventArgs e) { var evt = e as HeroLvlUpEvent; if (null != evt) { //// 队列显示唤灵师升级 //PopupEffectQueueHelper.Instance.ShowEffect(ePopupEffectType.HuanLingShiLvUp, ""); //int power = evt.HeroVo.GetPower() - evt.PowerAdded; //int added = evt.PowerAdded; //string powerStr = "" + power.ToString() + ""; //string add = " + "; //string addedStr = "" + added.ToString() + ""; //// 队列显示战力提升 //PopupEffectQueueHelper.Instance.ShowEffect(ePopupEffectType.PowerAdd, powerStr + add + addedStr); } } /// /// 唤灵师加经验提升事件 /// /// public void HeroAddProcessor(object sender, GameEventArgs e) { var evt = e as GetExpEvent; if (null != evt) { // Debug.Log("获取经验:" + evt.ExpNum); UI_TipsWindow.ShowHeroAddExpEffect(evt.ExpNum); } } private void ExpEffect() { // 增加拾取特效 ResourceHelper.Instance.LoadAssetBundle("shiqu_tuowei", (ab) => { if (ab != null) { eff = (GameObject)Instantiate(ab.LoadAsset("shiqu_tuowei")); eff.transform.localPosition = this.transform.position; //CmptAutoDestory des = eff.AddComponent(); //des.LiveTime = 2.0f; eff.transform.DOMove(this.transform.position + Vector3.up * 4, 0.7f).OnComplete(() => { DropItemFollow follow = eff.AddComponent(); follow.target = HeroPlayerController.Instance.m_Hero.gameObject; }); //mtweener = eff.transform.DOMove(this.transform.position + Vector3.up * 5, 1.0f); //mtweener.OnComplete(()=> //{ // tweenFly = true; //}); } }); } }