コード例 #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 void Update()
 {
     this.CheckMats();
     if (this.oldMats != null && this.mats != null)
     {
         if (this.playingEffects != null && this.playingEffects.get_Count() > 0)
         {
             for (int i = 0; i < this.playingEffects.get_Count(); i++)
             {
                 SMaterialEffect_Base sMaterialEffect_Base = this.playingEffects.get_Item(i);
                 sMaterialEffect_Base.OnMeshChanged(this.oldMats, this.mats);
             }
         }
         this.oldMats = null;
     }
     if (this.playingEffects != null && this.playingEffects.get_Count() > 0)
     {
         for (int j = 0; j < this.playingEffects.get_Count(); j++)
         {
             SMaterialEffect_Base sMaterialEffect_Base2 = this.playingEffects.get_Item(j);
             if (sMaterialEffect_Base2.Update())
             {
                 sMaterialEffect_Base2.Release();
                 this.playingEffects.RemoveAt(j);
                 j--;
             }
         }
     }
 }
コード例 #3
0
 private void Update()
 {
     this.CheckMats();
     if ((this.oldMats != null) && (this.mats != null))
     {
         if ((this.playingEffects != null) && (this.playingEffects.Count > 0))
         {
             for (int i = 0; i < this.playingEffects.Count; i++)
             {
                 this.playingEffects[i].OnMeshChanged(this.oldMats, this.mats);
             }
         }
         this.oldMats = null;
     }
     if ((this.playingEffects != null) && (this.playingEffects.Count > 0))
     {
         for (int j = 0; j < this.playingEffects.Count; j++)
         {
             SMaterialEffect_Base base3 = this.playingEffects[j];
             if (base3.Update())
             {
                 base3.Release();
                 this.playingEffects.RemoveAt(j);
                 j--;
             }
         }
     }
 }
コード例 #4
0
 public override bool Update()
 {
     if (this.enableFade)
     {
         float factor = 1f;
         if (SMaterialEffect_Base.UpdateFadeState(out factor, ref this.fadeState, ref this.fadeTimer, this.fadeInterval, false))
         {
             this.SetFactor(factor);
         }
         if (this.fadeState == SMaterialEffect_Base.FadeState.Stopped)
         {
             this.Stop();
             return(true);
         }
     }
     return(false);
 }
コード例 #5
0
 private void Update()
 {
     this.CheckMats();
     if ((this.playingEffects != null) && (this.playingEffects.Count > 0))
     {
         for (int i = 0; i < this.playingEffects.Count; i++)
         {
             SMaterialEffect_Base base2 = this.playingEffects[i];
             if (base2.Update())
             {
                 base2.Release();
                 this.playingEffects.RemoveAt(i);
                 i--;
             }
         }
     }
 }
コード例 #6
0
 public override bool Update()
 {
     if (this.enableFade)
     {
         float alpha = 1f;
         if (SMaterialEffect_Base.UpdateFadeState(out alpha, ref this.fadeState, ref this.fadeTimer, this.fadeInterval, this.forceUpdateFactor))
         {
             this.SetAlpha(alpha);
         }
         if (this.fadeState == SMaterialEffect_Base.FadeState.Stopped)
         {
             this.Stop();
             return(true);
         }
     }
     return(false);
 }
コード例 #7
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);
    }
コード例 #8
0
 private void StopEffect(SMaterialEffect_Base effect)
 {
     effect.Stop();
     effect.Release();
     this.playingEffects.Remove(effect);
 }
コード例 #9
0
 public virtual void OnMeshChanged(ListView <Material> oldMats, ListView <Material> newMats)
 {
     SMaterialEffect_Base.enableMatsKeyword(oldMats, this.shaderKeyword, false);
     SMaterialEffect_Base.enableMatsKeyword(newMats, this.shaderKeyword, true);
 }
コード例 #10
0
 public virtual void Play()
 {
     SMaterialEffect_Base.enableMatsKeyword(this.owner.mats, this.shaderKeyword, true);
 }
コード例 #11
0
 public virtual void Stop()
 {
     SMaterialEffect_Base.enableMatsKeyword(this.owner.mats, this.shaderKeyword, false);
 }