Exemplo n.º 1
0
    public GameObject PlayEffect(eUIEffectType effectType, Transform targetRoot, float scale = 0f, int id = 0)
    {
        if (this.CheckEffectInList(effectType, id) != -1)
        {
            return(null);
        }
        GameObject gameObject = UnityEngine.Object.Instantiate(this.LoadEffectPrefab(effectType)) as GameObject;
        Vector3    localScale = gameObject.transform.localScale;

        gameObject.transform.parent           = targetRoot;
        gameObject.transform.localPosition    = Vector3.zero;
        gameObject.transform.localEulerAngles = new Vector3(340f, 0f, 0f);
        if (scale == 0f)
        {
            gameObject.transform.localScale = localScale;
        }
        else
        {
            gameObject.transform.localScale = Vector3.one * scale;
        }
        UIEffectMgr.EffectItem effectItem = new UIEffectMgr.EffectItem();
        effectItem.effectType = effectType;
        effectItem.effectObj  = gameObject;
        effectItem.nID        = id;
        this.m_effectItemList.Add(effectItem);
        return(gameObject);
    }
Exemplo n.º 2
0
 private GameObject LoadEffectPrefab(eUIEffectType effectType)
 {
     if (!this.m_uiEffectPrefabDict.ContainsKey(effectType))
     {
         GameObject value = ResourceManager.Load <GameObject>(effectType.ToString(), true, true, null, 0, false);
         this.m_uiEffectPrefabDict.Add(effectType, value);
     }
     return(this.m_uiEffectPrefabDict[effectType]);
 }
Exemplo n.º 3
0
    public void StopEffect(eUIEffectType effectType, int id = 0)
    {
        int num = this.CheckEffectInList(effectType, id);

        if (num != -1)
        {
            UnityEngine.Object.Destroy(this.m_effectItemList[num].effectObj);
            this.m_effectItemList[num].effectObj = null;
            this.m_effectItemList.RemoveAt(num);
        }
    }
Exemplo n.º 4
0
 private int CheckEffectInList(eUIEffectType effectType, int id)
 {
     for (int i = 0; i < this.m_effectItemList.Count; i++)
     {
         if (this.m_effectItemList[i].effectType == effectType && this.m_effectItemList[i].nID == id)
         {
             return(i);
         }
     }
     return(-1);
 }