123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- 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<ExpManager>();
- }
- }
- private void OnEnable()
- {
- EventComponent eventCmpt = GameEntry.GetComponent<EventComponent>();
- eventCmpt.Subscribe(HeroLvlUpEvent.EventId, HeroLevelUpProcessor);
- eventCmpt.Subscribe(GetExpEvent.EventId, HeroAddProcessor);
- }
- private void OnDisable()
- {
- EventComponent eventCmpt = GameEntry.GetComponent<EventComponent>();
- if (eventCmpt.Check(HeroLvlUpEvent.EventId, HeroLevelUpProcessor))
- {
- eventCmpt.Unsubscribe(HeroLvlUpEvent.EventId, HeroLevelUpProcessor);
- }
- if (eventCmpt.Check(GetExpEvent.EventId, HeroAddProcessor))
- {
- eventCmpt.Unsubscribe(GetExpEvent.EventId, HeroAddProcessor);
- }
- }
- /// <summary>
- /// 唤灵师等级提升事件
- /// </summary>
- /// <param name="e"></param>
- 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 = "<color=#F6CF00>" + power.ToString() + "</color>";
- //string add = "<color=#ffffff> + </color>";
- //string addedStr = "<color=#00ff00>" + added.ToString() + "</color>";
- //// 队列显示战力提升
- //PopupEffectQueueHelper.Instance.ShowEffect(ePopupEffectType.PowerAdd, powerStr + add + addedStr);
- }
- }
- /// <summary>
- /// 唤灵师加经验提升事件
- /// </summary>
- /// <param name="e"></param>
- 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<CmptAutoDestory>();
- //des.LiveTime = 2.0f;
-
- eff.transform.DOMove(this.transform.position + Vector3.up * 4, 0.7f).OnComplete(() =>
- {
- DropItemFollow follow = eff.AddComponent<DropItemFollow>();
- follow.target = HeroPlayerController.Instance.m_Hero.gameObject;
- });
- //mtweener = eff.transform.DOMove(this.transform.position + Vector3.up * 5, 1.0f);
- //mtweener.OnComplete(()=>
- //{
- // tweenFly = true;
- //});
-
- }
- });
- }
- }
|