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);
                            }
                        }
                    }
                }
            }
        }
    }
Esempio n. 2
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);
                    }
                }
            }
        }
    }
    public void Setup(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)
        {
            Debug.LogError("Skin.Get returned a NULL skin");
            return;
        }
        int num = (int)this.type;

        PlayerModelHair.GetRandomVariation(hairNum, num, index, out single, out single1);
        this.Setup(this.type, skins.HairCollection, index, single, single1, block);
    }
    public void Setup(
        SkinSetCollection skin,
        float hairNum,
        float meshNum,
        MaterialPropertyBlock block)
    {
        int     index = skin.GetIndex(meshNum);
        SkinSet skin1 = skin.Skins[index];

        if (Object.op_Equality((Object)skin1, (Object)null))
        {
            Debug.LogError((object)"Skin.Get returned a NULL skin");
        }
        else
        {
            int   type = (int)this.type;
            float typeNum;
            float dyeNum;
            PlayerModelHair.GetRandomVariation(hairNum, type, index, out typeNum, out dyeNum);
            this.Setup(this.type, skin1.HairCollection, index, typeNum, dyeNum, block);
        }
    }