예제 #1
0
    private T FindOrCreateEffect <T>(int type) where T : SMaterialEffect_Base, new()
    {
        if (this.playingEffects != null)
        {
            for (int i = 0; i < this.playingEffects.Count; i++)
            {
                SMaterialEffect_Base base2 = this.playingEffects[i];
                if (base2.type == type)
                {
                    if (base2 is T)
                    {
                        return(base2 as T);
                    }
                    base2.Stop();
                    base2.Release();
                    this.playingEffects.RemoveAt(i);
                    break;
                }
            }
        }
        T item = ClassObjPool <T> .Get();

        item.type      = type;
        item.owner     = this;
        item.bChkReset = false;
        item.AllocId();
        if (this.playingEffects == null)
        {
            this.playingEffects = new ListView <SMaterialEffect_Base>();
        }
        this.playingEffects.Add(item);
        return(item);
    }
예제 #2
0
    private T FindOrCreateEffect <T>(int type) where T : SMaterialEffect_Base, new()
    {
        if (this.playingEffects != null)
        {
            int i = 0;
            while (i < this.playingEffects.get_Count())
            {
                SMaterialEffect_Base sMaterialEffect_Base = this.playingEffects.get_Item(i);
                if (sMaterialEffect_Base.type == type)
                {
                    if (!(sMaterialEffect_Base is T))
                    {
                        sMaterialEffect_Base.Stop();
                        sMaterialEffect_Base.Release();
                        this.playingEffects.RemoveAt(i);
                        break;
                    }
                    return(sMaterialEffect_Base as T);
                }
                else
                {
                    i++;
                }
            }
        }
        T t = ClassObjPool <T> .Get();

        t.type      = type;
        t.owner     = this;
        t.bChkReset = false;
        t.AllocId();
        if (this.playingEffects == null)
        {
            this.playingEffects = new ListView <SMaterialEffect_Base>();
        }
        this.playingEffects.Add(t);
        return(t);
    }
예제 #3
0
 private void StopEffect(SMaterialEffect_Base effect)
 {
     effect.Stop();
     effect.Release();
     this.playingEffects.Remove(effect);
 }