public void SetupHairCap(SkinSetCollection skin, float hairNum, float meshNum, MaterialPropertyBlock block)
    {
        float   single;
        float   single1;
        int     index = skin.GetIndex(meshNum);
        SkinSet skins = skin.Skins[index];

        if (skins != null)
        {
            for (int i = 0; i < 5; i++)
            {
                if (((int)this.hairCapMask & 1 << (i & 31)) != 0)
                {
                    PlayerModelHair.GetRandomVariation(hairNum, i, index, out single, out single1);
                    HairType hairType = (HairType)i;
                    HairSetCollection.HairSetEntry hairSetEntry = skins.HairCollection.Get(hairType, single);
                    if (hairSetEntry.HairSet != null)
                    {
                        HairDyeCollection hairDyeCollection = hairSetEntry.HairDyeCollection;
                        if (hairDyeCollection != null)
                        {
                            HairDye hairDye = hairDyeCollection.Get(single1);
                            if (hairDye != null)
                            {
                                hairDye.ApplyCap(hairDyeCollection, hairType, block);
                            }
                        }
                    }
                }
            }
        }
    }
    private void Setup(HairType type, HairSetCollection hair, int meshIndex, float typeNum, float dyeNum, MaterialPropertyBlock block)
    {
        this.CacheOriginalMaterials();
        HairSetCollection.HairSetEntry hairSetEntry = hair.Get(type, typeNum);
        if (hairSetEntry.HairSet == null)
        {
            Debug.LogWarning("Hair.Get returned a NULL hair");
            return;
        }
        int num = -1;

        if (type == HairType.Facial || type == HairType.Eyebrow)
        {
            num = meshIndex;
        }
        HairDye           hairDye           = null;
        HairDyeCollection hairDyeCollection = hairSetEntry.HairDyeCollection;

        if (hairDyeCollection != null)
        {
            hairDye = hairDyeCollection.Get(dyeNum);
        }
        hairSetEntry.HairSet.Process(this, hairDyeCollection, hairDye, block);
        hairSetEntry.HairSet.ProcessMorphs(base.gameObject, num);
    }
 private void Setup(
     HairType type,
     HairSetCollection hair,
     int meshIndex,
     float typeNum,
     float dyeNum,
     MaterialPropertyBlock block)
 {
     this.CacheOriginalMaterials();
     HairSetCollection.HairSetEntry hairSetEntry = hair.Get(type, typeNum);
     if (Object.op_Equality((Object)hairSetEntry.HairSet, (Object)null))
     {
         Debug.LogWarning((object)"Hair.Get returned a NULL hair");
     }
     else
     {
         int blendShapeIndex = -1;
         if (type == HairType.Facial || type == HairType.Eyebrow)
         {
             blendShapeIndex = meshIndex;
         }
         HairDye           dye = (HairDye)null;
         HairDyeCollection hairDyeCollection = hairSetEntry.HairDyeCollection;
         if (Object.op_Inequality((Object)hairDyeCollection, (Object)null))
         {
             dye = hairDyeCollection.Get(dyeNum);
         }
         hairSetEntry.HairSet.Process(this, hairDyeCollection, dye, block);
         hairSetEntry.HairSet.ProcessMorphs(((Component)this).get_gameObject(), blendShapeIndex);
     }
 }
示例#4
0
    public void SetupHairCap(
        SkinSetCollection skin,
        float hairNum,
        float meshNum,
        MaterialPropertyBlock block)
    {
        int     index = skin.GetIndex(meshNum);
        SkinSet skin1 = skin.Skins[index];

        if (!Object.op_Inequality((Object)skin1, (Object)null))
        {
            return;
        }
        for (int typeIndex = 0; typeIndex < 5; ++typeIndex)
        {
            if ((this.hairCapMask & (HairCapMask)(1 << typeIndex)) != (HairCapMask)0)
            {
                float typeNum;
                float dyeNum;
                PlayerModelHair.GetRandomVariation(hairNum, typeIndex, index, out typeNum, out dyeNum);
                HairType hairType = (HairType)typeIndex;
                HairSetCollection.HairSetEntry hairSetEntry = skin1.HairCollection.Get(hairType, typeNum);
                if (Object.op_Inequality((Object)hairSetEntry.HairSet, (Object)null))
                {
                    HairDyeCollection hairDyeCollection = hairSetEntry.HairDyeCollection;
                    if (Object.op_Inequality((Object)hairDyeCollection, (Object)null))
                    {
                        hairDyeCollection.Get(dyeNum)?.ApplyCap(hairDyeCollection, hairType, block);
                    }
                }
            }
        }
    }