// Token: 0x060003F4 RID: 1012 RVA: 0x000230E8 File Offset: 0x000212E8
        private bool HasTarget(ref AnimTex anmTex)
        {
            Texture texture = this.material.GetTexture(anmTex.texProp.PropId);

            if (texture == null)
            {
                anmTex = null;
                return(false);
            }
            if (texture.GetInstanceID() != anmTex.texId)
            {
                AnimTex animTex = ParseAnimUtil.ParseAnimTex(this.material, anmTex.texProp, texture);
                if (animTex == null)
                {
                    if (AnimItem.settings.backScale)
                    {
                        this.RestoreTexPos(anmTex);
                    }
                    anmTex = null;
                    return(false);
                }
                anmTex = animTex;
            }
            return(true);
        }
Beispiel #2
0
        /// <summary>
        /// アニメーション対象のテクスチャのIDが変わっていないか判定し、
        /// 変更されたテクスチャがアニメ対象外であればマテリアルのスケールを強制的に0,1にセットし、falseを返す
        ///
        ///
        /// menuからの"マテリアル変更"は、materialオブジェクトを使いまわす
        /// "テクスチャ変更"は、さらにオフセットやスケールが変わらない仕様のため、
        /// ***_anim.tex以外のファイルはスケールを元に戻す
        /// </summary>
        /// <param name="anmTex">チェック対象オブジェクト</param>
        /// <returns>アニメーション対象であればtrue それ以外はfalse</returns>
        private bool HasTarget(ref AnimTex anmTex)
        {
            var tex1 = material.GetTexture(anmTex.texProp.PropId);

            if (tex1 == null)
            {
                // LogUtil.Debug("has no texture. ", anmTex.texProp, ", tex=", anmTex);
                anmTex = null;
                return(false);
            }

            if (tex1.GetInstanceID() != anmTex.texId)
            {
                // LogUtil.Debug("tex id changed.", anmTex.texId, "=>", tex1.GetInstanceID());
                var parsedAnmTex = ParseAnimUtil.ParseAnimTex(material, anmTex.texProp, tex1);
                if (parsedAnmTex == null)
                {
                    // LogUtil.Debug(" no anim tex");
                    if (settings.backScale)
                    {
                        RestoreTexPos(anmTex);
                    }
                    anmTex = null;
                    return(false);
                }

                anmTex = parsedAnmTex;
            }
            return(true);
        }
        // Token: 0x060003F5 RID: 1013 RVA: 0x00023160 File Offset: 0x00021360
        private void RestoreTexPos(AnimTex anmTex)
        {
            int propId    = anmTex.texProp.PropId;
            int propFPSId = anmTex.texProp.PropFPSId;

            this.material.SetTextureScale(propId, Vector2.one);
            this.material.SetTextureOffset(propId, Vector2.zero);
            if (this.material.HasProperty(propFPSId))
            {
                this.material.SetFloat(propFPSId, -1f);
            }
        }
Beispiel #4
0
        private void RestoreTexPos(AnimTex anmTex)
        {
            // マテリアルのスケールとオフセットをデフォルトに復元
            var propId    = anmTex.texProp.PropId;
            var propFPSId = anmTex.texProp.PropFPSId;

            material.SetTextureScale(propId, Vector2.one);
            material.SetTextureOffset(propId, Vector2.zero);
            if (material.HasProperty(propFPSId))
            {
                material.SetFloat(propFPSId, -1);
            }
        }
        // Token: 0x06000418 RID: 1048 RVA: 0x00023934 File Offset: 0x00021B34
        public static AnimTex[] ParseAnimTex(Material m)
        {
            AnimTex[] array = null;
            int       num   = 0;

            foreach (TexProp texProp in ParseAnimUtil.targets)
            {
                AnimTex animTex = ParseAnimUtil.ParseAnimTex(m, texProp, null);
                if (animTex != null)
                {
                    array      = (array ?? new AnimTex[ParseAnimUtil.targets.Length]);
                    array[num] = animTex;
                }
                num++;
            }
            return(array);
        }
 // Token: 0x060003F2 RID: 1010 RVA: 0x00023014 File Offset: 0x00021214
 public void Animate(float deltaTime)
 {
     if (this.material == null)
     {
         return;
     }
     for (int i = 0; i < this.texes.Length; i++)
     {
         AnimTex animTex = this.texes[i];
         if (animTex != null && animTex.updateTime(deltaTime))
         {
             if (this.HasTarget(ref animTex))
             {
                 this.material.SetTextureOffset(animTex.texProp.PropId, animTex.nextOffset());
             }
             this.texes[i] = animTex;
         }
     }
 }
 // Token: 0x060003F3 RID: 1011 RVA: 0x00023088 File Offset: 0x00021288
 public void Deactivate()
 {
     if (this.material == null)
     {
         return;
     }
     if (AnimItem.settings.backScale)
     {
         for (int i = 0; i < this.texes.Length; i++)
         {
             AnimTex animTex = this.texes[i];
             if (animTex != null)
             {
                 this.RestoreTexPos(animTex);
                 this.texes[i] = null;
             }
         }
     }
     this.material = null;
 }