Example #1
0
    public IEnumerator loadskinE(int hair, int eye, string hairlink)
    {
        bool iteratorVariable0 = false;

        UnityEngine.Object.Destroy(this.part_hair);
        this.hair     = CostumeHair.hairsM[hair];
        this.hairType = hair;
        if (this.hair.hair != string.Empty)
        {
            GameObject iteratorVariable1 = (GameObject)UnityEngine.Object.Instantiate(CLEARSKIES.CacheResources.Load("Character/" + this.hair.hair));
            iteratorVariable1.transform.parent     = this.hair_go_ref.transform.parent;
            iteratorVariable1.transform.position   = this.hair_go_ref.transform.position;
            iteratorVariable1.transform.rotation   = this.hair_go_ref.transform.rotation;
            iteratorVariable1.transform.localScale = this.hair_go_ref.transform.localScale;
            iteratorVariable1.renderer.material    = CharacterMaterials.materials[this.hair.texture];
            bool mipmap = true;
            if (((int)FengGameManagerMKII.settings[0x3f]) == 1)
            {
                mipmap = false;
            }
            if (RCextensions.CheckIP(hairlink))
            {
                if ((!hairlink.EndsWith(".jpg") && !hairlink.EndsWith(".png")) && !hairlink.EndsWith(".jpeg"))
                {
                    if (hairlink.ToLower() == "transparent")
                    {
                        iteratorVariable1.renderer.enabled = false;
                    }
                }
                else if (FengGameManagerMKII.linkHash[0].ContainsKey(hairlink))
                {
                    iteratorVariable1.renderer.material = (Material)FengGameManagerMKII.linkHash[0][hairlink];
                }
                else
                {
                    WWW link = new WWW(hairlink);
                    yield return(link);

                    Texture2D iteratorVariable4 = RCextensions.loadimage(link, mipmap, 0x30d40);
                    link.Dispose();
                    if (!FengGameManagerMKII.linkHash[0].ContainsKey(hairlink))
                    {
                        iteratorVariable0 = true;
                        iteratorVariable1.renderer.material.mainTexture = iteratorVariable4;
                        FengGameManagerMKII.linkHash[0].Add(hairlink, iteratorVariable1.renderer.material);
                        iteratorVariable1.renderer.material = (Material)FengGameManagerMKII.linkHash[0][hairlink];
                    }
                    else
                    {
                        iteratorVariable1.renderer.material = (Material)FengGameManagerMKII.linkHash[0][hairlink];
                    }
                }
                this.part_hair = iteratorVariable1;
            }
        }
        if (eye >= 0)
        {
            this.setFacialTexture(this.eye, eye);
        }
        if (iteratorVariable0)
        {
            FengGameManagerMKII.instance.unloadAssets();
        }
    }