// 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);
        }
예제 #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);
        }
예제 #3
0
        // Token: 0x060003F9 RID: 1017 RVA: 0x000233C4 File Offset: 0x000215C4
        public List <AnimItem> ParseMaidSlot(TBodySkin slot, Material[] mates, IList <MenuFileHandler.MateInfo> miList)
        {
            if (mates == null)
            {
                return(null);
            }
            List <AnimItem> list = null;

            try
            {
                if (miList == null)
                {
                    int num = 0;
                    foreach (Material material in mates)
                    {
                        AnimTex[] array = ParseAnimUtil.ParseAnimTex(material);
                        if (array != null)
                        {
                            if (list == null)
                            {
                                list = new List <AnimItem>();
                            }
                            list.Add(new AnimItem(material, num, array));
                        }
                        num++;
                    }
                }
                else
                {
                    foreach (MenuFileHandler.MateInfo mateInfo in miList)
                    {
                        Material  material2 = mates[mateInfo.matNo];
                        AnimTex[] array2    = ParseAnimUtil.ParseAnimTex(material2);
                        if (array2 != null)
                        {
                            if (list == null)
                            {
                                list = new List <AnimItem>();
                            }
                            list.Add(new AnimItem(material2, mateInfo.matNo, array2));
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LogUtil.Debug(new object[]
                {
                    "slotId:",
                    slot,
                    ex.Message
                });
            }
            return(list);
        }
        public List <AnimItem> ParseMaidSlot(TBodySkin slot, Material[] mates, IList <MenuFileHandler.MateInfo> miList)
        {
            if (mates == null)
            {
                return(null);
            }

            // 変更のあったスロットをパースし、マテリアル/テクスチャからアニメーション対象を抽出
            List <AnimItem> targets = null;

            try {
                if (miList == null)
                {
                    var mateNo = 0;
                    foreach (var mate in mates)
                    {
                        var animTexes = ParseAnimUtil.ParseAnimTex(mate);
                        if (animTexes != null)
                        {
                            if (targets == null)
                            {
                                targets = new List <AnimItem>();
                            }
                            targets.Add(new AnimItem(mate, mateNo, animTexes));
                        }
                        mateNo++;
                    }
                }
                else
                {
                    foreach (var mi in miList)
                    {
                        var mate      = mates[mi.matNo];
                        var animTexes = ParseAnimUtil.ParseAnimTex(mate);
                        if (animTexes != null)
                        {
                            if (targets == null)
                            {
                                targets = new List <AnimItem>();
                            }
                            targets.Add(new AnimItem(mate, mi.matNo, animTexes));
                        }
                    }
                }
            } catch (Exception e) {
                LogUtil.Debug("slotId:", slot, e.Message);
            }
            return(targets);
        }
        // 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);
        }
예제 #6
0
 // Token: 0x06000426 RID: 1062 RVA: 0x00023E60 File Offset: 0x00022060
 private bool ParseMaterial(Material mate, int matNo)
 {
     AnimTex[] array = ParseAnimUtil.ParseAnimTex(mate);
     if (array != null)
     {
         AnimItem target = this.GetTarget(matNo);
         if (target != null)
         {
             target.UpdateTexes(mate, array);
         }
         else
         {
             this.targets.Add(new AnimItem(mate, matNo, array));
         }
         return(true);
     }
     return(false);
 }
예제 #7
0
        private bool ParseMaterial(Material mate, int matNo)
        {
            var animTexes = ParseAnimUtil.ParseAnimTex(mate);

            if (animTexes != null)
            {
                var target = GetTarget(matNo);
                if (target != null)
                {
                    target.UpdateTexes(mate, animTexes);
                }
                else
                {
                    targets.Add(new AnimItem(mate, matNo, animTexes));
                }

                return(true);
            }

            return(false);
        }
 // Token: 0x06000419 RID: 1049 RVA: 0x0002398C File Offset: 0x00021B8C
 public static AnimTex ParseAnimTex(Material mate, TexProp texProp, Texture tex = null)
 {
     try
     {
         if (tex != null)
         {
             if (!ParseAnimUtil.IsTarget(tex))
             {
                 return(null);
             }
         }
         else if (!ParseAnimUtil.TryGetTargetTex(mate, texProp, out tex))
         {
             return(null);
         }
         Vector2 scale = (texProp == TexProp.MainTex) ? mate.mainTextureScale : mate.GetTextureScale(texProp.PropId);
         if (mate.HasProperty(texProp.PropScrollXId) || mate.HasProperty(texProp.PropScrollYId))
         {
             Vector2 scroll;
             scroll.x = ParseAnimUtil.fitting(mate.GetFloat(texProp.PropScrollXId));
             scroll.y = ParseAnimUtil.fitting(mate.GetFloat(texProp.PropScrollYId));
             float     frameSec  = ParseAnimUtil.ParseFrameSecond(mate, texProp);
             ScrollTex scrollTex = new ScrollTex(scroll, tex, frameSec)
             {
                 texProp = texProp
             };
             scrollTex.InitOffsetIndex(mate.GetTextureOffset(texProp.PropId));
             return(scrollTex);
         }
         if (scale.x <= 0.5f || scale.y <= 0.5f)
         {
             if (ParseAnimUtil.Equals(scale.x, 0f, 1E-06f) || ParseAnimUtil.Equals(scale.y, 0f, 1E-06f))
             {
                 return(null);
             }
             float          frameSec2      = ParseAnimUtil.ParseFrameSecond(mate, texProp);
             SlideScaledTex slideScaledTex = new SlideScaledTex(scale, tex, frameSec2)
             {
                 texProp = texProp
             };
             if (slideScaledTex.imageLength > 1)
             {
                 slideScaledTex.InitOffsetIndex(mate.GetTextureOffset(texProp.PropId));
                 LogUtil.DebugF("{0} X:{1},Y:{2},length={3}", new object[]
                 {
                     texProp,
                     slideScaledTex.ratioX,
                     slideScaledTex.ratioY,
                     slideScaledTex.imageLength
                 });
                 return(slideScaledTex);
             }
             return(slideScaledTex);
         }
     }
     catch (Exception ex)
     {
         LogUtil.Debug(new object[]
         {
             "Failed to parse texture:",
             texProp,
             ex
         });
     }
     return(null);
 }
 // Token: 0x0600041E RID: 1054 RVA: 0x00023C4B File Offset: 0x00021E4B
 public static bool TryGetTargetTex(Material m, TexProp texType, out Texture tex)
 {
     tex = ((texType == TexProp.MainTex) ? m.mainTexture : m.GetTexture(texType.PropId));
     return(tex != null && ParseAnimUtil.IsTarget(tex));
 }
        // Token: 0x0600041D RID: 1053 RVA: 0x00023C10 File Offset: 0x00021E10
        public static bool HasTargetTexName(Material m, TexProp texType)
        {
            Texture texture = (texType == TexProp.MainTex) ? m.mainTexture : m.GetTexture(texType.PropId);

            return(texture != null && ParseAnimUtil.IsTarget(texture));
        }