75 lines
2.3 KiB
C#
75 lines
2.3 KiB
C#
|
using System;
|
|||
|
using UnityEngine;
|
|||
|
using UnityEngine.UI;
|
|||
|
using System.Collections;
|
|||
|
using Games.GlobeDefine;
|
|||
|
using Games.LogicObj;
|
|||
|
using GCGame.Table;
|
|||
|
|
|||
|
public class Impact_ScreenUIEffect : ImpactEffectBase
|
|||
|
{
|
|||
|
public override EffectLogic.EffectType ImpactEffectType
|
|||
|
{
|
|||
|
get { return EffectLogic.EffectType.TYPE_SCREENUIEFFECT; }
|
|||
|
}
|
|||
|
|
|||
|
GameObject m_effectObj;
|
|||
|
RectTransform m_effectRect;
|
|||
|
public override void StartEffect()
|
|||
|
{
|
|||
|
base.StartEffect();
|
|||
|
int paramid = Data.GetParamValuebyIndex(0);
|
|||
|
Tab_EffectParam effectparam = TableManager.GetEffectParamByID(paramid, 0);
|
|||
|
if (effectparam == null)
|
|||
|
return;
|
|||
|
string path = effectparam.GetParamValuebyIndex(0);
|
|||
|
string name = effectparam.GetParamValuebyIndex(1);
|
|||
|
|
|||
|
LoadAssetBundle.Instance.LoadUI(path, name, OnLoadHead, null);
|
|||
|
}
|
|||
|
|
|||
|
public void OnLoadHead(string modelName, GameObject resObj, Hashtable hashParam)
|
|||
|
{
|
|||
|
m_effectObj = GameObject.Instantiate(resObj) as GameObject;
|
|||
|
if (m_effectObj == null || objCharacter==null)
|
|||
|
{
|
|||
|
StopEffect();
|
|||
|
return;
|
|||
|
}
|
|||
|
m_effectRect = m_effectObj.GetComponent<RectTransform>();
|
|||
|
if(m_effectRect==null)
|
|||
|
{
|
|||
|
StopEffect();
|
|||
|
return;
|
|||
|
}
|
|||
|
if (null != GameManager.gameManager.ActiveScene.NameBoardRoot)
|
|||
|
{
|
|||
|
m_effectObj.transform.parent = GameManager.gameManager.ActiveScene.NameBoardRoot.transform;
|
|||
|
}
|
|||
|
|
|||
|
m_effectObj.transform.localPosition = Vector3.zero;
|
|||
|
m_effectObj.transform.localRotation = Quaternion.LookRotation(Vector3.forward);
|
|||
|
m_effectObj.transform.localScale = Vector3.one;
|
|||
|
}
|
|||
|
|
|||
|
public override void StopEffect()
|
|||
|
{
|
|||
|
base.StopEffect();
|
|||
|
if(m_effectObj!=null)
|
|||
|
{
|
|||
|
m_effectObj.transform.parent = null;
|
|||
|
m_effectObj.SetActive(false);
|
|||
|
GameObject.Destroy(m_effectObj);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
protected override void UpdateInherited()
|
|||
|
{
|
|||
|
Vector3 worldPos = objCharacter.Position + new Vector3(0, objCharacter.DeltaHeight, 0); ;
|
|||
|
if (UIManager.Instance() != null && m_effectRect!=null)
|
|||
|
{
|
|||
|
var screenPoint = UIManager.Instance().WorldToUiPoint(worldPos);
|
|||
|
m_effectRect.anchoredPosition = screenPoint;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|